Passkeys: sign in with a passkey (#334) #470

Merged
jcoffey-dev merged 1 commits from feat/334-passkey-sign-in into main 2026-11-19 03:43:17 +00:00
1 Commits
Author SHA1 Message Date
jcoffey-dev fc2b886c5d Passkeys: sign in with a passkey (#334)
ci / fork-checks (pull_request) Skipped
ci / build (pull_request) Skipped
github/ci (branch) GitHub Actions
ci / github (pull_request) Successful in 12m46s
Third part of passkeys (docs/spec/features/passkeys.md, PK-8 to PK-12).

The login page offers passkeys in the authorization-code flow: the
browser's autofill on the username field where it supports conditional
mediation, and a "Sign in with a passkey" button. Each try asks
POST /api/auth/passkey for a challenge (anonymous and limited like the
login request), kept in the in-memory store for two minutes and good
once, so any node can answer the next step. The login request then
carries the browser's assertion in a new passkey field in place of the
name and password.

The server finds the passkey by credential id and the account by user
handle, and both must agree. It checks the signature, the origin, user
verification, that the passkey was made for the current relying-party
id, and the counter: one that didn't go up fails and is logged as a
possibly cloned passkey. Then the same checks run as for a password: a
locked account fails the same way, and the client, redirect URI and
PKCE checks are unchanged. A passkey signs in on its own, with no TOTP
code after it. Failures count toward the same sign-in blocking as wrong
passwords. A successful sign-in keeps the new counter and lastUsedAt,
raises auth.success with type passkey, and is recorded in the audit log
with via passkey where sign-ins are recorded.

The registration page now takes one of the account's active passkeys
instead of the password, and refuses an app password.

The device flow, the settings and the external-directory rule follow in
the last part.
2026-11-18 20:29:42 -07:00