What are passkeys? Passkeys and WebAuthn, explained
Passkeys replace passwords with a key pair: the private key stays with you, the site keeps only a public key. How WebAuthn works and why it stops phishing.

A passkey is a login credential made of a public and private key pair: your device or password manager keeps the private key, the website stores only the public key, and you sign in by letting your device sign a fresh challenge after you confirm with a fingerprint, face or PIN. The FIDO Alliance defines it as “an authentication credential based on FIDO standards” (fidoalliance.org), and on the web passkeys are implemented with the W3C’s Web Authentication API, WebAuthn. Because the key is bound to the site’s domain, a passkey cannot be typed into a fake site, which is why it resists phishing in a way passwords and SMS codes do not.
Where did passkeys come from?
WebAuthn is a W3C standard developed with the FIDO Alliance. Level 2 became a W3C Recommendation in April 2021, and Level 3 became a Recommendation on August 25, 2026. The abstract describes the whole idea in one sentence: an API “enabling the creation and use of strong, attested, scoped, public key-based credentials.”
The word “passkey” came later. On May 5, 2022, Apple, Google and Microsoft committed to two things that made FIDO usable by ordinary people: letting users “automatically access their FIDO sign-in credentials” on “many of their devices, even new ones, without having to re-enroll every account,” and letting them use their phone to sign in “on a nearby device,” regardless of OS or browser. Before that, a FIDO credential lived on one device or one hardware key, and losing it meant account recovery. Syncing is what turned a niche security feature into a password replacement.
How do passkeys work?
Two ceremonies, both through the browser.
Registration. The site’s server sends a random challenge. The page calls navigator.credentials.create(). Per MDN, after the user consents the authenticator “generates a key pair and returns the public key.” The server checks the challenge and origin, then stores the public key against the user. No secret is stored on the server.
Sign-in. The server sends a new challenge (MDN says it “must be a buffer of random information at least 16 bytes in size”). The page calls navigator.credentials.get(). The authenticator asks the user to verify with a fingerprint, face or PIN, then signs. Here is the browser side with autofill, which lets passkeys appear in the username field’s suggestions:
<input type="text" name="username" autocomplete="username webauthn" />
// On page load: offer passkeys in the autofill menu (MDN's conditional get example).
const caps = await PublicKeyCredential.getClientCapabilities();
if (caps.conditionalGet) {
const assertion = await navigator.credentials.get({
publicKey: {
challenge: challengeFromServer, // random bytes from your server
rpId: "example.com",
userVerification: "required",
},
mediation: "conditional", // wait for the user to pick from autofill
});
await fetch("/login/verify", { method: "POST", body: serialize(assertion) });
}
What comes back is a signature over two pieces of data. The spec says “the authenticator signs over the combination of the hash of the serialized client data, and its own authenticator data”:
- Client data is JSON written by the browser, not the page: the
type(webauthn.get), the base64urlchallengeand theoriginthe browser was actually on. - Authenticator data starts with
rpIdHash, the “SHA-256 hash of the RP ID the credential is scoped to” (32 bytes), then a flags byte (bit 0 is User Present, bit 2 is User Verified, bits 3 and 4 say whether the credential can be and is backed up), then a 4-byte signature counter.
The server verifies the signature with the stored public key, then checks every field. That second half is where phishing resistance lives.
Why can’t passkeys be phished?
Two independent locks. First, the browser enforces scope: a credential “can only be accessed by origins belonging to that Relying Party” (WebAuthn Level 3). On examp1e.com your example.com passkey is not even offered. Second, if an attacker somehow relayed the ceremony, the browser writes the real origin into the signed client data and the authenticator hashes the real RP ID into the authenticator data. The server sees the mismatch. MDN’s summary: “An attacker who creates a fake login website can’t login as the user because the signature changes with the origin of the website.”
The checks are simple enough to write out. Here they are in Python’s standard library, minus the elliptic-curve signature check itself (which needs a crypto library), run against a real login, a phishing relay, a replayed challenge and a login without biometrics or PIN.
# passkey_checks.py: the checks a relying party runs on a WebAuthn assertion,
# minus the signature math (stdlib has no ECDSA). Python 3 stdlib only.
import base64, hashlib, json, os, struct
RP_ID, ORIGIN = "example.com", "https://example.com"
b64url = lambda b: base64.urlsafe_b64encode(b).rstrip(b"=").decode()
def authenticator_data(rp_id, up=True, uv=True, count=0):
flags = (1 if up else 0) | (4 if uv else 0) # bit 0 UP, bit 2 UV
return hashlib.sha256(rp_id.encode()).digest() + bytes([flags]) + struct.pack(">I", count)
def client_data(origin, challenge):
return json.dumps({"type": "webauthn.get", "challenge": b64url(challenge),
"origin": origin}).encode()
def verify(auth_data, client_json, expected_challenge):
c = json.loads(client_json)
rp_hash, flags, count = auth_data[:32], auth_data[32], struct.unpack(">I", auth_data[33:37])[0]
checks = {
"type": c["type"] == "webauthn.get",
"challenge": c["challenge"] == b64url(expected_challenge),
"origin": c["origin"] == ORIGIN,
"rpIdHash": rp_hash == hashlib.sha256(RP_ID.encode()).digest(),
"UP": bool(flags & 1),
"UV": bool(flags & 4),
}
signed = auth_data + hashlib.sha256(client_json).digest() # what the signature covers
return all(checks.values()), [k for k, ok in checks.items() if not ok], len(signed)
challenge = os.urandom(32)
cases = {
"real site": (authenticator_data("example.com"), client_data(ORIGIN, challenge)),
"phishing origin": (authenticator_data("examp1e.com"), client_data("https://examp1e.com", challenge)),
"replayed challenge": (authenticator_data("example.com"), client_data(ORIGIN, os.urandom(32))),
"no user verify": (authenticator_data("example.com", uv=False), client_data(ORIGIN, challenge)),
}
for name, (ad, cd) in cases.items():
ok, failed, n = verify(ad, cd, challenge)
print(f"{name:20} ok={ok!s:5} failed={failed} signed bytes={n}")
Output (Python 3.13.11):
real site ok=True failed=[] signed bytes=69
phishing origin ok=False failed=['origin', 'rpIdHash'] signed bytes=69
replayed challenge ok=False failed=['challenge'] signed bytes=69
no user verify ok=False failed=['UV'] signed bytes=69
The signed message is 69 bytes: 37 bytes of authenticator data plus a 32-byte SHA-256 of the client data. Because the origin and challenge are inside what gets signed, an attacker cannot edit them without breaking the signature, and cannot reuse an old signature because the challenge changes every time. In production, use a maintained WebAuthn server library rather than this; the point is to see that the security comes from a handful of equality checks on data the attacker cannot forge.
Passkeys vs passwords vs 2FA: what’s the difference?
A password is a shared secret. You and the server both know it, so a breach of the server’s database, or a convincing fake page, gives it to an attacker. TOTP codes and SMS codes add a second shared secret, but a real-time phishing proxy can still relay them.
A passkey is not shared. The server holds a public key that is useless to a thief, and the private key signs only for the right domain. FIDO’s page says “Unlike passwords, passkeys are always strong and phishing-resistant.” From the privacy and data-platform work I did, the property I value most is the boring one: a leaked table of public keys is not a credential dump. There is nothing to crack and nothing to stuff into other sites.
Synced passkeys vs device-bound passkeys
FIDO distinguishes passkeys that “can be securely synced across a user’s devices” through a cloud service from “those that never leave a single device,” such as passkeys on a hardware security key. The spec marks the difference in the flags: Backup Eligibility means the credential is multi-device, and Backup State means it is currently backed up. WebAuthn Level 3 notes that multi-device credentials are “commonly referred to as synced passkeys.”
Synced passkeys are what make passkeys usable for consumers: a new phone restores them. The trade is that your account security now includes the security of your Apple, Google or password-manager account. Device-bound keys avoid that dependency and are the usual choice for administrators and high-risk accounts, at the cost of needing a backup key.
Where do passkeys break?
Account recovery is the new weakest link. If “lost my passkey” falls back to an email link or SMS code, attackers will target the fallback. Phishing resistance is only as strong as the weakest path into the account.
Mixed ecosystems. A user with an iPhone and a Windows laptop may have passkeys in two places. Cross-device sign-in via the phone, one of the 2022 commitments, covers this, but users find it confusing the first time.
RP ID choice is permanent. Credentials are scoped to the RP ID you pick at registration. Choose example.com rather than login.example.com if subdomains need to share them; changing it later strands every existing passkey.
Server-side checks are easy to skip. Every check in the script above is one line, and skipping any one of them reopens a hole. Origin and challenge checks are the ones I would audit first.
What I would do
For a new consumer product, I would offer passkeys at sign-up and on the first successful password login, use conditional autofill so the user does not have to find a “sign in with passkey” button, and require user verification. I would keep passwords as a fallback for a while but put rate limits and alerting on the recovery path, since that is where attacks move.
For an internal or admin system, I would require device-bound FIDO keys and give every admin two of them.
And I would not write WebAuthn verification by hand. Use a maintained library for your server language, then read its verification code against the checks above so you know what it does. The same thinking applies to any trust boundary, including the one I describe in what prompt injection is: know exactly which bytes you trust and why. For the data side of identity, see how CRDTs sync state across devices and how an SBOM tracks the libraries your auth stack depends on.
FAQ
Are passkeys more secure than passwords?
Yes, for the two attacks that cause most account takeovers. They cannot be phished onto another domain, and a server breach leaks only public keys. They do not fix a weak account recovery flow.
What happens if I lose my phone with my passkeys?
Synced passkeys come back when you sign in to the same platform account or password manager on a new device. Device-bound passkeys do not, so you need a second key or the site’s recovery process.
Is WebAuthn the same as passkeys?
WebAuthn is the W3C browser API; a passkey is the credential it creates. MDN puts it plainly: “On the web, passkeys are implemented using the Web Authentication API.”
Do passkeys use biometrics, and does the website see my fingerprint?
The device uses your fingerprint, face or PIN to release the private key for signing. FIDO says the check stays on the device and only a signature reaches the server. The site never receives biometric data.
Can I use a passkey on a computer that is not mine?
Yes, through cross-device sign-in, one of the 2022 commitments: you approve the sign-in on your phone, which holds the passkey, and the private key never moves to the borrowed computer.
Sources
- W3C, Web Authentication: An API for accessing Public Key Credentials, Level 3, W3C Recommendation, August 25, 2026
- W3C, Web Authentication Level 2, W3C Recommendation, April 8, 2021
- FIDO Alliance, Passkeys, accessed October 31, 2026
- FIDO Alliance, Apple, Google and Microsoft commit to expanded support for FIDO standard, May 5, 2022
- MDN, Web Authentication API, accessed October 31, 2026