Web Authentication (WebAuthn)
Web Authentication, published by the W3C Web Authentication Working Group, defines a browser API for creating and using public key credentials (passkeys and security keys) scoped to a Relying Party, and the steps a Relying Party server performs to verify them. This skill pins WebAuthn Level 3 (W3C Recommendation, 25 August 2026) and produces Relying Party options, verification code, or a review that meets its MUST-level rules.
Follow the workflow below step by step. Every rule here comes from a source in Sources, with the section it cites. Section numbers refer to WebAuthn Level 3 unless another level or document is named; "§ 7.1 step 14" counts the numbered steps of that algorithm. When a rule and the pinned source disagree, the source wins; when the source has a newer revision than the pin, follow the refresh steps.
Inputs (fill in, or ask before starting)
- Role: Relying Party server (generates options, verifies responses, stores credential records), Relying Party front end (calls
navigator.credentials.create()andget()), or both. Clients, authenticators and CTAP are out of scope except where an RP depends on them. - Sign-in flow: username first with
allowCredentials, usernameless with discoverable credentials, conditional mediation (autofill), or WebAuthn as a second factor after a password. - Origins: the RP ID, every origin that runs ceremonies, any cross-origin iframe embedding (
topOrigin), related origins on other domains, and native app origins. - Attestation policy: none (consumer default), or verified attestation for named authenticator models (often workforce).
- Target version: WebAuthn Level 3 (current, the default). WebAuthn Level 2 is supported: keep its behaviour only for a named peer or library that cannot do Level 3. WebAuthn Level 1 is legacy: read it and upgrade from it, never author it. WebAuthn Level 4 is a preview (posture: track): never emit it. See
references/versions.md. - Revision: the pinned revision in Sources, unless the user names another.
- Sources: when refreshing this skill or when a rule looks out of date, re-read the W3C TR pages in Sources for a newer Recommendation or Working Draft, then the editor's draft and its revision history (§ 18), then the CTAP version the current level cites. Update the pins and bump the version.
Invariants
- Challenges are random, server-made and single-use. Generate
challengein a trusted environment with enough entropy to make guessing infeasible (SHOULD be at least 16 bytes), store it until the ceremony ends, and requireC.challengeto equal its base64url encoding. Tolerating a mismatch compromises the protocol (§ 13.4.3; § 7.1 step 8; § 7.2 step 11). - Check the ceremony type.
C.typeMUST bewebauthn.createat registration andwebauthn.getat authentication (§ 7.1 step 7; § 7.2 step 10). - Validate the origin. The RP MUST validate
C.originand MUST NOT accept unexpected values; by default it SHOULD NOT accept subdomain origins. WhentopOriginis present, the RP MUST validate it too (§ 13.4.9; § 13.4.8). - Check the RP ID hash.
rpIdHashin the authenticator data MUST be the SHA-256 hash of the RP ID the RP expects (§ 7.1 step 14; § 7.2 step 15). The RP ID is the origin's effective domain or a registrable domain suffix of it (§ 4, RP ID), unless related origins apply (§ 5.11). - Presence and verification are separate checks. UP MUST be set, except at registration with conditional mediation; UV MUST be set when the RP requires user verification (§ 7.1 steps 15 and 16; § 7.2 steps 16 and 17).
- Verify the assertion signature with the stored key. The signature MUST verify over
authenticatorData || SHA-256(clientDataJSON)using the credential record's public key (§ 7.2 steps 20 and 21). - Only accept requested algorithms. The credential public key's
algMUST match an entry inpubKeyCredParams(§ 7.1 step 20). - Backup flags are consistent. If BE is not set, BS MUST NOT be set; BE never changes for a credential, so an assertion whose BE differs from the record's
backupEligiblefails when the RP uses backup state (§ 6.1.3; § 7.1 step 17; § 7.2 steps 18 and 19). - Credential IDs are bounded and unique. Fail registration when the credential ID is longer than 1023 bytes or already registered to any user (both SHOULD) (§ 7.1 steps 25 and 26).
- The user handle is opaque.
user.idis 1 to 64 bytes, MUST NOT be empty and MUST NOT contain personally identifying information, including unsalted hashes of it; authorization decisions MUST be based on it, not onnameordisplayName(§ 5.4.3; § 14.6.1). - Bind the assertion to the account. The credential MUST be one listed in a non-empty
allowCredentials, and must belong to the identified account; for usernameless sign-in,userHandleMUST be present and identify the account that holds the credential (§ 7.2 steps 5 and 6). - Do not trust UV before it is initialized. While the record's
uvInitializedis false, the UV flag MUST NOT be relied on as an authentication factor (§ 4, Credential Record). - Expect unsolicited and missing extension outputs. The RP MUST handle outputs it did not request and requests the client or authenticator ignored (§ 7.1 step 28; § 7.2 step 23).
Workflow
- Pick the version. Target WebAuthn Level 3. List any library or peer that only does Level 2.
->
references/versions.md✓ The target level is recorded, and it is not Level 1 or the Level 4 draft. - Design the account model. Define the credential record fields, a random 64-byte user handle per account, and the expected RP ID and origin list.
->
references/registration.md✓ The record storesid,publicKey,signCount,transports,uvInitialized,backupEligibleandbackupState. - Build creation options. Set
rp,user, a freshchallenge,pubKeyCredParams,excludeCredentials,authenticatorSelection,hints,attestationandextensions. ->references/registration.md✓ The options round-trip throughPublicKeyCredential.parseCreationOptionsFromJSON(). - Verify registration. Run § 7.1 in order and store the credential record only when every step passes.
->
references/registration.md✓ Each § 7.1 step maps to a line of code or a documented reason it does not apply. - Set the attestation policy. Default to
none; request and verify attestation only with a trust anchor source and a policy for each format. ->references/attestation.md✓ Every acceptedfmthas a verification procedure and a trust decision. - Build request options and pick the sign-in flow. Username first, usernameless, or conditional mediation, with enumeration defences.
->
references/authentication.md✓ An unknown username gets a response indistinguishable from a known one. - Verify the assertion. Run § 7.2 in order, then update
signCount,backupStateanduvInitialized. ->references/authentication.md✓ A tamperedclientDataJSON, wrong origin, wrong RP ID or replayed challenge fails. - Apply passkey policy. Use BE and BS, the signature counter and authenticator attachment to drive recovery and step-up prompts.
->
references/passkeys-and-flags.md✓ A single-device credential prompts for a second credential or a recovery path. - Wire JSON, signals and extensions. Send options as JSON, post
toJSON()output, call the signal methods, and handle credProps, prf and largeBlob. ->references/extensions-and-json.md✓ PRFresultsnever reach the server unless the design needs them there. - Upgrade (only when asked). Follow the checklist for each step from the source level to Level 3.
->
references/versions.md✓ Credentials registered under the old level still authenticate, and the Verify list below passes.
Verify before done
- Challenges come from a CSPRNG, are at least 16 bytes, are stored server-side, and are rejected on reuse or after the ceremony timeout (§ 13.4.3; § 15.1).
- Registration and authentication reject a wrong
type,challenge,origin,topOriginorrpIdHash. - Origin matching is exact against an allow list, or a documented structural rule; subdomains are not accepted by default (§ 13.4.9).
- UV is checked when
userVerificationisrequired; UP is checked except for conditional create. - Registration rejects an
algnot inpubKeyCredParams, a credential ID over 1023 bytes, and a credential ID already registered. - The credential record stores transports, BE, BS,
uvInitializedand the sign count, and authentication updates them after all checks pass (§ 7.2 step 24). - A BS flag with BE unset, or a BE value that differs from the record, fails the ceremony when backup state is used.
- A sign count that does not increase (when either value is non-zero) feeds risk scoring (§ 7.2 step 22).
-
user.idis random, 1 to 64 bytes, and contains no email, username or unsalted hash of them. - Nothing from the Level 4 draft, such as
remoteClientDataJSON, is emitted.
Reference index
references/versions.md: every WebAuthn level with its status, what each changed, upgrade checklists, and the Level 4 draft. Load for steps 1 and 10.references/registration.md: creation options, the credential record, the § 7.1 steps,excludeCredentials, algorithms, and RP ID and origin rules shared with authentication.references/authentication.md: request options, username-first, usernameless and conditional flows, the § 7.2 steps, related origins, iframes, and username enumeration.references/attestation.md: conveyance preferences, attestation types, the defined formats and their verification, trust anchors, revocation and privacy.references/passkeys-and-flags.md: passkeys and discoverable credentials, authenticator data flags, BE and BS, signature counters,uvInitialized, attachment, hints and client capabilities.references/extensions-and-json.md:toJSON(), the JSON option types and parsers, signal methods, the extension framework, credProps, prf, largeBlob and appid.
Related skills
openid-connect, when passkeys sign users in to an OpenID Provider that then issues ID tokens:npx skills add ScaleDockHQ/scaledock-skills --skill openid-connectoauth, when a WebAuthn sign-in sits inside an OAuth authorization server's login step:npx skills add ScaleDockHQ/scaledock-skills --skill oauthnist-800-63, for mapping passkeys and security keys to authenticator assurance levels:npx skills add ScaleDockHQ/scaledock-skills --skill nist-800-63credential-management, when the work also follows that specification:npx skills add ScaleDockHQ/scaledock-skills --skill credential-managementdbsc, when the work also follows that specification:npx skills add ScaleDockHQ/scaledock-skills --skill dbscsecure-payment-confirmation, when the work also follows that specification:npx skills add ScaleDockHQ/scaledock-skills --skill secure-payment-confirmationdigital-credentials, when the work also follows that specification:npx skills add ScaleDockHQ/scaledock-skills --skill digital-credentialsfido-ctap, when the work also follows that specification:npx skills add ScaleDockHQ/scaledock-skills --skill fido-ctap
Sources
Status uses the publishing body's own maturity term. Checked is the date the source was last read.
- Web Authentication: An API for accessing Public Key Credentials - Level 3: W3C Recommendation, 25 August 2026 (REC-webauthn-3-20260825), checked 2026-10-05.
- Web Authentication: An API for accessing Public Key Credentials - Level 2: W3C Recommendation, 8 April 2021 (REC-webauthn-2-20210408), checked 2026-10-05.
- Web Authentication: An API for accessing Public Key Credentials Level 1: W3C Recommendation, 4 March 2019 (REC-webauthn-1-20190304), checked 2026-10-05.
- Web Authentication: An API for accessing Public Key Credentials - Level 4: W3C First Public Working Draft, 15 September 2026 (WD-webauthn-4-20260915), checked 2026-10-05. Draft posture: track.
- Web Authentication editor's draft: Editor's Draft as of 2026-10-05; its content matches the Level 4 draft (it includes
remoteClientDataJSON) although its header still reads Level 3, checked 2026-10-05. Draft posture: track. - Client to Authenticator Protocol (CTAP) 2.3: FIDO Alliance Proposed Standard, 26 February 2026, the
[FIDO-CTAP]version WebAuthn Level 3 cites; used only for hmac-secret, large blobs and credential management, checked 2026-10-05.