From 6a0d94739be8300ca5adf48a20c7eefb0bdda3b8 Mon Sep 17 00:00:00 2001 From: Jon Seager Date: Thu, 5 Feb 2026 11:24:52 +0000 Subject: [PATCH] feat(auth): allow naming the initial passkey during registration - Add "Passkey Name" field to the registration form - Pass passkey_name through start/finish WebAuthn ceremony - Use user-provided name instead of hardcoded "default" --- src/application/routes/webauthn.rs | 4 +++- templates/register.html | 21 ++++++++++++++++++++- templates/webauthn.js | 5 +++-- 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/src/application/routes/webauthn.rs b/src/application/routes/webauthn.rs index f00c008..5763213 100644 --- a/src/application/routes/webauthn.rs +++ b/src/application/routes/webauthn.rs @@ -47,6 +47,7 @@ struct CliCallbackTemplate { pub struct RegisterStartRequest { pub token: String, pub display_name: String, + pub passkey_name: String, } #[derive(Serialize)] @@ -58,6 +59,7 @@ pub struct ChallengeResponse { #[derive(Deserialize)] pub struct RegisterFinishRequest { pub challenge_id: String, + pub passkey_name: String, pub credential: RegisterPublicKeyCredential, } @@ -211,7 +213,7 @@ pub(crate) async fn register_finish( // Store the credential let credential_json = serde_json::to_string(&passkey).map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?; - let new_credential = NewPasskeyCredential::new(user_id, credential_json, "default".to_string()); + let new_credential = NewPasskeyCredential::new(user_id, credential_json, payload.passkey_name); state .passkey_repo .insert(new_credential) diff --git a/templates/register.html b/templates/register.html index 8af7e2b..7e27e81 100644 --- a/templates/register.html +++ b/templates/register.html @@ -30,6 +30,17 @@ /> + +