@metamask-previews/profile-sync-controller 28.0.2-preview-6c5b6b08f → 28.0.2-preview-6961bc96f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CHANGELOG.md +3 -22
  2. package/dist/controllers/authentication/AuthenticationController-method-action-types.cjs.map +1 -1
  3. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.cts +6 -45
  4. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.cts.map +1 -1
  5. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.mts +6 -45
  6. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.mts.map +1 -1
  7. package/dist/controllers/authentication/AuthenticationController-method-action-types.mjs.map +1 -1
  8. package/dist/controllers/authentication/AuthenticationController.cjs +7 -169
  9. package/dist/controllers/authentication/AuthenticationController.cjs.map +1 -1
  10. package/dist/controllers/authentication/AuthenticationController.d.cts +7 -61
  11. package/dist/controllers/authentication/AuthenticationController.d.cts.map +1 -1
  12. package/dist/controllers/authentication/AuthenticationController.d.mts +7 -61
  13. package/dist/controllers/authentication/AuthenticationController.d.mts.map +1 -1
  14. package/dist/controllers/authentication/AuthenticationController.mjs +7 -169
  15. package/dist/controllers/authentication/AuthenticationController.mjs.map +1 -1
  16. package/dist/controllers/authentication/index.cjs.map +1 -1
  17. package/dist/controllers/authentication/index.d.cts +1 -1
  18. package/dist/controllers/authentication/index.d.cts.map +1 -1
  19. package/dist/controllers/authentication/index.d.mts +1 -1
  20. package/dist/controllers/authentication/index.d.mts.map +1 -1
  21. package/dist/controllers/authentication/index.mjs.map +1 -1
  22. package/dist/controllers/authentication/mocks/mockResponses.cjs +1 -10
  23. package/dist/controllers/authentication/mocks/mockResponses.cjs.map +1 -1
  24. package/dist/controllers/authentication/mocks/mockResponses.d.cts +32 -17
  25. package/dist/controllers/authentication/mocks/mockResponses.d.cts.map +1 -1
  26. package/dist/controllers/authentication/mocks/mockResponses.d.mts +32 -17
  27. package/dist/controllers/authentication/mocks/mockResponses.d.mts.map +1 -1
  28. package/dist/controllers/authentication/mocks/mockResponses.mjs +1 -9
  29. package/dist/controllers/authentication/mocks/mockResponses.mjs.map +1 -1
  30. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +1 -28
  31. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +1 -1
  32. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts +0 -2
  33. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +1 -1
  34. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts +0 -2
  35. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +1 -1
  36. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs +2 -29
  37. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +1 -1
  38. package/dist/sdk/authentication-jwt-bearer/services.cjs +1 -59
  39. package/dist/sdk/authentication-jwt-bearer/services.cjs.map +1 -1
  40. package/dist/sdk/authentication-jwt-bearer/services.d.cts +1 -17
  41. package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +1 -1
  42. package/dist/sdk/authentication-jwt-bearer/services.d.mts +1 -17
  43. package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +1 -1
  44. package/dist/sdk/authentication-jwt-bearer/services.mjs +0 -56
  45. package/dist/sdk/authentication-jwt-bearer/services.mjs.map +1 -1
  46. package/dist/sdk/authentication-jwt-bearer/types.cjs.map +1 -1
  47. package/dist/sdk/authentication-jwt-bearer/types.d.cts +1 -20
  48. package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +1 -1
  49. package/dist/sdk/authentication-jwt-bearer/types.d.mts +1 -20
  50. package/dist/sdk/authentication-jwt-bearer/types.d.mts.map +1 -1
  51. package/dist/sdk/authentication-jwt-bearer/types.mjs.map +1 -1
  52. package/dist/sdk/authentication.cjs +0 -4
  53. package/dist/sdk/authentication.cjs.map +1 -1
  54. package/dist/sdk/authentication.d.cts +0 -2
  55. package/dist/sdk/authentication.d.cts.map +1 -1
  56. package/dist/sdk/authentication.d.mts +0 -2
  57. package/dist/sdk/authentication.d.mts.map +1 -1
  58. package/dist/sdk/authentication.mjs +0 -4
  59. package/dist/sdk/authentication.mjs.map +1 -1
  60. package/dist/sdk/mocks/auth.cjs +1 -11
  61. package/dist/sdk/mocks/auth.cjs.map +1 -1
  62. package/dist/sdk/mocks/auth.d.cts +0 -10
  63. package/dist/sdk/mocks/auth.d.cts.map +1 -1
  64. package/dist/sdk/mocks/auth.d.mts +0 -10
  65. package/dist/sdk/mocks/auth.d.mts.map +1 -1
  66. package/dist/sdk/mocks/auth.mjs +1 -11
  67. package/dist/sdk/mocks/auth.mjs.map +1 -1
  68. package/dist/sdk/user-storage.cjs +3 -26
  69. package/dist/sdk/user-storage.cjs.map +1 -1
  70. package/dist/sdk/user-storage.d.cts +0 -7
  71. package/dist/sdk/user-storage.d.cts.map +1 -1
  72. package/dist/sdk/user-storage.d.mts +0 -7
  73. package/dist/sdk/user-storage.d.mts.map +1 -1
  74. package/dist/sdk/user-storage.mjs +3 -26
  75. package/dist/sdk/user-storage.mjs.map +1 -1
  76. package/dist/shared/types/services.cjs.map +1 -1
  77. package/dist/shared/types/services.d.cts +0 -7
  78. package/dist/shared/types/services.d.cts.map +1 -1
  79. package/dist/shared/types/services.d.mts +0 -7
  80. package/dist/shared/types/services.d.mts.map +1 -1
  81. package/dist/shared/types/services.mjs.map +1 -1
  82. package/package.json +5 -5
  83. package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs +0 -27
  84. package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs.map +0 -1
  85. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.cts +0 -13
  86. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.cts.map +0 -1
  87. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts +0 -13
  88. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts.map +0 -1
  89. package/dist/sdk/authentication-jwt-bearer/utils/identifier.mjs +0 -23
  90. package/dist/sdk/authentication-jwt-bearer/utils/identifier.mjs.map +0 -1
  91. package/dist/sdk/utils/validate-pair-response.cjs +0 -29
  92. package/dist/sdk/utils/validate-pair-response.cjs.map +0 -1
  93. package/dist/sdk/utils/validate-pair-response.d.cts +0 -26
  94. package/dist/sdk/utils/validate-pair-response.d.cts.map +0 -1
  95. package/dist/sdk/utils/validate-pair-response.d.mts +0 -26
  96. package/dist/sdk/utils/validate-pair-response.d.mts.map +0 -1
  97. package/dist/sdk/utils/validate-pair-response.mjs +0 -25
  98. package/dist/sdk/utils/validate-pair-response.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,29 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
- ### Added
10
+ ### Changed
11
11
 
12
- - Add SRP profile pairing support (Accounts ADR 0006) ([#8504](https://github.com/MetaMask/core/pull/8504), [#8642](https://github.com/MetaMask/core/pull/8642))
13
- - Pairing runs at the end of `performSignIn`; pair failures are swallowed and retried on the next gate fire.
14
- - Add `needsProfilePairing?: boolean` to state (defaults `true`, cleared on successful pair, re-armed via `requestProfilePairing()`). Optional in the type to keep partial-state selectors assignable; treat `undefined` as `true`.
15
- - Add `requestProfilePairing()` (and `AuthenticationController:requestProfilePairing` action) for clients to signal SRP-set changes so the next auto-sign-in cycle re-pairs.
16
- - Upgrade path: existing signed-in users re-pair automatically on the first auto-sign-in cycle. Pre-pairing sessions miss `canonicalProfileId` and re-login on the next `getAccessToken`, so the pair call runs against fresh v2 JWTs — no client migration needed.
17
- - JWT staleness note: a newly added SRP's JWT keeps `sub = alias_id` until that SRP's session is re-logged-in. User storage is unaffected (it keys on `x-profile-id`, not `sub`).
18
- - Add `canonicalProfileId` to `UserProfile` — the unified profile ID across paired SRPs
19
- - Add `ProfileAlias` type for transient alias data returned by the pairing API
20
- - Add `pairSrpProfiles` method to `SRPJwtBearerAuth` and `JwtBearerAuth`
21
- - Add `ProfileSignInEvent` (`AuthenticationController:profileSignIn`) emitted after successful pairing when the canonical profile ID changes or new aliases are returned
22
- - Send `X-MetaMask-Profile-Pairing: enabled` header on all `/srp/login` requests
23
- - Resolve original per-SRP `profileId` from `profile_aliases` using `computeIdentifierId`
24
- - Propagate canonical profile ID to all `srpSessionData` entries after pairing
25
- - Add `refreshCanonicalProfileId` method — forces a fresh canonical retrieval from the server (1 primary SRP login) and propagates it to all cached SRP sessions. For best-effort reads, use `getSessionProfile().canonicalProfileId` instead.
26
- - Force re-login when cached session is missing `canonicalProfileId`
27
- - Add optional `getAppVersion` callback to `MetaMetricsAuth`, forwarded as `metametrics.app_version` in the `POST /api/v2/srp/login` payload. ([#8626](https://github.com/MetaMask/core/pull/8626))
28
-
29
- ### Changed
30
-
31
- - Bump `@metamask/keyring-controller` from `^25.1.1` to `^25.5.0` ([#8363](https://github.com/MetaMask/core/pull/8363), [#8634](https://github.com/MetaMask/core/pull/8634), [#8665](https://github.com/MetaMask/core/pull/8665), [#8722](https://github.com/MetaMask/core/pull/8722))
32
- - Bump `@metamask/messenger` from `^1.0.0` to `^1.2.0` ([#8364](https://github.com/MetaMask/core/pull/8364), [#8373](https://github.com/MetaMask/core/pull/8373), [#8632](https://github.com/MetaMask/core/pull/8632))
12
+ - Bump `@metamask/keyring-controller` from `^25.1.1` to `^25.2.0` ([#8363](https://github.com/MetaMask/core/pull/8363))
13
+ - Bump `@metamask/messenger` from `^1.0.0` to `^1.1.1` ([#8364](https://github.com/MetaMask/core/pull/8364), [#8373](https://github.com/MetaMask/core/pull/8373))
33
14
  - Bump `@metamask/base-controller` from `^9.0.1` to `^9.1.0` ([#8457](https://github.com/MetaMask/core/pull/8457))
34
15
 
35
16
  ## [28.0.2]
@@ -1 +1 @@
1
- {"version":3,"file":"AuthenticationController-method-action-types.cjs","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AuthenticationController } from './AuthenticationController';\n\nexport type AuthenticationControllerPerformSignInAction = {\n type: `AuthenticationController:performSignIn`;\n handler: AuthenticationController['performSignIn'];\n};\n\n/**\n * Marks profile pairing as needed. Clients call this when the SRP set\n * changes (e.g. a new keyring was added) so the next auto-sign-in cycle\n * re-runs `performSignIn` and re-pairs.\n */\nexport type AuthenticationControllerRequestProfilePairingAction = {\n type: `AuthenticationController:requestProfilePairing`;\n handler: AuthenticationController['requestProfilePairing'];\n};\n\nexport type AuthenticationControllerPerformSignOutAction = {\n type: `AuthenticationController:performSignOut`;\n handler: AuthenticationController['performSignOut'];\n};\n\n/**\n * Returns a bearer token for the specified SRP, logging in if needed.\n *\n * When called without `entropySourceId`, returns the primary (first) SRP's\n * access token, which is effectively the canonical\n * profile's token that can be used by alias-aware consumers for cross-SRP\n * operations.\n *\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The OIDC access token.\n */\nexport type AuthenticationControllerGetBearerTokenAction = {\n type: `AuthenticationController:getBearerToken`;\n handler: AuthenticationController['getBearerToken'];\n};\n\n/**\n * Returns the cached session profile, logging in if no session exists.\n *\n * The returned `canonicalProfileId` reflects the value from the most recent\n * login or pairing. In the rare event where a canonical changed because of\n * a pairing that happened on another device, the cached value may be stale\n * until the next login. For guaranteed freshness, call\n * `refreshCanonicalProfileId()` before reading `canonicalProfileId`.\n *\n * @param entropySourceId - The entropy source ID used to derive the key,\n * when multiple sources are available (Multi-SRP).\n * @returns profile for the session.\n */\nexport type AuthenticationControllerGetSessionProfileAction = {\n type: `AuthenticationController:getSessionProfile`;\n handler: AuthenticationController['getSessionProfile'];\n};\n\n/**\n * Forces a fresh retrieval of the canonical profile ID from the server\n * and propagates it to all cached SRP sessions.\n *\n * This method invalidates the primary SRP's cached session and forces a\n * re-login. Use it before operations that require a guaranteed-fresh\n * canonical (e.g. storage key derivation for Accounts ADR 0005). For\n * best-effort reads, use\n * `getSessionProfile().canonicalProfileId` instead.\n *\n * Only the primary SRP is re-logged-in regardless of how many SRPs exist —\n * the server returns the current canonical for the entire pairing group\n * from any single SRP login.\n *\n * @returns The refreshed canonical profile ID.\n */\nexport type AuthenticationControllerRefreshCanonicalProfileIdAction = {\n type: `AuthenticationController:refreshCanonicalProfileId`;\n handler: AuthenticationController['refreshCanonicalProfileId'];\n};\n\nexport type AuthenticationControllerGetUserProfileLineageAction = {\n type: `AuthenticationController:getUserProfileLineage`;\n handler: AuthenticationController['getUserProfileLineage'];\n};\n\nexport type AuthenticationControllerIsSignedInAction = {\n type: `AuthenticationController:isSignedIn`;\n handler: AuthenticationController['isSignedIn'];\n};\n\n/**\n * Union of all AuthenticationController action types.\n */\nexport type AuthenticationControllerMethodActions =\n | AuthenticationControllerPerformSignInAction\n | AuthenticationControllerRequestProfilePairingAction\n | AuthenticationControllerPerformSignOutAction\n | AuthenticationControllerGetBearerTokenAction\n | AuthenticationControllerGetSessionProfileAction\n | AuthenticationControllerRefreshCanonicalProfileIdAction\n | AuthenticationControllerGetUserProfileLineageAction\n | AuthenticationControllerIsSignedInAction;\n"]}
1
+ {"version":3,"file":"AuthenticationController-method-action-types.cjs","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AuthenticationController } from './AuthenticationController';\n\nexport type AuthenticationControllerPerformSignInAction = {\n type: `AuthenticationController:performSignIn`;\n handler: AuthenticationController['performSignIn'];\n};\n\nexport type AuthenticationControllerPerformSignOutAction = {\n type: `AuthenticationController:performSignOut`;\n handler: AuthenticationController['performSignOut'];\n};\n\n/**\n * Will return a bearer token.\n * Logs a user in if a user is not logged in.\n *\n * @returns profile for the session.\n */\nexport type AuthenticationControllerGetBearerTokenAction = {\n type: `AuthenticationController:getBearerToken`;\n handler: AuthenticationController['getBearerToken'];\n};\n\n/**\n * Will return a session profile.\n * Logs a user in if a user is not logged in.\n *\n * @param entropySourceId - The entropy source ID used to derive the key,\n * when multiple sources are available (Multi-SRP).\n * @returns profile for the session.\n */\nexport type AuthenticationControllerGetSessionProfileAction = {\n type: `AuthenticationController:getSessionProfile`;\n handler: AuthenticationController['getSessionProfile'];\n};\n\nexport type AuthenticationControllerGetUserProfileLineageAction = {\n type: `AuthenticationController:getUserProfileLineage`;\n handler: AuthenticationController['getUserProfileLineage'];\n};\n\nexport type AuthenticationControllerIsSignedInAction = {\n type: `AuthenticationController:isSignedIn`;\n handler: AuthenticationController['isSignedIn'];\n};\n\n/**\n * Union of all AuthenticationController action types.\n */\nexport type AuthenticationControllerMethodActions =\n | AuthenticationControllerPerformSignInAction\n | AuthenticationControllerPerformSignOutAction\n | AuthenticationControllerGetBearerTokenAction\n | AuthenticationControllerGetSessionProfileAction\n | AuthenticationControllerGetUserProfileLineageAction\n | AuthenticationControllerIsSignedInAction;\n"]}
@@ -7,42 +7,23 @@ export type AuthenticationControllerPerformSignInAction = {
7
7
  type: `AuthenticationController:performSignIn`;
8
8
  handler: AuthenticationController['performSignIn'];
9
9
  };
10
- /**
11
- * Marks profile pairing as needed. Clients call this when the SRP set
12
- * changes (e.g. a new keyring was added) so the next auto-sign-in cycle
13
- * re-runs `performSignIn` and re-pairs.
14
- */
15
- export type AuthenticationControllerRequestProfilePairingAction = {
16
- type: `AuthenticationController:requestProfilePairing`;
17
- handler: AuthenticationController['requestProfilePairing'];
18
- };
19
10
  export type AuthenticationControllerPerformSignOutAction = {
20
11
  type: `AuthenticationController:performSignOut`;
21
12
  handler: AuthenticationController['performSignOut'];
22
13
  };
23
14
  /**
24
- * Returns a bearer token for the specified SRP, logging in if needed.
15
+ * Will return a bearer token.
16
+ * Logs a user in if a user is not logged in.
25
17
  *
26
- * When called without `entropySourceId`, returns the primary (first) SRP's
27
- * access token, which is effectively the canonical
28
- * profile's token that can be used by alias-aware consumers for cross-SRP
29
- * operations.
30
- *
31
- * @param entropySourceId - The entropy source ID. Omit for the primary SRP.
32
- * @returns The OIDC access token.
18
+ * @returns profile for the session.
33
19
  */
34
20
  export type AuthenticationControllerGetBearerTokenAction = {
35
21
  type: `AuthenticationController:getBearerToken`;
36
22
  handler: AuthenticationController['getBearerToken'];
37
23
  };
38
24
  /**
39
- * Returns the cached session profile, logging in if no session exists.
40
- *
41
- * The returned `canonicalProfileId` reflects the value from the most recent
42
- * login or pairing. In the rare event where a canonical changed because of
43
- * a pairing that happened on another device, the cached value may be stale
44
- * until the next login. For guaranteed freshness, call
45
- * `refreshCanonicalProfileId()` before reading `canonicalProfileId`.
25
+ * Will return a session profile.
26
+ * Logs a user in if a user is not logged in.
46
27
  *
47
28
  * @param entropySourceId - The entropy source ID used to derive the key,
48
29
  * when multiple sources are available (Multi-SRP).
@@ -52,26 +33,6 @@ export type AuthenticationControllerGetSessionProfileAction = {
52
33
  type: `AuthenticationController:getSessionProfile`;
53
34
  handler: AuthenticationController['getSessionProfile'];
54
35
  };
55
- /**
56
- * Forces a fresh retrieval of the canonical profile ID from the server
57
- * and propagates it to all cached SRP sessions.
58
- *
59
- * This method invalidates the primary SRP's cached session and forces a
60
- * re-login. Use it before operations that require a guaranteed-fresh
61
- * canonical (e.g. storage key derivation for Accounts ADR 0005). For
62
- * best-effort reads, use
63
- * `getSessionProfile().canonicalProfileId` instead.
64
- *
65
- * Only the primary SRP is re-logged-in regardless of how many SRPs exist —
66
- * the server returns the current canonical for the entire pairing group
67
- * from any single SRP login.
68
- *
69
- * @returns The refreshed canonical profile ID.
70
- */
71
- export type AuthenticationControllerRefreshCanonicalProfileIdAction = {
72
- type: `AuthenticationController:refreshCanonicalProfileId`;
73
- handler: AuthenticationController['refreshCanonicalProfileId'];
74
- };
75
36
  export type AuthenticationControllerGetUserProfileLineageAction = {
76
37
  type: `AuthenticationController:getUserProfileLineage`;
77
38
  handler: AuthenticationController['getUserProfileLineage'];
@@ -83,5 +44,5 @@ export type AuthenticationControllerIsSignedInAction = {
83
44
  /**
84
45
  * Union of all AuthenticationController action types.
85
46
  */
86
- export type AuthenticationControllerMethodActions = AuthenticationControllerPerformSignInAction | AuthenticationControllerRequestProfilePairingAction | AuthenticationControllerPerformSignOutAction | AuthenticationControllerGetBearerTokenAction | AuthenticationControllerGetSessionProfileAction | AuthenticationControllerRefreshCanonicalProfileIdAction | AuthenticationControllerGetUserProfileLineageAction | AuthenticationControllerIsSignedInAction;
47
+ export type AuthenticationControllerMethodActions = AuthenticationControllerPerformSignInAction | AuthenticationControllerPerformSignOutAction | AuthenticationControllerGetBearerTokenAction | AuthenticationControllerGetSessionProfileAction | AuthenticationControllerGetUserProfileLineageAction | AuthenticationControllerIsSignedInAction;
87
48
  //# sourceMappingURL=AuthenticationController-method-action-types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AuthenticationController-method-action-types.d.cts","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAE3E,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,wBAAwB,CAAC,eAAe,CAAC,CAAC;CACpD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,wBAAwB,CAAC,mBAAmB,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,oDAAoD,CAAC;IAC3D,OAAO,EAAE,wBAAwB,CAAC,2BAA2B,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC7C,2CAA2C,GAC3C,mDAAmD,GACnD,4CAA4C,GAC5C,4CAA4C,GAC5C,+CAA+C,GAC/C,uDAAuD,GACvD,mDAAmD,GACnD,wCAAwC,CAAC"}
1
+ {"version":3,"file":"AuthenticationController-method-action-types.d.cts","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAE3E,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,wBAAwB,CAAC,eAAe,CAAC,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,wBAAwB,CAAC,mBAAmB,CAAC,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC7C,2CAA2C,GAC3C,4CAA4C,GAC5C,4CAA4C,GAC5C,+CAA+C,GAC/C,mDAAmD,GACnD,wCAAwC,CAAC"}
@@ -7,42 +7,23 @@ export type AuthenticationControllerPerformSignInAction = {
7
7
  type: `AuthenticationController:performSignIn`;
8
8
  handler: AuthenticationController['performSignIn'];
9
9
  };
10
- /**
11
- * Marks profile pairing as needed. Clients call this when the SRP set
12
- * changes (e.g. a new keyring was added) so the next auto-sign-in cycle
13
- * re-runs `performSignIn` and re-pairs.
14
- */
15
- export type AuthenticationControllerRequestProfilePairingAction = {
16
- type: `AuthenticationController:requestProfilePairing`;
17
- handler: AuthenticationController['requestProfilePairing'];
18
- };
19
10
  export type AuthenticationControllerPerformSignOutAction = {
20
11
  type: `AuthenticationController:performSignOut`;
21
12
  handler: AuthenticationController['performSignOut'];
22
13
  };
23
14
  /**
24
- * Returns a bearer token for the specified SRP, logging in if needed.
15
+ * Will return a bearer token.
16
+ * Logs a user in if a user is not logged in.
25
17
  *
26
- * When called without `entropySourceId`, returns the primary (first) SRP's
27
- * access token, which is effectively the canonical
28
- * profile's token that can be used by alias-aware consumers for cross-SRP
29
- * operations.
30
- *
31
- * @param entropySourceId - The entropy source ID. Omit for the primary SRP.
32
- * @returns The OIDC access token.
18
+ * @returns profile for the session.
33
19
  */
34
20
  export type AuthenticationControllerGetBearerTokenAction = {
35
21
  type: `AuthenticationController:getBearerToken`;
36
22
  handler: AuthenticationController['getBearerToken'];
37
23
  };
38
24
  /**
39
- * Returns the cached session profile, logging in if no session exists.
40
- *
41
- * The returned `canonicalProfileId` reflects the value from the most recent
42
- * login or pairing. In the rare event where a canonical changed because of
43
- * a pairing that happened on another device, the cached value may be stale
44
- * until the next login. For guaranteed freshness, call
45
- * `refreshCanonicalProfileId()` before reading `canonicalProfileId`.
25
+ * Will return a session profile.
26
+ * Logs a user in if a user is not logged in.
46
27
  *
47
28
  * @param entropySourceId - The entropy source ID used to derive the key,
48
29
  * when multiple sources are available (Multi-SRP).
@@ -52,26 +33,6 @@ export type AuthenticationControllerGetSessionProfileAction = {
52
33
  type: `AuthenticationController:getSessionProfile`;
53
34
  handler: AuthenticationController['getSessionProfile'];
54
35
  };
55
- /**
56
- * Forces a fresh retrieval of the canonical profile ID from the server
57
- * and propagates it to all cached SRP sessions.
58
- *
59
- * This method invalidates the primary SRP's cached session and forces a
60
- * re-login. Use it before operations that require a guaranteed-fresh
61
- * canonical (e.g. storage key derivation for Accounts ADR 0005). For
62
- * best-effort reads, use
63
- * `getSessionProfile().canonicalProfileId` instead.
64
- *
65
- * Only the primary SRP is re-logged-in regardless of how many SRPs exist —
66
- * the server returns the current canonical for the entire pairing group
67
- * from any single SRP login.
68
- *
69
- * @returns The refreshed canonical profile ID.
70
- */
71
- export type AuthenticationControllerRefreshCanonicalProfileIdAction = {
72
- type: `AuthenticationController:refreshCanonicalProfileId`;
73
- handler: AuthenticationController['refreshCanonicalProfileId'];
74
- };
75
36
  export type AuthenticationControllerGetUserProfileLineageAction = {
76
37
  type: `AuthenticationController:getUserProfileLineage`;
77
38
  handler: AuthenticationController['getUserProfileLineage'];
@@ -83,5 +44,5 @@ export type AuthenticationControllerIsSignedInAction = {
83
44
  /**
84
45
  * Union of all AuthenticationController action types.
85
46
  */
86
- export type AuthenticationControllerMethodActions = AuthenticationControllerPerformSignInAction | AuthenticationControllerRequestProfilePairingAction | AuthenticationControllerPerformSignOutAction | AuthenticationControllerGetBearerTokenAction | AuthenticationControllerGetSessionProfileAction | AuthenticationControllerRefreshCanonicalProfileIdAction | AuthenticationControllerGetUserProfileLineageAction | AuthenticationControllerIsSignedInAction;
47
+ export type AuthenticationControllerMethodActions = AuthenticationControllerPerformSignInAction | AuthenticationControllerPerformSignOutAction | AuthenticationControllerGetBearerTokenAction | AuthenticationControllerGetSessionProfileAction | AuthenticationControllerGetUserProfileLineageAction | AuthenticationControllerIsSignedInAction;
87
48
  //# sourceMappingURL=AuthenticationController-method-action-types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AuthenticationController-method-action-types.d.mts","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAE3E,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,wBAAwB,CAAC,eAAe,CAAC,CAAC;CACpD,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,wBAAwB,CAAC,mBAAmB,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,uDAAuD,GAAG;IACpE,IAAI,EAAE,oDAAoD,CAAC;IAC3D,OAAO,EAAE,wBAAwB,CAAC,2BAA2B,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC7C,2CAA2C,GAC3C,mDAAmD,GACnD,4CAA4C,GAC5C,4CAA4C,GAC5C,+CAA+C,GAC/C,uDAAuD,GACvD,mDAAmD,GACnD,wCAAwC,CAAC"}
1
+ {"version":3,"file":"AuthenticationController-method-action-types.d.mts","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,wBAAwB,EAAE,uCAAmC;AAE3E,MAAM,MAAM,2CAA2C,GAAG;IACxD,IAAI,EAAE,wCAAwC,CAAC;IAC/C,OAAO,EAAE,wBAAwB,CAAC,eAAe,CAAC,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,wBAAwB,CAAC,gBAAgB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,wBAAwB,CAAC,mBAAmB,CAAC,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,mDAAmD,GAAG;IAChE,IAAI,EAAE,gDAAgD,CAAC;IACvD,OAAO,EAAE,wBAAwB,CAAC,uBAAuB,CAAC,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,wBAAwB,CAAC,YAAY,CAAC,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qCAAqC,GAC7C,2CAA2C,GAC3C,4CAA4C,GAC5C,4CAA4C,GAC5C,+CAA+C,GAC/C,mDAAmD,GACnD,wCAAwC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AuthenticationController-method-action-types.mjs","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AuthenticationController } from './AuthenticationController';\n\nexport type AuthenticationControllerPerformSignInAction = {\n type: `AuthenticationController:performSignIn`;\n handler: AuthenticationController['performSignIn'];\n};\n\n/**\n * Marks profile pairing as needed. Clients call this when the SRP set\n * changes (e.g. a new keyring was added) so the next auto-sign-in cycle\n * re-runs `performSignIn` and re-pairs.\n */\nexport type AuthenticationControllerRequestProfilePairingAction = {\n type: `AuthenticationController:requestProfilePairing`;\n handler: AuthenticationController['requestProfilePairing'];\n};\n\nexport type AuthenticationControllerPerformSignOutAction = {\n type: `AuthenticationController:performSignOut`;\n handler: AuthenticationController['performSignOut'];\n};\n\n/**\n * Returns a bearer token for the specified SRP, logging in if needed.\n *\n * When called without `entropySourceId`, returns the primary (first) SRP's\n * access token, which is effectively the canonical\n * profile's token that can be used by alias-aware consumers for cross-SRP\n * operations.\n *\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The OIDC access token.\n */\nexport type AuthenticationControllerGetBearerTokenAction = {\n type: `AuthenticationController:getBearerToken`;\n handler: AuthenticationController['getBearerToken'];\n};\n\n/**\n * Returns the cached session profile, logging in if no session exists.\n *\n * The returned `canonicalProfileId` reflects the value from the most recent\n * login or pairing. In the rare event where a canonical changed because of\n * a pairing that happened on another device, the cached value may be stale\n * until the next login. For guaranteed freshness, call\n * `refreshCanonicalProfileId()` before reading `canonicalProfileId`.\n *\n * @param entropySourceId - The entropy source ID used to derive the key,\n * when multiple sources are available (Multi-SRP).\n * @returns profile for the session.\n */\nexport type AuthenticationControllerGetSessionProfileAction = {\n type: `AuthenticationController:getSessionProfile`;\n handler: AuthenticationController['getSessionProfile'];\n};\n\n/**\n * Forces a fresh retrieval of the canonical profile ID from the server\n * and propagates it to all cached SRP sessions.\n *\n * This method invalidates the primary SRP's cached session and forces a\n * re-login. Use it before operations that require a guaranteed-fresh\n * canonical (e.g. storage key derivation for Accounts ADR 0005). For\n * best-effort reads, use\n * `getSessionProfile().canonicalProfileId` instead.\n *\n * Only the primary SRP is re-logged-in regardless of how many SRPs exist —\n * the server returns the current canonical for the entire pairing group\n * from any single SRP login.\n *\n * @returns The refreshed canonical profile ID.\n */\nexport type AuthenticationControllerRefreshCanonicalProfileIdAction = {\n type: `AuthenticationController:refreshCanonicalProfileId`;\n handler: AuthenticationController['refreshCanonicalProfileId'];\n};\n\nexport type AuthenticationControllerGetUserProfileLineageAction = {\n type: `AuthenticationController:getUserProfileLineage`;\n handler: AuthenticationController['getUserProfileLineage'];\n};\n\nexport type AuthenticationControllerIsSignedInAction = {\n type: `AuthenticationController:isSignedIn`;\n handler: AuthenticationController['isSignedIn'];\n};\n\n/**\n * Union of all AuthenticationController action types.\n */\nexport type AuthenticationControllerMethodActions =\n | AuthenticationControllerPerformSignInAction\n | AuthenticationControllerRequestProfilePairingAction\n | AuthenticationControllerPerformSignOutAction\n | AuthenticationControllerGetBearerTokenAction\n | AuthenticationControllerGetSessionProfileAction\n | AuthenticationControllerRefreshCanonicalProfileIdAction\n | AuthenticationControllerGetUserProfileLineageAction\n | AuthenticationControllerIsSignedInAction;\n"]}
1
+ {"version":3,"file":"AuthenticationController-method-action-types.mjs","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { AuthenticationController } from './AuthenticationController';\n\nexport type AuthenticationControllerPerformSignInAction = {\n type: `AuthenticationController:performSignIn`;\n handler: AuthenticationController['performSignIn'];\n};\n\nexport type AuthenticationControllerPerformSignOutAction = {\n type: `AuthenticationController:performSignOut`;\n handler: AuthenticationController['performSignOut'];\n};\n\n/**\n * Will return a bearer token.\n * Logs a user in if a user is not logged in.\n *\n * @returns profile for the session.\n */\nexport type AuthenticationControllerGetBearerTokenAction = {\n type: `AuthenticationController:getBearerToken`;\n handler: AuthenticationController['getBearerToken'];\n};\n\n/**\n * Will return a session profile.\n * Logs a user in if a user is not logged in.\n *\n * @param entropySourceId - The entropy source ID used to derive the key,\n * when multiple sources are available (Multi-SRP).\n * @returns profile for the session.\n */\nexport type AuthenticationControllerGetSessionProfileAction = {\n type: `AuthenticationController:getSessionProfile`;\n handler: AuthenticationController['getSessionProfile'];\n};\n\nexport type AuthenticationControllerGetUserProfileLineageAction = {\n type: `AuthenticationController:getUserProfileLineage`;\n handler: AuthenticationController['getUserProfileLineage'];\n};\n\nexport type AuthenticationControllerIsSignedInAction = {\n type: `AuthenticationController:isSignedIn`;\n handler: AuthenticationController['isSignedIn'];\n};\n\n/**\n * Union of all AuthenticationController action types.\n */\nexport type AuthenticationControllerMethodActions =\n | AuthenticationControllerPerformSignInAction\n | AuthenticationControllerPerformSignOutAction\n | AuthenticationControllerGetBearerTokenAction\n | AuthenticationControllerGetSessionProfileAction\n | AuthenticationControllerGetUserProfileLineageAction\n | AuthenticationControllerIsSignedInAction;\n"]}
@@ -10,7 +10,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
10
10
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
11
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
12
  };
13
- var _AuthenticationController_instances, _AuthenticationController_metametrics, _AuthenticationController_auth, _AuthenticationController_config, _AuthenticationController_isUnlocked, _AuthenticationController_cachedPrimaryEntropySourceId, _AuthenticationController_profilePairingRequestEpoch, _AuthenticationController_keyringController, _AuthenticationController_getLoginResponseFromState, _AuthenticationController_setLoginResponseToState, _AuthenticationController_assertIsUnlocked, _AuthenticationController_getPrimaryEntropySourceId, _AuthenticationController_tryClearNeedsProfilePairing, _AuthenticationController_doPair, _AuthenticationController_pairSrpProfiles, _AuthenticationController_propagateCanonical, _AuthenticationController_getCanonicalProfileId, _AuthenticationController_invalidateSrpSession, _AuthenticationController_snapGetPublicKey, _AuthenticationController_snapGetAllPublicKeys, _AuthenticationController__snapSignMessageCache, _AuthenticationController_snapSignMessage;
13
+ var _AuthenticationController_instances, _AuthenticationController_metametrics, _AuthenticationController_auth, _AuthenticationController_config, _AuthenticationController_isUnlocked, _AuthenticationController_cachedPrimaryEntropySourceId, _AuthenticationController_keyringController, _AuthenticationController_getLoginResponseFromState, _AuthenticationController_setLoginResponseToState, _AuthenticationController_assertIsUnlocked, _AuthenticationController_getPrimaryEntropySourceId, _AuthenticationController_snapGetPublicKey, _AuthenticationController_snapGetAllPublicKeys, _AuthenticationController__snapSignMessageCache, _AuthenticationController_snapSignMessage;
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.AuthenticationController = exports.defaultState = void 0;
16
16
  const base_controller_1 = require("@metamask/base-controller");
@@ -19,7 +19,6 @@ const auth_snap_requests_1 = require("./auth-snap-requests.cjs");
19
19
  const controllerName = 'AuthenticationController';
20
20
  exports.defaultState = {
21
21
  isSignedIn: false,
22
- needsProfilePairing: true,
23
22
  };
24
23
  const metadata = {
25
24
  isSignedIn: {
@@ -28,12 +27,6 @@ const metadata = {
28
27
  includeInDebugSnapshot: true,
29
28
  usedInUi: true,
30
29
  },
31
- needsProfilePairing: {
32
- includeInStateLogs: true,
33
- persist: true,
34
- includeInDebugSnapshot: true,
35
- usedInUi: true,
36
- },
37
30
  srpSessionData: {
38
31
  // Remove access token from state logs
39
32
  includeInStateLogs: (srpSessionData) => {
@@ -64,10 +57,8 @@ const MESSENGER_EXPOSED_METHODS = [
64
57
  'performSignOut',
65
58
  'getBearerToken',
66
59
  'getSessionProfile',
67
- 'refreshCanonicalProfileId',
68
60
  'getUserProfileLineage',
69
61
  'isSignedIn',
70
- 'requestProfilePairing',
71
62
  ];
72
63
  /**
73
64
  * Controller that enables authentication for restricted endpoints.
@@ -89,10 +80,6 @@ class AuthenticationController extends base_controller_1.BaseController {
89
80
  });
90
81
  _AuthenticationController_isUnlocked.set(this, false);
91
82
  _AuthenticationController_cachedPrimaryEntropySourceId.set(this, void 0);
92
- // Bumped by `requestProfilePairing`. `performSignIn` snapshots this
93
- // before its first await; if it changes mid-flight we must NOT clear
94
- // `needsProfilePairing` (the rearm signal wins).
95
- _AuthenticationController_profilePairingRequestEpoch.set(this, 0);
96
83
  _AuthenticationController_keyringController.set(this, {
97
84
  setupLockedStateSubscriptions: () => {
98
85
  const { isUnlocked } = this.messenger.call('KeyringController:getState');
@@ -134,7 +121,6 @@ class AuthenticationController extends base_controller_1.BaseController {
134
121
  }
135
122
  async performSignIn() {
136
123
  __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'performSignIn');
137
- const epochAtStart = __classPrivateFieldGet(this, _AuthenticationController_profilePairingRequestEpoch, "f");
138
124
  const allPublicKeys = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_snapGetAllPublicKeys).call(this);
139
125
  const accessTokens = [];
140
126
  // We iterate sequentially in order to be sure that the first entry
@@ -143,34 +129,8 @@ class AuthenticationController extends base_controller_1.BaseController {
143
129
  const accessToken = await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getAccessToken(entropySourceId);
144
130
  accessTokens.push(accessToken);
145
131
  }
146
- if (allPublicKeys.length < 2) {
147
- // Single-SRP wallet: nothing to pair.
148
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_tryClearNeedsProfilePairing).call(this, epochAtStart);
149
- }
150
- else {
151
- // Pair failures must not break sign-in; the gate stays `true` for retry.
152
- try {
153
- await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_doPair).call(this, accessTokens, epochAtStart);
154
- }
155
- catch {
156
- // noop
157
- }
158
- }
159
132
  return accessTokens;
160
133
  }
161
- /**
162
- * Marks profile pairing as needed. Clients call this when the SRP set
163
- * changes (e.g. a new keyring was added) so the next auto-sign-in cycle
164
- * re-runs `performSignIn` and re-pairs.
165
- */
166
- requestProfilePairing() {
167
- __classPrivateFieldSet(this, _AuthenticationController_profilePairingRequestEpoch, __classPrivateFieldGet(this, _AuthenticationController_profilePairingRequestEpoch, "f") + 1, "f");
168
- if (!this.state.needsProfilePairing) {
169
- this.update((state) => {
170
- state.needsProfilePairing = true;
171
- });
172
- }
173
- }
174
134
  performSignOut() {
175
135
  __classPrivateFieldSet(this, _AuthenticationController_cachedPrimaryEntropySourceId, undefined, "f");
176
136
  this.update((state) => {
@@ -179,15 +139,10 @@ class AuthenticationController extends base_controller_1.BaseController {
179
139
  });
180
140
  }
181
141
  /**
182
- * Returns a bearer token for the specified SRP, logging in if needed.
183
- *
184
- * When called without `entropySourceId`, returns the primary (first) SRP's
185
- * access token, which is effectively the canonical
186
- * profile's token that can be used by alias-aware consumers for cross-SRP
187
- * operations.
142
+ * Will return a bearer token.
143
+ * Logs a user in if a user is not logged in.
188
144
  *
189
- * @param entropySourceId - The entropy source ID. Omit for the primary SRP.
190
- * @returns The OIDC access token.
145
+ * @returns profile for the session.
191
146
  */
192
147
  async getBearerToken(entropySourceId) {
193
148
  __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'getBearerToken');
@@ -195,13 +150,8 @@ class AuthenticationController extends base_controller_1.BaseController {
195
150
  return await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getAccessToken(resolvedId);
196
151
  }
197
152
  /**
198
- * Returns the cached session profile, logging in if no session exists.
199
- *
200
- * The returned `canonicalProfileId` reflects the value from the most recent
201
- * login or pairing. In the rare event where a canonical changed because of
202
- * a pairing that happened on another device, the cached value may be stale
203
- * until the next login. For guaranteed freshness, call
204
- * `refreshCanonicalProfileId()` before reading `canonicalProfileId`.
153
+ * Will return a session profile.
154
+ * Logs a user in if a user is not logged in.
205
155
  *
206
156
  * @param entropySourceId - The entropy source ID used to derive the key,
207
157
  * when multiple sources are available (Multi-SRP).
@@ -212,34 +162,6 @@ class AuthenticationController extends base_controller_1.BaseController {
212
162
  const resolvedId = entropySourceId ?? (await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this));
213
163
  return await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getUserProfile(resolvedId);
214
164
  }
215
- /**
216
- * Forces a fresh retrieval of the canonical profile ID from the server
217
- * and propagates it to all cached SRP sessions.
218
- *
219
- * This method invalidates the primary SRP's cached session and forces a
220
- * re-login. Use it before operations that require a guaranteed-fresh
221
- * canonical (e.g. storage key derivation for Accounts ADR 0005). For
222
- * best-effort reads, use
223
- * `getSessionProfile().canonicalProfileId` instead.
224
- *
225
- * Only the primary SRP is re-logged-in regardless of how many SRPs exist —
226
- * the server returns the current canonical for the entire pairing group
227
- * from any single SRP login.
228
- *
229
- * @returns The refreshed canonical profile ID.
230
- */
231
- async refreshCanonicalProfileId() {
232
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'refreshCanonicalProfileId');
233
- const primaryEntropySourceId = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
234
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_invalidateSrpSession).call(this, primaryEntropySourceId);
235
- await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getAccessToken(primaryEntropySourceId);
236
- const canonical = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
237
- if (!canonical) {
238
- throw new Error('refreshCanonicalProfileId - Unable to resolve canonical profile ID');
239
- }
240
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_propagateCanonical).call(this, canonical);
241
- return canonical;
242
- }
243
165
  async getUserProfileLineage(entropySourceId) {
244
166
  __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'getUserProfileLineage');
245
167
  const resolvedId = entropySourceId ?? (await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this));
@@ -250,7 +172,7 @@ class AuthenticationController extends base_controller_1.BaseController {
250
172
  }
251
173
  }
252
174
  exports.AuthenticationController = AuthenticationController;
253
- _AuthenticationController_metametrics = new WeakMap(), _AuthenticationController_auth = new WeakMap(), _AuthenticationController_config = new WeakMap(), _AuthenticationController_isUnlocked = new WeakMap(), _AuthenticationController_cachedPrimaryEntropySourceId = new WeakMap(), _AuthenticationController_profilePairingRequestEpoch = new WeakMap(), _AuthenticationController_keyringController = new WeakMap(), _AuthenticationController__snapSignMessageCache = new WeakMap(), _AuthenticationController_instances = new WeakSet(), _AuthenticationController_getLoginResponseFromState = async function _AuthenticationController_getLoginResponseFromState(entropySourceId) {
175
+ _AuthenticationController_metametrics = new WeakMap(), _AuthenticationController_auth = new WeakMap(), _AuthenticationController_config = new WeakMap(), _AuthenticationController_isUnlocked = new WeakMap(), _AuthenticationController_cachedPrimaryEntropySourceId = new WeakMap(), _AuthenticationController_keyringController = new WeakMap(), _AuthenticationController__snapSignMessageCache = new WeakMap(), _AuthenticationController_instances = new WeakSet(), _AuthenticationController_getLoginResponseFromState = async function _AuthenticationController_getLoginResponseFromState(entropySourceId) {
254
176
  const resolvedId = entropySourceId ?? (await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this));
255
177
  if (!this.state.srpSessionData?.[resolvedId]) {
256
178
  return null;
@@ -290,90 +212,6 @@ _AuthenticationController_metametrics = new WeakMap(), _AuthenticationController
290
212
  }
291
213
  __classPrivateFieldSet(this, _AuthenticationController_cachedPrimaryEntropySourceId, primaryId, "f");
292
214
  return __classPrivateFieldGet(this, _AuthenticationController_cachedPrimaryEntropySourceId, "f");
293
- }, _AuthenticationController_tryClearNeedsProfilePairing = function _AuthenticationController_tryClearNeedsProfilePairing(epochAtStart) {
294
- if (__classPrivateFieldGet(this, _AuthenticationController_profilePairingRequestEpoch, "f") !== epochAtStart) {
295
- return;
296
- }
297
- if (this.state.needsProfilePairing) {
298
- this.update((state) => {
299
- state.needsProfilePairing = false;
300
- });
301
- }
302
- }, _AuthenticationController_doPair =
303
- /**
304
- * Pairs all SRPs via `POST /profile/pair`, propagates the canonical
305
- * profile ID, clears `needsProfilePairing`, and emits
306
- * `AuthenticationController:profileSignIn` when the canonical changes or
307
- * new aliases are returned. Throws on failure.
308
- *
309
- * @param accessTokens - Per-SRP access tokens, primary first.
310
- * @param epochAtStart - Pairing-request epoch captured by the caller.
311
- * Used to skip the gate clear if `requestProfilePairing` ran while the
312
- * pair API call was in-flight.
313
- */
314
- async function _AuthenticationController_doPair(accessTokens, epochAtStart) {
315
- const previousCanonical = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
316
- const profileAliases = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_pairSrpProfiles).call(this, accessTokens);
317
- const newCanonical = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
318
- // If somehow we cannot compute the new canonical profile ID after pairing,
319
- // we just return now and do not update the `needsProfilePairing` flag.
320
- if (!newCanonical) {
321
- return;
322
- }
323
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_tryClearNeedsProfilePairing).call(this, epochAtStart);
324
- const profileIdChanged = previousCanonical !== newCanonical;
325
- const shouldEmitProfileSignInEvent = profileIdChanged || profileAliases.length > 0;
326
- if (shouldEmitProfileSignInEvent) {
327
- this.messenger.publish('AuthenticationController:profileSignIn', {
328
- profileId: newCanonical,
329
- profileAliases,
330
- profileIdChanged,
331
- });
332
- }
333
- }, _AuthenticationController_pairSrpProfiles = async function _AuthenticationController_pairSrpProfiles(accessTokens) {
334
- if (accessTokens.length < 2) {
335
- return [];
336
- }
337
- const primaryAccessToken = accessTokens[0]; // Associated with primary SRP.
338
- const { profileAliases, profile: { canonicalProfileId }, } = await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").pairSrpProfiles(accessTokens, primaryAccessToken);
339
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_propagateCanonical).call(this, canonicalProfileId);
340
- return profileAliases;
341
- }, _AuthenticationController_propagateCanonical = function _AuthenticationController_propagateCanonical(canonicalProfileId) {
342
- const { srpSessionData } = this.state;
343
- if (!srpSessionData) {
344
- return;
345
- }
346
- this.update((state) => {
347
- for (const entry of Object.values(state.srpSessionData ?? {})) {
348
- if (entry?.profile) {
349
- entry.profile.canonicalProfileId = canonicalProfileId;
350
- }
351
- }
352
- });
353
- }, _AuthenticationController_getCanonicalProfileId =
354
- /**
355
- * Returns the canonical profile id from the primary SRP's cached session.
356
- * Returns `null` when no session exists yet for the primary SRP.
357
- *
358
- * Always reads from the primary SRP because the canonical is shared across
359
- * all paired SRPs after `#propagateCanonical`.
360
- *
361
- * @returns The canonical profile id, or `null` if unavailable.
362
- */
363
- async function _AuthenticationController_getCanonicalProfileId() {
364
- const primaryEntropySourceId = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
365
- return (this.state.srpSessionData?.[primaryEntropySourceId]?.profile
366
- ?.canonicalProfileId ?? null);
367
- }, _AuthenticationController_invalidateSrpSession = function _AuthenticationController_invalidateSrpSession(entropySourceId) {
368
- this.update((state) => {
369
- const entry = state.srpSessionData?.[entropySourceId];
370
- if (entry?.profile) {
371
- // Setting canonicalProfileId to '' forces a re-fetch on the next
372
- // #getAuthSession call. The falsy check (!auth.profile.canonicalProfileId)
373
- // treats '' the same as undefined/null — all signal an invalid session.
374
- entry.profile.canonicalProfileId = '';
375
- }
376
- });
377
215
  }, _AuthenticationController_snapGetPublicKey =
378
216
  /**
379
217
  * Returns the auth snap public key.