@metamask-previews/profile-sync-controller 29.0.0-preview-3e34650c2 → 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,182 +0,0 @@
1
- import type { AddressBookControllerContactUpdatedEvent, AddressBookControllerContactDeletedEvent, AddressBookControllerActions, AddressBookControllerListAction, AddressBookControllerSetAction, AddressBookControllerDeleteAction } from "@metamask/address-book-controller";
2
- import { BaseController } from "@metamask/base-controller";
3
- import type { ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
4
- import type { TraceCallback } from "@metamask/controller-utils";
5
- import type { KeyringControllerGetStateAction, KeyringControllerLockEvent, KeyringControllerUnlockEvent, KeyringControllerWithKeyringV2UnsafeAction } from "@metamask/keyring-controller";
6
- import type { Messenger } from "@metamask/messenger";
7
- import type { UserStorageGenericFeatureKey, UserStorageGenericPathWithFeatureAndKey, UserStorageGenericPathWithFeatureOnly } from "../../sdk/index.mjs";
8
- import { Env } from "../../sdk/index.mjs";
9
- import type { NativeScrypt } from "../../shared/types/encryption.mjs";
10
- import { EventQueue } from "../../shared/utils/event-queue.mjs";
11
- import type { AuthenticationControllerGetBearerTokenAction, AuthenticationControllerGetSessionProfileAction, AuthenticationControllerIsSignedInAction, AuthenticationControllerPerformSignInAction } from "../authentication/AuthenticationController-method-action-types.mjs";
12
- import { BACKUPANDSYNC_FEATURES } from "./constants.mjs";
13
- import type { UserStorageControllerMethodActions } from "./UserStorageController-method-action-types.mjs";
14
- declare const controllerName = "UserStorageController";
15
- export type UserStorageControllerState = {
16
- /**
17
- * Condition used by UI and to determine if we can use some of the User Storage methods.
18
- */
19
- isBackupAndSyncEnabled: boolean;
20
- /**
21
- * Loading state for the backup and sync update
22
- */
23
- isBackupAndSyncUpdateLoading: boolean;
24
- /**
25
- * Condition used by UI to determine if account syncing is enabled.
26
- */
27
- isAccountSyncingEnabled: boolean;
28
- /**
29
- * Condition used by UI to determine if contact syncing is enabled.
30
- */
31
- isContactSyncingEnabled: boolean;
32
- /**
33
- * Condition used by UI to determine if contact syncing is in progress.
34
- */
35
- isContactSyncingInProgress: boolean;
36
- };
37
- export declare const defaultState: UserStorageControllerState;
38
- type ControllerConfig = {
39
- env: Env;
40
- contactSyncing?: {
41
- /**
42
- * Callback that fires when contact sync updates a contact.
43
- * This is used for analytics.
44
- */
45
- onContactUpdated?: (profileId: string) => void;
46
- /**
47
- * Callback that fires when contact sync deletes a contact.
48
- * This is used for analytics.
49
- */
50
- onContactDeleted?: (profileId: string) => void;
51
- /**
52
- * Callback that fires when an erroneous situation happens during contact sync.
53
- * This is used for analytics.
54
- */
55
- onContactSyncErroneousSituation?: (profileId: string, situationMessage: string, sentryContext?: Record<string, unknown>) => void;
56
- };
57
- };
58
- export type UserStorageControllerGetStateAction = ControllerGetStateAction<typeof controllerName, UserStorageControllerState>;
59
- export type Actions = UserStorageControllerGetStateAction | UserStorageControllerMethodActions;
60
- export type AllowedActions = KeyringControllerGetStateAction | KeyringControllerWithKeyringV2UnsafeAction | AuthenticationControllerGetBearerTokenAction | AuthenticationControllerGetSessionProfileAction | AuthenticationControllerPerformSignInAction | AuthenticationControllerIsSignedInAction | AddressBookControllerListAction | AddressBookControllerSetAction | AddressBookControllerDeleteAction | AddressBookControllerActions;
61
- export type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, UserStorageControllerState>;
62
- export type Events = UserStorageControllerStateChangeEvent;
63
- export type AllowedEvents = KeyringControllerLockEvent | KeyringControllerUnlockEvent | AddressBookControllerContactUpdatedEvent | AddressBookControllerContactDeletedEvent;
64
- export type UserStorageControllerMessenger = Messenger<typeof controllerName, Actions | AllowedActions, Events | AllowedEvents>;
65
- /**
66
- * Reusable controller that allows any team to store synchronized data for a given user.
67
- * These can be settings shared cross MetaMask clients, or data we want to persist when uninstalling/reinstalling.
68
- *
69
- * NOTE:
70
- * - data stored on UserStorage is FULLY encrypted, with the only keys stored/managed on the client.
71
- * - No one can access this data unless they are have the SRP and are able to run the signing snap.
72
- */
73
- export declare class UserStorageController extends BaseController<typeof controllerName, UserStorageControllerState, UserStorageControllerMessenger> {
74
- #private;
75
- eventQueue: EventQueue;
76
- constructor({ messenger, state, config, nativeScryptCrypto, trace, }: {
77
- messenger: UserStorageControllerMessenger;
78
- state?: UserStorageControllerState;
79
- config?: Partial<ControllerConfig>;
80
- nativeScryptCrypto?: NativeScrypt;
81
- trace?: TraceCallback;
82
- });
83
- /**
84
- * Allows retrieval of stored data. Data stored is string formatted.
85
- * Developers can extend the entry path and entry name through the `schema.ts` file.
86
- *
87
- * @param path - string in the form of `${feature}.${key}` that matches schema
88
- * @param entropySourceId - The entropy source ID used to generate the encryption key.
89
- * @returns the decrypted string contents found from user storage (or null if not found)
90
- */
91
- performGetStorage(path: UserStorageGenericPathWithFeatureAndKey, entropySourceId?: string): Promise<string | null>;
92
- /**
93
- * Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings.
94
- * Developers can extend the entry path through the `schema.ts` file.
95
- *
96
- * @param path - string in the form of `${feature}` that matches schema
97
- * @param entropySourceId - The entropy source ID used to generate the encryption key.
98
- * @returns the array of decrypted string contents found from user storage (or null if not found)
99
- */
100
- performGetStorageAllFeatureEntries(path: UserStorageGenericPathWithFeatureOnly, entropySourceId?: string): Promise<string[] | null>;
101
- /**
102
- * Allows storage of user data. Data stored must be string formatted.
103
- * Developers can extend the entry path and entry name through the `schema.ts` file.
104
- *
105
- * @param path - string in the form of `${feature}.${key}` that matches schema
106
- * @param value - The string data you want to store.
107
- * @param entropySourceId - The entropy source ID used to generate the encryption key.
108
- * @returns nothing. NOTE that an error is thrown if fails to store data.
109
- */
110
- performSetStorage(path: UserStorageGenericPathWithFeatureAndKey, value: string, entropySourceId?: string): Promise<void>;
111
- /**
112
- * Allows storage of multiple user data entries for one specific feature. Data stored must be string formatted.
113
- * Developers can extend the entry path through the `schema.ts` file.
114
- *
115
- * @param path - string in the form of `${feature}` that matches schema
116
- * @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs
117
- * @param entropySourceId - The entropy source ID used to generate the encryption key.
118
- * @returns nothing. NOTE that an error is thrown if fails to store data.
119
- */
120
- performBatchSetStorage(path: UserStorageGenericPathWithFeatureOnly, values: [UserStorageGenericFeatureKey, string][], entropySourceId?: string): Promise<void>;
121
- /**
122
- * Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file.
123
- *
124
- * @param path - string in the form of `${feature}.${key}` that matches schema
125
- * @param entropySourceId - The entropy source ID used to generate the encryption key.
126
- * @returns nothing. NOTE that an error is thrown if fails to delete data.
127
- */
128
- performDeleteStorage(path: UserStorageGenericPathWithFeatureAndKey, entropySourceId?: string): Promise<void>;
129
- /**
130
- * Allows deletion of all user data entries for a specific feature.
131
- * Developers can extend the entry path through the `schema.ts` file.
132
- *
133
- * @param path - string in the form of `${feature}` that matches schema
134
- * @param entropySourceId - The entropy source ID used to generate the encryption key.
135
- * @returns nothing. NOTE that an error is thrown if fails to delete data.
136
- */
137
- performDeleteStorageAllFeatureEntries(path: UserStorageGenericPathWithFeatureOnly, entropySourceId?: string): Promise<void>;
138
- /**
139
- * Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted.
140
- * Developers can extend the entry path through the `schema.ts` file.
141
- *
142
- * @param path - string in the form of `${feature}` that matches schema
143
- * @param values - data to store, in the form of an array of entryKey[]
144
- * @param entropySourceId - The entropy source ID used to generate the encryption key.
145
- * @returns nothing. NOTE that an error is thrown if fails to store data.
146
- */
147
- performBatchDeleteStorage(path: UserStorageGenericPathWithFeatureOnly, values: UserStorageGenericFeatureKey[], entropySourceId?: string): Promise<void>;
148
- /**
149
- * Retrieves the storage key, for internal use only!
150
- *
151
- * @returns the storage key
152
- */
153
- getStorageKey(): Promise<string>;
154
- /**
155
- * Flushes the storage key cache.
156
- * CAUTION: This is only public for testing purposes.
157
- * It should not be used in production code.
158
- */
159
- flushStorageKeyCache(): void;
160
- /**
161
- * Lists all the available HD keyring metadata IDs.
162
- * These IDs can be used in a multi-SRP context to segregate data specific to different SRPs.
163
- *
164
- * @returns A promise that resolves to an array of HD keyring metadata IDs.
165
- */
166
- listEntropySources(): Promise<string[]>;
167
- setIsBackupAndSyncFeatureEnabled(feature: keyof typeof BACKUPANDSYNC_FEATURES, enabled: boolean): Promise<void>;
168
- /**
169
- * Sets the isContactSyncingInProgress flag to prevent infinite loops during contact synchronization
170
- *
171
- * @param isContactSyncingInProgress - Whether contact syncing is in progress
172
- */
173
- setIsContactSyncingInProgress(isContactSyncingInProgress: boolean): Promise<void>;
174
- /**
175
- * Syncs the address book list with the user storage address book list.
176
- * This method is used to make sure that the address book list is up-to-date with the user storage address book list and vice-versa.
177
- * It will add new contacts to the address book list, update/merge conflicting contacts and re-upload the results in some cases to the user storage.
178
- */
179
- syncContactsWithUserStorage(): Promise<void>;
180
- }
181
- export {};
182
- //# sourceMappingURL=UserStorageController.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserStorageController.d.mts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wCAAwC,EACxC,wCAAwC,EACxC,4BAA4B,EAC5B,+BAA+B,EAC/B,8BAA8B,EAC9B,iCAAiC,EAClC,0CAA0C;AAC3C,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAC3D,OAAO,KAAK,EACV,wBAAwB,EACxB,0BAA0B,EAE3B,kCAAkC;AACnC,OAAO,KAAK,EACV,aAAa,EAGd,mCAAmC;AACpC,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC5B,0CAA0C,EAC3C,qCAAqC;AACtC,OAAO,KAAK,EAAE,SAAS,EAAE,4BAA4B;AAErD,OAAO,KAAK,EACV,4BAA4B,EAC5B,uCAAuC,EACvC,qCAAqC,EACtC,4BAA2B;AAC5B,OAAO,EAAE,GAAG,EAAe,4BAA2B;AACtD,OAAO,KAA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,EAC7C,KAAK,EAAE,MAAM,EACb,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;IAOhB;;;;;;;;OAQG;IACU,sBAAsB,CACjC,IAAI,EAAE,qCAAqC,EAC3C,MAAM,EAAE,CAAC,4BAA4B,EAAE,MAAM,CAAC,EAAE,EAChD,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;IAOhB;;;;;;OAMG;IACU,oBAAoB,CAC/B,IAAI,EAAE,uCAAuC,EAC7C,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;IAOhB;;;;;;;OAOG;IACU,qCAAqC,CAChD,IAAI,EAAE,qCAAqC,EAC3C,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;IAOhB;;;;;;;;OAQG;IACU,yBAAyB,CACpC,IAAI,EAAE,qCAAqC,EAC3C,MAAM,EAAE,4BAA4B,EAAE,EACtC,eAAe,CAAC,EAAE,MAAM,GACvB,OAAO,CAAC,IAAI,CAAC;IAOhB;;;;OAIG;IACU,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAI7C;;;;OAIG;IACI,oBAAoB,IAAI,IAAI;IAInC;;;;;OAKG;IACG,kBAAkB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IA2FhC,gCAAgC,CAC3C,OAAO,EAAE,MAAM,OAAO,sBAAsB,EAC5C,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC;IA6ChB;;;;OAIG;IACG,6BAA6B,CACjC,0BAA0B,EAAE,OAAO,GAClC,OAAO,CAAC,IAAI,CAAC;IAMhB;;;;OAIG;IACG,2BAA2B,IAAI,OAAO,CAAC,IAAI,CAAC;CA4BnD"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"UserStorageController.mjs","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":";;;;;;;;;;;;AAQA,OAAO,EAA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AED,MAAM,QAAQ,GAAG,uBAAA,IAAI,+EAAgB,MAApB,IAAI,EACnB,OAA+B,EAC/B,eAAe,CAChB,CAAC;IACF,IAAI,uBAAA,IAAI,+CAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;QACrC,OAAO,uBAAA,IAAI,+CAAkB,CAAC,QAAQ,CAAC,CAAC;IAC1C,CAAC;IAED,MAAM,UAAU,GAAG,eAAe,IAAI,uBAAA,IAAI,0FAA2B,MAA/B,IAAI,CAA6B,CAAC;IACxE,MAAM,IAAI,GAAG,MAAM,gBAAgB,CAAC,IAAI,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IAChE,MAAM,MAAM,GAAG,MAAM,gCAAgC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAErE,uBAAA,IAAI,+CAAkB,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC;IAE1C,OAAO,MAAM,CAAC;AAChB,CAAC,2HA2CC,4BAAqC;IAErC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE;QACpB,KAAK,CAAC,4BAA4B,GAAG,4BAA4B,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type {\n AddressBookControllerContactUpdatedEvent,\n AddressBookControllerContactDeletedEvent,\n AddressBookControllerActions,\n AddressBookControllerListAction,\n AddressBookControllerSetAction,\n AddressBookControllerDeleteAction,\n} from '@metamask/address-book-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type {\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport type {\n TraceCallback,\n TraceContext,\n TraceRequest,\n} from '@metamask/controller-utils';\nimport type {\n KeyringControllerGetStateAction,\n KeyringControllerLockEvent,\n KeyringControllerUnlockEvent,\n KeyringControllerWithKeyringV2UnsafeAction,\n} from '@metamask/keyring-controller';\nimport type { Messenger } from '@metamask/messenger';\n\nimport type {\n UserStorageGenericFeatureKey,\n UserStorageGenericPathWithFeatureAndKey,\n UserStorageGenericPathWithFeatureOnly,\n} from '../../sdk/index.js';\nimport { Env, UserStorage } from '../../sdk/index.js';\nimport type { NativeScrypt } from '../../shared/types/encryption.js';\nimport {\n getHdKeyringEntropySourceIds,\n getPrimaryHdKeyringEntropySourceId,\n} from '../../shared/utils/entropy-source.js';\nimport { EventQueue } from '../../shared/utils/event-queue.js';\nimport { getHdKeyringSeed } from '../../shared/utils/hd-keyring-seed.js';\nimport { signMessageWithMessageSigningKey } from '../../shared/utils/message-signing.js';\nimport type {\n AuthenticationControllerGetBearerTokenAction,\n AuthenticationControllerGetSessionProfileAction,\n AuthenticationControllerIsSignedInAction,\n AuthenticationControllerPerformSignInAction,\n} from '../authentication/AuthenticationController-method-action-types.js';\nimport { BACKUPANDSYNC_FEATURES } from './constants.js';\nimport { syncContactsWithUserStorage } from './contact-syncing/controller-integration.js';\nimport { setupContactSyncingSubscriptions } from './contact-syncing/setup-subscriptions.js';\nimport type { UserStorageControllerMethodActions } from './UserStorageController-method-action-types.js';\n\nconst controllerName = 'UserStorageController';\n\n// State\nexport type UserStorageControllerState = {\n /**\n * Condition used by UI and to determine if we can use some of the User Storage methods.\n */\n isBackupAndSyncEnabled: boolean;\n /**\n * Loading state for the backup and sync update\n */\n isBackupAndSyncUpdateLoading: boolean;\n /**\n * Condition used by UI to determine if account syncing is enabled.\n */\n isAccountSyncingEnabled: boolean;\n /**\n * Condition used by UI to determine if contact syncing is enabled.\n */\n isContactSyncingEnabled: boolean;\n /**\n * Condition used by UI to determine if contact syncing is in progress.\n */\n isContactSyncingInProgress: boolean;\n};\n\nexport const defaultState: UserStorageControllerState = {\n isBackupAndSyncEnabled: true,\n isBackupAndSyncUpdateLoading: false,\n isAccountSyncingEnabled: true,\n isContactSyncingEnabled: true,\n isContactSyncingInProgress: false,\n};\n\nconst metadata: StateMetadata<UserStorageControllerState> = {\n isBackupAndSyncEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n isBackupAndSyncUpdateLoading: {\n includeInStateLogs: false,\n persist: false,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n isAccountSyncingEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n isContactSyncingEnabled: {\n includeInStateLogs: true,\n persist: true,\n includeInDebugSnapshot: true,\n usedInUi: true,\n },\n isContactSyncingInProgress: {\n includeInStateLogs: false,\n persist: false,\n includeInDebugSnapshot: false,\n usedInUi: true,\n },\n};\n\ntype ControllerConfig = {\n env: Env;\n contactSyncing?: {\n /**\n * Callback that fires when contact sync updates a contact.\n * This is used for analytics.\n */\n onContactUpdated?: (profileId: string) => void;\n\n /**\n * Callback that fires when contact sync deletes a contact.\n * This is used for analytics.\n */\n onContactDeleted?: (profileId: string) => void;\n\n /**\n * Callback that fires when an erroneous situation happens during contact sync.\n * This is used for analytics.\n */\n onContactSyncErroneousSituation?: (\n profileId: string,\n situationMessage: string,\n sentryContext?: Record<string, unknown>,\n ) => void;\n };\n};\n\nconst MESSENGER_EXPOSED_METHODS = [\n 'performGetStorage',\n 'performGetStorageAllFeatureEntries',\n 'performSetStorage',\n 'performBatchSetStorage',\n 'performDeleteStorage',\n 'performBatchDeleteStorage',\n 'getStorageKey',\n 'performDeleteStorageAllFeatureEntries',\n 'listEntropySources',\n 'setIsBackupAndSyncFeatureEnabled',\n 'setIsContactSyncingInProgress',\n 'syncContactsWithUserStorage',\n] as const;\n\nexport type UserStorageControllerGetStateAction = ControllerGetStateAction<\n typeof controllerName,\n UserStorageControllerState\n>;\nexport type Actions =\n | UserStorageControllerGetStateAction\n | UserStorageControllerMethodActions;\n\nexport type AllowedActions =\n // Keyring Requests\n | KeyringControllerGetStateAction\n | KeyringControllerWithKeyringV2UnsafeAction\n // Auth Requests\n | AuthenticationControllerGetBearerTokenAction\n | AuthenticationControllerGetSessionProfileAction\n | AuthenticationControllerPerformSignInAction\n | AuthenticationControllerIsSignedInAction\n // Contact Syncing\n | AddressBookControllerListAction\n | AddressBookControllerSetAction\n | AddressBookControllerDeleteAction\n | AddressBookControllerActions;\n\n// Messenger events\nexport type UserStorageControllerStateChangeEvent = ControllerStateChangeEvent<\n typeof controllerName,\n UserStorageControllerState\n>;\n\nexport type Events = UserStorageControllerStateChangeEvent;\n\nexport type AllowedEvents =\n | KeyringControllerLockEvent\n | KeyringControllerUnlockEvent\n // Address Book Events\n | AddressBookControllerContactUpdatedEvent\n | AddressBookControllerContactDeletedEvent;\n\n// Messenger\nexport type UserStorageControllerMessenger = Messenger<\n typeof controllerName,\n Actions | AllowedActions,\n Events | AllowedEvents\n>;\n\n/**\n * Reusable controller that allows any team to store synchronized data for a given user.\n * These can be settings shared cross MetaMask clients, or data we want to persist when uninstalling/reinstalling.\n *\n * NOTE:\n * - data stored on UserStorage is FULLY encrypted, with the only keys stored/managed on the client.\n * - No one can access this data unless they are have the SRP and are able to run the signing snap.\n */\nexport class UserStorageController extends BaseController<\n typeof controllerName,\n UserStorageControllerState,\n UserStorageControllerMessenger\n> {\n readonly #userStorage: UserStorage;\n\n readonly #auth = {\n getProfileId: async (entropySourceId?: string) => {\n const sessionProfile = await this.messenger.call(\n 'AuthenticationController:getSessionProfile',\n entropySourceId,\n );\n return sessionProfile?.profileId;\n },\n isSignedIn: () => {\n return this.messenger.call('AuthenticationController:isSignedIn');\n },\n signIn: async () => {\n return await this.messenger.call(\n 'AuthenticationController:performSignIn',\n );\n },\n };\n\n readonly #config: ControllerConfig = {\n env: Env.PRD,\n };\n\n readonly #trace: TraceCallback;\n\n #isUnlocked = false;\n\n // Both caches are keyed by `${entropySourceId}:${message}` (the primary SRP\n // resolves to its HD keyring metadata ID) so two SRPs that transiently\n // resolve to the same `profileId` can never share a cached storage key /\n // signature and leak data across each other's user storage.\n #storageKeyCache: Record<string, string> = {};\n\n #signMessageCache: Record<string, string> = {};\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 readonly #nativeScryptCrypto: NativeScrypt | undefined = undefined;\n\n eventQueue = new EventQueue();\n\n constructor({\n messenger,\n state,\n config,\n nativeScryptCrypto,\n trace,\n }: {\n messenger: UserStorageControllerMessenger;\n state?: UserStorageControllerState;\n config?: Partial<ControllerConfig>;\n nativeScryptCrypto?: NativeScrypt;\n trace?: TraceCallback;\n }) {\n super({\n messenger,\n metadata,\n name: controllerName,\n state: { ...defaultState, ...state },\n });\n\n this.#config = {\n ...this.#config,\n ...config,\n };\n this.#trace =\n trace ??\n (async <ReturnType>(\n _request: TraceRequest,\n fn?: (context?: TraceContext) => ReturnType,\n ): Promise<ReturnType> => {\n if (!fn) {\n return undefined as ReturnType;\n }\n return await Promise.resolve(fn());\n });\n\n this.#userStorage = new UserStorage(\n {\n env: this.#config.env,\n auth: {\n getAccessToken: (entropySourceId?: string) =>\n this.messenger.call(\n 'AuthenticationController:getBearerToken',\n entropySourceId,\n ),\n getUserProfile: async (entropySourceId?: string) => {\n return await this.messenger.call(\n 'AuthenticationController:getSessionProfile',\n entropySourceId,\n );\n },\n signMessage: (message: string, entropySourceId?: string) =>\n this.#signMessage(message, entropySourceId),\n },\n },\n {\n storage: {\n getStorageKey: async (message, entropySourceId) => {\n // No derived key can exist while locked (the KeyringController\n // clears its keyrings on lock, so the scope is unresolvable).\n if (!this.#isUnlocked) {\n return null;\n }\n return (\n this.#storageKeyCache[\n this.#scopedCacheKey(message, entropySourceId)\n ] ?? null\n );\n },\n // Only ever reached after a successful signature, i.e. while unlocked.\n setStorageKey: async (message, key, entropySourceId) => {\n this.#storageKeyCache[\n this.#scopedCacheKey(message, entropySourceId)\n ] = key;\n },\n },\n },\n );\n\n this.messenger.registerMethodActionHandlers(\n this,\n MESSENGER_EXPOSED_METHODS,\n );\n\n this.#keyringController.setupLockedStateSubscriptions();\n this.#nativeScryptCrypto = nativeScryptCrypto;\n\n // Contact Syncing\n setupContactSyncingSubscriptions({\n getUserStorageControllerInstance: () => this,\n getMessenger: () => this.messenger,\n trace: this.#trace,\n });\n }\n\n /**\n * Allows retrieval of stored data. Data stored is string formatted.\n * Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns the decrypted string contents found from user storage (or null if not found)\n */\n public async performGetStorage(\n path: UserStorageGenericPathWithFeatureAndKey,\n entropySourceId?: string,\n ): Promise<string | null> {\n return await this.#userStorage.getItem(path, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n entropySourceId,\n });\n }\n\n /**\n * Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns the array of decrypted string contents found from user storage (or null if not found)\n */\n public async performGetStorageAllFeatureEntries(\n path: UserStorageGenericPathWithFeatureOnly,\n entropySourceId?: string,\n ): Promise<string[] | null> {\n return await this.#userStorage.getAllFeatureItems(path, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n entropySourceId,\n });\n }\n\n /**\n * Allows storage of user data. Data stored must be string formatted.\n * Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @param value - The string data you want to store.\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\n public async performSetStorage(\n path: UserStorageGenericPathWithFeatureAndKey,\n value: string,\n entropySourceId?: string,\n ): Promise<void> {\n return await this.#userStorage.setItem(path, value, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n entropySourceId,\n });\n }\n\n /**\n * Allows storage of multiple user data entries for one specific feature. Data stored must be string formatted.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\n public async performBatchSetStorage(\n path: UserStorageGenericPathWithFeatureOnly,\n values: [UserStorageGenericFeatureKey, string][],\n entropySourceId?: string,\n ): Promise<void> {\n return await this.#userStorage.batchSetItems(path, values, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n entropySourceId,\n });\n }\n\n /**\n * Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}.${key}` that matches schema\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to delete data.\n */\n public async performDeleteStorage(\n path: UserStorageGenericPathWithFeatureAndKey,\n entropySourceId?: string,\n ): Promise<void> {\n return await this.#userStorage.deleteItem(path, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n entropySourceId,\n });\n }\n\n /**\n * Allows deletion of all user data entries for a specific feature.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to delete data.\n */\n public async performDeleteStorageAllFeatureEntries(\n path: UserStorageGenericPathWithFeatureOnly,\n entropySourceId?: string,\n ): Promise<void> {\n return await this.#userStorage.deleteAllFeatureItems(path, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n entropySourceId,\n });\n }\n\n /**\n * Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted.\n * Developers can extend the entry path through the `schema.ts` file.\n *\n * @param path - string in the form of `${feature}` that matches schema\n * @param values - data to store, in the form of an array of entryKey[]\n * @param entropySourceId - The entropy source ID used to generate the encryption key.\n * @returns nothing. NOTE that an error is thrown if fails to store data.\n */\n public async performBatchDeleteStorage(\n path: UserStorageGenericPathWithFeatureOnly,\n values: UserStorageGenericFeatureKey[],\n entropySourceId?: string,\n ): Promise<void> {\n return await this.#userStorage.batchDeleteItems(path, values, {\n nativeScryptCrypto: this.#nativeScryptCrypto,\n entropySourceId,\n });\n }\n\n /**\n * Retrieves the storage key, for internal use only!\n *\n * @returns the storage key\n */\n public async getStorageKey(): Promise<string> {\n return await this.#userStorage.getStorageKey();\n }\n\n /**\n * Flushes the storage key cache.\n * CAUTION: This is only public for testing purposes.\n * It should not be used in production code.\n */\n public flushStorageKeyCache(): void {\n this.#storageKeyCache = {};\n }\n\n /**\n * Lists all the available HD keyring metadata IDs.\n * These IDs can be used in a multi-SRP context to segregate data specific to different SRPs.\n *\n * @returns A promise that resolves to an array of HD keyring metadata IDs.\n */\n async listEntropySources(): Promise<string[]> {\n if (!this.#isUnlocked) {\n throw new Error(\n 'listEntropySources - unable to list entropy sources, wallet is locked',\n );\n }\n\n return this.#getHdKeyringEntropySourceIds();\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, used to scope the primary's\n * cache entries. The ID is randomly regenerated whenever the vault is\n * recreated (e.g. on restore), so a new primary can never inherit a previous\n * vault's cached key.\n *\n * @returns The primary HD keyring metadata ID.\n * @throws If no HD keyring is available; callers must only resolve the scope\n * while the wallet is unlocked.\n */\n #getPrimaryEntropySourceId(): string {\n const { keyrings } = this.messenger.call('KeyringController:getState');\n return getPrimaryHdKeyringEntropySourceId(keyrings);\n }\n\n /**\n * Builds a cache key scoped to a specific entropy source, so each SRP's\n * signature/storage key derivation stays isolated even when two SRPs\n * transiently resolve to the same `profileId` (see `#storageKeyCache`).\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 key.\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 * (same key as `@metamask/message-signing-snap` with empty salt).\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 if (!this.#isUnlocked) {\n throw new Error('#signMessage - unable to proceed, wallet is locked');\n }\n\n const cacheKey = this.#scopedCacheKey(\n message as `metamask:${string}`,\n entropySourceId,\n );\n if (this.#signMessageCache[cacheKey]) {\n return this.#signMessageCache[cacheKey];\n }\n\n const resolvedId = entropySourceId ?? this.#getPrimaryEntropySourceId();\n const seed = await getHdKeyringSeed(this.messenger, resolvedId);\n const result = await signMessageWithMessageSigningKey(message, seed);\n\n this.#signMessageCache[cacheKey] = result;\n\n return result;\n }\n\n public async setIsBackupAndSyncFeatureEnabled(\n feature: keyof typeof BACKUPANDSYNC_FEATURES,\n enabled: boolean,\n ): Promise<void> {\n try {\n this.#setIsBackupAndSyncUpdateLoading(true);\n\n if (enabled) {\n // If any of the features are enabled, we need to ensure the user is signed in\n const isSignedIn = this.#auth.isSignedIn();\n if (!isSignedIn) {\n await this.#auth.signIn();\n }\n }\n\n this.update((state) => {\n if (feature === BACKUPANDSYNC_FEATURES.main) {\n state.isBackupAndSyncEnabled = enabled;\n }\n\n if (feature === BACKUPANDSYNC_FEATURES.accountSyncing) {\n state.isAccountSyncingEnabled = enabled;\n }\n\n if (feature === BACKUPANDSYNC_FEATURES.contactSyncing) {\n state.isContactSyncingEnabled = enabled;\n }\n });\n } catch (e) {\n // istanbul ignore next\n const errorMessage = e instanceof Error ? e.message : JSON.stringify(e);\n // istanbul ignore next\n throw new Error(\n `${controllerName} - failed to ${enabled ? 'enable' : 'disable'} ${feature} - ${errorMessage}`,\n );\n } finally {\n this.#setIsBackupAndSyncUpdateLoading(false);\n }\n }\n\n #setIsBackupAndSyncUpdateLoading(\n isBackupAndSyncUpdateLoading: boolean,\n ): void {\n this.update((state) => {\n state.isBackupAndSyncUpdateLoading = isBackupAndSyncUpdateLoading;\n });\n }\n\n /**\n * Sets the isContactSyncingInProgress flag to prevent infinite loops during contact synchronization\n *\n * @param isContactSyncingInProgress - Whether contact syncing is in progress\n */\n async setIsContactSyncingInProgress(\n isContactSyncingInProgress: boolean,\n ): Promise<void> {\n this.update((state) => {\n state.isContactSyncingInProgress = isContactSyncingInProgress;\n });\n }\n\n /**\n * Syncs the address book list with the user storage address book list.\n * This method is used to make sure that the address book list is up-to-date with the user storage address book list and vice-versa.\n * It will add new contacts to the address book list, update/merge conflicting contacts and re-upload the results in some cases to the user storage.\n */\n async syncContactsWithUserStorage(): Promise<void> {\n const profileId = await this.#auth.getProfileId();\n\n const config = {\n onContactUpdated: () => {\n this.#config?.contactSyncing?.onContactUpdated?.(profileId);\n },\n onContactDeleted: () => {\n this.#config?.contactSyncing?.onContactDeleted?.(profileId);\n },\n onContactSyncErroneousSituation: (\n errorMessage: string,\n sentryContext?: Record<string, unknown>,\n ) => {\n this.#config?.contactSyncing?.onContactSyncErroneousSituation?.(\n profileId,\n errorMessage,\n sentryContext,\n );\n },\n };\n\n await syncContactsWithUserStorage(config, {\n getMessenger: () => this.messenger,\n getUserStorageControllerInstance: () => this,\n trace: this.#trace,\n });\n }\n}\n"]}
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TraceName = exports.BACKUPANDSYNC_FEATURES = void 0;
4
- exports.BACKUPANDSYNC_FEATURES = {
5
- main: 'main',
6
- accountSyncing: 'accountSyncing',
7
- contactSyncing: 'contactSyncing',
8
- };
9
- /**
10
- * Trace names for UserStorage syncing operations
11
- */
12
- exports.TraceName = {
13
- // Contact syncing traces
14
- ContactSyncFull: 'Contact Sync Full',
15
- ContactSyncSaveBatch: 'Contact Sync Save Batch',
16
- ContactSyncUpdateRemote: 'Contact Sync Update Remote',
17
- ContactSyncDeleteRemote: 'Contact Sync Delete Remote',
18
- };
19
- //# sourceMappingURL=constants.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../../../src/controllers/user-storage/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,sBAAsB,GAAG;IACpC,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE,gBAAgB;CACxB,CAAC;AAEX;;GAEG;AACU,QAAA,SAAS,GAAG;IACvB,yBAAyB;IACzB,eAAe,EAAE,mBAAmB;IACpC,oBAAoB,EAAE,yBAAyB;IAC/C,uBAAuB,EAAE,4BAA4B;IACrD,uBAAuB,EAAE,4BAA4B;CAC7C,CAAC","sourcesContent":["export const BACKUPANDSYNC_FEATURES = {\n main: 'main',\n accountSyncing: 'accountSyncing',\n contactSyncing: 'contactSyncing',\n} as const;\n\n/**\n * Trace names for UserStorage syncing operations\n */\nexport const TraceName = {\n // Contact syncing traces\n ContactSyncFull: 'Contact Sync Full',\n ContactSyncSaveBatch: 'Contact Sync Save Batch',\n ContactSyncUpdateRemote: 'Contact Sync Update Remote',\n ContactSyncDeleteRemote: 'Contact Sync Delete Remote',\n} as const;\n"]}
@@ -1,15 +0,0 @@
1
- export declare const BACKUPANDSYNC_FEATURES: {
2
- readonly main: "main";
3
- readonly accountSyncing: "accountSyncing";
4
- readonly contactSyncing: "contactSyncing";
5
- };
6
- /**
7
- * Trace names for UserStorage syncing operations
8
- */
9
- export declare const TraceName: {
10
- readonly ContactSyncFull: "Contact Sync Full";
11
- readonly ContactSyncSaveBatch: "Contact Sync Save Batch";
12
- readonly ContactSyncUpdateRemote: "Contact Sync Update Remote";
13
- readonly ContactSyncDeleteRemote: "Contact Sync Delete Remote";
14
- };
15
- //# sourceMappingURL=constants.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../../../src/controllers/user-storage/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;CAMZ,CAAC"}
@@ -1,15 +0,0 @@
1
- export declare const BACKUPANDSYNC_FEATURES: {
2
- readonly main: "main";
3
- readonly accountSyncing: "accountSyncing";
4
- readonly contactSyncing: "contactSyncing";
5
- };
6
- /**
7
- * Trace names for UserStorage syncing operations
8
- */
9
- export declare const TraceName: {
10
- readonly ContactSyncFull: "Contact Sync Full";
11
- readonly ContactSyncSaveBatch: "Contact Sync Save Batch";
12
- readonly ContactSyncUpdateRemote: "Contact Sync Update Remote";
13
- readonly ContactSyncDeleteRemote: "Contact Sync Delete Remote";
14
- };
15
- //# sourceMappingURL=constants.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../../src/controllers/user-storage/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB;;;;CAIzB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;CAMZ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../../src/controllers/user-storage/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,gBAAgB;IAChC,cAAc,EAAE,gBAAgB;CACxB,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,yBAAyB;IACzB,eAAe,EAAE,mBAAmB;IACpC,oBAAoB,EAAE,yBAAyB;IAC/C,uBAAuB,EAAE,4BAA4B;IACrD,uBAAuB,EAAE,4BAA4B;CAC7C,CAAC","sourcesContent":["export const BACKUPANDSYNC_FEATURES = {\n main: 'main',\n accountSyncing: 'accountSyncing',\n contactSyncing: 'contactSyncing',\n} as const;\n\n/**\n * Trace names for UserStorage syncing operations\n */\nexport const TraceName = {\n // Contact syncing traces\n ContactSyncFull: 'Contact Sync Full',\n ContactSyncSaveBatch: 'Contact Sync Save Batch',\n ContactSyncUpdateRemote: 'Contact Sync Update Remote',\n ContactSyncDeleteRemote: 'Contact Sync Delete Remote',\n} as const;\n"]}
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.USER_STORAGE_VERSION = exports.USER_STORAGE_VERSION_KEY = void 0;
4
- /**
5
- * Key for version in User Storage schema
6
- */
7
- exports.USER_STORAGE_VERSION_KEY = 'v';
8
- /**
9
- * Current version of User Storage schema
10
- */
11
- exports.USER_STORAGE_VERSION = '1';
12
- //# sourceMappingURL=constants.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/constants.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,wBAAwB,GAAG,GAAG,CAAC;AAE5C;;GAEG;AACU,QAAA,oBAAoB,GAAG,GAAG,CAAC","sourcesContent":["/**\n * Key for version in User Storage schema\n */\nexport const USER_STORAGE_VERSION_KEY = 'v';\n\n/**\n * Current version of User Storage schema\n */\nexport const USER_STORAGE_VERSION = '1';\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Key for version in User Storage schema
3
- */
4
- export declare const USER_STORAGE_VERSION_KEY = "v";
5
- /**
6
- * Current version of User Storage schema
7
- */
8
- export declare const USER_STORAGE_VERSION = "1";
9
- //# sourceMappingURL=constants.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,wBAAwB,MAAM,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,oBAAoB,MAAM,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../../../src/controllers/user-storage/contact-syncing/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,CAAC","sourcesContent":["/**\n * Key for version in User Storage schema\n */\nexport const USER_STORAGE_VERSION_KEY = 'v';\n\n/**\n * Current version of User Storage schema\n */\nexport const USER_STORAGE_VERSION = '1';\n"]}