From 409b152fce982c95b3f79d39a5f90fa95691a6f9 Mon Sep 17 00:00:00 2001 From: mortis-0 <1190200714@stu.hit.edu.cn> Date: Fri, 15 Mar 2024 18:45:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DPasskey=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E7=9A=84UserHandle=20=E7=BC=96=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- register.html | 2 +- src/services/auth.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/register.html b/register.html index 262eacf..a68f8d6 100644 --- a/register.html +++ b/register.html @@ -106,7 +106,7 @@ authenticatorData: Base64.fromUint8Array(new Uint8Array(assertion.response.authenticatorData), true), clientDataJSON: Base64.fromUint8Array(new Uint8Array(assertion.response.clientDataJSON), true), signature: Base64.fromUint8Array(new Uint8Array(assertion.response.signature), true), - userHandle: assertion.response.userHandle + userHandle: Base64.fromUint8Array(new Uint8Array(assertion.response.userHandle),true) }, }), }) diff --git a/src/services/auth.rs b/src/services/auth.rs index 7b08d53..e830d8a 100644 --- a/src/services/auth.rs +++ b/src/services/auth.rs @@ -280,7 +280,7 @@ pub async fn start_authentication( session: Session, Path(user_name): Path, ) -> Result { - info!("Start Authentication"); + info!("开始passkey 验证"); let pool = &state.db; // Remove any previous authentication that may have occurred from the session. let _ = session.remove::<(Uuid, PasskeyAuthentication)>("auth_state").await; @@ -347,7 +347,7 @@ pub async fn finish_authentication( .await .unwrap() .ok_or(WebauthnError::AuthenticationFailure.to_string())?; - + info!("已获得认证状态:uid:{}",user_id); let _ = session.remove::<(Uuid, PasskeyAuthentication)>("auth_state").await; let res = match state @@ -355,6 +355,7 @@ pub async fn finish_authentication( .finish_passkey_authentication(&auth, &auth_state) { Ok(auth_result) => { + info!("passkey认证通过:uid:{}",user_id); let uid = user_id.clone().to_string(); let records = sqlx::query!( "SELECT CREDENTIAL FROM CREDENTIALS WHERE USER_ID = $1;",