The WebAuthn registration and authentication ceremonies
In one line: What the browser, server and authenticator each build and verify during create and get, field by field, and where implementations usually go wrong.
Most passkey debugging sessions fail on flow, not on bytes. Registration and authentication use the same public key, but the server verifies different things in each ceremony. This article walks both from the fields that come back in the response.
The registration (create) ceremony
- The server sends
PublicKeyCredentialCreationOptionswith a challenge (usually 32 random bytes), the relying party, user information and a list of acceptable algorithms. - The browser calls
navigator.credentials.create(). After the user confirms with a touch, fingerprint or PIN, the authenticator generates a key pair. The private key never leaves the authenticator. - The browser assembles
authenticatorDataandclientDataJSONand wraps them in anattestationObject. - The server verifies the challenge, origin, RP ID hash, flags and signature, then stores the credential ID and public key.
{
"id": "5f0d…", // credential ID (base64url)
"rawId": Uint8Array(32),
"type": "public-key",
"response": {
"clientDataJSON": Uint8Array, // type, challenge, origin, crossOrigin
"attestationObject": Uint8Array, // CBOR: fmt, attStmt, authData
"transports": ["internal", "hybrid"]
},
"authenticatorAttachment": "platform"
}
The authentication (get) ceremony
The server sends a fresh challenge in PublicKeyCredentialRequestOptions and the browser calls navigator.credentials.get(). The response has no attestationObject; instead it carries authenticatorData and signature. The signature covers authenticatorData || SHA-256(clientDataJSON).
Transports and attachment
The transports array tells you how a credential can be reached: internal for a built-in authenticator, hybrid for the QR-code flow that uses a phone, and usb or nfc for external security keys. Store the value and pass it back in allowCredentials on later sign-ins so the browser can pick the right authenticator. authenticatorAttachment distinguishes a platform authenticator from a cross-platform one, and a policy that only allows platform authenticators has to check it.
In the hybrid flow the desktop browser relays the request to a phone over BLE or a QR code. The RP ID and origin rules do not change, and the origin in clientData is still the desktop site's origin.
What the server actually checks
| Check | Registration | Authentication | What a failure means |
|---|---|---|---|
| clientData.type | webauthn.create | webauthn.get | A response from the other ceremony was replayed |
| challenge | The value just issued | The value just issued | Replay attack |
| origin | Matches the allow list | Matches the allow list | Phishing domain |
| rpIdHash | SHA-256 of the RP ID | The same | Credential from another site |
| UP / UV | Required by policy | Required by policy | Authentication without user intent |
| signature | attStmt (format specific) | Stored public key | Forged response |
| signCount | 0 or arbitrary | Greater than the stored value | Possible cloned authenticator |
Where it usually breaks
- Comparing the challenge as a string — the challenge in clientData is Base64URL. Encode the bytes your server issued the same way before comparing.
- Looking for attestationObject in a get response — it is not there. Use authenticatorData and signature.
- Assembling the signed message wrong — append SHA-256 of the raw clientDataJSON bytes to authenticatorData. Re-serialising the JSON changes the hash.
- Comparing signCount as an absolute number — some synced passkeys always report 0. Relaxing the counter check for BE=1 credentials is normal.
Checking it in PasskeyLab
Paste a registration attestationObject together with its clientDataJSON and the decoder shows type, challenge and origin at once. Then paste an authentication authenticatorData as hex, add the signature, and verify that it passes against the same public key.
Decoding happens right in the browser. The payload you paste is not stored.
Open the PasskeyLab decoderFrequently asked questions
Is a new key pair created on every registration?
Yes. Registration creates a new credential, so each authenticator generates a fresh key pair. If one user registers on several devices, each device stores a different public key.
Why is there no attestationObject in an authentication response?
Attestation proves the identity of the authenticator when a credential is first created. Later authentications only need a signature from the stored key, so no attestationObject is sent.
Where does the server keep the public key?
It stores the public key (COSE or JWK), signCount, transports and user ID in the account record, keyed by credential ID. The private key stays inside the authenticator.
Sources
Read next
- The authenticatorData byte layout and flag bitsOffsets for the 37-byte header, AAGUID, credential ID, COSE key and extensions, with a worked hex example and the meaning of every flag.
- Reading CBOR and COSE public keys: ES256, RS256, Ed25519How the attestationObject CBOR map and the COSE key map (kty, alg, crv, x, y, n, e) are laid out, with byte-level examples and reconstruction steps.
- RP ID and origin validation: why passkeys bind to the wrong siteHow rpIdHash is computed, the protocol, host and port rules for origins, and the subdomain and localhost exceptions, with real mismatch cases.