Skip to content

feat(auth-client): Add passkey wrap methods and assertion scope - #21146

Merged
nshirley merged 1 commit into
mainfrom
FXA-13148
Sep 4, 2026
Merged

feat(auth-client): Add passkey wrap methods and assertion scope#21146
nshirley merged 1 commit into
mainfrom
FXA-13148

Conversation

@nshirley

@nshirley nshirley commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Because

  • Passwordless sign-in needs the wrap envelope, and no client method reaches the wrap endpoints.
  • A passkey assertion can now mint a scoped MFA token, which callers need in order to request and spend one.

This pull request

  • Adds createPasskeyWrap and getPasskeyWrap, both taking an mfa:passkey JWT.
  • Keeps base64url on the wire and Uint8Array in the caller's hands; both codecs iterate one field list so they cannot drift.
  • Adds the optional scope param to beginPasskeyAuthentication and surfaces mfaToken on the authentication result.

Issue that this pull request solves

Closes: FXA-13148

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

Other information (Optional)

  • The ticket predates the current API and is stale: endpoints moved from /passkey/keys to /passkey/wraps, auth moved from verifiedSessionToken to the mfa:passkey token, the passkeyVerificationProof design was dropped, and errno 236 is now PASSKEY_WRAP_STALE rather than a PRF-support error.

const credentialId = 'Y3JlZC1pZA';

// Distinct fills, so a field swapped for another is visible.
const envelope = {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is left as literals rather than importing V1_WIDTHS. It would be the first runtime @fxa/* import in this package (the existing MetricsContext one is type-only), so it needs tsconfig-paths wired into the mocha scripts, and it pulls @fxa/shared/db/mysql/core in via passkey.wrap.repository... That's a lot of weight on a browser-shipped client to share five numbers.

The clean version is extracting the widths to a dependency-free module both sides import, which is bigger than this PR.

@nshirley
nshirley marked this pull request as ready for review September 4, 2026 05:33
@nshirley
nshirley requested a review from a team as a code owner September 4, 2026 05:33
@nshirley
nshirley requested a balanced review from Copilot September 4, 2026 13:21

This comment was marked as outdated.

Comment thread packages/fxa-auth-server/docs/swagger/passkeys-api.ts
Comment thread packages/fxa-auth-server/docs/swagger/passkeys-api.ts
Comment thread packages/fxa-auth-server/lib/routes/passkey-wraps.spec.ts
Comment thread packages/fxa-auth-server/lib/routes/passkey-wraps.spec.ts
Comment thread packages/fxa-auth-server/test/remote/passkey_wraps.in.spec.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation matches the server contracts; only a minor API documentation clarification remains.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread packages/fxa-auth-client/lib/client.ts
Because:
- Passwordless sign-in needs the wrap envelope, and no client method
  reaches the wrap endpoints.
- A passkey assertion can now mint a scoped MFA token, which callers
  need in order to request and spend one.

This commit:
- Adds createPasskeyWrap and getPasskeyWrap, base64url on the wire and
  Uint8Array for callers.
- Adds the optional scope param to beginPasskeyAuthentication.
- Surfaces mfaToken on the authentication result.

Closes #FXA-13148
Base automatically changed from FXA-13143 to main September 4, 2026 19:45
@nshirley
nshirley merged commit 3c17a2f into main Sep 4, 2026
18 checks passed
@nshirley
nshirley deleted the FXA-13148 branch September 4, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants