test(passkey): add PRF output support to the virtual authenticator - #21115
Merged
Conversation
vpomerleau
force-pushed
the
FXA-14268
branch
2 times, most recently
from
August 28, 2026 00:30
14b17a7 to
f3bc99f
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Suppressed comments (2)
libs/accounts/passkey/src/lib/virtual-authenticator.ts:270
- A PRF-capable registration still emits flags
UP | AT | UVonly and appends no authenticator-extension CBOR. That contradicts the statedhmac-secretregistration support and lets tests produceprf.enabled: truewithout the corresponding ED flag andhmac-secret: trueauthenticator output. Set ED and append that CBOR output when PRF is requested and supported.
const flags = Buffer.from([0x41 | uvFlag]); // UP + AT (+ UV unless suppressed)
libs/accounts/passkey/src/lib/virtual-authenticator.ts:149
- The advertised per-UV-state derivation is explicitly not implemented here:
userVerifiednever reachesprfSecretorderivePrfOutput, so UV and non-UV assertions return identical PRF bytes. Either incorporate UV state into the derivation and cover both states, or update the PR contract to document that this test authenticator intentionally models only the UV output.
* Not keyed on UV state, unlike CTAP 2.1: FxA requires UV at both ceremonies
* and rejects a no-UV assertion server-side, so there is no reachable no-UV
* output to model.
vpomerleau
marked this pull request as ready for review
August 31, 2026 20:32
nshirley
reviewed
Sep 1, 2026
nshirley
reviewed
Sep 1, 2026
nshirley
reviewed
Sep 1, 2026
nshirley
approved these changes
Sep 1, 2026
Because: - The virtual authenticator is test-only, but the package barrel exported it, so anything importing @fxa/accounts/passkey could reach it. - The PRF work adds derivePrfOutput, which looks like a key-derivation function and should not sit one autocomplete away from production passkey code. This commit: - Adds a `@fxa/accounts/passkey/testing` entry point holding the fake. - Drops the virtual authenticator from the package barrel. - Repoints the auth-server remote spec at the new entry point. - Maps the subpath ahead of the greedy accounts pattern in auth-server's jest config, which would otherwise resolve it under `passkey/testing/src`.
Because: - Nothing in the test stack could produce a PRF output, so the kB wrap work could not be tested above the unit layer. - The adapter spec hand-patched clientExtensionResults to route around the gap, leaving the fake's PRF path with no coverage at all. This commit: - Returns a deterministic per-credential PRF output at assertion, keyed on the eval salt the server sent. - Reports `prf.enabled` at registration, the capability flag the server records. - Models an authenticator with no PRF support via `prfSupported: false`. - Returns no output for an eval carrying no salt, rather than throwing. - Drives the adapter spec's two prfEnabled cases through the real path, retiring its hand-patched clientExtensionResults.
vpomerleau
force-pushed
the
FXA-14268
branch
from
September 2, 2026 17:21
c5e28c7 to
b4daf68
Compare
Because: - The browser shim dropped `extensions`, so no eval salt ever reached the virtual authenticator and no output reached page code. - Page code needs the output as an ArrayBuffer, as a real browser returns it — binary outputs are what keep kB out of the request body. This commit: - Forwards the PRF eval salt to Node and decodes the output to an ArrayBuffer. - Imports the fake through the testing entry point rather than a deep relative path into another project's src. - Adds two tests covering the browser shim seam, the one part of the polyfill no unit test can reach. - Declares the Nx dependency on `accounts-passkey`. Closes #FXA-14268
vpomerleau
force-pushed
the
FXA-14268
branch
from
September 2, 2026 18:13
b4daf68 to
c9ac49e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Because
kBwrap work in this epic could not be tested above the unit layer.This pull request
prf.enabledat registration, the capability flag the server records.prfSupported: false, for the password-fallback path.ArrayBuffer.prfEnabledcases through the real path, retiring its hand-patchedclientExtensionResults.@fxa/accounts/passkey/testingentry point.Issue that this pull request solves
Closes: FXA-14268
Checklist
Put an
xin the boxes that applyHow to review (Optional)
libs/accounts/passkey/src/lib/virtual-authenticator.tsa4fdafaa35(entry point) → authenticator → polyfillderivePrfOutputis deterministic by construction and is not a real KDFScreenshots (Optional)
Please attach the screenshots of the changes made in case of change in user interface.
Other information (Optional)
Any other information that is important to this pull request.