mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-20 08:25:16 +00:00
Can generate admin key enrollment challenge
This commit is contained in:
@ -2,6 +2,8 @@
|
||||
//!
|
||||
//! @author Pierre Hubert
|
||||
|
||||
|
||||
|
||||
use crate::api_data::admin::admin_auth_options::AdminAuthOptions;
|
||||
use crate::api_data::admin::admin_auth_success::AdminAuthSuccess;
|
||||
use crate::api_data::admin::admin_id_api::AdminIDAPI;
|
||||
@ -9,7 +11,8 @@ use crate::api_data::admin::admin_info_api::AdminInfoAPI;
|
||||
use crate::data::admin::NewAdminGeneralSettings;
|
||||
use crate::data::base_request_handler::BaseRequestHandler;
|
||||
use crate::data::http_request_handler::HttpRequestHandler;
|
||||
use crate::helpers::{admin_access_token_helper, admin_account_helper};
|
||||
use crate::data::webauthn_config::get_wan;
|
||||
use crate::helpers::{admin_access_token_helper, admin_account_helper, admin_key_registration_challenges_helper};
|
||||
use crate::routes::RequestResult;
|
||||
use crate::utils::date_utils::time;
|
||||
|
||||
@ -89,4 +92,15 @@ pub fn update_general_settings(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
})?;
|
||||
|
||||
r.ok()
|
||||
}
|
||||
|
||||
/// Generate a challenge to register a new key
|
||||
pub fn challenge_register_key(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
let mut wan = get_wan();
|
||||
|
||||
let (res, state) = wan.generate_challenge_register(&r.admin_id()?.id_str(), None)?;
|
||||
|
||||
admin_key_registration_challenges_helper::set(r.admin_id()?, state)?;
|
||||
|
||||
r.set_response(res)
|
||||
}
|
Reference in New Issue
Block a user