@metamask/profile-sync-controller 28.3.0 → 30.0.0

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 (231) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/LICENSE +1 -0
  3. package/dist/controllers/authentication/AuthenticationController-method-action-types.cjs.map +1 -1
  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.map +1 -1
  6. package/dist/controllers/authentication/AuthenticationController-method-action-types.mjs.map +1 -1
  7. package/dist/controllers/authentication/AuthenticationController.cjs +236 -75
  8. package/dist/controllers/authentication/AuthenticationController.cjs.map +1 -1
  9. package/dist/controllers/authentication/AuthenticationController.d.cts +22 -3
  10. package/dist/controllers/authentication/AuthenticationController.d.cts.map +1 -1
  11. package/dist/controllers/authentication/AuthenticationController.d.mts +22 -3
  12. package/dist/controllers/authentication/AuthenticationController.d.mts.map +1 -1
  13. package/dist/controllers/authentication/AuthenticationController.mjs +231 -70
  14. package/dist/controllers/authentication/AuthenticationController.mjs.map +1 -1
  15. package/dist/controllers/authentication/index.cjs +3 -3
  16. package/dist/controllers/authentication/index.cjs.map +1 -1
  17. package/dist/controllers/authentication/index.d.cts.map +1 -1
  18. package/dist/controllers/authentication/index.d.mts.map +1 -1
  19. package/dist/controllers/authentication/index.mjs.map +1 -1
  20. package/dist/controllers/authentication/mocks/index.cjs.map +1 -1
  21. package/dist/controllers/authentication/mocks/index.d.cts.map +1 -1
  22. package/dist/controllers/authentication/mocks/index.d.mts.map +1 -1
  23. package/dist/controllers/authentication/mocks/index.mjs.map +1 -1
  24. package/dist/controllers/authentication/mocks/mockResponses.cjs +26 -15
  25. package/dist/controllers/authentication/mocks/mockResponses.cjs.map +1 -1
  26. package/dist/controllers/authentication/mocks/mockResponses.d.cts +11 -0
  27. package/dist/controllers/authentication/mocks/mockResponses.d.cts.map +1 -1
  28. package/dist/controllers/authentication/mocks/mockResponses.d.mts +11 -0
  29. package/dist/controllers/authentication/mocks/mockResponses.d.mts.map +1 -1
  30. package/dist/controllers/authentication/mocks/mockResponses.mjs +13 -3
  31. package/dist/controllers/authentication/mocks/mockResponses.mjs.map +1 -1
  32. package/dist/controllers/index.cjs.map +1 -1
  33. package/dist/controllers/index.d.cts.map +1 -1
  34. package/dist/controllers/index.d.mts.map +1 -1
  35. package/dist/controllers/index.mjs.map +1 -1
  36. package/dist/controllers/user-storage/UserStorageController-method-action-types.cjs.map +1 -1
  37. package/dist/controllers/user-storage/UserStorageController-method-action-types.d.cts.map +1 -1
  38. package/dist/controllers/user-storage/UserStorageController-method-action-types.d.mts.map +1 -1
  39. package/dist/controllers/user-storage/UserStorageController-method-action-types.mjs.map +1 -1
  40. package/dist/controllers/user-storage/UserStorageController.cjs +35 -36
  41. package/dist/controllers/user-storage/UserStorageController.cjs.map +1 -1
  42. package/dist/controllers/user-storage/UserStorageController.d.cts +2 -3
  43. package/dist/controllers/user-storage/UserStorageController.d.cts.map +1 -1
  44. package/dist/controllers/user-storage/UserStorageController.d.mts +2 -3
  45. package/dist/controllers/user-storage/UserStorageController.d.mts.map +1 -1
  46. package/dist/controllers/user-storage/UserStorageController.mjs +22 -23
  47. package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -1
  48. package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs +23 -23
  49. package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs.map +1 -1
  50. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.cts.map +1 -1
  51. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts.map +1 -1
  52. package/dist/controllers/user-storage/contact-syncing/controller-integration.mjs.map +1 -1
  53. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs +9 -9
  54. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs.map +1 -1
  55. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.cts.map +1 -1
  56. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts.map +1 -1
  57. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.mjs.map +1 -1
  58. package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs.map +1 -1
  59. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.cts.map +1 -1
  60. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts.map +1 -1
  61. package/dist/controllers/user-storage/contact-syncing/sync-utils.mjs.map +1 -1
  62. package/dist/controllers/user-storage/contact-syncing/types.cjs.map +1 -1
  63. package/dist/controllers/user-storage/contact-syncing/types.d.cts.map +1 -1
  64. package/dist/controllers/user-storage/contact-syncing/types.d.mts.map +1 -1
  65. package/dist/controllers/user-storage/contact-syncing/types.mjs.map +1 -1
  66. package/dist/controllers/user-storage/contact-syncing/utils.cjs +2 -2
  67. package/dist/controllers/user-storage/contact-syncing/utils.cjs.map +1 -1
  68. package/dist/controllers/user-storage/contact-syncing/utils.d.cts.map +1 -1
  69. package/dist/controllers/user-storage/contact-syncing/utils.d.mts.map +1 -1
  70. package/dist/controllers/user-storage/contact-syncing/utils.mjs.map +1 -1
  71. package/dist/controllers/user-storage/index.cjs +3 -3
  72. package/dist/controllers/user-storage/index.cjs.map +1 -1
  73. package/dist/controllers/user-storage/index.d.cts.map +1 -1
  74. package/dist/controllers/user-storage/index.d.mts.map +1 -1
  75. package/dist/controllers/user-storage/index.mjs.map +1 -1
  76. package/dist/controllers/user-storage/mocks/index.cjs.map +1 -1
  77. package/dist/controllers/user-storage/mocks/index.d.cts.map +1 -1
  78. package/dist/controllers/user-storage/mocks/index.d.mts.map +1 -1
  79. package/dist/controllers/user-storage/mocks/index.mjs.map +1 -1
  80. package/dist/controllers/user-storage/mocks/mockResponses.cjs +15 -15
  81. package/dist/controllers/user-storage/mocks/mockResponses.cjs.map +1 -1
  82. package/dist/controllers/user-storage/mocks/mockResponses.d.cts.map +1 -1
  83. package/dist/controllers/user-storage/mocks/mockResponses.d.mts.map +1 -1
  84. package/dist/controllers/user-storage/mocks/mockResponses.mjs.map +1 -1
  85. package/dist/controllers/user-storage/mocks/mockStorage.cjs +3 -3
  86. package/dist/controllers/user-storage/mocks/mockStorage.cjs.map +1 -1
  87. package/dist/controllers/user-storage/mocks/mockStorage.d.cts.map +1 -1
  88. package/dist/controllers/user-storage/mocks/mockStorage.d.mts.map +1 -1
  89. package/dist/controllers/user-storage/mocks/mockStorage.mjs.map +1 -1
  90. package/dist/controllers/user-storage/types.cjs.map +1 -1
  91. package/dist/controllers/user-storage/types.d.cts.map +1 -1
  92. package/dist/controllers/user-storage/types.d.mts.map +1 -1
  93. package/dist/controllers/user-storage/types.mjs.map +1 -1
  94. package/dist/index.cjs.map +1 -1
  95. package/dist/index.d.cts.map +1 -1
  96. package/dist/index.d.mts.map +1 -1
  97. package/dist/index.mjs.map +1 -1
  98. package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs +11 -11
  99. package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs.map +1 -1
  100. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.cts.map +1 -1
  101. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts.map +1 -1
  102. package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs.map +1 -1
  103. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +40 -26
  104. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +1 -1
  105. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts +12 -1
  106. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +1 -1
  107. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts +12 -1
  108. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +1 -1
  109. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs +20 -6
  110. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +1 -1
  111. package/dist/sdk/authentication-jwt-bearer/services.cjs +85 -39
  112. package/dist/sdk/authentication-jwt-bearer/services.cjs.map +1 -1
  113. package/dist/sdk/authentication-jwt-bearer/services.d.cts +19 -2
  114. package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +1 -1
  115. package/dist/sdk/authentication-jwt-bearer/services.d.mts +19 -2
  116. package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +1 -1
  117. package/dist/sdk/authentication-jwt-bearer/services.mjs +46 -2
  118. package/dist/sdk/authentication-jwt-bearer/services.mjs.map +1 -1
  119. package/dist/sdk/authentication-jwt-bearer/types.cjs.map +1 -1
  120. package/dist/sdk/authentication-jwt-bearer/types.d.cts +36 -0
  121. package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +1 -1
  122. package/dist/sdk/authentication-jwt-bearer/types.d.mts +36 -0
  123. package/dist/sdk/authentication-jwt-bearer/types.d.mts.map +1 -1
  124. package/dist/sdk/authentication-jwt-bearer/types.mjs.map +1 -1
  125. package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs +2 -2
  126. package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs.map +1 -1
  127. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.cts.map +1 -1
  128. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts.map +1 -1
  129. package/dist/sdk/authentication-jwt-bearer/utils/identifier.mjs.map +1 -1
  130. package/dist/sdk/authentication.cjs +25 -21
  131. package/dist/sdk/authentication.cjs.map +1 -1
  132. package/dist/sdk/authentication.d.cts +2 -1
  133. package/dist/sdk/authentication.d.cts.map +1 -1
  134. package/dist/sdk/authentication.d.mts +2 -1
  135. package/dist/sdk/authentication.d.mts.map +1 -1
  136. package/dist/sdk/authentication.mjs +4 -0
  137. package/dist/sdk/authentication.mjs.map +1 -1
  138. package/dist/sdk/constants.cjs +1 -0
  139. package/dist/sdk/constants.cjs.map +1 -1
  140. package/dist/sdk/constants.d.cts +1 -0
  141. package/dist/sdk/constants.d.cts.map +1 -1
  142. package/dist/sdk/constants.d.mts +1 -0
  143. package/dist/sdk/constants.d.mts.map +1 -1
  144. package/dist/sdk/constants.mjs +1 -0
  145. package/dist/sdk/constants.mjs.map +1 -1
  146. package/dist/sdk/errors.cjs +17 -4
  147. package/dist/sdk/errors.cjs.map +1 -1
  148. package/dist/sdk/errors.d.cts +9 -0
  149. package/dist/sdk/errors.d.cts.map +1 -1
  150. package/dist/sdk/errors.d.mts +9 -0
  151. package/dist/sdk/errors.d.mts.map +1 -1
  152. package/dist/sdk/errors.mjs +12 -0
  153. package/dist/sdk/errors.mjs.map +1 -1
  154. package/dist/sdk/index.cjs.map +1 -1
  155. package/dist/sdk/index.d.cts.map +1 -1
  156. package/dist/sdk/index.d.mts.map +1 -1
  157. package/dist/sdk/index.mjs.map +1 -1
  158. package/dist/sdk/mocks/auth.cjs +24 -13
  159. package/dist/sdk/mocks/auth.cjs.map +1 -1
  160. package/dist/sdk/mocks/auth.d.cts +11 -0
  161. package/dist/sdk/mocks/auth.d.cts.map +1 -1
  162. package/dist/sdk/mocks/auth.d.mts +11 -0
  163. package/dist/sdk/mocks/auth.d.mts.map +1 -1
  164. package/dist/sdk/mocks/auth.mjs +12 -1
  165. package/dist/sdk/mocks/auth.mjs.map +1 -1
  166. package/dist/sdk/mocks/userstorage.cjs +8 -8
  167. package/dist/sdk/mocks/userstorage.cjs.map +1 -1
  168. package/dist/sdk/mocks/userstorage.mjs.map +1 -1
  169. package/dist/sdk/user-storage.cjs +32 -32
  170. package/dist/sdk/user-storage.cjs.map +1 -1
  171. package/dist/sdk/user-storage.d.cts.map +1 -1
  172. package/dist/sdk/user-storage.d.mts.map +1 -1
  173. package/dist/sdk/user-storage.mjs +1 -1
  174. package/dist/sdk/user-storage.mjs.map +1 -1
  175. package/dist/sdk/utils/validate-login-response.cjs.map +1 -1
  176. package/dist/sdk/utils/validate-login-response.d.cts.map +1 -1
  177. package/dist/sdk/utils/validate-login-response.d.mts.map +1 -1
  178. package/dist/sdk/utils/validate-login-response.mjs.map +1 -1
  179. package/dist/shared/encryption/cache.cjs +6 -6
  180. package/dist/shared/encryption/cache.cjs.map +1 -1
  181. package/dist/shared/encryption/cache.mjs.map +1 -1
  182. package/dist/shared/encryption/encryption.cjs +26 -26
  183. package/dist/shared/encryption/encryption.cjs.map +1 -1
  184. package/dist/shared/encryption/encryption.d.cts.map +1 -1
  185. package/dist/shared/encryption/encryption.d.mts.map +1 -1
  186. package/dist/shared/encryption/encryption.mjs.map +1 -1
  187. package/dist/shared/encryption/index.cjs +3 -3
  188. package/dist/shared/encryption/index.cjs.map +1 -1
  189. package/dist/shared/encryption/index.d.cts.map +1 -1
  190. package/dist/shared/encryption/index.d.mts.map +1 -1
  191. package/dist/shared/encryption/index.mjs.map +1 -1
  192. package/dist/shared/storage-schema.cjs +2 -2
  193. package/dist/shared/storage-schema.cjs.map +1 -1
  194. package/dist/shared/storage-schema.mjs.map +1 -1
  195. package/dist/shared/types/services.cjs.map +1 -1
  196. package/dist/shared/types/services.d.cts.map +1 -1
  197. package/dist/shared/types/services.d.mts.map +1 -1
  198. package/dist/shared/types/services.mjs.map +1 -1
  199. package/dist/shared/utils/entropy-source.cjs +37 -0
  200. package/dist/shared/utils/entropy-source.cjs.map +1 -0
  201. package/dist/shared/utils/entropy-source.d.cts +22 -0
  202. package/dist/shared/utils/entropy-source.d.cts.map +1 -0
  203. package/dist/shared/utils/entropy-source.d.mts +22 -0
  204. package/dist/shared/utils/entropy-source.d.mts.map +1 -0
  205. package/dist/shared/utils/entropy-source.mjs +32 -0
  206. package/dist/shared/utils/entropy-source.mjs.map +1 -0
  207. package/dist/shared/utils/hd-keyring-seed.cjs +49 -0
  208. package/dist/shared/utils/hd-keyring-seed.cjs.map +1 -0
  209. package/dist/shared/utils/hd-keyring-seed.d.cts +27 -0
  210. package/dist/shared/utils/hd-keyring-seed.d.cts.map +1 -0
  211. package/dist/shared/utils/hd-keyring-seed.d.mts +27 -0
  212. package/dist/shared/utils/hd-keyring-seed.d.mts.map +1 -0
  213. package/dist/shared/utils/hd-keyring-seed.mjs +45 -0
  214. package/dist/shared/utils/hd-keyring-seed.mjs.map +1 -0
  215. package/dist/shared/utils/message-signing.cjs +147 -0
  216. package/dist/shared/utils/message-signing.cjs.map +1 -0
  217. package/dist/shared/utils/message-signing.d.cts +73 -0
  218. package/dist/shared/utils/message-signing.d.cts.map +1 -0
  219. package/dist/shared/utils/message-signing.d.mts +73 -0
  220. package/dist/shared/utils/message-signing.d.mts.map +1 -0
  221. package/dist/shared/utils/message-signing.mjs +140 -0
  222. package/dist/shared/utils/message-signing.mjs.map +1 -0
  223. package/package.json +17 -14
  224. package/dist/controllers/authentication/auth-snap-requests.cjs +0 -60
  225. package/dist/controllers/authentication/auth-snap-requests.cjs.map +0 -1
  226. package/dist/controllers/authentication/auth-snap-requests.d.cts +0 -27
  227. package/dist/controllers/authentication/auth-snap-requests.d.cts.map +0 -1
  228. package/dist/controllers/authentication/auth-snap-requests.d.mts +0 -27
  229. package/dist/controllers/authentication/auth-snap-requests.d.mts.map +0 -1
  230. package/dist/controllers/authentication/auth-snap-requests.mjs +0 -54
  231. package/dist/controllers/authentication/auth-snap-requests.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [30.0.0]
11
+
12
+ ### Added
13
+
14
+ - **BREAKING:** Add social identifier pairing after SRP sign-in (`POST /api/v2/profile/pair/identifier`) ([#10128](https://github.com/MetaMask/core/pull/10128))
15
+ - Add `needsSocialPairing?: boolean` to state (defaults `true`; cleared on success or 409 Conflict; left `true` on other failures so the next `performSignIn` retries; cleared without an API call when the user never logged in with a social provider). If `authConnection` is set but the seedless vault is not written yet, the flag stays `true` so onboarding-in-flight sign-ins can retry. Optional in the type so partial-state selectors stay assignable; treat `undefined` as `true`.
16
+ - Add optional `isSocialPairingEnabled` config callback (defaults to `() => false`). When it returns `true`, Google/Apple/Telegram seedless users are paired after SRP login and profile pairing. Telegram never sends `email` (clients store a display name there).
17
+ - Use `SeedlessOnboardingController:getAccessToken` to fetch the social JWT (refreshed when expired).
18
+ - Add `pairSocialIdentifier` to `JwtBearerAuth` / `SRPJwtBearerAuth` and `PairConflictError` for 409 Conflict.
19
+
20
+ ### Changed
21
+
22
+ - **BREAKING:** Derive auth and user-storage message-signing keys natively via SIP-6 from HD keyring seeds instead of calling `@metamask/message-signing-snap` through `SnapController`. `AuthenticationController` and `UserStorageController` now require `KeyringController:withKeyringV2Unsafe` and no longer call `SnapController:handleRequest`. The message-signing snap remains for Portfolio / external origins ([#9824](https://github.com/MetaMask/core/pull/9824))
23
+ - Derive native SIP-6 keys with `@noble/hashes` HMAC-SHA-512 instead of Web Crypto, so auth works on React Native, whose SubtleCrypto cannot HMAC.
24
+ - Resolve HD entropy source IDs from `KeyringController` instead of the message-signing snap (`getBearerToken` primary ID, `performSignIn` SRP enumeration) ([#9794](https://github.com/MetaMask/core/pull/9794))
25
+ - Bump `@metamask/keyring-controller` from `^27.1.0` to `^27.1.1` ([#9791](https://github.com/MetaMask/core/pull/9791))
26
+ - Add `@metamask/key-tree` and `@noble/curves`; remove unused `@metamask/snaps-controllers`, `@metamask/snaps-sdk`, and `@metamask/snaps-utils` dependencies ([#9824](https://github.com/MetaMask/core/pull/9824))
27
+ - Bump `@metamask/utils` from `^11.11.0` to `^11.12.0` ([#10076](https://github.com/MetaMask/core/pull/10076))
28
+
29
+ ## [29.0.0]
30
+
31
+ ### Changed
32
+
33
+ - **BREAKING:** Tag `/srp/login` with SRP slot and social provider metadata ([#9741](https://github.com/MetaMask/core/pull/9741), [#9776](https://github.com/MetaMask/core/pull/9776))
34
+ - Append `primary` | `secondary` to `raw_message` (`metamask:<nonce>:<pubkey>:<tag>`; `primary` for the first HD entropy source). Leave `raw_message` untagged when `getLoginTag` is not provided. Include `metametrics.identifier_type` (`SRP` | `GOOGLE` | `APPLE` | `TELEGRAM`; social vault primary maps from `SeedlessOnboardingController.state.authConnection`).
35
+ - Bump `@metamask/seedless-onboarding-controller` from `^10.1.0` to `^10.1.1` ([#9779](https://github.com/MetaMask/core/pull/9779))
36
+
10
37
  ## [28.3.0]
11
38
 
12
39
  ### Added
@@ -897,7 +924,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
897
924
 
898
925
  - Initial release
899
926
 
900
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@28.3.0...HEAD
927
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@30.0.0...HEAD
928
+ [30.0.0]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@29.0.0...@metamask/profile-sync-controller@30.0.0
929
+ [29.0.0]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@28.3.0...@metamask/profile-sync-controller@29.0.0
901
930
  [28.3.0]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@28.2.0...@metamask/profile-sync-controller@28.3.0
902
931
  [28.2.0]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@28.1.1...@metamask/profile-sync-controller@28.2.0
903
932
  [28.1.1]: https://github.com/MetaMask/core/compare/@metamask/profile-sync-controller@28.1.0...@metamask/profile-sync-controller@28.1.1
package/LICENSE CHANGED
@@ -18,3 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
18
  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
19
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -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\n/**\n * Returns a Customer Service specific access token for the specified SRP,\n * logging in if needed.\n *\n * Exchanges the OIDC access token for a short-lived token scoped to the\n * customer-service audience. Customer Service tooling consumes this token to\n * identify and authenticate the user.\n *\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The customer-service access token.\n */\nexport type AuthenticationControllerGetCustomerServiceTokenAction = {\n type: `AuthenticationController:getCustomerServiceToken`;\n handler: AuthenticationController['getCustomerServiceToken'];\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 | AuthenticationControllerGetCustomerServiceTokenAction\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.js';\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\n/**\n * Returns a Customer Service specific access token for the specified SRP,\n * logging in if needed.\n *\n * Exchanges the OIDC access token for a short-lived token scoped to the\n * customer-service audience. Customer Service tooling consumes this token to\n * identify and authenticate the user.\n *\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The customer-service access token.\n */\nexport type AuthenticationControllerGetCustomerServiceTokenAction = {\n type: `AuthenticationController:getCustomerServiceToken`;\n handler: AuthenticationController['getCustomerServiceToken'];\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 | AuthenticationControllerGetCustomerServiceTokenAction\n | AuthenticationControllerIsSignedInAction;\n"]}
@@ -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;;;;;;;;;;GAUG;AACH,MAAM,MAAM,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;CAC9D,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,qDAAqD,GACrD,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,uCAAsC;AAE9E,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;;;;;;;;;;GAUG;AACH,MAAM,MAAM,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;CAC9D,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,qDAAqD,GACrD,wCAAwC,CAAC"}
@@ -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;;;;;;;;;;GAUG;AACH,MAAM,MAAM,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;CAC9D,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,qDAAqD,GACrD,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,uCAAsC;AAE9E,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;;;;;;;;;;GAUG;AACH,MAAM,MAAM,qDAAqD,GAAG;IAClE,IAAI,EAAE,kDAAkD,CAAC;IACzD,OAAO,EAAE,wBAAwB,CAAC,yBAAyB,CAAC,CAAC;CAC9D,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,qDAAqD,GACrD,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\n/**\n * Returns a Customer Service specific access token for the specified SRP,\n * logging in if needed.\n *\n * Exchanges the OIDC access token for a short-lived token scoped to the\n * customer-service audience. Customer Service tooling consumes this token to\n * identify and authenticate the user.\n *\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The customer-service access token.\n */\nexport type AuthenticationControllerGetCustomerServiceTokenAction = {\n type: `AuthenticationController:getCustomerServiceToken`;\n handler: AuthenticationController['getCustomerServiceToken'];\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 | AuthenticationControllerGetCustomerServiceTokenAction\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.js';\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\n/**\n * Returns a Customer Service specific access token for the specified SRP,\n * logging in if needed.\n *\n * Exchanges the OIDC access token for a short-lived token scoped to the\n * customer-service audience. Customer Service tooling consumes this token to\n * identify and authenticate the user.\n *\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The customer-service access token.\n */\nexport type AuthenticationControllerGetCustomerServiceTokenAction = {\n type: `AuthenticationController:getCustomerServiceToken`;\n handler: AuthenticationController['getCustomerServiceToken'];\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 | AuthenticationControllerGetCustomerServiceTokenAction\n | AuthenticationControllerIsSignedInAction;\n"]}
@@ -10,16 +10,19 @@ 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_profilePairingRequestEpoch, _AuthenticationController_keyringController, _AuthenticationController_getLoginResponseFromState, _AuthenticationController_setLoginResponseToState, _AuthenticationController_assertIsUnlocked, _AuthenticationController_getHdKeyringEntropySourceIds, _AuthenticationController_getPrimaryEntropySourceId, _AuthenticationController_getLoginTag, _AuthenticationController_getLoginIdentifierType, _AuthenticationController_resolveSocialIdentifierType, _AuthenticationController_identifierTypeFromSeedlessState, _AuthenticationController_trySocialPairing, _AuthenticationController_clearNeedsSocialPairing, _AuthenticationController_tryClearNeedsProfilePairing, _AuthenticationController_doPair, _AuthenticationController_pairSrpProfiles, _AuthenticationController_propagateCanonical, _AuthenticationController_getCanonicalProfileId, _AuthenticationController_invalidateSrpSession, _AuthenticationController_getHdKeyringSeed, _AuthenticationController_getPublicKey, _AuthenticationController__signMessageCache, _AuthenticationController_scopedCacheKey, _AuthenticationController_signMessage;
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");
17
- const sdk_1 = require("../../sdk/index.cjs");
18
- const auth_snap_requests_1 = require("./auth-snap-requests.cjs");
17
+ const index_js_1 = require("../../sdk/index.cjs");
18
+ const entropy_source_js_1 = require("../../shared/utils/entropy-source.cjs");
19
+ const hd_keyring_seed_js_1 = require("../../shared/utils/hd-keyring-seed.cjs");
20
+ const message_signing_js_1 = require("../../shared/utils/message-signing.cjs");
19
21
  const controllerName = 'AuthenticationController';
20
22
  exports.defaultState = {
21
23
  isSignedIn: false,
22
24
  needsProfilePairing: true,
25
+ needsSocialPairing: true,
23
26
  };
24
27
  const metadata = {
25
28
  isSignedIn: {
@@ -34,6 +37,12 @@ const metadata = {
34
37
  includeInDebugSnapshot: true,
35
38
  usedInUi: true,
36
39
  },
40
+ needsSocialPairing: {
41
+ includeInStateLogs: true,
42
+ persist: true,
43
+ includeInDebugSnapshot: true,
44
+ usedInUi: true,
45
+ },
37
46
  srpSessionData: {
38
47
  // Remove access token from state logs
39
48
  includeInStateLogs: (srpSessionData) => {
@@ -86,10 +95,10 @@ class AuthenticationController extends base_controller_1.BaseController {
86
95
  _AuthenticationController_metametrics.set(this, void 0);
87
96
  _AuthenticationController_auth.set(this, void 0);
88
97
  _AuthenticationController_config.set(this, {
89
- env: sdk_1.Env.PRD,
98
+ env: index_js_1.Env.PRD,
99
+ isSocialPairingEnabled: () => false,
90
100
  });
91
101
  _AuthenticationController_isUnlocked.set(this, false);
92
- _AuthenticationController_cachedPrimaryEntropySourceId.set(this, void 0);
93
102
  // Bumped by `requestProfilePairing`. `performSignIn` snapshots this
94
103
  // before its first await; if it changes mid-flight we must NOT clear
95
104
  // `needsProfilePairing` (the rearm signal wins).
@@ -106,28 +115,31 @@ class AuthenticationController extends base_controller_1.BaseController {
106
115
  });
107
116
  },
108
117
  });
109
- _AuthenticationController__snapSignMessageCache.set(this, {});
118
+ _AuthenticationController__signMessageCache.set(this, {});
110
119
  if (!metametrics) {
111
120
  throw new Error('`metametrics` field is required');
112
121
  }
113
122
  __classPrivateFieldSet(this, _AuthenticationController_config, {
114
123
  ...__classPrivateFieldGet(this, _AuthenticationController_config, "f"),
115
124
  ...config,
125
+ isSocialPairingEnabled: config?.isSocialPairingEnabled ?? __classPrivateFieldGet(this, _AuthenticationController_config, "f").isSocialPairingEnabled,
116
126
  }, "f");
117
127
  __classPrivateFieldSet(this, _AuthenticationController_metametrics, metametrics, "f");
118
- __classPrivateFieldSet(this, _AuthenticationController_auth, new sdk_1.JwtBearerAuth({
128
+ __classPrivateFieldSet(this, _AuthenticationController_auth, new index_js_1.JwtBearerAuth({
119
129
  env: __classPrivateFieldGet(this, _AuthenticationController_config, "f").env,
120
130
  platform: metametrics.agent,
121
- type: sdk_1.AuthType.SRP,
131
+ type: index_js_1.AuthType.SRP,
122
132
  }, {
123
133
  storage: {
124
134
  getLoginResponse: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getLoginResponseFromState).bind(this),
125
135
  setLoginResponse: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_setLoginResponseToState).bind(this),
126
136
  },
127
137
  signing: {
128
- getIdentifier: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_snapGetPublicKey).bind(this),
129
- signMessage: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_snapSignMessage).bind(this),
138
+ getIdentifier: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPublicKey).bind(this),
139
+ signMessage: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_signMessage).bind(this),
130
140
  },
141
+ getLoginTag: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getLoginTag).bind(this),
142
+ getLoginIdentifierType: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getLoginIdentifierType).bind(this),
131
143
  metametrics: __classPrivateFieldGet(this, _AuthenticationController_metametrics, "f"),
132
144
  }), "f");
133
145
  __classPrivateFieldGet(this, _AuthenticationController_keyringController, "f").setupLockedStateSubscriptions();
@@ -136,15 +148,15 @@ class AuthenticationController extends base_controller_1.BaseController {
136
148
  async performSignIn() {
137
149
  __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'performSignIn');
138
150
  const epochAtStart = __classPrivateFieldGet(this, _AuthenticationController_profilePairingRequestEpoch, "f");
139
- const allPublicKeys = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_snapGetAllPublicKeys).call(this);
151
+ const entropySourceIds = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getHdKeyringEntropySourceIds).call(this);
140
152
  const accessTokens = [];
141
153
  // We iterate sequentially in order to be sure that the first entry
142
154
  // is the primary SRP LoginResponse.
143
- for (const [entropySourceId] of allPublicKeys) {
155
+ for (const entropySourceId of entropySourceIds) {
144
156
  const accessToken = await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getAccessToken(entropySourceId);
145
157
  accessTokens.push(accessToken);
146
158
  }
147
- if (allPublicKeys.length < 2) {
159
+ if (entropySourceIds.length < 2) {
148
160
  // Single-SRP wallet: nothing to pair.
149
161
  __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_tryClearNeedsProfilePairing).call(this, epochAtStart);
150
162
  }
@@ -157,6 +169,12 @@ class AuthenticationController extends base_controller_1.BaseController {
157
169
  // noop
158
170
  }
159
171
  }
172
+ try {
173
+ await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_trySocialPairing).call(this, accessTokens[0]);
174
+ }
175
+ catch {
176
+ // noop
177
+ }
160
178
  return accessTokens;
161
179
  }
162
180
  /**
@@ -173,7 +191,6 @@ class AuthenticationController extends base_controller_1.BaseController {
173
191
  }
174
192
  }
175
193
  performSignOut() {
176
- __classPrivateFieldSet(this, _AuthenticationController_cachedPrimaryEntropySourceId, undefined, "f");
177
194
  this.update((state) => {
178
195
  state.isSignedIn = false;
179
196
  state.srpSessionData = undefined;
@@ -192,7 +209,7 @@ class AuthenticationController extends base_controller_1.BaseController {
192
209
  */
193
210
  async getBearerToken(entropySourceId) {
194
211
  __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'getBearerToken');
195
- const resolvedId = entropySourceId ?? (await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this));
212
+ const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
196
213
  return await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getAccessToken(resolvedId);
197
214
  }
198
215
  /**
@@ -210,7 +227,7 @@ class AuthenticationController extends base_controller_1.BaseController {
210
227
  */
211
228
  async getSessionProfile(entropySourceId) {
212
229
  __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'getSessionProfile');
213
- const resolvedId = entropySourceId ?? (await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this));
230
+ const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
214
231
  return await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getUserProfile(resolvedId);
215
232
  }
216
233
  /**
@@ -231,10 +248,10 @@ class AuthenticationController extends base_controller_1.BaseController {
231
248
  */
232
249
  async refreshCanonicalProfileId() {
233
250
  __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'refreshCanonicalProfileId');
234
- const primaryEntropySourceId = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
251
+ const primaryEntropySourceId = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
235
252
  __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_invalidateSrpSession).call(this, primaryEntropySourceId);
236
253
  await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getAccessToken(primaryEntropySourceId);
237
- const canonical = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
254
+ const canonical = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
238
255
  if (!canonical) {
239
256
  throw new Error('refreshCanonicalProfileId - Unable to resolve canonical profile ID');
240
257
  }
@@ -243,7 +260,7 @@ class AuthenticationController extends base_controller_1.BaseController {
243
260
  }
244
261
  async getUserProfileLineage(entropySourceId) {
245
262
  __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'getUserProfileLineage');
246
- const resolvedId = entropySourceId ?? (await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this));
263
+ const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
247
264
  return await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getUserProfileLineage(resolvedId);
248
265
  }
249
266
  /**
@@ -259,7 +276,7 @@ class AuthenticationController extends base_controller_1.BaseController {
259
276
  */
260
277
  async getCustomerServiceToken(entropySourceId) {
261
278
  __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'getCustomerServiceToken');
262
- const resolvedId = entropySourceId ?? (await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this));
279
+ const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
263
280
  return await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getCustomerServiceToken(resolvedId);
264
281
  }
265
282
  isSignedIn() {
@@ -267,14 +284,14 @@ class AuthenticationController extends base_controller_1.BaseController {
267
284
  }
268
285
  }
269
286
  exports.AuthenticationController = AuthenticationController;
270
- _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) {
271
- const resolvedId = entropySourceId ?? (await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this));
287
+ _AuthenticationController_metametrics = new WeakMap(), _AuthenticationController_auth = new WeakMap(), _AuthenticationController_config = new WeakMap(), _AuthenticationController_isUnlocked = new WeakMap(), _AuthenticationController_profilePairingRequestEpoch = new WeakMap(), _AuthenticationController_keyringController = new WeakMap(), _AuthenticationController__signMessageCache = new WeakMap(), _AuthenticationController_instances = new WeakSet(), _AuthenticationController_getLoginResponseFromState = async function _AuthenticationController_getLoginResponseFromState(entropySourceId) {
288
+ const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
272
289
  if (!this.state.srpSessionData?.[resolvedId]) {
273
290
  return null;
274
291
  }
275
292
  return this.state.srpSessionData[resolvedId];
276
293
  }, _AuthenticationController_setLoginResponseToState = async function _AuthenticationController_setLoginResponseToState(loginResponse, entropySourceId) {
277
- const resolvedId = entropySourceId ?? (await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this));
294
+ const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
278
295
  const metaMetricsId = await __classPrivateFieldGet(this, _AuthenticationController_metametrics, "f").getMetaMetricsId();
279
296
  this.update((state) => {
280
297
  state.isSignedIn = true;
@@ -293,20 +310,168 @@ _AuthenticationController_metametrics = new WeakMap(), _AuthenticationController
293
310
  if (!__classPrivateFieldGet(this, _AuthenticationController_isUnlocked, "f")) {
294
311
  throw new Error(`${methodName} - unable to proceed, wallet is locked`);
295
312
  }
296
- }, _AuthenticationController_getPrimaryEntropySourceId = async function _AuthenticationController_getPrimaryEntropySourceId() {
297
- if (__classPrivateFieldGet(this, _AuthenticationController_cachedPrimaryEntropySourceId, "f")) {
298
- return __classPrivateFieldGet(this, _AuthenticationController_cachedPrimaryEntropySourceId, "f");
313
+ }, _AuthenticationController_getHdKeyringEntropySourceIds = function _AuthenticationController_getHdKeyringEntropySourceIds() {
314
+ const { keyrings } = this.messenger.call('KeyringController:getState');
315
+ return (0, entropy_source_js_1.getHdKeyringEntropySourceIds)(keyrings);
316
+ }, _AuthenticationController_getPrimaryEntropySourceId = function _AuthenticationController_getPrimaryEntropySourceId() {
317
+ const { keyrings } = this.messenger.call('KeyringController:getState');
318
+ return (0, entropy_source_js_1.getPrimaryHdKeyringEntropySourceId)(keyrings);
319
+ }, _AuthenticationController_getLoginTag =
320
+ /**
321
+ * Resolves the SRP login tag for `raw_message`.
322
+ *
323
+ * - `primary` for the first HD entropy source
324
+ * - `secondary` for any other entropy source
325
+ *
326
+ * @param entropySourceId - Entropy source for this login attempt.
327
+ * @returns The login tag to append to the signed message.
328
+ */
329
+ async function _AuthenticationController_getLoginTag(entropySourceId) {
330
+ const primaryEntropySourceId = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
331
+ const resolvedId = entropySourceId ?? primaryEntropySourceId;
332
+ return resolvedId === primaryEntropySourceId ? 'primary' : 'secondary';
333
+ }, _AuthenticationController_getLoginIdentifierType =
334
+ /**
335
+ * Resolves metametrics `identifier_type` for `/srp/login`
336
+ * (`SRP` | `GOOGLE` | `APPLE` | `TELEGRAM`).
337
+ *
338
+ * This is the auth method for the entropy source, independent of
339
+ * {@link SrpLoginTag} (`primary` / `secondary`).
340
+ *
341
+ * SeedlessOnboarding currently exposes a single vault-level
342
+ * `authConnection`, which always backs the primary entropy source. Non-
343
+ * primary sources therefore return `SRP`. If social identities become
344
+ * per-entropy later, resolve from that metadata instead of assuming
345
+ * primary === social.
346
+ *
347
+ * Soft-fails to `SRP` when SeedlessOnboarding is not registered.
348
+ *
349
+ * @param entropySourceId - Entropy source for this login attempt.
350
+ * @returns The login identifier type.
351
+ */
352
+ async function _AuthenticationController_getLoginIdentifierType(entropySourceId) {
353
+ const primaryEntropySourceId = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
354
+ const resolvedId = entropySourceId ?? primaryEntropySourceId;
355
+ // Social vault authConnection is only associated with the primary source.
356
+ if (resolvedId !== primaryEntropySourceId) {
357
+ return 'SRP';
358
+ }
359
+ return __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_resolveSocialIdentifierType).call(this);
360
+ }, _AuthenticationController_resolveSocialIdentifierType = function _AuthenticationController_resolveSocialIdentifierType() {
361
+ try {
362
+ return __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_identifierTypeFromSeedlessState).call(this, this.messenger.call('SeedlessOnboardingController:getState'));
299
363
  }
300
- const allPublicKeys = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_snapGetAllPublicKeys).call(this);
301
- if (allPublicKeys.length === 0) {
302
- throw new Error('#getPrimaryEntropySourceId - No entropy sources found from snap');
364
+ catch {
365
+ return 'SRP';
303
366
  }
304
- const primaryId = allPublicKeys[0][0];
305
- if (!primaryId) {
306
- throw new Error('#getPrimaryEntropySourceId - Primary entropy source ID is undefined');
367
+ }, _AuthenticationController_identifierTypeFromSeedlessState = function _AuthenticationController_identifierTypeFromSeedlessState(state) {
368
+ if (state.vault === null || state.vault === undefined) {
369
+ return 'SRP';
370
+ }
371
+ // Match provider strings from SeedlessOnboarding state rather than
372
+ // importing AuthConnection — a value import would load that package
373
+ // (and its heavy deps) whenever this controller is imported.
374
+ switch (state.authConnection) {
375
+ case 'google':
376
+ return 'GOOGLE';
377
+ case 'apple':
378
+ return 'APPLE';
379
+ case 'telegram':
380
+ return 'TELEGRAM';
381
+ default:
382
+ return 'SRP';
383
+ }
384
+ }, _AuthenticationController_trySocialPairing =
385
+ /**
386
+ * Attaches a Google/Apple/Telegram social identifier to the primary SRP
387
+ * profile via `POST /api/v2/profile/pair/identifier`.
388
+ *
389
+ * Runs only when `isSocialPairingEnabled()` is true and
390
+ * `needsSocialPairing` is not `false` (`undefined` is treated as true).
391
+ * No social provider (`authConnection` unset) → clear the flag (nothing
392
+ * to pair). Social provider set but vault missing → skip (onboarding
393
+ * still in flight). Google without email → skip (API requires it).
394
+ * Telegram never sends `email` (the field holds a display name, not an
395
+ * address). Missing social JWT → skip. 409 Conflict → clear the flag
396
+ * (identifier already owned; retry is pointless). Other errors
397
+ * propagate so the caller can swallow them and leave the flag set for
398
+ * retry.
399
+ *
400
+ * @param primaryAccessToken - Primary SRP OIDC access token used as the
401
+ * Bearer credential. The profile associated with this JWT becomes the
402
+ * canonical owner of the social identifier.
403
+ */
404
+ async function _AuthenticationController_trySocialPairing(primaryAccessToken) {
405
+ if (!__classPrivateFieldGet(this, _AuthenticationController_config, "f").isSocialPairingEnabled() ||
406
+ this.state.needsSocialPairing === false ||
407
+ !primaryAccessToken) {
408
+ return;
409
+ }
410
+ let seedlessState;
411
+ try {
412
+ seedlessState = this.messenger.call('SeedlessOnboardingController:getState');
413
+ }
414
+ catch {
415
+ // Controller missing or getState failed — retry next performSignIn.
416
+ return;
417
+ }
418
+ // `SRP` here does not describe the vault: it is the mapping's "no social
419
+ // identity" result, returned when there is no seedless vault or the
420
+ // provider is unrecognised. In both cases there is nothing to pair.
421
+ const identifierType = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_identifierTypeFromSeedlessState).call(this, seedlessState);
422
+ if (identifierType === 'SRP') {
423
+ const { vault, authConnection } = seedlessState;
424
+ // Vault not written yet but a social provider is already known —
425
+ // onboarding is still in flight. Do not clear; retry next sign-in.
426
+ if ((vault === null || vault === undefined) && Boolean(authConnection)) {
427
+ return;
428
+ }
429
+ __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_clearNeedsSocialPairing).call(this);
430
+ return;
431
+ }
432
+ // Email policy follows the API contract: GOOGLE requires `email` (400
433
+ // without it), APPLE accepts it optionally, TELEGRAM must not send it
434
+ // (clients store a display name in `socialLoginEmail` for Telegram).
435
+ // Clients request the `email` scope for Google, so a missing value is a
436
+ // defensive case rather than an expected one; returning here leaves
437
+ // `needsSocialPairing` set so the next sign-in retries instead of
438
+ // sending a request that would fail.
439
+ const { socialLoginEmail } = seedlessState;
440
+ let email;
441
+ if (identifierType === 'GOOGLE') {
442
+ if (!socialLoginEmail) {
443
+ return;
444
+ }
445
+ email = socialLoginEmail;
446
+ }
447
+ else if (identifierType === 'APPLE') {
448
+ email = socialLoginEmail;
449
+ }
450
+ const socialJwt = await this.messenger.call('SeedlessOnboardingController:getAccessToken');
451
+ if (socialJwt === undefined || socialJwt === '') {
452
+ return;
453
+ }
454
+ try {
455
+ await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").pairSocialIdentifier({
456
+ identifierType,
457
+ socialJwt,
458
+ ...(email ? { email } : {}),
459
+ }, primaryAccessToken);
460
+ __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_clearNeedsSocialPairing).call(this);
461
+ }
462
+ catch (error) {
463
+ if (error instanceof index_js_1.PairConflictError) {
464
+ __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_clearNeedsSocialPairing).call(this);
465
+ return;
466
+ }
467
+ throw error;
468
+ }
469
+ }, _AuthenticationController_clearNeedsSocialPairing = function _AuthenticationController_clearNeedsSocialPairing() {
470
+ if (this.state.needsSocialPairing !== false) {
471
+ this.update((state) => {
472
+ state.needsSocialPairing = false;
473
+ });
307
474
  }
308
- __classPrivateFieldSet(this, _AuthenticationController_cachedPrimaryEntropySourceId, primaryId, "f");
309
- return __classPrivateFieldGet(this, _AuthenticationController_cachedPrimaryEntropySourceId, "f");
310
475
  }, _AuthenticationController_tryClearNeedsProfilePairing = function _AuthenticationController_tryClearNeedsProfilePairing(epochAtStart) {
311
476
  if (__classPrivateFieldGet(this, _AuthenticationController_profilePairingRequestEpoch, "f") !== epochAtStart) {
312
477
  return;
@@ -329,9 +494,9 @@ _AuthenticationController_metametrics = new WeakMap(), _AuthenticationController
329
494
  * pair API call was in-flight.
330
495
  */
331
496
  async function _AuthenticationController_doPair(accessTokens, epochAtStart) {
332
- const previousCanonical = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
497
+ const previousCanonical = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
333
498
  const profileAliases = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_pairSrpProfiles).call(this, accessTokens);
334
- const newCanonical = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
499
+ const newCanonical = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
335
500
  // If somehow we cannot compute the new canonical profile ID after pairing,
336
501
  // we just return now and do not update the `needsProfilePairing` flag.
337
502
  if (!newCanonical) {
@@ -367,18 +532,8 @@ async function _AuthenticationController_doPair(accessTokens, epochAtStart) {
367
532
  }
368
533
  }
369
534
  });
370
- }, _AuthenticationController_getCanonicalProfileId =
371
- /**
372
- * Returns the canonical profile id from the primary SRP's cached session.
373
- * Returns `null` when no session exists yet for the primary SRP.
374
- *
375
- * Always reads from the primary SRP because the canonical is shared across
376
- * all paired SRPs after `#propagateCanonical`.
377
- *
378
- * @returns The canonical profile id, or `null` if unavailable.
379
- */
380
- async function _AuthenticationController_getCanonicalProfileId() {
381
- const primaryEntropySourceId = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
535
+ }, _AuthenticationController_getCanonicalProfileId = function _AuthenticationController_getCanonicalProfileId() {
536
+ const primaryEntropySourceId = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
382
537
  return (this.state.srpSessionData?.[primaryEntropySourceId]?.profile
383
538
  ?.canonicalProfileId ?? null);
384
539
  }, _AuthenticationController_invalidateSrpSession = function _AuthenticationController_invalidateSrpSession(entropySourceId) {
@@ -391,45 +546,51 @@ async function _AuthenticationController_getCanonicalProfileId() {
391
546
  entry.profile.canonicalProfileId = '';
392
547
  }
393
548
  });
394
- }, _AuthenticationController_snapGetPublicKey =
549
+ }, _AuthenticationController_getHdKeyringSeed =
395
550
  /**
396
- * Returns the auth snap public key.
551
+ * Reads the BIP-39 seed for an HD entropy source from KeyringController.
397
552
  *
398
- * @param entropySourceId - The entropy source ID used to derive the key,
399
- * when multiple sources are available (Multi-SRP).
400
- * @returns The snap public key.
553
+ * @param entropySourceId - Entropy source ID. Defaults to the primary HD
554
+ * keyring.
555
+ * @returns The HD keyring seed.
401
556
  */
402
- async function _AuthenticationController_snapGetPublicKey(entropySourceId) {
403
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, '#snapGetPublicKey');
404
- const result = (await this.messenger.call('SnapController:handleRequest', (0, auth_snap_requests_1.createSnapPublicKeyRequest)(entropySourceId)));
405
- return result;
406
- }, _AuthenticationController_snapGetAllPublicKeys =
557
+ async function _AuthenticationController_getHdKeyringSeed(entropySourceId) {
558
+ const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
559
+ return (0, hd_keyring_seed_js_1.getHdKeyringSeed)(this.messenger, resolvedId);
560
+ }, _AuthenticationController_getPublicKey =
407
561
  /**
408
- * Returns a mapping of entropy source IDs to auth snap public keys.
562
+ * Returns the message-signing public key via native SIP-6 derivation
563
+ * (same key as `@metamask/message-signing-snap` with empty salt).
409
564
  *
410
- * @returns A mapping of entropy source IDs to public keys.
565
+ * @param entropySourceId - The entropy source ID used to derive the key,
566
+ * when multiple sources are available (Multi-SRP).
567
+ * @returns The public key hex.
411
568
  */
412
- async function _AuthenticationController_snapGetAllPublicKeys() {
413
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, '#snapGetAllPublicKeys');
414
- const result = (await this.messenger.call('SnapController:handleRequest', (0, auth_snap_requests_1.createSnapAllPublicKeysRequest)()));
415
- return result;
416
- }, _AuthenticationController_snapSignMessage =
569
+ async function _AuthenticationController_getPublicKey(entropySourceId) {
570
+ __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, '#getPublicKey');
571
+ const seed = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getHdKeyringSeed).call(this, entropySourceId);
572
+ return (0, message_signing_js_1.getMessageSigningPublicKey)(seed);
573
+ }, _AuthenticationController_scopedCacheKey = function _AuthenticationController_scopedCacheKey(message, entropySourceId) {
574
+ return `${entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this)}:${message}`;
575
+ }, _AuthenticationController_signMessage =
417
576
  /**
418
- * Signs a specific message using an underlying auth snap.
577
+ * Signs a `metamask:…` message with the native SIP-6 message-signing key.
419
578
  *
420
579
  * @param message - A specific tagged message to sign.
421
580
  * @param entropySourceId - The entropy source ID used to derive the key,
422
581
  * when multiple sources are available (Multi-SRP).
423
- * @returns A Signature created by the snap.
582
+ * @returns Compact secp256k1 signature hex.
424
583
  */
425
- async function _AuthenticationController_snapSignMessage(message, entropySourceId) {
426
- (0, sdk_1.assertMessageStartsWithMetamask)(message);
427
- if (__classPrivateFieldGet(this, _AuthenticationController__snapSignMessageCache, "f")[message]) {
428
- return __classPrivateFieldGet(this, _AuthenticationController__snapSignMessageCache, "f")[message];
429
- }
430
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, '#snapSignMessage');
431
- const result = (await this.messenger.call('SnapController:handleRequest', (0, auth_snap_requests_1.createSnapSignMessageRequest)(message, entropySourceId)));
432
- __classPrivateFieldGet(this, _AuthenticationController__snapSignMessageCache, "f")[message] = result;
584
+ async function _AuthenticationController_signMessage(message, entropySourceId) {
585
+ (0, index_js_1.assertMessageStartsWithMetamask)(message);
586
+ __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, '#signMessage');
587
+ const cacheKey = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_scopedCacheKey).call(this, message, entropySourceId);
588
+ if (__classPrivateFieldGet(this, _AuthenticationController__signMessageCache, "f")[cacheKey]) {
589
+ return __classPrivateFieldGet(this, _AuthenticationController__signMessageCache, "f")[cacheKey];
590
+ }
591
+ const seed = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getHdKeyringSeed).call(this, entropySourceId);
592
+ const result = await (0, message_signing_js_1.signMessageWithMessageSigningKey)(message, seed);
593
+ __classPrivateFieldGet(this, _AuthenticationController__signMessageCache, "f")[cacheKey] = result;
433
594
  return result;
434
595
  };
435
596
  //# sourceMappingURL=AuthenticationController.cjs.map