| name | webauthx |
| description | Set up production-ready WebAuthn passkey authentication using webauthx. Use when adding passkey auth, WebAuthn registration, or WebAuthn authentication to an app. |
webauthx
Set up production-ready WebAuthn passkey ceremony orchestration using webauthx.
Read README.md for the full API reference. Read examples/hono/ for a simplified reference implementation. The example prioritizes clarity over production hardening, so follow this checklist for production.
Setup
Install webauthx and import from webauthx/server and webauthx/client.
Registration Flow (Sign Up)
- Server: call
Registration.getOptions({ name, rp }). Returns { challenge, options }.
- Store the
challenge server-side (signed cookie, DB, or KV). Must be single-use and short-lived (≤5 min).
- Client: pass
options to Registration.create({ options }). Triggers the browser passkey prompt. Must be called from a user gesture (click/tap).
- Client: POST the returned credential to the server.
- Server: consume the stored challenge, then call
Registration.verify(credential, { challenge, origin, rpId }).
- Persist
result.credential.id and result.credential.publicKey associated with the user.
Authentication Flow (Log In)
- Server: call
Authentication.getOptions({ credentialId, rpId }). Returns { challenge, options }.
- Store the challenge. Same rules as registration: single-use, short-lived, server-side.