17 lines
615 B
Rust
17 lines
615 B
Rust
use std::convert::Infallible;
|
|
use webauthn_rs::prelude::*;
|
|
|
|
use crate::models::AppState;
|
|
|
|
pub async fn start_webauthn_registration(app_state: AppState) -> Result<impl warp::Reply, Infallible> {
|
|
let mut db = app_state.db.lock().await;
|
|
// TODO: query the user
|
|
let mut user = db.users.first_mut().unwrap();
|
|
|
|
let (creation_challenge_response, passkey_registration) = app_state.webauthn.start_passkey_registration(user.uuid, &user.user_name, &user.display_name, None).unwrap();
|
|
|
|
user.creation_challenge_response = Some(creation_challenge_response);
|
|
|
|
Ok(warp::reply::json(&"hello".to_string()))
|
|
}
|