Skip to main content

Passwordless, Passkeys & WebAuthn/FIDO2

Level 8: Level 8: Security, Privacy & Multi-tenancymedium30 minpasskeyswebauthnfido2

Passkeys replace shared secrets with a device-held private key so the server stores only a useless-to-steal public key, origin binding makes them phishing-resistant where OTP and SMS are not, synced passkeys solve device loss for consumers while device-bound plus attestation suits enterprise, and you roll them out via progressive enrollment alongside passwords.

Passkeys replace shared secrets with a device-held private key

Passkeys are the industry's shift away from shared secrets. A password is a secret both you and the server know, which means the server can leak it and a phishing site can capture it. A passkey is a public-key credential: your device generates a key pair, keeps the private key, and hands the server only the public key. That single change eliminates two of the biggest classes of attack.

How it works

During registration (WebAuthn navigator.credentials.create), the authenticator (your phone's secure enclave, a laptop's TPM, or a hardware key like a YubiKey) generates a key pair scoped to the site's origin. The server stores the public key and a credential ID against the user account. During login (navigator.credentials.get), the server sends a random challenge; the authenticator signs it with the private key after a local user gesture (Face ID, fingerprint, PIN), and the server verifies the signature against the stored public key. The private key never leaves the device and is never transmitted.

Interview nuance: "Breach-proof on the server" is the phrase that lands. A stolen user table full of public keys is worthless to an attacker, because a public key cannot be used to authenticate, only to verify. Compare that to a password hash dump, which is crackable offline. There is simply nothing secret to steal on the server side.

Check yourself
An attacker runs a perfect real-time phishing proxy: the victim interacts with a fake login page and every message is relayed instantly to the real site. This reliably defeats TOTP codes. Does it defeat a passkey?

Phishing resistance from origin binding

The credential is cryptographically tied to the exact origin (say accounts.google.com). The browser will only offer and use that credential for that origin. If a victim lands on accounts-google.evil.com, the browser refuses to produce the credential, so there is nothing to phish. Contrast this with a TOTP code or an SMS OTP: those are just numbers the user reads and can be tricked into typing into a fake site, and a real-time phishing proxy relays them to the real site within the 30-second window. Passkeys close that hole because the signed challenge is bound to the origin and cannot be replayed elsewhere.

Registration:  device generates keypair (scoped to origin)
               server stores  PUBLIC key + credential_id
Login:         server --challenge--> device
               device signs with PRIVATE key (after Face ID/PIN)
               device --signature--> server verifies vs public key
   private key NEVER leaves the device; nothing phishable on the wire

Authenticator types, sync, and attestation

Platform authenticators are built into the device (Touch ID, Windows Hello). Roaming authenticators are removable (USB/NFC security keys) and work across machines. Modern passkeys are usually synced: Apple's iCloud Keychain and Google Password Manager back the private key up to the cloud (end-to-end encrypted) and sync it across your devices, so losing one phone does not lose the passkey. Device-bound passkeys (typically on hardware keys) never leave that device, which is more secure but has no built-in recovery. For consumer products, synced passkeys win on usability; for high-assurance enterprise, device-bound keys plus attestation are common. Attestation is an optional signed statement about what kind of authenticator was used, letting an enterprise require, say, only certified hardware keys. Most consumer sites skip attestation to avoid a privacy and friction cost.

Check yourself

Synced or device-bound? Match each property to the passkey flavor it belongs to.

Losing your phone does not lose the credential
The private key can never exist anywhere but one authenticator
The right default for a consumer product
Pairs with attestation when an enterprise requires certified hardware

Device loss and coexistence

If a passkey is device-bound and the device is gone, the user is locked out unless they enrolled a second authenticator. Practical designs require enrolling at least two passkeys (phone plus a backup key), or fall back to another enrolled factor. Rolling out passkeys onto an existing password base uses progressive enrollment: keep passwords working, prompt users to add a passkey after a successful login, and over time let passkey-only users disable their password. Do not force a hard cutover; you will lock out the users whose only device just broke.

Recap: passkeys replace shared secrets with a device-held private key so the server stores only a useless-to-steal public key, origin binding makes them phishing-resistant where OTP and SMS are not, synced passkeys solve device loss for consumers while device-bound plus attestation suits enterprise, and you roll them out via progressive enrollment alongside passwords.

Check yourself
You are adding passkeys to a site with 20M existing password users. Which rollout do you write down?

Apply

Your turn

The task this lesson builds to.

Add passkey (WebAuthn) sign-in to an existing password system and design the fallback, device-loss, and cross-device sync story.

Think about

  1. Why is the public-key credential model breach-proof on the server?
  2. How does origin binding make passkeys phishing-resistant?
  3. How do you handle device loss and recovery?

Practice

Make it stick

A second problem on the same idea, so it survives past today.

Design passkey rollout for a large enterprise SSO (like Okta or Microsoft Entra) serving 5,000 corporate customers, where IT admins must enforce phishing-resistant auth for privileged roles but many employees share kiosk machines and some are contractors on unmanaged devices.

Think about

  1. Why does authenticator choice depend on device class (managed, kiosk, unmanaged)?
  2. Where does attestation earn its keep in an enterprise?
  3. How do SCIM provisioning and break-glass accounts fit the lifecycle?