opyebPasskeyLab

The WebAuthn registration and authentication ceremonies

Fundamentals · 8 min read

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

  1. The server sends PublicKeyCredentialCreationOptions with a challenge (usually 32 random bytes), the relying party, user information and a list of acceptable algorithms.
  2. 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.
  3. The browser assembles authenticatorData and clientDataJSON and wraps them in an attestationObject.
  4. 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

CheckRegistrationAuthenticationWhat a failure means
clientData.typewebauthn.createwebauthn.getA response from the other ceremony was replayed
challengeThe value just issuedThe value just issuedReplay attack
originMatches the allow listMatches the allow listPhishing domain
rpIdHashSHA-256 of the RP IDThe sameCredential from another site
UP / UVRequired by policyRequired by policyAuthentication without user intent
signatureattStmt (format specific)Stored public keyForged response
signCount0 or arbitraryGreater than the stored valuePossible 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 decoder

Frequently 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