feat(settings): wire passkey management UI to backend#20380
feat(settings): wire passkey management UI to backend#20380MagentaManifold merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Wires the Settings “Passkeys” management UI into the FxA backend by adding passkeys to the settings account state/storage model, fetching passkeys from auth-server, and invoking backend APIs for passkey operations. It also fixes auth-server passkey handlers to treat uid as hex when constructing buffers.
Changes:
- Add
passkeysto settings account state, unified localStorage schema, and account data fetching/refresh flows. - Update Settings UI components (UnitRowPasskey/PasskeySubRow) to read passkeys from account context and call backend passkey APIs.
- Fix auth-server passkey/account handlers to use
Buffer.from(uid, 'hex')when querying passkeys.
Reviewed changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/fxa-settings/src/models/contexts/AppContext.ts | Adds passkeys to the default mock account context. |
| packages/fxa-settings/src/models/contexts/AccountStateContext.tsx | Extends account state model to include passkeys and serializes it through unified storage. |
| packages/fxa-settings/src/models/Account.ts | Adds passkeys getter, refresh support, and passkey delete/rename methods. |
| packages/fxa-settings/src/lib/hooks/useAccountData.ts | Adds passkeys support to consolidated account fetch/field refetch logic. |
| packages/fxa-settings/src/lib/account-storage.ts | Extends unified localStorage schema to persist passkeys. |
| packages/fxa-settings/src/components/Settings/UnitRowPasskey/index.tsx | Switches to reading passkeys from useAccount() and keys subrows by credentialId. |
| packages/fxa-settings/src/components/Settings/UnitRowPasskey/index.test.tsx | Updates tests to provide passkeys through AppContext. |
| packages/fxa-settings/src/components/Settings/UnitRowPasskey/index.stories.tsx | Updates stories to provide passkeys (and mock passkey methods) via AppContext. |
| packages/fxa-settings/src/components/Settings/SubRow/index.tsx | Updates passkey row data shape and calls account.deletePasskey from UI. |
| packages/fxa-settings/src/components/Settings/SubRow/index.test.tsx | Updates passkey subrow tests to mock useAccount() instead of passing deletePasskey as a prop. |
| packages/fxa-settings/src/components/Settings/SubRow/index.stories.tsx | Updates passkey stories to new passkey data shape. |
| packages/fxa-settings/src/components/Settings/Security/index.tsx | Adds UnitRowPasskey into Security settings behind a feature flag. |
| packages/fxa-content-server/server/config/local.json-dist | Adds passkey-related feature flags to local config template. |
| packages/fxa-auth-server/lib/routes/passkeys.ts | Uses hex-decoding for uid buffer conversion in passkey routes. |
| packages/fxa-auth-server/lib/routes/account.ts | Uses hex-decoding for uid when listing passkeys in the consolidated /account response. |
| libs/accounts/passkey/src/lib/passkey.repository.in.spec.ts | Updates test description to reflect lastUsedAt naming. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
77e2f9f to
bdfe514
Compare
4a81b63 to
3779e55
Compare
| * Deletes the passkey identified by `credentialId`. | ||
| * Requires a cached MFA JWT with scope `passkey`. | ||
| */ | ||
| async deletePasskey(credentialId: string): Promise<void> { |
There was a problem hiding this comment.
Valerie made a comment on my PR that we wanted to move away from using Account.ts and use auth-client directly. Personally I don't see this a blocker, but @vpomerleau what are your thoughts?
There was a problem hiding this comment.
In this case since it ties in with the data fetching/refresh, this probably makes sense? But I'll admit I haven't looked closely at this model since we switched from graphql to REST
| LinkedAccount, | ||
| SecurityEvent, | ||
| } from '../Account'; | ||
| import type { Passkey } from 'fxa-auth-client'; |
3779e55 to
566fb88
Compare
vpomerleau
left a comment
There was a problem hiding this comment.
Tested locally and all happy paths appear to be working as expected 🚀
I would just recommend a change to the error handling before merging.
Because: * we want passkey management UI to actually work This commit: * wires passkey management UI to backend Closes FXA-13073
566fb88 to
02e3c30
Compare
Because
This pull request
Issue that this pull request solves
Closes: FXA-13073
Checklist
Put an
xin the boxes that applyHow to review (Optional)
Screenshots (Optional)
Please attach the screenshots of the changes made in case of change in user interface.
Other information (Optional)
I checked with UX, and passkey delete indeed should be a modal, while registration is a separate page.