//! # 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 { Webauthn::new(ComunicAdminWebauthnConfig {}) }