Authn.tech
Home
  • SAML 2.0
  • OAuth 2.0
  • OIDC
  • WebAuthn / Passkey
  • MFA / TOTP
  • LDAP
  • All Tools
  • JWT Decode
  • JWT Sign
  • JWK Gen
  • JWK → PEM
  • PEM → JWK
  • PKCE Gen
  • OIDC Discovery
  • TOTP
  • WebAuthn
  • SAML Codec
  • SAML Metadata
  • SAML Response
  • X.509 Cert
  • PEM Inspect
  • Base64URL
  • LDAP Filter
  • Overview & Roles
  • OIDC Mock
  • SAML Mock
  • Mail Server
  • LDAP Directory
  • OIDC Login Demo
  • SAML Login Demo
  • 简体中文
  • English
  • Deutsch
GitHub
Home
  • SAML 2.0
  • OAuth 2.0
  • OIDC
  • WebAuthn / Passkey
  • MFA / TOTP
  • LDAP
  • All Tools
  • JWT Decode
  • JWT Sign
  • JWK Gen
  • JWK → PEM
  • PEM → JWK
  • PKCE Gen
  • OIDC Discovery
  • TOTP
  • WebAuthn
  • SAML Codec
  • SAML Metadata
  • SAML Response
  • X.509 Cert
  • PEM Inspect
  • Base64URL
  • LDAP Filter
  • Overview & Roles
  • OIDC Mock
  • SAML Mock
  • Mail Server
  • LDAP Directory
  • OIDC Login Demo
  • SAML Login Demo
  • 简体中文
  • English
  • Deutsch
GitHub
  • WebAuthn / Passkey

    • WebAuthn Overview
    • Core Concepts
    • Registration and Authentication Flows
    • Parameters and Data Structure Reference

Parameters and Data Structure Reference

This page is a field-level quick reference. For concept explanations, see Core Concepts; for usage, see Flows. Except where specifically noted, binary fields are ArrayBuffer/BufferSource in the browser API and are encoded as Base64URL (without padding) in JSON transmission by convention.

PublicKeyCredentialCreationOptions (Registration)

Passed to navigator.credentials.create({ publicKey }).

FieldTypeRequiredDescription
rpObjectYesRelying party information. rp.id is the rpId (defaults to the registrable domain of current origin), rp.name is the display name.
userObjectYesuser.id (binary, opaque user handle, do not include PII like email), user.name (login name), user.displayName (display name).
challengeBufferSourceYesOne-time random challenge, ≥ 16 bytes.
pubKeyCredParamsArrayYesAlgorithms acceptable to RP, ordered by preference; each item is { type: "public-key", alg }, where alg is COSE identifier (see table below).
timeoutnumberNoMilliseconds; 60000 recommended. Informational only; browser may ignore.
excludeCredentialsArrayNoList of already-registered credentials, preventing duplicate registration on the same authenticator. Each item is { type, id, transports? }.
authenticatorSelectionObjectNoAuthenticator filtering; see below.
attestationstringNonone (default/recommended), indirect, direct, enterprise.
extensionsObjectNoExtensions, such as credProps (reports whether a resident key was created).

authenticatorSelection Sub-fields

FieldValuesDescription
authenticatorAttachmentplatform / cross-platformRestricts to platform authenticators or roaming security keys; omit for no restriction.
residentKeyrequired / preferred / discouragedWhether to create a discoverable credential (Passkey). required enforces resident.
requireResidentKeybooleanLegacy field, retained for compatibility; true equals residentKey: "required".
userVerificationrequired / preferred / discouragedWhether to require user verification (UV).

PublicKeyCredentialRequestOptions (Authentication)

Passed to navigator.credentials.get({ publicKey }).

FieldTypeRequiredDescription
challengeBufferSourceYesOne-time random challenge.
timeoutnumberNoMilliseconds, informational.
rpIdstringNoRelying party identifier, defaults to registrable domain of current origin; must match registration.
allowCredentialsArrayNoList of allowed credentials { type, id, transports? }; leave empty for username-less Passkey login.
userVerificationstringNorequired / preferred / discouraged.
extensionsObjectNoAuthentication extensions.

clientDataJSON

Generated by the browser as JSON (returned as UTF-8 bytes); page JavaScript cannot tamper with it.

FieldDescription
type"webauthn.create" for registration, "webauthn.get" for authentication.
challengeBase64URL encoding of the challenge issued by the RP.
originComplete origin of the page that initiated the request, such as https://login.example.com.
crossOriginWhether initiated from a cross-origin iframe, typically false.
topOriginOnly appears if crossOrigin is true, the top-level origin.

Example:

{
  "type": "webauthn.get",
  "challenge": "YXV0aC1jaGFsbGVuZ2UtcmFuZG9t",
  "origin": "https://login.example.com",
  "crossOrigin": false
}

authenticatorData Structure

A binary data segment returned in both registration and authentication (in registration, encapsulated in attestationObject). Byte layout:

OffsetLengthFieldDescription
032 BrpIdHashSHA-256(rpId), must be verified by RP.
321 BflagsBit flags; see below.
334 BsignCountBig-endian 32-bit signature counter.
37VariableattestedCredentialDataOnly appears when AT flag is 1 (during registration); contains AAGUID (16B), credentialId length (2B), credentialId, credentialPublicKey (COSE).
AfterVariableextensionsOnly appears when ED flag is 1, CBOR-encoded.

flags Bit Definitions

BitNameMeaning
bit 0 (0x01)UPUser Present, user is physically present.
bit 2 (0x04)UVUser Verified, user has been verified (multi-factor).
bit 3 (0x08)BEBackup Eligible, credential can be backed up/synchronized.
bit 4 (0x10)BSBackup State, credential is currently backed up/synchronized.
bit 6 (0x40)ATAttested credential data included (set to 1 during registration).
bit 7 (0x80)EDExtension data included.

Tips

BE/BS distinguish synced Passkeys (cross-device) from device-bound credentials. If the business requires credentials to remain on device, check BE=0.

COSE Algorithm Identifiers

pubKeyCredParams[].alg uses COSE Algorithm values (IANA registry, all negative):

algNameDescriptionRecommendation
-7ES256ECDSA + P-256 + SHA-256First choice, nearly all authenticators support
-8EdDSAEd25519Optional if supported, good performance
-35ES384ECDSA + P-384 + SHA-384Rare
-36ES512ECDSA + P-521 + SHA-512Rare
-257RS256RSASSA-PKCS1-v1_5 + SHA-256Compatibility with legacy TPM/Windows Hello, recommend providing alongside -7
-258RS384RSASSA-PKCS1-v1_5 + SHA-384Very rare
-259RS512RSASSA-PKCS1-v1_5 + SHA-512Very rare
-37PS256RSASSA-PSS + SHA-256Some TPM

Tips

In practice, providing [-7, -257] covers the vast majority of authenticators: -7 (ES256) covers modern platforms and security keys, -257 (RS256) maintains compatibility with some Windows Hello / TPM scenarios.

Troubleshooting Quick Reference Table

Symptom / ErrorCommon CauseResolution
SecurityError (create/get)rp.id/rpId is not the registrable domain of current origin; non-HTTPS (except localhost)Correct rpId to registrable domain; use HTTPS
NotAllowedErrorUser cancelled, timeout, or origin/permissions policy not allowingPrompt to retry; check timeout and Permissions-Policy: publickey-credentials-*
InvalidStateError (registration)This authenticator already registered (matches excludeCredentials)Prompt "this device already registered", guide to login
ConstraintErrorresidentKey: required or UV requirement authenticator cannot meetRelax to preferred, or switch authenticator
Server challenge mismatchChallenge not stored/expired; Base64URL decoding errorStore and bind challenge to session server-side; confirm Base64URL usage
Server origin verification failureMissing origin from allowlist; protocol/port mismatchConfigure allowlist precisely
Signature verification failureSignature data concatenation error (should be authData ‖ SHA-256(clientDataJSON)); algorithm mismatch with stored; ECDSA signature is DER-encoded, needs proper parsingReview verification flow, prefer mature libraries
signCount always 0Synced Passkey / certain platform authenticatorsTreat as normal, don't reject based on this
Base64URL-related garbageMixed with standard Base64 +//=Unify to Base64URL without padding for encoding/decoding

Related reading: Overview · Core Concepts · Registration and Authentication Flows. Multi-factor and federated login see ../mfa/, ../oidc/.

Last updated: 7/6/26, 7:49 AM
Contributors: linux, Claude Opus 4.8
Prev
Registration and Authentication Flows