mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-07-03 22:45:01 +00:00
Can generate admin key enrollment challenge
This commit is contained in:
@ -13,6 +13,10 @@ impl AdminID {
|
||||
pub fn id(&self) -> u64 {
|
||||
self.0
|
||||
}
|
||||
|
||||
pub fn id_str(&self) -> String {
|
||||
format!("{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
pub struct NewAdmin {
|
||||
@ -47,12 +51,12 @@ pub struct AdminKey {
|
||||
pub struct AdminAccessToken {
|
||||
pub token: String,
|
||||
pub id: AdminID,
|
||||
pub last_refresh: u64
|
||||
pub last_refresh: u64,
|
||||
}
|
||||
|
||||
/// New admin general settings
|
||||
pub struct NewAdminGeneralSettings {
|
||||
pub id: AdminID,
|
||||
pub name: String,
|
||||
pub email: String
|
||||
pub email: String,
|
||||
}
|
@ -41,4 +41,5 @@ pub mod call_signal;
|
||||
pub mod new_notifications_settings;
|
||||
pub mod push_notification;
|
||||
pub mod presence;
|
||||
pub mod admin;
|
||||
pub mod admin;
|
||||
pub mod webauthn_config;
|
36
src/data/webauthn_config.rs
Normal file
36
src/data/webauthn_config.rs
Normal file
@ -0,0 +1,36 @@
|
||||
//! # Webauthn config
|
||||
//!
|
||||
//! @author Pierre Hubert
|
||||
|
||||
use webauthn_rs::{Webauthn, WebauthnConfig};
|
||||
|
||||
use crate::data::config::conf;
|
||||
|
||||
pub struct ComunicAdminWebauthnConfig {}
|
||||
|
||||
impl WebauthnConfig for ComunicAdminWebauthnConfig {
|
||||
fn get_relying_party_name(&self) -> String {
|
||||
"ComunicAdmin".to_string()
|
||||
}
|
||||
|
||||
fn get_origin(&self) -> &String {
|
||||
&conf().admin_url
|
||||
}
|
||||
|
||||
fn get_relying_party_id(&self) -> String {
|
||||
self.get_origin()
|
||||
.replace("https://", "")
|
||||
.replace("http://", "")
|
||||
.split(":")
|
||||
.next()
|
||||
.unwrap()
|
||||
.split("/")
|
||||
.next()
|
||||
.unwrap()
|
||||
.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_wan() -> Webauthn<ComunicAdminWebauthnConfig> {
|
||||
Webauthn::new(ComunicAdminWebauthnConfig {})
|
||||
}
|
Reference in New Issue
Block a user