Replace SecurityKey with Passkey

This commit is contained in:
Johanna Larsson
2026-08-08 15:41:29 +00:00
committed by Tangled
parent 1dc0c40206
commit 779dc1b985
5 changed files with 25 additions and 29 deletions
@@ -492,7 +492,7 @@ pub async fn complete_passkey_setup(
}
};
let security_key = match webauthn.finish_registration(&credential, &reg_state) {
let passkey = match webauthn.finish_registration(&credential, &reg_state) {
Ok(sk) => sk,
Err(e) => {
warn!("Passkey registration failed: {:?}", e);
@@ -500,11 +500,11 @@ pub async fn complete_passkey_setup(
}
};
let credential_id = security_key.cred_id().to_vec();
let public_key = match serde_json::to_vec(&security_key) {
let credential_id = passkey.cred_id().to_vec();
let public_key = match serde_json::to_vec(&passkey) {
Ok(pk) => pk,
Err(e) => {
error!("Error serializing security key: {:?}", e);
error!("Error serializing passkey: {:?}", e);
return Err(ApiError::InternalError(None));
}
};
+4 -5
View File
@@ -104,11 +104,10 @@ pub async fn finish_passkey_registration(
.log_db_err("loading registration state")?
.ok_or(ApiError::NoRegistrationInProgress)?;
let reg_state: SecurityKeyRegistration =
serde_json::from_str(&reg_state_json).map_err(|e| {
error!("Failed to deserialize registration state: {:?}", e);
ApiError::InternalError(None)
})?;
let reg_state: PasskeyRegistration = serde_json::from_str(&reg_state_json).map_err(|e| {
error!("Failed to deserialize registration state: {:?}", e);
ApiError::InternalError(None)
})?;
let credential: RegisterPublicKeyCredential = serde_json::from_value(input.credential)
.map_err(|e| {
+2 -2
View File
@@ -159,7 +159,7 @@ pub async fn reauth_passkey_start(
return Err(ApiError::NoPasskeys);
}
let passkeys: Vec<webauthn_rs::prelude::SecurityKey> = stored_passkeys
let passkeys: Vec<webauthn_rs::prelude::Passkey> = stored_passkeys
.iter()
.filter_map(|sp| serde_json::from_slice(&sp.public_key).ok())
.collect();
@@ -216,7 +216,7 @@ pub async fn reauth_passkey_finish(
.log_db_err("loading authentication state")?
.ok_or(ApiError::NoChallengeInProgress)?;
let auth_state: webauthn_rs::prelude::SecurityKeyAuthentication =
let auth_state: webauthn_rs::prelude::PasskeyAuthentication =
serde_json::from_str(&auth_state_json).map_err(|e| {
error!("Failed to deserialize authentication state: {:?}", e);
ApiError::InternalError(None)