~ knotless Search/
↑↓ move↵ open⇧↵ all results

zat.dev/zds

atproto pds · mirror of https://tangled.org/zat.dev/zds

0
0
66 lines · 2.9 KB Raw History

passkeys

ZDS supports WebAuthn passkeys for OAuth login. This is modeled after Tranquil's passkey support; passkeys are outside the official Bluesky PDS surface ZDS tracks for compatibility.

storage

Each passkey row belongs to an account DID and stores:

  • credential ID
  • credential public key
  • signature counter
  • friendly name
  • created and last-used timestamps

Challenge rows are short-lived. Registration challenges are tied to the account DID. Discoverable login challenges are tied to the OAuth request so an authenticator can identify the account by credential ID.

login behavior

The OAuth sign-in card offers passkeys two ways. The username field carries autocomplete="username webauthn", and where the browser supports conditional mediation the page starts a discoverable request with mediation:'conditional' so saved passkeys appear in the field's autofill. The "Sign in with a passkey" button aborts that request and starts a modal one, reusing its discoverable challenge. When the request's login_hint names a local account with saved passkeys, the page starts from that account and its "Continue with passkey" button asks for that account's credentials (allowCredentials). Failures of the autofill request stay quiet; failures of an explicit request are reported inline.

Discoverable passkey login is supported: the browser may return a credential without the page first choosing an account. ZDS resolves the credential ID to the stored account and verifies the assertion. A request can hold a discoverable challenge and an account challenge at once, so ZDS reads the challenge from the assertion's client data and verifies against the stored challenge that equals it.

A verified passkey passes the same account checks as a password. A taken down, suspended, or deactivated account is refused with 401, and a passkey for an account other than the one the OAuth request's login_hint names is refused with 400.

A verified passkey signs the browser in for that one authorization request, like a password; it does not authorize the app. /oauth/passkey/finish returns the authorization page's URL, which then asks for consent. Passkey sign-in does not remember the browser.

management

Passkeys are managed from /account/manage, alongside app passwords. That page signs in with the account password, lists saved passkeys, and supports add, rename, and delete. Registration uses a browser WebAuthn prompt; ZDS stores only the credential ID, public key, counter, name, and timestamps.

Deleting a passkey removes it from ZDS. The browser, OS, or password manager may still keep its copy, but it can no longer be used with this PDS.

references

  • Tranquil frontend: frontend/src/routes/OAuthLogin.svelte, frontend/src/routes/Settings.svelte
  • Tranquil storage traits: crates/tranquil-db-traits/src/user.rs
  • ZDS WebAuthn dependency: https://tangled.org/zzstoatzz.io/webauthn