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

User deviceBrowser (WebAuthn)Your serverrequest login optionschallenge + rpIdask authenticatorbiometric/PIN verifies usersignature over challengeassertionverify with stored public key → session
Sign-in with a passkey: the private key never leaves the authenticator.

Passwords vs passkeys

PasswordPasskey
Secret on serverPassword hash (crackable if leaked)Public key only (useless to attackers)
PhishingUser can type it anywhereBound to your domain
Reuse across sitesCommonImpossible (unique per site)
User effortRemember/typeBiometric or PIN
MFANeeds a second factorInherently multi-factor (possession + user verification)

Adoption strategy

  1. Offer passkey creation after sign-in or at sign-up
  2. Keep existing login methods during transition
  3. Use conditional UI (autofill) for frictionless sign-in
  4. Let users manage multiple passkeys per account
  5. Design recovery: other passkeys, verified email, support flow
Rolling out passkeys.

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).

More Security articles