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
Owner

Part of #334. Step 3 of 4 in docs/spec/features/passkeys.md (PK-8 to PK-12).

  • Login page (authorization-code flow): passkey autofill on the username field (conditional mediation) and a "Sign in with a passkey" button.
  • POST /api/auth/passkey: a challenge, anonymous and limited like /api/auth, kept in the in-memory store for 2 minutes and good once (any node).
  • The login request takes passkey: {challengeId, credential} in place of name/password. Checks: credential id → passkey, user handle → account (must agree), signature, origin, UV, RP id the passkey was made for, counter (no increase → fail, logged as possible clone). Then the password path's checks: locked account fails the same way; client/redirect/PKCE unchanged. No TOTP after a passkey. Failures feed the same auth fail2ban.
  • Success updates counter, flags and lastUsedAt, raises auth.success with type passkey, audit via: passkey (new Via::Passkey).
  • Registration page: "Use a passkey you already have" instead of the password (PK-8); app passwords no longer open it.
  • Both pages re-minified with resources/scripts/minify_html.sh (passkey.html.min was hand-stripped in #469).

Tests: system::passkeys::passkey_tests now signs in with the software authenticator: code issued and exchanged for a token, lastUsedAt set, challenge reuse fails, same counter fails, wrong origin fails, unknown passkey fails, higher counter works, registration page accepts the passkey. The full system::system_tests suite (incl. OIDC, whose LoginRequest literals gained passkey: None) passes locally; fmt and fork checks clean.

Part of #334. Step 3 of 4 in `docs/spec/features/passkeys.md` (PK-8 to PK-12). - Login page (authorization-code flow): passkey autofill on the username field (conditional mediation) and a "Sign in with a passkey" button. - `POST /api/auth/passkey`: a challenge, anonymous and limited like `/api/auth`, kept in the in-memory store for 2 minutes and good once (any node). - The login request takes `passkey: {challengeId, credential}` in place of name/password. Checks: credential id → passkey, user handle → account (must agree), signature, origin, UV, RP id the passkey was made for, counter (no increase → fail, logged as possible clone). Then the password path's checks: locked account fails the same way; client/redirect/PKCE unchanged. No TOTP after a passkey. Failures feed the same auth fail2ban. - Success updates counter, flags and `lastUsedAt`, raises `auth.success` with type passkey, audit `via: passkey` (new `Via::Passkey`). - Registration page: "Use a passkey you already have" instead of the password (PK-8); app passwords no longer open it. - Both pages re-minified with `resources/scripts/minify_html.sh` (passkey.html.min was hand-stripped in #469). Tests: `system::passkeys::passkey_tests` now signs in with the software authenticator: code issued and exchanged for a token, `lastUsedAt` set, challenge reuse fails, same counter fails, wrong origin fails, unknown passkey fails, higher counter works, registration page accepts the passkey. The full `system::system_tests` suite (incl. OIDC, whose `LoginRequest` literals gained `passkey: None`) passes locally; fmt and fork checks clean.
jcoffey-dev added 1 commit 2026-11-19 03:30:01 +00:00
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
fc2b886c5d
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.
jcoffey-dev merged commit 0b43e5d571 into main 2026-11-19 03:43:17 +00:00
jcoffey-dev deleted branch feat/334-passkey-sign-in 2026-11-19 03:43:17 +00:00
Sign in to join this conversation.