Skip to main content
Passkeys use the WebAuthn standard (FIDO2) to authenticate users with device biometrics (Touch ID, Face ID, Windows Hello) or hardware security keys. No password is ever created or stored.

Setup

1

Install

2

Add the plugin

lib/kavach.ts
rpId must be a registrable domain suffix of the origin. For https://app.example.com, valid values are app.example.com or example.com. Localhost works during development.

Registration ceremony

A passkey is tied to a specific device. Users register once per device they want to use.
1

Get registration options

POST /auth/passkey/register/optionsReturns a WebAuthn challenge from the server. Requires an active session (the user must already be signed in to register a passkey).
2

Create the credential

Pass the options to the browser’s WebAuthn API:
3

Verify and store

POST /auth/passkey/register/verify
On success, the credential is stored and the passkey is active.

Authentication ceremony

1

Get authentication options

POST /auth/passkey/authenticate/optionsDoes not require a session, this is the start of sign-in.
Omitting email returns options for any registered passkey on the device (useful for conditional UI).
2

Get the assertion

3

Verify and start session

POST /auth/passkey/authenticate/verify
On success, a session cookie is set.

Managing credentials

Users can register multiple passkeys across different devices.

List credentials

GET /auth/passkey/credentials

Delete a credential

DELETE /auth/passkey/credentials/:id
If a user deletes their last passkey and has no other sign-in method, they will be locked out. Check the credential count before allowing deletion, or prompt the user to set a password first.

Endpoints

Options

Last modified on April 29, 2026