mirror of
https://tangled.org/tranquil.farm/tranquil-pds
synced 2026-08-17 23:06:05 +00:00
Replace SecurityKey with Passkey
This commit is contained in:
@@ -492,7 +492,7 @@ pub async fn complete_passkey_setup(
|
||||
}
|
||||
};
|
||||
|
||||
let security_key = match webauthn.finish_registration(&credential, ®_state) {
|
||||
let passkey = match webauthn.finish_registration(&credential, ®_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));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -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(®_state_json).map_err(|e| {
|
||||
error!("Failed to deserialize registration state: {:?}", e);
|
||||
ApiError::InternalError(None)
|
||||
})?;
|
||||
let reg_state: PasskeyRegistration = serde_json::from_str(®_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| {
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user