Skip to content

Commit e00ff1a

Browse files
authored
feat(passkeys): derive friendly name from AAGUID (#2415)
Derives friendly name for webauthn credential using the AAGUID. A generate command is added to make it easy to generate the map of AAGUIDs to friendly names based on the [passkey-authenticator-aaguids](https://github.com/passkeydeveloper/passkey-authenticator-aaguids) project: ``` go generate ./internal/utilities/... ```
1 parent 7831226 commit e00ff1a

4 files changed

Lines changed: 439 additions & 2 deletions

File tree

internal/api/passkey_registration.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ func (a *API) PasskeyRegistrationVerify(w http.ResponseWriter, r *http.Request)
177177
return apierrors.NewBadRequestError(apierrors.ErrorCodeWebAuthnVerificationFailed, "Credential verification failed").WithInternalError(err)
178178
}
179179

180-
// TODO(fm): fallback to AAGUID -> UA -> "Passkey" for friendly name
181-
passkeyCredential := models.NewWebAuthnCredential(user.ID, credential, "")
180+
friendlyName := utilities.PasskeyFriendlyName(credential.Authenticator.AAGUID)
181+
passkeyCredential := models.NewWebAuthnCredential(user.ID, credential, friendlyName)
182182

183183
err = db.Transaction(func(tx *storage.Connection) error {
184184
count, terr := models.CountWebAuthnCredentialsByUserID(tx, user.ID)

0 commit comments

Comments
 (0)