修复Passkey登录的UserHandle 编码

This commit is contained in:
mortis-0 2024-03-15 18:45:54 +08:00
parent 0880718125
commit 409b152fce
2 changed files with 4 additions and 3 deletions

View File

@ -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)
},
}),
})

View File

@ -280,7 +280,7 @@ pub async fn start_authentication(
session: Session,
Path(user_name): Path<String>,
) -> Result<impl IntoResponse, String> {
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;",