Problem Statement: Passwords Fail, Passkeys Replace Them
Define the product, why passwords fail in four distinct ways, and the two cryptographic facts the rest of the design depends on.
What we are building
We are building the sign-in and account-security platform for a consumer product with 50 million registered accounts (assumption) and an enterprise tier that sells to universities and companies. A user never creates or types a password. Each account holds one or more passkeys. A passkey is a FIDO2 credential: a key pair created for one website, where the private key stays inside an authenticator (a phone's secure hardware, a laptop's TPM, or a hardware security key) and the server keeps only the public key.
The platform must do more than verify signatures. It must enroll passkeys, issue a fresh challenge for every login, offer fallbacks when the authenticator is unavailable, recover accounts after a lost device, issue sessions and tokens to downstream apps, federate with enterprise identity providers, and resist abuse at every entry point. The defining rule is that the database must never contain anything that lets an attacker log in. A full copy of the credential store must be useless for signing in.
Why passwords still fail
Passwords fail in four ways, and a design has to address each one. They are typed into forms, so a look-alike site captures them in real time. They are reused across services, so a breach at one service produces working logins at others (credential stuffing). They are stored server-side as hashes, so a leaked database can be attacked offline. And they push teams toward weak recovery, such as security questions, whose answers attackers can often find in public profiles.
Passkeys remove the first three failures because nothing reusable is typed and nothing reusable is stored. They do not remove the need for recovery, fallback, session control, or abuse defense. Those are the parts of this design that take the most engineering.
The two facts the design rests on
The first fact: the authenticator creates a separate key pair for each relying party (the website or app), and the private key never leaves the authenticator. The second fact: the browser, not the web page, writes the origin into the data that gets signed, in a structure called clientDataJSON. The signature covers a SHA-256 hash of that structure. A signature produced on example.com therefore fails verification on a look-alike domain, because the server checks the origin and the signature covers it.
Every later decision in this answer is a consequence of these two facts. Challenges must be random and single-use, because a signature over a known challenge can be replayed. The server must check the origin, the RP ID hash, the user presence and verification flags, and the signature, in that order, on every request. Storage must hold public keys only.
Scope of this answer
In scope: registration and authentication ceremonies, the credential lifecycle (synced passkeys versus device-bound keys, attestation policy), magic-link and one-time-code fallbacks, account recovery including an admin-assisted path for a lost device, session and token design, multi-device sign-in, enterprise SSO federation, rate limits and abuse controls, observability, and compliance. Out of scope: building an authenticator, the biometric matching algorithm (which runs inside the device), and consumer marketing flows.
This answer covers defensive architecture only. It describes how to protect users and operators and does not describe how to attack a passkey deployment.
Key Highlights
- •Passwords fail in four ways (typed, reused, stored as hashes, weakly recovered), and passkeys remove the first three without removing the need for recovery.
- •A passkey is a per-site key pair: the private key stays in the authenticator and the server stores only the public key and metadata.
- •The browser writes the origin into clientDataJSON, so a signature made for one domain fails verification on a look-alike domain.
- •Design target: 9M sign-ins per day (assumption), two ceremony calls per sign-in, and a server-side verify p99 under 150 ms.
Section Rescue Kit
Buzzwords to use:
Safe statements:
- "Before I draw anything, let me state the two facts the design rests on: the private key stays in the authenticator, and the origin is signed into every response."
- "I will treat the password-free path as the primary design and spend most of my time on fallback and recovery, because that is where attackers go once the primary path is blocked."