Security keys, passkeys, and biometrics
A passkey signs Ava in by proving that her device holds a private keyThe half of a key pair that its owner keeps to themselves and uses to create signatures or decrypt data. Anyone who obtains it can act as its owner. registered to her account. Nothing she could read, type or approve on a fake page is sent, and the fingerprint or PIN that unlocks the key never leaves her device.
Signing in with your device
Every method in the last lesson ended with something a person reads, types or approves, and a convincing fake page can ask for any of them. Public-key sign-in takes a different route. When Ava signs in to the photo service with a passkey, her phone asks for her fingerprint, and a moment later she is signed in. She never typed an email address or a password.
The fingerprint did not go to the photo service. As with the security-key PIN in Passwords and PINs, it only unlocks an authenticatorSomething a person controls and uses to prove control of an account, such as a memorized password, an app that generates one-time codes, or a security key. It counts only after it has been registered to that account. on Ava's device. The authenticator then uses a key to produce a response the photo service can check.
That key belongs to a public-key credential: a key pairA private key and a public key generated together and mathematically linked. The private key creates signatures and the public key checks them, but the private key cannot practically be worked out from the public one. of the kind described in Secrets and key pairs, created for Ava's account at the photo service and for nothing else. The photo service stores the public keyThe half of a key pair that can be shared freely. It checks signatures made with the matching private key and can encrypt data that only that private key can decrypt.. The private key stays with the authenticator, and the photo service checks signatures made with it without ever receiving it.
Several names describe the parts. WebAuthn (Web AuthenticationChecking evidence that someone, or some application, controls an account, such as a password or a passkey. It establishes which account is being used, not what that account may do.) is the browser standard that lets a web page ask the browser to create or use this kind of credential. The authenticator can be a separate security key, a small device that connects by USB or by NFC, the short-range radio a phone uses for contactless payment, or it can be built into a phone or computer. A passkey is a public-key credential that can sign someone in on its own, without a password first. The name comes from the FIDO Alliance, the industry group whose standards WebAuthn works with. A passkey can live on a security key or in the part of a phone, computer or password manager that stores credentials, called its credential provider.
Registering a key
Before Ava can sign in this way, the photo service has to register a credential to her account, usually while she is already signed in with her password. In WebAuthn the photo service is the relying party, the service that will rely on the result. It is the same name OpenID ConnectAn identity layer on top of OAuth 2.0 that lets an application sign people in with an account at another service. It adds the ID token, standard claims, and discovery to the OAuth exchange. gives an application that relies on a sign-in, used here for the website that relies on the authenticator.
When Ava chooses to add a passkey, the authenticator creates a new key pair. It returns the public key and a credential ID, an identifier the authenticator chose for this credential. The photo service checks the registration response, then stores both against Ava's account. A registration response can also include attestation, a signed statement about the authenticator's make and model. An organization that issues approved security keys to its staff can use it to accept only those models. Many passkeys provide none, and a service like the photo service usually doesn't ask.
A passkey is also a discoverable credential. The authenticator stores an account handle, the photo service's identifier for Ava's account, beside the private key. At sign-in it can find the right credential by itself, offer a choice if several accounts are saved for the site, and tell the photo service which account is signing in. That is why Ava didn't type an email address. A security key registered only as a second step after a password is often non-discoverable instead. The photo service first learns which account is signing in from the password step, then sends the credential IDs it stored, so the key can recognize its own credential.
Every credential is tied to one website. WebAuthn calls the domain the relying party ID, such as auth.photos.example. The browser also knows the page's origin, its scheme, host and port, and it only lets a page use credentials whose relying party ID matches that origin. A credential made for the photo service can't be requested by a page on another domain.
Adding a credential changes who can get into Ava's account. If someone briefly reached her signed-in browser, they shouldn't be able to add a passkey of their own. So the photo service asks for a recent sign-in, or a fresh one, before it registers a new credential, and tells Ava afterward that one was added.
Answering a challenge
At sign-in the photo service sends a challenge, the fresh random value from Secrets and key pairs that it has never used before. The browser passes the request to an authenticator, together with the origin of the page that asked. Once Ava completes the local check, the authenticator signs two things: its own authenticator data, which names the relying party and records what the authenticator checked, and a hashTurning data into a short, fixed-size value called a hash, in a way that cannot be reversed and where changing one character changes the result completely. Services store password hashes instead of passwords, and signatures are made over a hash. of data the browser supplied, which contains the challenge and the origin.
The browser returns that signed response, called an assertion. The photo service checks that it answers the challenge it just sent, came from its own origin, names its relying party ID, and carries a valid signatureA value made with a private key that lets anyone holding the matching public key check that a message came from the key's holder and has not been changed. It proves origin and integrity; it does not hide the message. from the public key registered to Ava's account. It also checks whether the authenticator performed any user verification its policy requires, which the next section explains. Each check closes a different gap: an old assertion fails the challenge, an assertion collected by another site fails the origin and relying party ID, and a response from an unregistered key fails the signature. A service uses a maintained WebAuthn library for these checks rather than writing them itself.
Now suppose Ava follows a link in a convincing message to auth.photos-example.net, a look-alike of the photo service's sign-in page. The page can ask the browser for a passkey, but the browser asks the authenticator only for credentials whose relying party ID matches photos-example.net. Ava has none, so her passkey for auth.photos.example is never offered, and there is nothing for the fake site to pass on to the real one. If the look-alike page had collected a password or a six-digit code instead, it could have relayed it in time. That website binding is what makes a passkey sign-in resistant to phishingTricking someone, usually with a message and a look-alike sign-in page, into handing over the evidence that opens their account, such as a password or a one-time code., and it works without Ava noticing the difference between the two addresses.
Presence and verification
Authenticators can perform two different local checks. Touching a security key shows user presence: a person is there and taking part in this sign-in, so malware on the computer can't use the key silently. It says nothing about which person touched it. Anyone holding Ava's key could do the same.
A PIN or biometric check provides user verification: the authenticator confirms that the person is the one who set it up. The authenticator records both results as flags inside the authenticator data it signs, so the photo service can rely on them without seeing the fingerprint or the PIN. A passkey unlocked by Ava's fingerprint combines possession of the device with a biometric, and one unlocked by a PIN combines possession with knowledge. A touch alone is possession only.
Suppose the photo service's policy requires user verification, and an authenticator returns a valid signature after a touch alone, with the verification flag clear. The signature is genuine and the challenge is right, but the check the policy asked for didn't happen. The photo service must reject that sign-in.
auth.photos.example
- Passkey offered
- Yes
- Local check
- Fingerprint
- Signature
- Valid
- User verification
- Done
Accept
auth.photos-example.net
- Passkey offered
- No
- Local check
- Never asked
- Signature
- None made
- User verification
- Not reached
Nothing to relay
Verification required
- Passkey offered
- Yes
- Local check
- Touch only
- Signature
- Valid
- User verification
- Flag clear
Reject
The signature is genuine, yet the required local check did not happen.
Where keys live
A device-bound credential stays in one authenticator, such as a security key, and can't be copied out of it. A synced passkey is copied between Ava's devices by her credential provider, encrypted along the way, so the passkey she made on her phone also works on her laptop. Sync never sends the private key to the photo service, which still holds only the registered public key.
The two choices fail differently. Sync makes replacing a lost phone easy, because the passkey is waiting on the new one, but access to Ava's photos now depends partly on how well her credential provider account is protected and recovered. A device-bound key can't be copied by anyone, which also means losing it loses the credential, so Ava needs another way in, such as a second key registered as a backup.
A phone can also act as the authenticator for a different computer. When Ava signs in on a borrowed laptop, the laptop's browser shows a QR code, a square barcode her phone's camera can read. She scans it, and the two devices use Bluetooth to confirm that they are near each other before the phone answers the challenge. The passkey stays on the phone, and the borrowed laptop never holds it. The nearness check matters: a QR code shown on a fake page far away can't complete the exchange.
Check your understanding
Try these questions before moving on. If an answer isn't right, use the feedback and try again.
Try it in the Lab
- Register and use a passkey bound to Lab PhotosRegister a passkey for Ava, sign in without typing an identifier, read what the tenant reports about the key, and see that another site cannot ask for it.