Passkeys Explained: How WebAuthn Replaces Passwords
How passkeys work: public-key credentials, WebAuthn and FIDO2, phishing resistance, synced vs device-bound passkeys, user experience and account recovery.
Published December 4, 2026
Passwords are reused, phished, leaked and forgotten. Passkeys replace them with public-key cryptography built into operating systems, browsers and password managers. Signing in becomes a fingerprint, face scan or device PIN, and there is no shared secret for attackers to steal from your database or trick users into typing on a fake site.
The concept
When a user creates a passkey, their device generates a key pair for your site. The private key stays on the device (or in an end-to-end encrypted password manager or platform keychain that syncs it across the user's devices); your server stores only the public key. To sign in, your server sends a random challenge, the device signs it with the private key after the user verifies locally (biometric or PIN), and the server verifies the signature with the stored public key.
Passkeys are phishing-resistant because each credential is bound to your domain (the relying party ID). A look-alike phishing domain cannot ask the browser to use your passkey. Under the hood, passkeys are FIDO2 credentials used through the WebAuthn browser API. Synced passkeys offer convenience across devices; device-bound passkeys (such as hardware security keys) offer the highest assurance.
How a passkey sign-in works
Passwords vs passkeys
| Password | Passkey | |
|---|---|---|
| Secret on server | Password hash (crackable if leaked) | Public key only (useless to attackers) |
| Phishing | User can type it anywhere | Bound to your domain |
| Reuse across sites | Common | Impossible (unique per site) |
| User effort | Remember/type | Biometric or PIN |
| MFA | Needs a second factor | Inherently multi-factor (possession + user verification) |
Adoption strategy
- Offer passkey creation after sign-in or at sign-up
- Keep existing login methods during transition
- Use conditional UI (autofill) for frictionless sign-in
- Let users manage multiple passkeys per account
- Design recovery: other passkeys, verified email, support flow
Practical examples
Create a passkey in the browser (simplified)
Options come from your server; use a library to build and verify them.
const options = await fetch('/webauthn/register/options').then(r => r.json())
const credential = await navigator.credentials.create({ publicKey: decodeOptions(options) })
await fetch('/webauthn/register/verify', { method: 'POST', body: JSON.stringify(encodeCredential(credential)) })Conditional UI: passkeys in the username autofill
The browser offers saved passkeys in the input suggestions.
<input type="text" name="username" autocomplete="username webauthn">
<script>
if (await PublicKeyCredential.isConditionalMediationAvailable?.()) {
const opts = await fetch('/webauthn/login/options').then(r => r.json())
const assertion = await navigator.credentials.get({ publicKey: decodeOptions(opts), mediation: 'conditional' })
// send assertion to server for verification
}
</script>What the server stores per passkey
No secrets: public key and metadata.
CREATE TABLE passkeys (
id bytea PRIMARY KEY, -- credential ID
user_id bigint NOT NULL REFERENCES users(id),
public_key bytea NOT NULL,
sign_count bigint NOT NULL DEFAULT 0,
transports text[],
created_at timestamptz NOT NULL DEFAULT now(),
last_used_at timestamptz
);Common mistakes
- Implementing WebAuthn verification by hand instead of using a vetted library.
- Removing passwords before users have registered passkeys and recovery options.
- Only allowing one passkey per account, stranding users who change devices.
- Weak recovery flows (SMS-only) that undo the phishing resistance.
Key takeaways
- Passkeys use public-key cryptography; servers store only public keys.
- They are phishing-resistant because credentials are bound to your domain.
- Synced passkeys are convenient; hardware keys give highest assurance.
- Roll out gradually with conditional UI and solid recovery.
FAQ
What happens if a user loses their phone?
Synced passkeys are available on their other devices via their platform or password manager; otherwise use another registered passkey or your recovery process.
Do passkeys work across platforms?
Yes. Cross-device sign-in lets a phone authenticate a login on a nearby computer via QR code and Bluetooth proximity.
Which libraries help?
Well-maintained WebAuthn server libraries exist for most languages (for example SimpleWebAuthn for JavaScript, py_webauthn for Python, web-auth/webauthn-lib for PHP).