Registration ceremony
- 1Server → BrowserChallenge and creation options
- 2Browser → Authenticatorcredentials.create()
- 3Authenticator → AuthenticatorCheck user, make key pairOne key pair for this relying party
- 4Authenticator → BrowserCredential ID and public key
- 5Browser → ServerReturn the credential
- 6Server → ServerVerify, store public key
The server sends a random challenge and creation options to the browser. The browser calls navigator.credentials.create(). The authenticator checks user presence, and user verification if asked, then creates a key pair for that relying party. It returns the credential ID and public key, the browser passes them to the server, and the server verifies the response and stores them against the user.
WebAuthn is the piece of the web platform that makes passwordless sign-in
possible. Published by the W3C as the Web Authentication specification, it
gives JavaScript two calls, navigator.credentials.create() and
navigator.credentials.get(), that ask an authenticator to make or use a
public-key credential scoped to one website. Together with the FIDO Alliance’s
Client to Authenticator Protocol (CTAP), it forms what is known as FIDO2.
WebAuthn, FIDO2 and passkeys: how they fit
Several names describe one system at different layers:
| Name | What it is | Published by |
|---|---|---|
| WebAuthn | The browser API a website calls to create and use credentials | W3C: Level 1 Recommendation in 2019, Level 2 in 2021 |
| CTAP | The protocol between the browser or operating system and an external authenticator, over USB, NFC or Bluetooth | FIDO Alliance |
| FIDO2 | The umbrella name for WebAuthn plus CTAP | FIDO Alliance with the W3C |
| Passkey | The credential itself: a FIDO key pair, synced across devices or bound to one | FIDO Alliance and platform vendors |
So adding passkeys to a website means using WebAuthn: the passkey is what the user holds, WebAuthn is how your site asks for it. If the passkeys are meant to replace authenticator-app codes, TOTP vs passkeys covers what to require, and for whom.
How WebAuthn works
WebAuthn defines two ceremonies, each a round trip between your server (the relying party), the browser, and an authenticator.
Registration ceremony
- The server generates a random challenge and sends creation options: the relying party ID and name, the user handle, accepted algorithms, and preferences such as whether the credential should be discoverable.
- The browser calls
navigator.credentials.create(). - The authenticator checks user presence, and user verification if asked, then creates a key pair for that relying party.
- The browser returns the credential ID, the public key, the authenticator data, and an optional attestation statement.
- The server verifies the response and stores the credential ID and public key against the user.
const credential = await navigator.credentials.create({
publicKey: {
challenge,
rp: { id: "example.com", name: "Example" },
user: { id: userHandle, name: "ada@example.com", displayName: "Ada" },
pubKeyCredParams: [{ type: "public-key", alg: -7 }], // ES256
authenticatorSelection: {
residentKey: "required",
userVerification: "required",
},
},
});
Authentication ceremony
- The server sends a fresh challenge, and optionally the credential IDs it will accept. Leaving the list empty asks for a discoverable credential, so the user need not type a username.
- The browser calls
navigator.credentials.get(). - The authenticator signs the authenticator data and a hash of the client data, which includes the challenge and the origin.
- The server verifies the signature with the stored public key.
Authentication ceremony
- 1Server → BrowserFresh challengeEmpty credential list: discoverable
- 2Browser → Authenticatorcredentials.get()
- 3Authenticator → BrowserSigns challenge and origin
- 4Browser → ServerReturn the signature
- 5Server → ServerVerify with stored public key
The server sends a fresh challenge, and optionally the credential IDs it accepts; an empty list asks for a discoverable credential. The browser calls navigator.credentials.get(). The authenticator signs the authenticator data and a hash of the client data, which includes the challenge and origin. The browser returns the signature and the server verifies it with the stored public key.
What the server must check
A WebAuthn implementation is only as safe as its verification. For each response the relying party should confirm:
| Check | Why it matters |
|---|---|
| Challenge matches one it issued, and is used once | Stops replay |
origin in client data is an expected origin |
Stops phishing through look-alike sites |
| RP ID hash in authenticator data matches its RP ID | Binds the credential to the site |
| User presence flag set; user verification flag set if required | Proves a person approved, with biometric or PIN if required |
| Signature verifies against the stored public key | Proves possession of the private key |
| Signature counter, where the authenticator reports one | Can flag a cloned credential |
| Credential ID not already registered (at registration) | Prevents one authenticator being bound twice |
Use a maintained server library rather than parsing CBOR and COSE keys by hand.
When to use WebAuthn
Use WebAuthn for any sign-in or step-up where phishing resistance matters: workforce access, administrator actions, customer accounts. It serves both as a first factor, with passkeys, and as a second factor after a password. See passkeys vs passwords for the trade-offs, and TOTP for the code-based alternative it usually replaces.
Pitfalls
- Challenges that can be reused. Store issued challenges server-side and consume them once, across every replica.
- Wrong RP ID. Choosing
app.example.comas the RP ID means the credential will not work onexample.com. Choose the registrable domain you intend to keep. - Treating attestation as required. A service that does not restrict which authenticators users may use has no need for attestation; demanding it can block legitimate authenticators.
- Not asking for user verification when the credential is the only factor.
- Confusing errors. A user who cancels the browser prompt and a server that is unreachable are different failures and should read differently.
How QuorumAuth handles WebAuthn
QuorumAuth exposes WebAuthn registration and authentication ceremonies through its SDK and sign-in UI. In its tested behaviour:
- Beginning registration returns browser creation options and requires a signed-in user. Finishing registration requires the same user who began it, stores verified authenticator material, rejects malformed attestation, and rejects a duplicate authenticator.
- Beginning authentication returns discoverable request options. Finishing it issues a session token, and rejects malformed or untrusted assertions.
- Challenges are single-use: a duplicate challenge or callback in the operator device flow is rejected, and an assertion made for a challenge never issued is refused.
- Passkeys that did not verify the user, or whose counter did not advance, do not admit a switch between organizations.
- In the browser, a failed enrollment stays recoverable, and an unreachable credential service is not reported as a cancelled ceremony.
Rather not build these ceremonies yourself? Drop-in sign-in components run them for you, passkey enrollment included.
Frequently asked questions
What is the difference between WebAuthn and FIDO2?
FIDO2 is the umbrella. It combines W3C WebAuthn, the browser API, with the FIDO Alliance's CTAP, the protocol between the browser and an external authenticator.
Is WebAuthn the same as passkeys?
Passkeys are the credentials. WebAuthn is the API a website uses to create and use them.
Does WebAuthn need a hardware key?
No. Phones, laptops, and password managers act as authenticators. Hardware security keys are one option among several.
What must the server verify?
The challenge, the origin, the relying party ID hash, the user presence and verification flags, the signature, and, where used, the signature counter.