Skip to content

feat(profile-sync-controller): add profile pairing & canonical profile id management#8504

Open
mathieuartu wants to merge 9 commits intomainfrom
ma/auth-profile-pairing
Open

feat(profile-sync-controller): add profile pairing & canonical profile id management#8504
mathieuartu wants to merge 9 commits intomainfrom
ma/auth-profile-pairing

Conversation

@mathieuartu
Copy link
Copy Markdown
Contributor

@mathieuartu mathieuartu commented Apr 17, 2026

Explanation

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Touches SRP authentication/sign-in flow by adding a new profile-pairing API call and new profile ID semantics, which could affect login/session state and downstream storage key derivation if mishandled.

Overview
Adds SRP profile pairing during AuthenticationController.performSignIn: when 2+ SRPs are present it calls POST /profile/pair, propagates the returned canonical profile ID across all srpSessionData entries, and emits a new AuthenticationController:profileSignIn event when aliases are returned or the canonical ID changes (pairing failures are treated as non-fatal).

Extends auth SDK types and services to support pairing and canonical IDs: UserProfile gains canonicalProfileId, ProfileAlias is introduced, SRP /srp/login now sends X-MetaMask-Profile-Pairing: enabled and parses profile_aliases, and SRP login resolves/stores the original per-SRP profileId from aliases via new computeIdentifierId hashing utility.

Updates fixtures/mocks and expands unit tests to cover pairing behavior, event emission, header usage, alias parsing, and canonical/original profile ID persistence.

Reviewed by Cursor Bugbot for commit eb46ce4. Bugbot is set up for automated code reviews on this repo. Configure here.

@mathieuartu mathieuartu self-assigned this Apr 17, 2026
@mathieuartu mathieuartu requested a review from a team as a code owner April 17, 2026 10:27
@mathieuartu mathieuartu requested a review from a team as a code owner April 17, 2026 10:29
Comment thread packages/profile-sync-controller/src/sdk/authentication-jwt-bearer/services.ts Outdated
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 1d56cc0. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant