@metamask/profile-sync-controller 29.0.0 → 31.0.0

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