@metamask-previews/profile-sync-controller 29.0.0-preview-b13d916 → 29.0.0-preview-4f4c98e

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 (541) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/dist/controllers/authentication/{AuthenticationController-method-action-types.d.mts → AuthenticationController-method-action-types.d.ts} +2 -2
  3. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.ts.map +1 -0
  4. package/dist/controllers/authentication/{AuthenticationController-method-action-types.mjs → AuthenticationController-method-action-types.js} +1 -1
  5. package/dist/controllers/authentication/AuthenticationController-method-action-types.js.map +1 -0
  6. package/dist/controllers/authentication/{AuthenticationController.d.mts → AuthenticationController.d.ts} +10 -10
  7. package/dist/controllers/authentication/AuthenticationController.d.ts.map +1 -0
  8. package/dist/controllers/authentication/{AuthenticationController.mjs → AuthenticationController.js} +11 -11
  9. package/dist/controllers/authentication/AuthenticationController.js.map +1 -0
  10. package/dist/controllers/authentication/{index.d.cts → index.d.ts} +5 -5
  11. package/dist/controllers/authentication/index.d.ts.map +1 -0
  12. package/dist/controllers/authentication/index.js +6 -0
  13. package/dist/controllers/authentication/index.js.map +1 -0
  14. package/dist/controllers/authentication/mocks/index.d.ts +2 -0
  15. package/dist/controllers/authentication/mocks/index.d.ts.map +1 -0
  16. package/dist/controllers/authentication/mocks/index.js +2 -0
  17. package/dist/controllers/authentication/mocks/index.js.map +1 -0
  18. package/dist/controllers/authentication/mocks/{mockResponses.d.mts → mockResponses.d.ts} +1 -1
  19. package/dist/controllers/authentication/mocks/mockResponses.d.ts.map +1 -0
  20. package/dist/controllers/authentication/mocks/{mockResponses.mjs → mockResponses.js} +2 -2
  21. package/dist/controllers/authentication/mocks/mockResponses.js.map +1 -0
  22. package/dist/controllers/index.d.ts +3 -0
  23. package/dist/controllers/index.d.ts.map +1 -0
  24. package/dist/controllers/index.js +3 -0
  25. package/dist/controllers/index.js.map +1 -0
  26. package/dist/controllers/user-storage/{UserStorageController-method-action-types.d.mts → UserStorageController-method-action-types.d.ts} +2 -2
  27. package/dist/controllers/user-storage/UserStorageController-method-action-types.d.ts.map +1 -0
  28. package/dist/controllers/user-storage/{UserStorageController-method-action-types.mjs → UserStorageController-method-action-types.js} +1 -1
  29. package/dist/controllers/user-storage/UserStorageController-method-action-types.js.map +1 -0
  30. package/dist/controllers/user-storage/{UserStorageController.d.cts → UserStorageController.d.ts} +14 -14
  31. package/dist/controllers/user-storage/UserStorageController.d.ts.map +1 -0
  32. package/dist/controllers/user-storage/{UserStorageController.mjs → UserStorageController.js} +15 -15
  33. package/dist/controllers/user-storage/UserStorageController.js.map +1 -0
  34. package/dist/controllers/user-storage/constants.d.ts +15 -0
  35. package/dist/controllers/user-storage/constants.d.ts.map +1 -0
  36. package/dist/controllers/user-storage/{constants.mjs → constants.js} +1 -1
  37. package/dist/controllers/user-storage/constants.js.map +1 -0
  38. package/dist/controllers/user-storage/contact-syncing/{constants.d.cts → constants.d.ts} +1 -1
  39. package/dist/controllers/user-storage/contact-syncing/constants.d.ts.map +1 -0
  40. package/dist/controllers/user-storage/contact-syncing/{constants.mjs → constants.js} +1 -1
  41. package/dist/controllers/user-storage/contact-syncing/constants.js.map +1 -0
  42. package/dist/controllers/user-storage/contact-syncing/{controller-integration.d.cts → controller-integration.d.ts} +3 -3
  43. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.ts.map +1 -0
  44. package/dist/controllers/user-storage/contact-syncing/{controller-integration.mjs → controller-integration.js} +6 -6
  45. package/dist/controllers/user-storage/contact-syncing/controller-integration.js.map +1 -0
  46. package/dist/controllers/user-storage/contact-syncing/{setup-subscriptions.d.cts → setup-subscriptions.d.ts} +2 -2
  47. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.ts.map +1 -0
  48. package/dist/controllers/user-storage/contact-syncing/{setup-subscriptions.mjs → setup-subscriptions.js} +4 -4
  49. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.js.map +1 -0
  50. package/dist/controllers/user-storage/contact-syncing/{sync-utils.d.cts → sync-utils.d.ts} +2 -2
  51. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.ts.map +1 -0
  52. package/dist/controllers/user-storage/contact-syncing/{sync-utils.mjs → sync-utils.js} +1 -1
  53. package/dist/controllers/user-storage/contact-syncing/sync-utils.js.map +1 -0
  54. package/dist/controllers/user-storage/contact-syncing/{types.d.cts → types.d.ts} +6 -6
  55. package/dist/controllers/user-storage/contact-syncing/types.d.ts.map +1 -0
  56. package/dist/controllers/user-storage/contact-syncing/types.js +2 -0
  57. package/dist/controllers/user-storage/contact-syncing/types.js.map +1 -0
  58. package/dist/controllers/user-storage/contact-syncing/{utils.d.mts → utils.d.ts} +3 -3
  59. package/dist/controllers/user-storage/contact-syncing/utils.d.ts.map +1 -0
  60. package/dist/controllers/user-storage/contact-syncing/{utils.mjs → utils.js} +2 -2
  61. package/dist/controllers/user-storage/contact-syncing/utils.js.map +1 -0
  62. package/dist/controllers/user-storage/{index.d.cts → index.d.ts} +8 -8
  63. package/dist/controllers/user-storage/index.d.ts.map +1 -0
  64. package/dist/controllers/user-storage/index.js +9 -0
  65. package/dist/controllers/user-storage/index.js.map +1 -0
  66. package/dist/controllers/user-storage/mocks/index.d.ts +3 -0
  67. package/dist/controllers/user-storage/mocks/index.d.ts.map +1 -0
  68. package/dist/controllers/user-storage/mocks/index.js +3 -0
  69. package/dist/controllers/user-storage/mocks/index.js.map +1 -0
  70. package/dist/controllers/user-storage/mocks/{mockResponses.d.mts → mockResponses.d.ts} +3 -3
  71. package/dist/controllers/user-storage/mocks/mockResponses.d.ts.map +1 -0
  72. package/dist/controllers/user-storage/mocks/{mockResponses.mjs → mockResponses.js} +4 -4
  73. package/dist/controllers/user-storage/mocks/mockResponses.js.map +1 -0
  74. package/dist/controllers/user-storage/mocks/{mockStorage.d.cts → mockStorage.d.ts} +1 -1
  75. package/dist/controllers/user-storage/mocks/mockStorage.d.ts.map +1 -0
  76. package/dist/controllers/user-storage/mocks/{mockStorage.mjs → mockStorage.js} +2 -2
  77. package/dist/controllers/user-storage/mocks/mockStorage.js.map +1 -0
  78. package/dist/controllers/user-storage/{types.d.cts → types.d.ts} +3 -3
  79. package/dist/controllers/user-storage/types.d.ts.map +1 -0
  80. package/dist/controllers/user-storage/types.js +2 -0
  81. package/dist/controllers/user-storage/types.js.map +1 -0
  82. package/dist/controllers/user-storage/{utils.d.cts → utils.d.ts} +1 -1
  83. package/dist/controllers/user-storage/utils.d.ts.map +1 -0
  84. package/dist/controllers/user-storage/{utils.mjs → utils.js} +1 -1
  85. package/dist/controllers/user-storage/utils.js.map +1 -0
  86. package/dist/index.d.ts +4 -0
  87. package/dist/index.d.ts.map +1 -0
  88. package/dist/index.js +4 -0
  89. package/dist/index.js.map +1 -0
  90. package/dist/sdk/authentication-jwt-bearer/{flow-siwe.d.cts → flow-siwe.d.ts} +2 -2
  91. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.ts.map +1 -0
  92. package/dist/sdk/authentication-jwt-bearer/{flow-siwe.mjs → flow-siwe.js} +5 -5
  93. package/dist/sdk/authentication-jwt-bearer/flow-siwe.js.map +1 -0
  94. package/dist/sdk/authentication-jwt-bearer/{flow-srp.d.cts → flow-srp.d.ts} +5 -5
  95. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.ts.map +1 -0
  96. package/dist/sdk/authentication-jwt-bearer/{flow-srp.mjs → flow-srp.js} +8 -8
  97. package/dist/sdk/authentication-jwt-bearer/flow-srp.js.map +1 -0
  98. package/dist/sdk/authentication-jwt-bearer/{services.d.cts → services.d.ts} +5 -5
  99. package/dist/sdk/authentication-jwt-bearer/services.d.ts.map +1 -0
  100. package/dist/sdk/authentication-jwt-bearer/{services.mjs → services.js} +6 -6
  101. package/dist/sdk/authentication-jwt-bearer/services.js.map +1 -0
  102. package/dist/sdk/authentication-jwt-bearer/{types.d.cts → types.d.ts} +2 -2
  103. package/dist/sdk/authentication-jwt-bearer/types.d.ts.map +1 -0
  104. package/dist/sdk/authentication-jwt-bearer/{types.mjs → types.js} +1 -1
  105. package/dist/sdk/authentication-jwt-bearer/types.js.map +1 -0
  106. package/dist/sdk/authentication-jwt-bearer/utils/{identifier.d.cts → identifier.d.ts} +2 -2
  107. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.ts.map +1 -0
  108. package/dist/sdk/authentication-jwt-bearer/utils/{identifier.mjs → identifier.js} +2 -2
  109. package/dist/sdk/authentication-jwt-bearer/utils/identifier.js.map +1 -0
  110. package/dist/sdk/authentication-jwt-bearer/utils/{time.d.cts → time.d.ts} +1 -1
  111. package/dist/sdk/authentication-jwt-bearer/utils/time.d.ts.map +1 -0
  112. package/dist/sdk/authentication-jwt-bearer/utils/{time.mjs → time.js} +1 -1
  113. package/dist/sdk/authentication-jwt-bearer/utils/time.js.map +1 -0
  114. package/dist/sdk/{authentication.d.cts → authentication.d.ts} +9 -9
  115. package/dist/sdk/authentication.d.ts.map +1 -0
  116. package/dist/sdk/{authentication.mjs → authentication.js} +9 -9
  117. package/dist/sdk/authentication.js.map +1 -0
  118. package/dist/sdk/{constants.d.cts → constants.d.ts} +1 -1
  119. package/dist/sdk/constants.d.ts.map +1 -0
  120. package/dist/sdk/{constants.mjs → constants.js} +1 -1
  121. package/dist/sdk/constants.js.map +1 -0
  122. package/dist/sdk/{errors.d.cts → errors.d.ts} +1 -1
  123. package/dist/sdk/errors.d.ts.map +1 -0
  124. package/dist/sdk/{errors.mjs → errors.js} +2 -2
  125. package/dist/sdk/errors.js.map +1 -0
  126. package/dist/sdk/index.d.ts +8 -0
  127. package/dist/sdk/index.d.ts.map +1 -0
  128. package/dist/sdk/index.js +8 -0
  129. package/dist/sdk/index.js.map +1 -0
  130. package/dist/sdk/mocks/{auth.d.cts → auth.d.ts} +2 -2
  131. package/dist/sdk/mocks/auth.d.ts.map +1 -0
  132. package/dist/sdk/mocks/{auth.mjs → auth.js} +3 -3
  133. package/dist/sdk/mocks/auth.js.map +1 -0
  134. package/dist/sdk/mocks/{userstorage.d.cts → userstorage.d.ts} +1 -1
  135. package/dist/sdk/mocks/userstorage.d.ts.map +1 -0
  136. package/dist/sdk/mocks/{userstorage.mjs → userstorage.js} +5 -5
  137. package/dist/sdk/mocks/userstorage.js.map +1 -0
  138. package/dist/sdk/{user-storage.d.mts → user-storage.d.ts} +5 -5
  139. package/dist/sdk/user-storage.d.ts.map +1 -0
  140. package/dist/sdk/{user-storage.mjs → user-storage.js} +6 -6
  141. package/dist/sdk/user-storage.js.map +1 -0
  142. package/dist/sdk/utils/{eip-6963-metamask-provider.d.cts → eip-6963-metamask-provider.d.ts} +2 -2
  143. package/dist/sdk/utils/eip-6963-metamask-provider.d.ts.map +1 -0
  144. package/dist/sdk/utils/{eip-6963-metamask-provider.mjs → eip-6963-metamask-provider.js} +1 -1
  145. package/dist/sdk/utils/eip-6963-metamask-provider.js.map +1 -0
  146. package/dist/sdk/utils/{messaging-signing-snap-requests.d.cts → messaging-signing-snap-requests.d.ts} +2 -2
  147. package/dist/sdk/utils/messaging-signing-snap-requests.d.ts.map +1 -0
  148. package/dist/sdk/utils/{messaging-signing-snap-requests.mjs → messaging-signing-snap-requests.js} +1 -1
  149. package/dist/sdk/utils/messaging-signing-snap-requests.js.map +1 -0
  150. package/dist/sdk/utils/{validate-login-response.d.mts → validate-login-response.d.ts} +2 -2
  151. package/dist/sdk/utils/validate-login-response.d.ts.map +1 -0
  152. package/dist/sdk/utils/{validate-login-response.mjs → validate-login-response.js} +1 -1
  153. package/dist/sdk/utils/validate-login-response.js.map +1 -0
  154. package/dist/sdk/utils/{validate-pair-response.d.cts → validate-pair-response.d.ts} +1 -1
  155. package/dist/sdk/utils/validate-pair-response.d.ts.map +1 -0
  156. package/dist/sdk/utils/{validate-pair-response.mjs → validate-pair-response.js} +1 -1
  157. package/dist/sdk/utils/validate-pair-response.js.map +1 -0
  158. package/dist/shared/encryption/{cache.d.cts → cache.d.ts} +1 -1
  159. package/dist/shared/encryption/cache.d.ts.map +1 -0
  160. package/dist/shared/encryption/{cache.mjs → cache.js} +3 -3
  161. package/dist/shared/encryption/cache.js.map +1 -0
  162. package/dist/shared/encryption/{constants.d.cts → constants.d.ts} +2 -2
  163. package/dist/shared/encryption/constants.d.ts.map +1 -0
  164. package/dist/shared/encryption/{constants.mjs → constants.js} +1 -1
  165. package/dist/shared/encryption/constants.js.map +1 -0
  166. package/dist/shared/encryption/{encryption.d.cts → encryption.d.ts} +3 -3
  167. package/dist/shared/encryption/encryption.d.ts.map +1 -0
  168. package/dist/shared/encryption/{encryption.mjs → encryption.js} +9 -9
  169. package/dist/shared/encryption/encryption.js.map +1 -0
  170. package/dist/shared/encryption/index.d.ts +5 -0
  171. package/dist/shared/encryption/index.d.ts.map +1 -0
  172. package/dist/shared/encryption/index.js +5 -0
  173. package/dist/shared/encryption/index.js.map +1 -0
  174. package/dist/shared/encryption/{utils.d.cts → utils.d.ts} +3 -3
  175. package/dist/shared/encryption/utils.d.ts.map +1 -0
  176. package/dist/shared/encryption/{utils.mjs → utils.js} +1 -1
  177. package/dist/shared/encryption/utils.js.map +1 -0
  178. package/dist/shared/{env.d.cts → env.d.ts} +1 -1
  179. package/dist/shared/env.d.ts.map +1 -0
  180. package/dist/shared/{env.mjs → env.js} +1 -1
  181. package/dist/shared/env.js.map +1 -0
  182. package/dist/shared/{storage-schema.d.mts → storage-schema.d.ts} +1 -1
  183. package/dist/shared/storage-schema.d.ts.map +1 -0
  184. package/dist/shared/{storage-schema.mjs → storage-schema.js} +2 -2
  185. package/dist/shared/storage-schema.js.map +1 -0
  186. package/dist/shared/types/{encryption.d.cts → encryption.d.ts} +1 -1
  187. package/dist/shared/types/encryption.d.ts.map +1 -0
  188. package/dist/shared/types/encryption.js +2 -0
  189. package/dist/shared/types/encryption.js.map +1 -0
  190. package/dist/shared/types/{services.d.cts → services.d.ts} +2 -2
  191. package/dist/shared/types/services.d.ts.map +1 -0
  192. package/dist/shared/types/services.js +2 -0
  193. package/dist/shared/types/services.js.map +1 -0
  194. package/dist/shared/utils/{entropy-source.d.cts → entropy-source.d.ts} +2 -2
  195. package/dist/shared/utils/entropy-source.d.ts.map +1 -0
  196. package/dist/shared/utils/{entropy-source.mjs → entropy-source.js} +2 -2
  197. package/dist/shared/utils/entropy-source.js.map +1 -0
  198. package/dist/shared/utils/{event-queue.d.cts → event-queue.d.ts} +1 -1
  199. package/dist/shared/utils/event-queue.d.ts.map +1 -0
  200. package/dist/shared/utils/{event-queue.mjs → event-queue.js} +1 -1
  201. package/dist/shared/utils/event-queue.js.map +1 -0
  202. package/dist/shared/utils/{hd-keyring-seed.d.mts → hd-keyring-seed.d.ts} +3 -3
  203. package/dist/shared/utils/hd-keyring-seed.d.ts.map +1 -0
  204. package/dist/shared/utils/{hd-keyring-seed.mjs → hd-keyring-seed.js} +1 -1
  205. package/dist/shared/utils/hd-keyring-seed.js.map +1 -0
  206. package/dist/shared/utils/{message-signing.d.mts → message-signing.d.ts} +1 -1
  207. package/dist/shared/utils/message-signing.d.ts.map +1 -0
  208. package/dist/shared/utils/{message-signing.mjs → message-signing.js} +7 -7
  209. package/dist/shared/utils/message-signing.js.map +1 -0
  210. package/package.json +22 -56
  211. package/dist/controllers/authentication/AuthenticationController-method-action-types.cjs +0 -7
  212. package/dist/controllers/authentication/AuthenticationController-method-action-types.cjs.map +0 -1
  213. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.cts +0 -102
  214. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.cts.map +0 -1
  215. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.mts.map +0 -1
  216. package/dist/controllers/authentication/AuthenticationController-method-action-types.mjs.map +0 -1
  217. package/dist/controllers/authentication/AuthenticationController.cjs +0 -489
  218. package/dist/controllers/authentication/AuthenticationController.cjs.map +0 -1
  219. package/dist/controllers/authentication/AuthenticationController.d.cts +0 -130
  220. package/dist/controllers/authentication/AuthenticationController.d.cts.map +0 -1
  221. package/dist/controllers/authentication/AuthenticationController.d.mts.map +0 -1
  222. package/dist/controllers/authentication/AuthenticationController.mjs.map +0 -1
  223. package/dist/controllers/authentication/index.cjs +0 -35
  224. package/dist/controllers/authentication/index.cjs.map +0 -1
  225. package/dist/controllers/authentication/index.d.cts.map +0 -1
  226. package/dist/controllers/authentication/index.d.mts +0 -7
  227. package/dist/controllers/authentication/index.d.mts.map +0 -1
  228. package/dist/controllers/authentication/index.mjs +0 -6
  229. package/dist/controllers/authentication/index.mjs.map +0 -1
  230. package/dist/controllers/authentication/mocks/index.cjs +0 -18
  231. package/dist/controllers/authentication/mocks/index.cjs.map +0 -1
  232. package/dist/controllers/authentication/mocks/index.d.cts +0 -2
  233. package/dist/controllers/authentication/mocks/index.d.cts.map +0 -1
  234. package/dist/controllers/authentication/mocks/index.d.mts +0 -2
  235. package/dist/controllers/authentication/mocks/index.d.mts.map +0 -1
  236. package/dist/controllers/authentication/mocks/index.mjs +0 -2
  237. package/dist/controllers/authentication/mocks/index.mjs.map +0 -1
  238. package/dist/controllers/authentication/mocks/mockResponses.cjs +0 -126
  239. package/dist/controllers/authentication/mocks/mockResponses.cjs.map +0 -1
  240. package/dist/controllers/authentication/mocks/mockResponses.d.cts +0 -58
  241. package/dist/controllers/authentication/mocks/mockResponses.d.cts.map +0 -1
  242. package/dist/controllers/authentication/mocks/mockResponses.d.mts.map +0 -1
  243. package/dist/controllers/authentication/mocks/mockResponses.mjs.map +0 -1
  244. package/dist/controllers/index.cjs +0 -29
  245. package/dist/controllers/index.cjs.map +0 -1
  246. package/dist/controllers/index.d.cts +0 -3
  247. package/dist/controllers/index.d.cts.map +0 -1
  248. package/dist/controllers/index.d.mts +0 -3
  249. package/dist/controllers/index.d.mts.map +0 -1
  250. package/dist/controllers/index.mjs +0 -3
  251. package/dist/controllers/index.mjs.map +0 -1
  252. package/dist/controllers/user-storage/UserStorageController-method-action-types.cjs +0 -7
  253. package/dist/controllers/user-storage/UserStorageController-method-action-types.cjs.map +0 -1
  254. package/dist/controllers/user-storage/UserStorageController-method-action-types.d.cts +0 -137
  255. package/dist/controllers/user-storage/UserStorageController-method-action-types.d.cts.map +0 -1
  256. package/dist/controllers/user-storage/UserStorageController-method-action-types.d.mts.map +0 -1
  257. package/dist/controllers/user-storage/UserStorageController-method-action-types.mjs.map +0 -1
  258. package/dist/controllers/user-storage/UserStorageController.cjs +0 -412
  259. package/dist/controllers/user-storage/UserStorageController.cjs.map +0 -1
  260. package/dist/controllers/user-storage/UserStorageController.d.cts.map +0 -1
  261. package/dist/controllers/user-storage/UserStorageController.d.mts +0 -182
  262. package/dist/controllers/user-storage/UserStorageController.d.mts.map +0 -1
  263. package/dist/controllers/user-storage/UserStorageController.mjs.map +0 -1
  264. package/dist/controllers/user-storage/constants.cjs +0 -19
  265. package/dist/controllers/user-storage/constants.cjs.map +0 -1
  266. package/dist/controllers/user-storage/constants.d.cts +0 -15
  267. package/dist/controllers/user-storage/constants.d.cts.map +0 -1
  268. package/dist/controllers/user-storage/constants.d.mts +0 -15
  269. package/dist/controllers/user-storage/constants.d.mts.map +0 -1
  270. package/dist/controllers/user-storage/constants.mjs.map +0 -1
  271. package/dist/controllers/user-storage/contact-syncing/constants.cjs +0 -12
  272. package/dist/controllers/user-storage/contact-syncing/constants.cjs.map +0 -1
  273. package/dist/controllers/user-storage/contact-syncing/constants.d.cts.map +0 -1
  274. package/dist/controllers/user-storage/contact-syncing/constants.d.mts +0 -9
  275. package/dist/controllers/user-storage/contact-syncing/constants.d.mts.map +0 -1
  276. package/dist/controllers/user-storage/contact-syncing/constants.mjs.map +0 -1
  277. package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs +0 -346
  278. package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs.map +0 -1
  279. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.cts.map +0 -1
  280. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts +0 -47
  281. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts.map +0 -1
  282. package/dist/controllers/user-storage/contact-syncing/controller-integration.mjs.map +0 -1
  283. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs +0 -50
  284. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs.map +0 -1
  285. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.cts.map +0 -1
  286. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts +0 -8
  287. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts.map +0 -1
  288. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.mjs.map +0 -1
  289. package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs +0 -23
  290. package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs.map +0 -1
  291. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.cts.map +0 -1
  292. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts +0 -9
  293. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts.map +0 -1
  294. package/dist/controllers/user-storage/contact-syncing/sync-utils.mjs.map +0 -1
  295. package/dist/controllers/user-storage/contact-syncing/types.cjs +0 -3
  296. package/dist/controllers/user-storage/contact-syncing/types.cjs.map +0 -1
  297. package/dist/controllers/user-storage/contact-syncing/types.d.cts.map +0 -1
  298. package/dist/controllers/user-storage/contact-syncing/types.d.mts +0 -37
  299. package/dist/controllers/user-storage/contact-syncing/types.d.mts.map +0 -1
  300. package/dist/controllers/user-storage/contact-syncing/types.mjs +0 -2
  301. package/dist/controllers/user-storage/contact-syncing/types.mjs.map +0 -1
  302. package/dist/controllers/user-storage/contact-syncing/utils.cjs +0 -64
  303. package/dist/controllers/user-storage/contact-syncing/utils.cjs.map +0 -1
  304. package/dist/controllers/user-storage/contact-syncing/utils.d.cts +0 -36
  305. package/dist/controllers/user-storage/contact-syncing/utils.d.cts.map +0 -1
  306. package/dist/controllers/user-storage/contact-syncing/utils.d.mts.map +0 -1
  307. package/dist/controllers/user-storage/contact-syncing/utils.mjs.map +0 -1
  308. package/dist/controllers/user-storage/index.cjs +0 -38
  309. package/dist/controllers/user-storage/index.cjs.map +0 -1
  310. package/dist/controllers/user-storage/index.d.cts.map +0 -1
  311. package/dist/controllers/user-storage/index.d.mts +0 -10
  312. package/dist/controllers/user-storage/index.d.mts.map +0 -1
  313. package/dist/controllers/user-storage/index.mjs +0 -9
  314. package/dist/controllers/user-storage/index.mjs.map +0 -1
  315. package/dist/controllers/user-storage/mocks/index.cjs +0 -19
  316. package/dist/controllers/user-storage/mocks/index.cjs.map +0 -1
  317. package/dist/controllers/user-storage/mocks/index.d.cts +0 -3
  318. package/dist/controllers/user-storage/mocks/index.d.cts.map +0 -1
  319. package/dist/controllers/user-storage/mocks/index.d.mts +0 -3
  320. package/dist/controllers/user-storage/mocks/index.d.mts.map +0 -1
  321. package/dist/controllers/user-storage/mocks/index.mjs +0 -3
  322. package/dist/controllers/user-storage/mocks/index.mjs.map +0 -1
  323. package/dist/controllers/user-storage/mocks/mockResponses.cjs +0 -113
  324. package/dist/controllers/user-storage/mocks/mockResponses.cjs.map +0 -1
  325. package/dist/controllers/user-storage/mocks/mockResponses.d.cts +0 -66
  326. package/dist/controllers/user-storage/mocks/mockResponses.d.cts.map +0 -1
  327. package/dist/controllers/user-storage/mocks/mockResponses.d.mts.map +0 -1
  328. package/dist/controllers/user-storage/mocks/mockResponses.mjs.map +0 -1
  329. package/dist/controllers/user-storage/mocks/mockStorage.cjs +0 -36
  330. package/dist/controllers/user-storage/mocks/mockStorage.cjs.map +0 -1
  331. package/dist/controllers/user-storage/mocks/mockStorage.d.cts.map +0 -1
  332. package/dist/controllers/user-storage/mocks/mockStorage.d.mts +0 -5
  333. package/dist/controllers/user-storage/mocks/mockStorage.d.mts.map +0 -1
  334. package/dist/controllers/user-storage/mocks/mockStorage.mjs.map +0 -1
  335. package/dist/controllers/user-storage/types.cjs +0 -3
  336. package/dist/controllers/user-storage/types.cjs.map +0 -1
  337. package/dist/controllers/user-storage/types.d.cts.map +0 -1
  338. package/dist/controllers/user-storage/types.d.mts +0 -23
  339. package/dist/controllers/user-storage/types.d.mts.map +0 -1
  340. package/dist/controllers/user-storage/types.mjs +0 -2
  341. package/dist/controllers/user-storage/types.mjs.map +0 -1
  342. package/dist/controllers/user-storage/utils.cjs +0 -32
  343. package/dist/controllers/user-storage/utils.cjs.map +0 -1
  344. package/dist/controllers/user-storage/utils.d.cts.map +0 -1
  345. package/dist/controllers/user-storage/utils.d.mts +0 -19
  346. package/dist/controllers/user-storage/utils.d.mts.map +0 -1
  347. package/dist/controllers/user-storage/utils.mjs.map +0 -1
  348. package/dist/index.cjs +0 -30
  349. package/dist/index.cjs.map +0 -1
  350. package/dist/index.d.cts +0 -4
  351. package/dist/index.d.cts.map +0 -1
  352. package/dist/index.d.mts +0 -4
  353. package/dist/index.d.mts.map +0 -1
  354. package/dist/index.mjs +0 -4
  355. package/dist/index.mjs.map +0 -1
  356. package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs +0 -114
  357. package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs.map +0 -1
  358. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.cts.map +0 -1
  359. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts +0 -25
  360. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts.map +0 -1
  361. package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs.map +0 -1
  362. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +0 -290
  363. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +0 -1
  364. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +0 -1
  365. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts +0 -44
  366. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +0 -1
  367. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +0 -1
  368. package/dist/sdk/authentication-jwt-bearer/services.cjs +0 -400
  369. package/dist/sdk/authentication-jwt-bearer/services.cjs.map +0 -1
  370. package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +0 -1
  371. package/dist/sdk/authentication-jwt-bearer/services.d.mts +0 -105
  372. package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +0 -1
  373. package/dist/sdk/authentication-jwt-bearer/services.mjs.map +0 -1
  374. package/dist/sdk/authentication-jwt-bearer/types.cjs +0 -12
  375. package/dist/sdk/authentication-jwt-bearer/types.cjs.map +0 -1
  376. package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +0 -1
  377. package/dist/sdk/authentication-jwt-bearer/types.d.mts +0 -114
  378. package/dist/sdk/authentication-jwt-bearer/types.d.mts.map +0 -1
  379. package/dist/sdk/authentication-jwt-bearer/types.mjs.map +0 -1
  380. package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs +0 -27
  381. package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs.map +0 -1
  382. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.cts.map +0 -1
  383. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts +0 -13
  384. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts.map +0 -1
  385. package/dist/sdk/authentication-jwt-bearer/utils/identifier.mjs.map +0 -1
  386. package/dist/sdk/authentication-jwt-bearer/utils/time.cjs +0 -17
  387. package/dist/sdk/authentication-jwt-bearer/utils/time.cjs.map +0 -1
  388. package/dist/sdk/authentication-jwt-bearer/utils/time.d.cts.map +0 -1
  389. package/dist/sdk/authentication-jwt-bearer/utils/time.d.mts +0 -8
  390. package/dist/sdk/authentication-jwt-bearer/utils/time.d.mts.map +0 -1
  391. package/dist/sdk/authentication-jwt-bearer/utils/time.mjs.map +0 -1
  392. package/dist/sdk/authentication.cjs +0 -132
  393. package/dist/sdk/authentication.cjs.map +0 -1
  394. package/dist/sdk/authentication.d.cts.map +0 -1
  395. package/dist/sdk/authentication.d.mts +0 -38
  396. package/dist/sdk/authentication.d.mts.map +0 -1
  397. package/dist/sdk/authentication.mjs.map +0 -1
  398. package/dist/sdk/constants.cjs +0 -7
  399. package/dist/sdk/constants.cjs.map +0 -1
  400. package/dist/sdk/constants.d.cts.map +0 -1
  401. package/dist/sdk/constants.d.mts +0 -4
  402. package/dist/sdk/constants.d.mts.map +0 -1
  403. package/dist/sdk/constants.mjs.map +0 -1
  404. package/dist/sdk/errors.cjs +0 -76
  405. package/dist/sdk/errors.cjs.map +0 -1
  406. package/dist/sdk/errors.d.cts.map +0 -1
  407. package/dist/sdk/errors.d.mts +0 -34
  408. package/dist/sdk/errors.d.mts.map +0 -1
  409. package/dist/sdk/errors.mjs.map +0 -1
  410. package/dist/sdk/index.cjs +0 -24
  411. package/dist/sdk/index.cjs.map +0 -1
  412. package/dist/sdk/index.d.cts +0 -8
  413. package/dist/sdk/index.d.cts.map +0 -1
  414. package/dist/sdk/index.d.mts +0 -8
  415. package/dist/sdk/index.d.mts.map +0 -1
  416. package/dist/sdk/index.mjs +0 -8
  417. package/dist/sdk/index.mjs.map +0 -1
  418. package/dist/sdk/mocks/auth.cjs +0 -82
  419. package/dist/sdk/mocks/auth.cjs.map +0 -1
  420. package/dist/sdk/mocks/auth.d.cts.map +0 -1
  421. package/dist/sdk/mocks/auth.d.mts +0 -69
  422. package/dist/sdk/mocks/auth.d.mts.map +0 -1
  423. package/dist/sdk/mocks/auth.mjs.map +0 -1
  424. package/dist/sdk/mocks/userstorage.cjs +0 -43
  425. package/dist/sdk/mocks/userstorage.cjs.map +0 -1
  426. package/dist/sdk/mocks/userstorage.d.cts.map +0 -1
  427. package/dist/sdk/mocks/userstorage.d.mts +0 -10
  428. package/dist/sdk/mocks/userstorage.d.mts.map +0 -1
  429. package/dist/sdk/mocks/userstorage.mjs.map +0 -1
  430. package/dist/sdk/user-storage.cjs +0 -386
  431. package/dist/sdk/user-storage.cjs.map +0 -1
  432. package/dist/sdk/user-storage.d.cts +0 -47
  433. package/dist/sdk/user-storage.d.cts.map +0 -1
  434. package/dist/sdk/user-storage.d.mts.map +0 -1
  435. package/dist/sdk/user-storage.mjs.map +0 -1
  436. package/dist/sdk/utils/eip-6963-metamask-provider.cjs +0 -70
  437. package/dist/sdk/utils/eip-6963-metamask-provider.cjs.map +0 -1
  438. package/dist/sdk/utils/eip-6963-metamask-provider.d.cts.map +0 -1
  439. package/dist/sdk/utils/eip-6963-metamask-provider.d.mts +0 -25
  440. package/dist/sdk/utils/eip-6963-metamask-provider.d.mts.map +0 -1
  441. package/dist/sdk/utils/eip-6963-metamask-provider.mjs.map +0 -1
  442. package/dist/sdk/utils/messaging-signing-snap-requests.cjs +0 -96
  443. package/dist/sdk/utils/messaging-signing-snap-requests.cjs.map +0 -1
  444. package/dist/sdk/utils/messaging-signing-snap-requests.d.cts.map +0 -1
  445. package/dist/sdk/utils/messaging-signing-snap-requests.d.mts +0 -41
  446. package/dist/sdk/utils/messaging-signing-snap-requests.d.mts.map +0 -1
  447. package/dist/sdk/utils/messaging-signing-snap-requests.mjs.map +0 -1
  448. package/dist/sdk/utils/validate-login-response.cjs +0 -49
  449. package/dist/sdk/utils/validate-login-response.cjs.map +0 -1
  450. package/dist/sdk/utils/validate-login-response.d.cts +0 -14
  451. package/dist/sdk/utils/validate-login-response.d.cts.map +0 -1
  452. package/dist/sdk/utils/validate-login-response.d.mts.map +0 -1
  453. package/dist/sdk/utils/validate-login-response.mjs.map +0 -1
  454. package/dist/sdk/utils/validate-pair-response.cjs +0 -29
  455. package/dist/sdk/utils/validate-pair-response.cjs.map +0 -1
  456. package/dist/sdk/utils/validate-pair-response.d.cts.map +0 -1
  457. package/dist/sdk/utils/validate-pair-response.d.mts +0 -26
  458. package/dist/sdk/utils/validate-pair-response.d.mts.map +0 -1
  459. package/dist/sdk/utils/validate-pair-response.mjs.map +0 -1
  460. package/dist/shared/encryption/cache.cjs +0 -77
  461. package/dist/shared/encryption/cache.cjs.map +0 -1
  462. package/dist/shared/encryption/cache.d.cts.map +0 -1
  463. package/dist/shared/encryption/cache.d.mts +0 -32
  464. package/dist/shared/encryption/cache.d.mts.map +0 -1
  465. package/dist/shared/encryption/cache.mjs.map +0 -1
  466. package/dist/shared/encryption/constants.cjs +0 -17
  467. package/dist/shared/encryption/constants.cjs.map +0 -1
  468. package/dist/shared/encryption/constants.d.cts.map +0 -1
  469. package/dist/shared/encryption/constants.d.mts +0 -9
  470. package/dist/shared/encryption/constants.d.mts.map +0 -1
  471. package/dist/shared/encryption/constants.mjs.map +0 -1
  472. package/dist/shared/encryption/encryption.cjs +0 -209
  473. package/dist/shared/encryption/encryption.cjs.map +0 -1
  474. package/dist/shared/encryption/encryption.d.cts.map +0 -1
  475. package/dist/shared/encryption/encryption.d.mts +0 -30
  476. package/dist/shared/encryption/encryption.d.mts.map +0 -1
  477. package/dist/shared/encryption/encryption.mjs.map +0 -1
  478. package/dist/shared/encryption/index.cjs +0 -25
  479. package/dist/shared/encryption/index.cjs.map +0 -1
  480. package/dist/shared/encryption/index.d.cts +0 -5
  481. package/dist/shared/encryption/index.d.cts.map +0 -1
  482. package/dist/shared/encryption/index.d.mts +0 -5
  483. package/dist/shared/encryption/index.d.mts.map +0 -1
  484. package/dist/shared/encryption/index.mjs +0 -5
  485. package/dist/shared/encryption/index.mjs.map +0 -1
  486. package/dist/shared/encryption/utils.cjs +0 -21
  487. package/dist/shared/encryption/utils.cjs.map +0 -1
  488. package/dist/shared/encryption/utils.d.cts.map +0 -1
  489. package/dist/shared/encryption/utils.d.mts +0 -5
  490. package/dist/shared/encryption/utils.d.mts.map +0 -1
  491. package/dist/shared/encryption/utils.mjs.map +0 -1
  492. package/dist/shared/env.cjs +0 -85
  493. package/dist/shared/env.cjs.map +0 -1
  494. package/dist/shared/env.d.cts.map +0 -1
  495. package/dist/shared/env.d.mts +0 -34
  496. package/dist/shared/env.d.mts.map +0 -1
  497. package/dist/shared/env.mjs.map +0 -1
  498. package/dist/shared/storage-schema.cjs +0 -42
  499. package/dist/shared/storage-schema.cjs.map +0 -1
  500. package/dist/shared/storage-schema.d.cts +0 -34
  501. package/dist/shared/storage-schema.d.cts.map +0 -1
  502. package/dist/shared/storage-schema.d.mts.map +0 -1
  503. package/dist/shared/storage-schema.mjs.map +0 -1
  504. package/dist/shared/types/encryption.cjs +0 -3
  505. package/dist/shared/types/encryption.cjs.map +0 -1
  506. package/dist/shared/types/encryption.d.cts.map +0 -1
  507. package/dist/shared/types/encryption.d.mts +0 -2
  508. package/dist/shared/types/encryption.d.mts.map +0 -1
  509. package/dist/shared/types/encryption.mjs +0 -2
  510. package/dist/shared/types/encryption.mjs.map +0 -1
  511. package/dist/shared/types/services.cjs +0 -3
  512. package/dist/shared/types/services.cjs.map +0 -1
  513. package/dist/shared/types/services.d.cts.map +0 -1
  514. package/dist/shared/types/services.d.mts +0 -17
  515. package/dist/shared/types/services.d.mts.map +0 -1
  516. package/dist/shared/types/services.mjs +0 -2
  517. package/dist/shared/types/services.mjs.map +0 -1
  518. package/dist/shared/utils/entropy-source.cjs +0 -37
  519. package/dist/shared/utils/entropy-source.cjs.map +0 -1
  520. package/dist/shared/utils/entropy-source.d.cts.map +0 -1
  521. package/dist/shared/utils/entropy-source.d.mts +0 -22
  522. package/dist/shared/utils/entropy-source.d.mts.map +0 -1
  523. package/dist/shared/utils/entropy-source.mjs.map +0 -1
  524. package/dist/shared/utils/event-queue.cjs +0 -24
  525. package/dist/shared/utils/event-queue.cjs.map +0 -1
  526. package/dist/shared/utils/event-queue.d.cts.map +0 -1
  527. package/dist/shared/utils/event-queue.d.mts +0 -6
  528. package/dist/shared/utils/event-queue.d.mts.map +0 -1
  529. package/dist/shared/utils/event-queue.mjs.map +0 -1
  530. package/dist/shared/utils/hd-keyring-seed.cjs +0 -49
  531. package/dist/shared/utils/hd-keyring-seed.cjs.map +0 -1
  532. package/dist/shared/utils/hd-keyring-seed.d.cts +0 -27
  533. package/dist/shared/utils/hd-keyring-seed.d.cts.map +0 -1
  534. package/dist/shared/utils/hd-keyring-seed.d.mts.map +0 -1
  535. package/dist/shared/utils/hd-keyring-seed.mjs.map +0 -1
  536. package/dist/shared/utils/message-signing.cjs +0 -147
  537. package/dist/shared/utils/message-signing.cjs.map +0 -1
  538. package/dist/shared/utils/message-signing.d.cts +0 -73
  539. package/dist/shared/utils/message-signing.d.cts.map +0 -1
  540. package/dist/shared/utils/message-signing.d.mts.map +0 -1
  541. package/dist/shared/utils/message-signing.mjs.map +0 -1
@@ -1,489 +0,0 @@
1
- "use strict";
2
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
- };
7
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
- if (kind === "m") throw new TypeError("Private method is not writable");
9
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
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
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
- };
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_tryClearNeedsProfilePairing, _AuthenticationController_doPair, _AuthenticationController_pairSrpProfiles, _AuthenticationController_propagateCanonical, _AuthenticationController_getCanonicalProfileId, _AuthenticationController_invalidateSrpSession, _AuthenticationController_getHdKeyringSeed, _AuthenticationController_getPublicKey, _AuthenticationController__signMessageCache, _AuthenticationController_scopedCacheKey, _AuthenticationController_signMessage;
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.AuthenticationController = exports.defaultState = void 0;
16
- const base_controller_1 = require("@metamask/base-controller");
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");
21
- const controllerName = 'AuthenticationController';
22
- exports.defaultState = {
23
- isSignedIn: false,
24
- needsProfilePairing: true,
25
- };
26
- const metadata = {
27
- isSignedIn: {
28
- includeInStateLogs: true,
29
- persist: true,
30
- includeInDebugSnapshot: true,
31
- usedInUi: true,
32
- },
33
- needsProfilePairing: {
34
- includeInStateLogs: true,
35
- persist: true,
36
- includeInDebugSnapshot: true,
37
- usedInUi: true,
38
- },
39
- srpSessionData: {
40
- // Remove access token from state logs
41
- includeInStateLogs: (srpSessionData) => {
42
- // Unreachable branch, included just to fix a type error for the case where this property is
43
- // unset. The type gets collapsed to include `| undefined` even though `undefined` is never
44
- // set here, because we don't yet use `exactOptionalPropertyTypes`.
45
- // TODO: Remove branch after enabling `exactOptionalPropertyTypes`
46
- // ref: https://github.com/MetaMask/core/issues/6565
47
- if (srpSessionData === null || srpSessionData === undefined) {
48
- return null;
49
- }
50
- return Object.entries(srpSessionData).reduce((sanitizedSrpSessionData, [key, value]) => {
51
- const { accessToken: _unused, ...tokenWithoutAccessToken } = value.token;
52
- sanitizedSrpSessionData[key] = {
53
- ...value,
54
- token: tokenWithoutAccessToken,
55
- };
56
- return sanitizedSrpSessionData;
57
- }, {});
58
- },
59
- persist: true,
60
- includeInDebugSnapshot: false,
61
- usedInUi: true,
62
- },
63
- };
64
- const MESSENGER_EXPOSED_METHODS = [
65
- 'performSignIn',
66
- 'performSignOut',
67
- 'getBearerToken',
68
- 'getSessionProfile',
69
- 'refreshCanonicalProfileId',
70
- 'getUserProfileLineage',
71
- 'getCustomerServiceToken',
72
- 'isSignedIn',
73
- 'requestProfilePairing',
74
- ];
75
- /**
76
- * Controller that enables authentication for restricted endpoints.
77
- * Used for Backup & Sync, Notifications, and other services.
78
- */
79
- class AuthenticationController extends base_controller_1.BaseController {
80
- constructor({ messenger, state, config, metametrics, }) {
81
- super({
82
- messenger,
83
- metadata,
84
- name: controllerName,
85
- state: { ...exports.defaultState, ...state },
86
- });
87
- _AuthenticationController_instances.add(this);
88
- _AuthenticationController_metametrics.set(this, void 0);
89
- _AuthenticationController_auth.set(this, void 0);
90
- _AuthenticationController_config.set(this, {
91
- env: index_js_1.Env.PRD,
92
- });
93
- _AuthenticationController_isUnlocked.set(this, false);
94
- // Bumped by `requestProfilePairing`. `performSignIn` snapshots this
95
- // before its first await; if it changes mid-flight we must NOT clear
96
- // `needsProfilePairing` (the rearm signal wins).
97
- _AuthenticationController_profilePairingRequestEpoch.set(this, 0);
98
- _AuthenticationController_keyringController.set(this, {
99
- setupLockedStateSubscriptions: () => {
100
- const { isUnlocked } = this.messenger.call('KeyringController:getState');
101
- __classPrivateFieldSet(this, _AuthenticationController_isUnlocked, isUnlocked, "f");
102
- this.messenger.subscribe('KeyringController:unlock', () => {
103
- __classPrivateFieldSet(this, _AuthenticationController_isUnlocked, true, "f");
104
- });
105
- this.messenger.subscribe('KeyringController:lock', () => {
106
- __classPrivateFieldSet(this, _AuthenticationController_isUnlocked, false, "f");
107
- });
108
- },
109
- });
110
- _AuthenticationController__signMessageCache.set(this, {});
111
- if (!metametrics) {
112
- throw new Error('`metametrics` field is required');
113
- }
114
- __classPrivateFieldSet(this, _AuthenticationController_config, {
115
- ...__classPrivateFieldGet(this, _AuthenticationController_config, "f"),
116
- ...config,
117
- }, "f");
118
- __classPrivateFieldSet(this, _AuthenticationController_metametrics, metametrics, "f");
119
- __classPrivateFieldSet(this, _AuthenticationController_auth, new index_js_1.JwtBearerAuth({
120
- env: __classPrivateFieldGet(this, _AuthenticationController_config, "f").env,
121
- platform: metametrics.agent,
122
- type: index_js_1.AuthType.SRP,
123
- }, {
124
- storage: {
125
- getLoginResponse: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getLoginResponseFromState).bind(this),
126
- setLoginResponse: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_setLoginResponseToState).bind(this),
127
- },
128
- signing: {
129
- getIdentifier: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPublicKey).bind(this),
130
- signMessage: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_signMessage).bind(this),
131
- },
132
- getLoginTag: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getLoginTag).bind(this),
133
- getLoginIdentifierType: __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getLoginIdentifierType).bind(this),
134
- metametrics: __classPrivateFieldGet(this, _AuthenticationController_metametrics, "f"),
135
- }), "f");
136
- __classPrivateFieldGet(this, _AuthenticationController_keyringController, "f").setupLockedStateSubscriptions();
137
- this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
138
- }
139
- async performSignIn() {
140
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'performSignIn');
141
- const epochAtStart = __classPrivateFieldGet(this, _AuthenticationController_profilePairingRequestEpoch, "f");
142
- const entropySourceIds = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getHdKeyringEntropySourceIds).call(this);
143
- const accessTokens = [];
144
- // We iterate sequentially in order to be sure that the first entry
145
- // is the primary SRP LoginResponse.
146
- for (const entropySourceId of entropySourceIds) {
147
- const accessToken = await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getAccessToken(entropySourceId);
148
- accessTokens.push(accessToken);
149
- }
150
- if (entropySourceIds.length < 2) {
151
- // Single-SRP wallet: nothing to pair.
152
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_tryClearNeedsProfilePairing).call(this, epochAtStart);
153
- }
154
- else {
155
- // Pair failures must not break sign-in; the gate stays `true` for retry.
156
- try {
157
- await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_doPair).call(this, accessTokens, epochAtStart);
158
- }
159
- catch {
160
- // noop
161
- }
162
- }
163
- return accessTokens;
164
- }
165
- /**
166
- * Marks profile pairing as needed. Clients call this when the SRP set
167
- * changes (e.g. a new keyring was added) so the next auto-sign-in cycle
168
- * re-runs `performSignIn` and re-pairs.
169
- */
170
- requestProfilePairing() {
171
- __classPrivateFieldSet(this, _AuthenticationController_profilePairingRequestEpoch, __classPrivateFieldGet(this, _AuthenticationController_profilePairingRequestEpoch, "f") + 1, "f");
172
- if (!this.state.needsProfilePairing) {
173
- this.update((state) => {
174
- state.needsProfilePairing = true;
175
- });
176
- }
177
- }
178
- performSignOut() {
179
- this.update((state) => {
180
- state.isSignedIn = false;
181
- state.srpSessionData = undefined;
182
- });
183
- }
184
- /**
185
- * Returns a bearer token for the specified SRP, logging in if needed.
186
- *
187
- * When called without `entropySourceId`, returns the primary (first) SRP's
188
- * access token, which is effectively the canonical
189
- * profile's token that can be used by alias-aware consumers for cross-SRP
190
- * operations.
191
- *
192
- * @param entropySourceId - The entropy source ID. Omit for the primary SRP.
193
- * @returns The OIDC access token.
194
- */
195
- async getBearerToken(entropySourceId) {
196
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'getBearerToken');
197
- const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
198
- return await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getAccessToken(resolvedId);
199
- }
200
- /**
201
- * Returns the cached session profile, logging in if no session exists.
202
- *
203
- * The returned `canonicalProfileId` reflects the value from the most recent
204
- * login or pairing. In the rare event where a canonical changed because of
205
- * a pairing that happened on another device, the cached value may be stale
206
- * until the next login. For guaranteed freshness, call
207
- * `refreshCanonicalProfileId()` before reading `canonicalProfileId`.
208
- *
209
- * @param entropySourceId - The entropy source ID used to derive the key,
210
- * when multiple sources are available (Multi-SRP).
211
- * @returns profile for the session.
212
- */
213
- async getSessionProfile(entropySourceId) {
214
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'getSessionProfile');
215
- const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
216
- return await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getUserProfile(resolvedId);
217
- }
218
- /**
219
- * Forces a fresh retrieval of the canonical profile ID from the server
220
- * and propagates it to all cached SRP sessions.
221
- *
222
- * This method invalidates the primary SRP's cached session and forces a
223
- * re-login. Use it before operations that require a guaranteed-fresh
224
- * canonical (e.g. storage key derivation for Accounts ADR 0005). For
225
- * best-effort reads, use
226
- * `getSessionProfile().canonicalProfileId` instead.
227
- *
228
- * Only the primary SRP is re-logged-in regardless of how many SRPs exist —
229
- * the server returns the current canonical for the entire pairing group
230
- * from any single SRP login.
231
- *
232
- * @returns The refreshed canonical profile ID.
233
- */
234
- async refreshCanonicalProfileId() {
235
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'refreshCanonicalProfileId');
236
- const primaryEntropySourceId = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
237
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_invalidateSrpSession).call(this, primaryEntropySourceId);
238
- await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getAccessToken(primaryEntropySourceId);
239
- const canonical = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
240
- if (!canonical) {
241
- throw new Error('refreshCanonicalProfileId - Unable to resolve canonical profile ID');
242
- }
243
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_propagateCanonical).call(this, canonical);
244
- return canonical;
245
- }
246
- async getUserProfileLineage(entropySourceId) {
247
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'getUserProfileLineage');
248
- const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
249
- return await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getUserProfileLineage(resolvedId);
250
- }
251
- /**
252
- * Returns a Customer Service specific access token for the specified SRP,
253
- * logging in if needed.
254
- *
255
- * Exchanges the OIDC access token for a short-lived token scoped to the
256
- * customer-service audience. Customer Service tooling consumes this token to
257
- * identify and authenticate the user.
258
- *
259
- * @param entropySourceId - The entropy source ID. Omit for the primary SRP.
260
- * @returns The customer-service access token.
261
- */
262
- async getCustomerServiceToken(entropySourceId) {
263
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, 'getCustomerServiceToken');
264
- const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
265
- return await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").getCustomerServiceToken(resolvedId);
266
- }
267
- isSignedIn() {
268
- return this.state.isSignedIn;
269
- }
270
- }
271
- exports.AuthenticationController = AuthenticationController;
272
- _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) {
273
- const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
274
- if (!this.state.srpSessionData?.[resolvedId]) {
275
- return null;
276
- }
277
- return this.state.srpSessionData[resolvedId];
278
- }, _AuthenticationController_setLoginResponseToState = async function _AuthenticationController_setLoginResponseToState(loginResponse, entropySourceId) {
279
- const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
280
- const metaMetricsId = await __classPrivateFieldGet(this, _AuthenticationController_metametrics, "f").getMetaMetricsId();
281
- this.update((state) => {
282
- state.isSignedIn = true;
283
- if (!state.srpSessionData) {
284
- state.srpSessionData = {};
285
- }
286
- state.srpSessionData[resolvedId] = {
287
- ...loginResponse,
288
- profile: {
289
- ...loginResponse.profile,
290
- metaMetricsId,
291
- },
292
- };
293
- });
294
- }, _AuthenticationController_assertIsUnlocked = function _AuthenticationController_assertIsUnlocked(methodName) {
295
- if (!__classPrivateFieldGet(this, _AuthenticationController_isUnlocked, "f")) {
296
- throw new Error(`${methodName} - unable to proceed, wallet is locked`);
297
- }
298
- }, _AuthenticationController_getHdKeyringEntropySourceIds = function _AuthenticationController_getHdKeyringEntropySourceIds() {
299
- const { keyrings } = this.messenger.call('KeyringController:getState');
300
- return (0, entropy_source_js_1.getHdKeyringEntropySourceIds)(keyrings);
301
- }, _AuthenticationController_getPrimaryEntropySourceId = function _AuthenticationController_getPrimaryEntropySourceId() {
302
- const { keyrings } = this.messenger.call('KeyringController:getState');
303
- return (0, entropy_source_js_1.getPrimaryHdKeyringEntropySourceId)(keyrings);
304
- }, _AuthenticationController_getLoginTag =
305
- /**
306
- * Resolves the SRP login tag for `raw_message`.
307
- *
308
- * - `primary` for the first HD entropy source
309
- * - `secondary` for any other entropy source
310
- *
311
- * @param entropySourceId - Entropy source for this login attempt.
312
- * @returns The login tag to append to the signed message.
313
- */
314
- async function _AuthenticationController_getLoginTag(entropySourceId) {
315
- const primaryEntropySourceId = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
316
- const resolvedId = entropySourceId ?? primaryEntropySourceId;
317
- return resolvedId === primaryEntropySourceId ? 'primary' : 'secondary';
318
- }, _AuthenticationController_getLoginIdentifierType =
319
- /**
320
- * Resolves metametrics `identifier_type` for `/srp/login`
321
- * (`SRP` | `GOOGLE` | `APPLE` | `TELEGRAM`).
322
- *
323
- * This is the auth method for the entropy source, independent of
324
- * {@link SrpLoginTag} (`primary` / `secondary`).
325
- *
326
- * SeedlessOnboarding currently exposes a single vault-level
327
- * `authConnection`, which always backs the primary entropy source. Non-
328
- * primary sources therefore return `SRP`. If social identities become
329
- * per-entropy later, resolve from that metadata instead of assuming
330
- * primary === social.
331
- *
332
- * Soft-fails to `SRP` when SeedlessOnboarding is not registered.
333
- *
334
- * @param entropySourceId - Entropy source for this login attempt.
335
- * @returns The login identifier type.
336
- */
337
- async function _AuthenticationController_getLoginIdentifierType(entropySourceId) {
338
- const primaryEntropySourceId = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
339
- const resolvedId = entropySourceId ?? primaryEntropySourceId;
340
- // Social vault authConnection is only associated with the primary source.
341
- if (resolvedId !== primaryEntropySourceId) {
342
- return 'SRP';
343
- }
344
- return __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_resolveSocialIdentifierType).call(this);
345
- }, _AuthenticationController_resolveSocialIdentifierType = function _AuthenticationController_resolveSocialIdentifierType() {
346
- try {
347
- const { vault, authConnection } = this.messenger.call('SeedlessOnboardingController:getState');
348
- if (vault === null || vault === undefined) {
349
- return 'SRP';
350
- }
351
- // Match provider strings from SeedlessOnboarding state rather than
352
- // importing AuthConnection — a value import would load that package
353
- // (and its heavy deps) whenever this controller is imported.
354
- switch (authConnection) {
355
- case 'google':
356
- return 'GOOGLE';
357
- case 'apple':
358
- return 'APPLE';
359
- case 'telegram':
360
- return 'TELEGRAM';
361
- default:
362
- return 'SRP';
363
- }
364
- }
365
- catch {
366
- return 'SRP';
367
- }
368
- }, _AuthenticationController_tryClearNeedsProfilePairing = function _AuthenticationController_tryClearNeedsProfilePairing(epochAtStart) {
369
- if (__classPrivateFieldGet(this, _AuthenticationController_profilePairingRequestEpoch, "f") !== epochAtStart) {
370
- return;
371
- }
372
- if (this.state.needsProfilePairing) {
373
- this.update((state) => {
374
- state.needsProfilePairing = false;
375
- });
376
- }
377
- }, _AuthenticationController_doPair =
378
- /**
379
- * Pairs all SRPs via `POST /profile/pair`, propagates the canonical
380
- * profile ID, clears `needsProfilePairing`, and emits
381
- * `AuthenticationController:profileSignIn` when the canonical changes or
382
- * new aliases are returned. Throws on failure.
383
- *
384
- * @param accessTokens - Per-SRP access tokens, primary first.
385
- * @param epochAtStart - Pairing-request epoch captured by the caller.
386
- * Used to skip the gate clear if `requestProfilePairing` ran while the
387
- * pair API call was in-flight.
388
- */
389
- async function _AuthenticationController_doPair(accessTokens, epochAtStart) {
390
- const previousCanonical = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
391
- const profileAliases = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_pairSrpProfiles).call(this, accessTokens);
392
- const newCanonical = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getCanonicalProfileId).call(this);
393
- // If somehow we cannot compute the new canonical profile ID after pairing,
394
- // we just return now and do not update the `needsProfilePairing` flag.
395
- if (!newCanonical) {
396
- return;
397
- }
398
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_tryClearNeedsProfilePairing).call(this, epochAtStart);
399
- const profileIdChanged = previousCanonical !== newCanonical;
400
- const shouldEmitProfileSignInEvent = profileIdChanged || profileAliases.length > 0;
401
- if (shouldEmitProfileSignInEvent) {
402
- this.messenger.publish('AuthenticationController:profileSignIn', {
403
- profileId: newCanonical,
404
- profileAliases,
405
- profileIdChanged,
406
- });
407
- }
408
- }, _AuthenticationController_pairSrpProfiles = async function _AuthenticationController_pairSrpProfiles(accessTokens) {
409
- if (accessTokens.length < 2) {
410
- return [];
411
- }
412
- const primaryAccessToken = accessTokens[0]; // Associated with primary SRP.
413
- const { profileAliases, profile: { canonicalProfileId }, } = await __classPrivateFieldGet(this, _AuthenticationController_auth, "f").pairSrpProfiles(accessTokens, primaryAccessToken);
414
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_propagateCanonical).call(this, canonicalProfileId);
415
- return profileAliases;
416
- }, _AuthenticationController_propagateCanonical = function _AuthenticationController_propagateCanonical(canonicalProfileId) {
417
- const { srpSessionData } = this.state;
418
- if (!srpSessionData) {
419
- return;
420
- }
421
- this.update((state) => {
422
- for (const entry of Object.values(state.srpSessionData ?? {})) {
423
- if (entry?.profile) {
424
- entry.profile.canonicalProfileId = canonicalProfileId;
425
- }
426
- }
427
- });
428
- }, _AuthenticationController_getCanonicalProfileId = function _AuthenticationController_getCanonicalProfileId() {
429
- const primaryEntropySourceId = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
430
- return (this.state.srpSessionData?.[primaryEntropySourceId]?.profile
431
- ?.canonicalProfileId ?? null);
432
- }, _AuthenticationController_invalidateSrpSession = function _AuthenticationController_invalidateSrpSession(entropySourceId) {
433
- this.update((state) => {
434
- const entry = state.srpSessionData?.[entropySourceId];
435
- if (entry?.profile) {
436
- // Setting canonicalProfileId to '' forces a re-fetch on the next
437
- // #getAuthSession call. The falsy check (!auth.profile.canonicalProfileId)
438
- // treats '' the same as undefined/null — all signal an invalid session.
439
- entry.profile.canonicalProfileId = '';
440
- }
441
- });
442
- }, _AuthenticationController_getHdKeyringSeed =
443
- /**
444
- * Reads the BIP-39 seed for an HD entropy source from KeyringController.
445
- *
446
- * @param entropySourceId - Entropy source ID. Defaults to the primary HD
447
- * keyring.
448
- * @returns The HD keyring seed.
449
- */
450
- async function _AuthenticationController_getHdKeyringSeed(entropySourceId) {
451
- const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this);
452
- return (0, hd_keyring_seed_js_1.getHdKeyringSeed)(this.messenger, resolvedId);
453
- }, _AuthenticationController_getPublicKey =
454
- /**
455
- * Returns the message-signing public key via native SIP-6 derivation
456
- * (same key as `@metamask/message-signing-snap` with empty salt).
457
- *
458
- * @param entropySourceId - The entropy source ID used to derive the key,
459
- * when multiple sources are available (Multi-SRP).
460
- * @returns The public key hex.
461
- */
462
- async function _AuthenticationController_getPublicKey(entropySourceId) {
463
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, '#getPublicKey');
464
- const seed = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getHdKeyringSeed).call(this, entropySourceId);
465
- return (0, message_signing_js_1.getMessageSigningPublicKey)(seed);
466
- }, _AuthenticationController_scopedCacheKey = function _AuthenticationController_scopedCacheKey(message, entropySourceId) {
467
- return `${entropySourceId ?? __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getPrimaryEntropySourceId).call(this)}:${message}`;
468
- }, _AuthenticationController_signMessage =
469
- /**
470
- * Signs a `metamask:…` message with the native SIP-6 message-signing key.
471
- *
472
- * @param message - A specific tagged message to sign.
473
- * @param entropySourceId - The entropy source ID used to derive the key,
474
- * when multiple sources are available (Multi-SRP).
475
- * @returns Compact secp256k1 signature hex.
476
- */
477
- async function _AuthenticationController_signMessage(message, entropySourceId) {
478
- (0, index_js_1.assertMessageStartsWithMetamask)(message);
479
- __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_assertIsUnlocked).call(this, '#signMessage');
480
- const cacheKey = __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_scopedCacheKey).call(this, message, entropySourceId);
481
- if (__classPrivateFieldGet(this, _AuthenticationController__signMessageCache, "f")[cacheKey]) {
482
- return __classPrivateFieldGet(this, _AuthenticationController__signMessageCache, "f")[cacheKey];
483
- }
484
- const seed = await __classPrivateFieldGet(this, _AuthenticationController_instances, "m", _AuthenticationController_getHdKeyringSeed).call(this, entropySourceId);
485
- const result = await (0, message_signing_js_1.signMessageWithMessageSigningKey)(message, seed);
486
- __classPrivateFieldGet(this, _AuthenticationController__signMessageCache, "f")[cacheKey] = result;
487
- return result;
488
- };
489
- //# sourceMappingURL=AuthenticationController.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AuthenticationController.cjs","sourceRoot":"","sources":["../../../src/controllers/authentication/AuthenticationController.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAA2D;AAyB3D,kDAK4B;AAE5B,6EAG8C;AAC9C,+EAAyE;AACzE,+EAG+C;AAG/C,MAAM,cAAc,GAAG,0BAA0B,CAAC;AAmBrC,QAAA,YAAY,GAAkC;IACzD,UAAU,EAAE,KAAK;IACjB,mBAAmB,EAAE,IAAI;CAC1B,CAAC;AACF,MAAM,QAAQ,GAAiD;IAC7D,UAAU,EAAE;QACV,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,IAAI;KACf;IACD,mBAAmB,EAAE;QACnB,kBAAkB,EAAE,IAAI;QACxB,OAAO,EAAE,IAAI;QACb,sBAAsB,EAAE,IAAI;QAC5B,QAAQ,EAAE,IAAI;KACf;IACD,cAAc,EAAE;QACd,sCAAsC;QACtC,kBAAkB,EAAE,CAAC,cAAc,EAAE,EAAE;YACrC,4FAA4F;YAC5F,2FAA2F;YAC3F,mEAAmE;YACnE,kEAAkE;YAClE,oDAAoD;YACpD,IAAI,cAAc,KAAK,IAAI,IAAI,cAAc,KAAK,SAAS,EAAE,CAAC;gBAC5D,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,M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AAE,UAAU,CAAC,CAAC;AACtD,CAAC;AAED;;;;;;;GAOG;AACH,KAAK,iDAAe,eAAwB;IAC1C,uBAAA,IAAI,uFAAkB,MAAtB,IAAI,EAAmB,eAAe,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,MAAM,uBAAA,IAAI,uFAAkB,MAAtB,IAAI,EAAmB,eAAe,CAAC,CAAC;IAC3D,OAAO,IAAA,+CAA0B,EAAC,IAAI,CAAC,CAAC;AAC1C,CAAC,+FAmBC,OAA6B,EAC7B,eAAwB;IAExB,OAAO,GAAG,eAAe,IAAI,uBAAA,IAAI,gGAA2B,MAA/B,IAAI,CAA6B,IAAI,OAAO,EAAE,CAAC;AAC9E,CAAC;AAED;;;;;;;GAOG;AACH,KAAK,gDACH,OAAe,EACf,eAAwB;IAExB,IAAA,0CAA+B,EAAC,OAAO,CAAC,CAAC;IACzC,uBAAA,IAAI,uFAAkB,MAAtB,IAAI,EAAmB,cAAc,CAAC,CAAC;IAEvC,MAAM,QAAQ,GAAG,uBAAA,IAAI,qFAAgB,MAApB,IAAI,EAAiB,OAAO,EAAE,eAAe,CAAC,CAAC;IAChE,IAAI,uBAAA,IAAI,mDAAmB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtC,OAAO,uBAAA,IAAI,mDAAmB,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,uBAAA,IAAI,uFAAkB,MAAtB,IAAI,EAAmB,eAAe,CAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,MAAM,IAAA,qDAAgC,EAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAErE,uBAAA,IAAI,mDAAmB,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IAE3C,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { BaseController } from '@metamask/base-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerLockEvent,\n KeyringControllerUnlockEvent,\n KeyringControllerWithKeyringV2UnsafeAction,\n} from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\nimport type { SeedlessOnboardingControllerGetStateAction } from '@metamask/seedless-onboarding-controller';\nimport type { Json } from '@metamask/utils';\n\nimport type {\n LoginIdentifierType,\n LoginResponse,\n ProfileAlias,\n SRPInterface,\n SrpLoginTag,\n UserProfile,\n UserProfileLineage,\n} from '../../sdk/index.js';\nimport {\n assertMessageStartsWithMetamask,\n AuthType,\n Env,\n JwtBearerAuth,\n} from '../../sdk/index.js';\nimport type { MetaMetricsAuth } from '../../shared/types/services.js';\nimport {\n getHdKeyringEntropySourceIds,\n getPrimaryHdKeyringEntropySourceId,\n} from '../../shared/utils/entropy-source.js';\nimport { getHdKeyringSeed } from '../../shared/utils/hd-keyring-seed.js';\nimport {\n getMessageSigningPublicKey,\n signMessageWithMessageSigningKey,\n} from '../../shared/utils/message-signing.js';\nimport { AuthenticationControllerMethodActions } from './AuthenticationController-method-action-types.js';\n\nconst controllerName = 'AuthenticationController';\n\n// State\nexport type AuthenticationControllerState = {\n isSignedIn: boolean;\n srpSessionData?: Record<string, LoginResponse>;\n /**\n * Client gate for profile pairing. Defaults to `true` (fresh install /\n * upgrade), set to `false` after a successful `performSignIn` pair, set\n * back to `true` via `requestProfilePairing()` when the SRP set changes,\n * and left `true` on pair failure so the next state shift retries.\n *\n * Optional in the type so partial-state selectors stay assignable to\n * `AuthenticationControllerState`. The controller seeds it via\n * `defaultState` at construction; consumers should read `undefined` as\n * `true` to mirror that runtime default.\n */\n needsProfilePairing?: boolean;\n};\nexport const defaultState: AuthenticationControllerState = {\n isSignedIn: false,\n needsProfilePairing: true,\n};\nconst metadata: StateMetadata<AuthenticationControllerState> = {\n isSignedIn: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n needsProfilePairing: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n srpSessionData: {\n // Remove access token from state logs\n includeInStateLogs: (srpSessionData) => {\n // Unreachable branch, included just to fix a type error for the case where this property is\n // unset. The type gets collapsed to include `| undefined` even though `undefined` is never\n // set here, because we don't yet use `exactOptionalPropertyTypes`.\n // TODO: Remove branch after enabling `exactOptionalPropertyTypes`\n // ref: https://github.com/MetaMask/core/issues/6565\n if (srpSessionData === null || srpSessionData === undefined) {\n return null;\n }\n return Object.entries(srpSessionData).reduce<Record<string, Json>>(\n (sanitizedSrpSessionData, [key, value]) => {\n const { accessToken: _unused, ...tokenWithoutAccessToken } =\n value.token;\n sanitizedSrpSessionData[key] = {\n ...value,\n token: tokenWithoutAccessToken,\n };\n return sanitizedSrpSessionData;\n },\n {},\n );\n },\n persist: true,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n};\n\ntype ControllerConfig = {\n env: Env;\n};\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'performSignIn',\n 'performSignOut',\n 'getBearerToken',\n 'getSessionProfile',\n 'refreshCanonicalProfileId',\n 'getUserProfileLineage',\n 'getCustomerServiceToken',\n 'isSignedIn',\n 'requestProfilePairing',\n] as const;\n\nexport type Actions =\n | AuthenticationControllerGetStateAction\n | AuthenticationControllerMethodActions;\n\nexport type AuthenticationControllerGetStateAction = ControllerGetStateAction<\n typeof controllerName,\n AuthenticationControllerState\n>;\n\nexport type AuthenticationControllerStateChangeEvent =\n ControllerStateChangeEvent<\n typeof controllerName,\n AuthenticationControllerState\n >;\n\nexport type ProfileSignInInfo = {\n profileId: string;\n profileAliases: ProfileAlias[];\n profileIdChanged: boolean;\n};\n\nexport type AuthenticationControllerProfileSignInEvent = {\n type: `${typeof controllerName}:profileSignIn`;\n payload: [ProfileSignInInfo];\n};\n\nexport type Events =\n | AuthenticationControllerStateChangeEvent\n | AuthenticationControllerProfileSignInEvent;\n\n// Allowed Actions\ntype AllowedActions =\n | KeyringControllerGetStateAction\n | KeyringControllerWithKeyringV2UnsafeAction\n | SeedlessOnboardingControllerGetStateAction;\n\ntype AllowedEvents = KeyringControllerLockEvent | KeyringControllerUnlockEvent;\n\n// Messenger\nexport type AuthenticationControllerMessenger = Messenger<\n typeof controllerName,\n Actions | AllowedActions,\n Events | AllowedEvents\n>;\n\n/**\n * Controller that enables authentication for restricted endpoints.\n * Used for Backup & Sync, Notifications, and other services.\n */\nexport class AuthenticationController extends BaseController<\n typeof controllerName,\n AuthenticationControllerState,\n AuthenticationControllerMessenger\n> {\n readonly #metametrics: MetaMetricsAuth;\n\n readonly #auth: SRPInterface;\n\n readonly #config: ControllerConfig = {\n env: Env.PRD,\n };\n\n #isUnlocked = false;\n\n // Bumped by `requestProfilePairing`. `performSignIn` snapshots this\n // before its first await; if it changes mid-flight we must NOT clear\n // `needsProfilePairing` (the rearm signal wins).\n #profilePairingRequestEpoch = 0;\n\n readonly #keyringController = {\n setupLockedStateSubscriptions: () => {\n const { isUnlocked } = this.messenger.call('KeyringController:getState');\n this.#isUnlocked = isUnlocked;\n\n this.messenger.subscribe('KeyringController:unlock', () => {\n this.#isUnlocked = true;\n });\n\n this.messenger.subscribe('KeyringController:lock', () => {\n this.#isUnlocked = false;\n });\n },\n };\n\n constructor({\n messenger,\n state,\n config,\n metametrics,\n }: {\n messenger: AuthenticationControllerMessenger;\n state?: AuthenticationControllerState;\n config?: Partial<ControllerConfig>;\n /**\n * Not using the Messaging System as we\n * do not want to tie this strictly to extension\n */\n metametrics: MetaMetricsAuth;\n }) {\n super({\n messenger,\n metadata,\n name: controllerName,\n state: { ...defaultState, ...state },\n });\n\n if (!metametrics) {\n throw new Error('`metametrics` field is required');\n }\n\n this.#config = {\n ...this.#config,\n ...config,\n };\n\n this.#metametrics = metametrics;\n\n this.#auth = new JwtBearerAuth(\n {\n env: this.#config.env,\n platform: metametrics.agent,\n type: AuthType.SRP,\n },\n {\n storage: {\n getLoginResponse: this.#getLoginResponseFromState.bind(this),\n setLoginResponse: this.#setLoginResponseToState.bind(this),\n },\n signing: {\n getIdentifier: this.#getPublicKey.bind(this),\n signMessage: this.#signMessage.bind(this),\n },\n getLoginTag: this.#getLoginTag.bind(this),\n getLoginIdentifierType: this.#getLoginIdentifierType.bind(this),\n metametrics: this.#metametrics,\n },\n );\n\n this.#keyringController.setupLockedStateSubscriptions();\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n }\n\n async #getLoginResponseFromState(\n entropySourceId?: string,\n ): Promise<LoginResponse | null> {\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n if (!this.state.srpSessionData?.[resolvedId]) {\n return null;\n }\n return this.state.srpSessionData[resolvedId];\n }\n\n async #setLoginResponseToState(\n loginResponse: LoginResponse,\n entropySourceId?: string,\n ) {\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n const metaMetricsId = await this.#metametrics.getMetaMetricsId();\n this.update((state) => {\n state.isSignedIn = true;\n if (!state.srpSessionData) {\n state.srpSessionData = {};\n }\n state.srpSessionData[resolvedId] = {\n ...loginResponse,\n profile: {\n ...loginResponse.profile,\n metaMetricsId,\n },\n };\n });\n }\n\n #assertIsUnlocked(methodName: string): void {\n if (!this.#isUnlocked) {\n throw new Error(`${methodName} - unable to proceed, wallet is locked`);\n }\n }\n\n /**\n * Reads the HD keyring entropy source IDs from KeyringController.\n *\n * @returns The HD keyring metadata IDs, primary first.\n */\n #getHdKeyringEntropySourceIds(): string[] {\n const { keyrings } = this.messenger.call('KeyringController:getState');\n return getHdKeyringEntropySourceIds(keyrings);\n }\n\n /**\n * Resolves the primary SRP's entropy source ID from KeyringController rather\n * than the message-signing snap, so callers like `getBearerToken()` are not\n * blocked on snap boot.\n *\n * @returns The primary HD keyring metadata ID.\n * @throws If no HD keyring is available; callers must only resolve while\n * the wallet is unlocked.\n */\n #getPrimaryEntropySourceId(): string {\n const { keyrings } = this.messenger.call('KeyringController:getState');\n return getPrimaryHdKeyringEntropySourceId(keyrings);\n }\n\n /**\n * Resolves the SRP login tag for `raw_message`.\n *\n * - `primary` for the first HD entropy source\n * - `secondary` for any other entropy source\n *\n * @param entropySourceId - Entropy source for this login attempt.\n * @returns The login tag to append to the signed message.\n */\n async #getLoginTag(entropySourceId?: string): Promise<SrpLoginTag> {\n const primaryEntropySourceId = this.#getPrimaryEntropySourceId();\n const resolvedId = entropySourceId ?? primaryEntropySourceId;\n\n return resolvedId === primaryEntropySourceId ? 'primary' : 'secondary';\n }\n\n /**\n * Resolves metametrics `identifier_type` for `/srp/login`\n * (`SRP` | `GOOGLE` | `APPLE` | `TELEGRAM`).\n *\n * This is the auth method for the entropy source, independent of\n * {@link SrpLoginTag} (`primary` / `secondary`).\n *\n * SeedlessOnboarding currently exposes a single vault-level\n * `authConnection`, which always backs the primary entropy source. Non-\n * primary sources therefore return `SRP`. If social identities become\n * per-entropy later, resolve from that metadata instead of assuming\n * primary === social.\n *\n * Soft-fails to `SRP` when SeedlessOnboarding is not registered.\n *\n * @param entropySourceId - Entropy source for this login attempt.\n * @returns The login identifier type.\n */\n async #getLoginIdentifierType(\n entropySourceId?: string,\n ): Promise<LoginIdentifierType> {\n const primaryEntropySourceId = this.#getPrimaryEntropySourceId();\n const resolvedId = entropySourceId ?? primaryEntropySourceId;\n\n // Social vault authConnection is only associated with the primary source.\n if (resolvedId !== primaryEntropySourceId) {\n return 'SRP';\n }\n\n return this.#resolveSocialIdentifierType();\n }\n\n /**\n * Maps `SeedlessOnboardingController.state.authConnection` to a login\n * identifier type when a social vault is present.\n *\n * Returns `SRP` if there is no vault, the provider is unrecognized, or\n * SeedlessOnboardingController is unavailable on the messenger.\n *\n * @returns The social provider identifier type, or `SRP`.\n */\n #resolveSocialIdentifierType(): LoginIdentifierType {\n try {\n const { vault, authConnection } = this.messenger.call(\n 'SeedlessOnboardingController:getState',\n );\n if (vault === null || vault === undefined) {\n return 'SRP';\n }\n\n // Match provider strings from SeedlessOnboarding state rather than\n // importing AuthConnection — a value import would load that package\n // (and its heavy deps) whenever this controller is imported.\n switch (authConnection) {\n case 'google':\n return 'GOOGLE';\n case 'apple':\n return 'APPLE';\n case 'telegram':\n return 'TELEGRAM';\n default:\n return 'SRP';\n }\n } catch {\n return 'SRP';\n }\n }\n\n public async performSignIn(): Promise<string[]> {\n this.#assertIsUnlocked('performSignIn');\n\n const epochAtStart = this.#profilePairingRequestEpoch;\n const entropySourceIds = this.#getHdKeyringEntropySourceIds();\n const accessTokens: string[] = [];\n\n // We iterate sequentially in order to be sure that the first entry\n // is the primary SRP LoginResponse.\n for (const entropySourceId of entropySourceIds) {\n const accessToken = await this.#auth.getAccessToken(entropySourceId);\n accessTokens.push(accessToken);\n }\n\n if (entropySourceIds.length < 2) {\n // Single-SRP wallet: nothing to pair.\n this.#tryClearNeedsProfilePairing(epochAtStart);\n } else {\n // Pair failures must not break sign-in; the gate stays `true` for retry.\n try {\n await this.#doPair(accessTokens, epochAtStart);\n } catch {\n // noop\n }\n }\n\n return accessTokens;\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 */\n public requestProfilePairing(): void {\n this.#profilePairingRequestEpoch += 1;\n if (!this.state.needsProfilePairing) {\n this.update((state) => {\n state.needsProfilePairing = true;\n });\n }\n }\n\n /**\n * Clears `needsProfilePairing` only if no `requestProfilePairing` call\n * landed since `epochAtStart` was captured. Prevents `performSignIn`\n * from silently overwriting a concurrent rearm.\n *\n * @param epochAtStart - Epoch value captured at the start of `performSignIn`.\n */\n #tryClearNeedsProfilePairing(epochAtStart: number): void {\n if (this.#profilePairingRequestEpoch !== epochAtStart) {\n return;\n }\n if (this.state.needsProfilePairing) {\n this.update((state) => {\n state.needsProfilePairing = false;\n });\n }\n }\n\n /**\n * Pairs all SRPs via `POST /profile/pair`, propagates the canonical\n * profile ID, clears `needsProfilePairing`, and emits\n * `AuthenticationController:profileSignIn` when the canonical changes or\n * new aliases are returned. Throws on failure.\n *\n * @param accessTokens - Per-SRP access tokens, primary first.\n * @param epochAtStart - Pairing-request epoch captured by the caller.\n * Used to skip the gate clear if `requestProfilePairing` ran while the\n * pair API call was in-flight.\n */\n async #doPair(accessTokens: string[], epochAtStart: number): Promise<void> {\n const previousCanonical = this.#getCanonicalProfileId();\n\n const profileAliases = await this.#pairSrpProfiles(accessTokens);\n const newCanonical = this.#getCanonicalProfileId();\n\n // If somehow we cannot compute the new canonical profile ID after pairing,\n // we just return now and do not update the `needsProfilePairing` flag.\n if (!newCanonical) {\n return;\n }\n\n this.#tryClearNeedsProfilePairing(epochAtStart);\n\n const profileIdChanged = previousCanonical !== newCanonical;\n const shouldEmitProfileSignInEvent =\n profileIdChanged || profileAliases.length > 0;\n\n if (shouldEmitProfileSignInEvent) {\n this.messenger.publish('AuthenticationController:profileSignIn', {\n profileId: newCanonical,\n profileAliases,\n profileIdChanged,\n });\n }\n }\n\n async #pairSrpProfiles(accessTokens: string[]): Promise<ProfileAlias[]> {\n if (accessTokens.length < 2) {\n return [];\n }\n const primaryAccessToken = accessTokens[0]; // Associated with primary SRP.\n const {\n profileAliases,\n profile: { canonicalProfileId },\n } = await this.#auth.pairSrpProfiles(accessTokens, primaryAccessToken);\n this.#propagateCanonical(canonicalProfileId);\n return profileAliases;\n }\n\n #propagateCanonical(canonicalProfileId: string): void {\n const { srpSessionData } = this.state;\n if (!srpSessionData) {\n return;\n }\n\n this.update((state) => {\n for (const entry of Object.values(state.srpSessionData ?? {})) {\n if (entry?.profile) {\n entry.profile.canonicalProfileId = canonicalProfileId;\n }\n }\n });\n }\n\n /**\n * Returns the canonical profile id from the primary SRP's cached session.\n * Returns `null` when no session exists yet for the primary SRP.\n *\n * Always reads from the primary SRP because the canonical is shared across\n * all paired SRPs after `#propagateCanonical`.\n *\n * @returns The canonical profile id, or `null` if unavailable.\n */\n #getCanonicalProfileId(): string | null {\n const primaryEntropySourceId = this.#getPrimaryEntropySourceId();\n return (\n this.state.srpSessionData?.[primaryEntropySourceId]?.profile\n ?.canonicalProfileId ?? null\n );\n }\n\n public performSignOut(): void {\n this.update((state) => {\n state.isSignedIn = false;\n state.srpSessionData = undefined;\n });\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 */\n public async getBearerToken(entropySourceId?: string): Promise<string> {\n this.#assertIsUnlocked('getBearerToken');\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n return await this.#auth.getAccessToken(resolvedId);\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 */\n public async getSessionProfile(\n entropySourceId?: string,\n ): Promise<UserProfile> {\n this.#assertIsUnlocked('getSessionProfile');\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n return await this.#auth.getUserProfile(resolvedId);\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 */\n public async refreshCanonicalProfileId(): Promise<string> {\n this.#assertIsUnlocked('refreshCanonicalProfileId');\n\n const primaryEntropySourceId = this.#getPrimaryEntropySourceId();\n this.#invalidateSrpSession(primaryEntropySourceId);\n await this.#auth.getAccessToken(primaryEntropySourceId);\n\n const canonical = this.#getCanonicalProfileId();\n if (!canonical) {\n throw new Error(\n 'refreshCanonicalProfileId - Unable to resolve canonical profile ID',\n );\n }\n\n this.#propagateCanonical(canonical);\n return canonical;\n }\n\n #invalidateSrpSession(entropySourceId: string): void {\n this.update((state) => {\n const entry = state.srpSessionData?.[entropySourceId];\n if (entry?.profile) {\n // Setting canonicalProfileId to '' forces a re-fetch on the next\n // #getAuthSession call. The falsy check (!auth.profile.canonicalProfileId)\n // treats '' the same as undefined/null — all signal an invalid session.\n entry.profile.canonicalProfileId = '';\n }\n });\n }\n\n public async getUserProfileLineage(\n entropySourceId?: string,\n ): Promise<UserProfileLineage> {\n this.#assertIsUnlocked('getUserProfileLineage');\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n return await this.#auth.getUserProfileLineage(resolvedId);\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 */\n public async getCustomerServiceToken(\n entropySourceId?: string,\n ): Promise<string> {\n this.#assertIsUnlocked('getCustomerServiceToken');\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n return await this.#auth.getCustomerServiceToken(resolvedId);\n }\n\n public isSignedIn(): boolean {\n return this.state.isSignedIn;\n }\n\n /**\n * Reads the BIP-39 seed for an HD entropy source from KeyringController.\n *\n * @param entropySourceId - Entropy source ID. Defaults to the primary HD\n * keyring.\n * @returns The HD keyring seed.\n */\n async #getHdKeyringSeed(entropySourceId?: string): Promise<Uint8Array> {\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n return getHdKeyringSeed(this.messenger, resolvedId);\n }\n\n /**\n * Returns the message-signing public key via native SIP-6 derivation\n * (same key as `@metamask/message-signing-snap` with empty salt).\n *\n * @param entropySourceId - The entropy source ID used to derive the key,\n * when multiple sources are available (Multi-SRP).\n * @returns The public key hex.\n */\n async #getPublicKey(entropySourceId?: string): Promise<string> {\n this.#assertIsUnlocked('#getPublicKey');\n const seed = await this.#getHdKeyringSeed(entropySourceId);\n return getMessageSigningPublicKey(seed);\n }\n\n #_signMessageCache: Record<string, string> = {};\n\n /**\n * Builds a cache key scoped to a specific entropy source, so each SRP's\n * signature stays isolated (same pattern as `UserStorageController`).\n *\n * When `entropySourceId` is omitted (primary SRP), it is resolved to the\n * primary HD keyring's metadata ID rather than a stable literal. Because that\n * ID is randomly regenerated whenever the vault is recreated (e.g. on\n * restore), the cached entry is naturally invalidated across vaults — a\n * different SRP can never inherit the previous primary's cached signature.\n *\n * @param message - The tagged message used for signing.\n * @param entropySourceId - The entropy source ID. Omit for the primary SRP.\n * @returns The scoped cache key.\n */\n #scopedCacheKey(\n message: `metamask:${string}`,\n entropySourceId?: string,\n ): string {\n return `${entropySourceId ?? this.#getPrimaryEntropySourceId()}:${message}`;\n }\n\n /**\n * Signs a `metamask:…` message with the native SIP-6 message-signing key.\n *\n * @param message - A specific tagged message to sign.\n * @param entropySourceId - The entropy source ID used to derive the key,\n * when multiple sources are available (Multi-SRP).\n * @returns Compact secp256k1 signature hex.\n */\n async #signMessage(\n message: string,\n entropySourceId?: string,\n ): Promise<string> {\n assertMessageStartsWithMetamask(message);\n this.#assertIsUnlocked('#signMessage');\n\n const cacheKey = this.#scopedCacheKey(message, entropySourceId);\n if (this.#_signMessageCache[cacheKey]) {\n return this.#_signMessageCache[cacheKey];\n }\n\n const seed = await this.#getHdKeyringSeed(entropySourceId);\n const result = await signMessageWithMessageSigningKey(message, seed);\n\n this.#_signMessageCache[cacheKey] = result;\n\n return result;\n }\n}\n"]}