Decoding WebAuthn Passkey CBOR (attestationObject, authenticatorData, COSE Keys) Without a Backend
When implementing Passkeys (WebAuthn), navigator.credentials.create() hands back an opaque Base64URL-encoded CBOR blob called attestationObject . When a server verifier rejects a registration with RP ID hash mismatch , UV flag not set , or Unsupported COSE algorithm , console.log alone does not tell you which byte failed. Here is the exact binary layout to inspect before blaming your server…
WebAuthn passkeys utilize a Base64URL-encoded CBOR blob known as attestationObject when created via navigator.credentials.create(). If a server verifier rejects registration due to RP ID hash mismatch, missing RP ID flag, or unsupported COSE algorithm, console.log output alone does not pinpoint the issue. This guide provides the exact binary layout to inspect before assuming server library problems.
After decoding the Base64URL-encoded attestationObject, the CBOR map contains three keys: fmt (attestation statement format), attStmt (attestation signature map), and authData (raw authenticatorData byte buffer). The 37-byte authenticatorData header is consistent across WebAuthn registration and assertion. The first 32 bytes represent SHA-256 of the relying party ID, which must match the configured Relying Party ID.
The 33rd byte contains flags indicating user presence, user verification, backup eligibility, backup state, and attested credential data.
If the hardware key requires user verification and is configured as "required" but lacks user verification (UV) flag, registration fails immediately. When the AT (attested credential data) bit is set, authData continues with a 16-byte aaguid (authenticator vendor/model identifier), a big-endian credentialIdLength, credentialId, and COSE key.
The COSE key includes an algorithm identifier (-7 for ES256/P-256 or -257 for RS256). To avoid network exposure, a zero-upload browser inspector is available to parse CBOR, flags, AAGUID, and COSE keys locally.
Rewritten by urgent.news; may contain errors — check the original.