@metamask-previews/profile-sync-controller 29.0.0-preview-3866c0ff1 → 29.0.0-preview-e3275932a

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 (548) hide show
  1. package/CHANGELOG.md +0 -1
  2. package/dist/controllers/authentication/AuthenticationController-method-action-types.cjs +7 -0
  3. package/dist/controllers/authentication/AuthenticationController-method-action-types.cjs.map +1 -0
  4. package/dist/controllers/authentication/{AuthenticationController-method-action-types.d.ts → AuthenticationController-method-action-types.d.cts} +2 -2
  5. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.cts.map +1 -0
  6. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.mts +102 -0
  7. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.mts.map +1 -0
  8. package/dist/controllers/authentication/{AuthenticationController-method-action-types.js → AuthenticationController-method-action-types.mjs} +1 -1
  9. package/dist/controllers/authentication/AuthenticationController-method-action-types.mjs.map +1 -0
  10. package/dist/controllers/authentication/AuthenticationController.cjs +489 -0
  11. package/dist/controllers/authentication/AuthenticationController.cjs.map +1 -0
  12. package/dist/controllers/authentication/{AuthenticationController.d.ts → AuthenticationController.d.cts} +10 -10
  13. package/dist/controllers/authentication/AuthenticationController.d.cts.map +1 -0
  14. package/dist/controllers/authentication/AuthenticationController.d.mts +130 -0
  15. package/dist/controllers/authentication/AuthenticationController.d.mts.map +1 -0
  16. package/dist/controllers/authentication/AuthenticationController.mjs +485 -0
  17. package/dist/controllers/authentication/AuthenticationController.mjs.map +1 -0
  18. package/dist/controllers/authentication/index.cjs +35 -0
  19. package/dist/controllers/authentication/index.cjs.map +1 -0
  20. package/dist/controllers/authentication/{index.d.ts → index.d.cts} +5 -5
  21. package/dist/controllers/authentication/index.d.cts.map +1 -0
  22. package/dist/controllers/authentication/index.d.mts +7 -0
  23. package/dist/controllers/authentication/index.d.mts.map +1 -0
  24. package/dist/controllers/authentication/index.mjs +6 -0
  25. package/dist/controllers/authentication/index.mjs.map +1 -0
  26. package/dist/controllers/authentication/mocks/index.cjs +18 -0
  27. package/dist/controllers/authentication/mocks/index.cjs.map +1 -0
  28. package/dist/controllers/authentication/mocks/index.d.cts +2 -0
  29. package/dist/controllers/authentication/mocks/index.d.cts.map +1 -0
  30. package/dist/controllers/authentication/mocks/index.d.mts +2 -0
  31. package/dist/controllers/authentication/mocks/index.d.mts.map +1 -0
  32. package/dist/controllers/authentication/mocks/index.mjs +2 -0
  33. package/dist/controllers/authentication/mocks/index.mjs.map +1 -0
  34. package/dist/controllers/authentication/mocks/mockResponses.cjs +126 -0
  35. package/dist/controllers/authentication/mocks/mockResponses.cjs.map +1 -0
  36. package/dist/controllers/authentication/mocks/{mockResponses.d.ts → mockResponses.d.cts} +1 -1
  37. package/dist/controllers/authentication/mocks/mockResponses.d.cts.map +1 -0
  38. package/dist/controllers/authentication/mocks/mockResponses.d.mts +58 -0
  39. package/dist/controllers/authentication/mocks/mockResponses.d.mts.map +1 -0
  40. package/dist/controllers/authentication/mocks/{mockResponses.js → mockResponses.mjs} +2 -2
  41. package/dist/controllers/authentication/mocks/mockResponses.mjs.map +1 -0
  42. package/dist/controllers/index.cjs +29 -0
  43. package/dist/controllers/index.cjs.map +1 -0
  44. package/dist/controllers/index.d.cts +3 -0
  45. package/dist/controllers/index.d.cts.map +1 -0
  46. package/dist/controllers/index.d.mts +3 -0
  47. package/dist/controllers/index.d.mts.map +1 -0
  48. package/dist/controllers/index.mjs +3 -0
  49. package/dist/controllers/index.mjs.map +1 -0
  50. package/dist/controllers/user-storage/UserStorageController-method-action-types.cjs +7 -0
  51. package/dist/controllers/user-storage/UserStorageController-method-action-types.cjs.map +1 -0
  52. package/dist/controllers/user-storage/{UserStorageController-method-action-types.d.ts → UserStorageController-method-action-types.d.cts} +2 -2
  53. package/dist/controllers/user-storage/UserStorageController-method-action-types.d.cts.map +1 -0
  54. package/dist/controllers/user-storage/UserStorageController-method-action-types.d.mts +137 -0
  55. package/dist/controllers/user-storage/UserStorageController-method-action-types.d.mts.map +1 -0
  56. package/dist/controllers/user-storage/{UserStorageController-method-action-types.js → UserStorageController-method-action-types.mjs} +1 -1
  57. package/dist/controllers/user-storage/UserStorageController-method-action-types.mjs.map +1 -0
  58. package/dist/controllers/user-storage/UserStorageController.cjs +412 -0
  59. package/dist/controllers/user-storage/UserStorageController.cjs.map +1 -0
  60. package/dist/controllers/user-storage/{UserStorageController.d.ts → UserStorageController.d.cts} +14 -14
  61. package/dist/controllers/user-storage/UserStorageController.d.cts.map +1 -0
  62. package/dist/controllers/user-storage/UserStorageController.d.mts +182 -0
  63. package/dist/controllers/user-storage/UserStorageController.d.mts.map +1 -0
  64. package/dist/controllers/user-storage/UserStorageController.mjs +408 -0
  65. package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -0
  66. package/dist/controllers/user-storage/constants.cjs +19 -0
  67. package/dist/controllers/user-storage/constants.cjs.map +1 -0
  68. package/dist/controllers/user-storage/constants.d.cts +15 -0
  69. package/dist/controllers/user-storage/constants.d.cts.map +1 -0
  70. package/dist/controllers/user-storage/constants.d.mts +15 -0
  71. package/dist/controllers/user-storage/constants.d.mts.map +1 -0
  72. package/dist/controllers/user-storage/{constants.js → constants.mjs} +1 -1
  73. package/dist/controllers/user-storage/constants.mjs.map +1 -0
  74. package/dist/controllers/user-storage/contact-syncing/constants.cjs +12 -0
  75. package/dist/controllers/user-storage/contact-syncing/constants.cjs.map +1 -0
  76. package/dist/controllers/user-storage/contact-syncing/{constants.d.ts → constants.d.cts} +1 -1
  77. package/dist/controllers/user-storage/contact-syncing/constants.d.cts.map +1 -0
  78. package/dist/controllers/user-storage/contact-syncing/constants.d.mts +9 -0
  79. package/dist/controllers/user-storage/contact-syncing/constants.d.mts.map +1 -0
  80. package/dist/controllers/user-storage/contact-syncing/{constants.js → constants.mjs} +1 -1
  81. package/dist/controllers/user-storage/contact-syncing/constants.mjs.map +1 -0
  82. package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs +346 -0
  83. package/dist/controllers/user-storage/contact-syncing/controller-integration.cjs.map +1 -0
  84. package/dist/controllers/user-storage/contact-syncing/{controller-integration.d.ts → controller-integration.d.cts} +3 -3
  85. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.cts.map +1 -0
  86. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts +47 -0
  87. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.mts.map +1 -0
  88. package/dist/controllers/user-storage/contact-syncing/{controller-integration.js → controller-integration.mjs} +6 -6
  89. package/dist/controllers/user-storage/contact-syncing/controller-integration.mjs.map +1 -0
  90. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs +50 -0
  91. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.cjs.map +1 -0
  92. package/dist/controllers/user-storage/contact-syncing/{setup-subscriptions.d.ts → setup-subscriptions.d.cts} +2 -2
  93. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.cts.map +1 -0
  94. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts +8 -0
  95. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.mts.map +1 -0
  96. package/dist/controllers/user-storage/contact-syncing/{setup-subscriptions.js → setup-subscriptions.mjs} +4 -4
  97. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.mjs.map +1 -0
  98. package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs +23 -0
  99. package/dist/controllers/user-storage/contact-syncing/sync-utils.cjs.map +1 -0
  100. package/dist/controllers/user-storage/contact-syncing/{sync-utils.d.ts → sync-utils.d.cts} +2 -2
  101. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.cts.map +1 -0
  102. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts +9 -0
  103. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.mts.map +1 -0
  104. package/dist/controllers/user-storage/contact-syncing/{sync-utils.js → sync-utils.mjs} +1 -1
  105. package/dist/controllers/user-storage/contact-syncing/sync-utils.mjs.map +1 -0
  106. package/dist/controllers/user-storage/contact-syncing/types.cjs +3 -0
  107. package/dist/controllers/user-storage/contact-syncing/types.cjs.map +1 -0
  108. package/dist/controllers/user-storage/contact-syncing/{types.d.ts → types.d.cts} +6 -6
  109. package/dist/controllers/user-storage/contact-syncing/types.d.cts.map +1 -0
  110. package/dist/controllers/user-storage/contact-syncing/types.d.mts +37 -0
  111. package/dist/controllers/user-storage/contact-syncing/types.d.mts.map +1 -0
  112. package/dist/controllers/user-storage/contact-syncing/types.mjs +2 -0
  113. package/dist/controllers/user-storage/contact-syncing/types.mjs.map +1 -0
  114. package/dist/controllers/user-storage/contact-syncing/utils.cjs +64 -0
  115. package/dist/controllers/user-storage/contact-syncing/utils.cjs.map +1 -0
  116. package/dist/controllers/user-storage/contact-syncing/{utils.d.ts → utils.d.cts} +3 -3
  117. package/dist/controllers/user-storage/contact-syncing/utils.d.cts.map +1 -0
  118. package/dist/controllers/user-storage/contact-syncing/utils.d.mts +36 -0
  119. package/dist/controllers/user-storage/contact-syncing/utils.d.mts.map +1 -0
  120. package/dist/controllers/user-storage/contact-syncing/{utils.js → utils.mjs} +2 -2
  121. package/dist/controllers/user-storage/contact-syncing/utils.mjs.map +1 -0
  122. package/dist/controllers/user-storage/index.cjs +38 -0
  123. package/dist/controllers/user-storage/index.cjs.map +1 -0
  124. package/dist/controllers/user-storage/{index.d.ts → index.d.cts} +8 -8
  125. package/dist/controllers/user-storage/index.d.cts.map +1 -0
  126. package/dist/controllers/user-storage/index.d.mts +10 -0
  127. package/dist/controllers/user-storage/index.d.mts.map +1 -0
  128. package/dist/controllers/user-storage/index.mjs +9 -0
  129. package/dist/controllers/user-storage/index.mjs.map +1 -0
  130. package/dist/controllers/user-storage/mocks/index.cjs +19 -0
  131. package/dist/controllers/user-storage/mocks/index.cjs.map +1 -0
  132. package/dist/controllers/user-storage/mocks/index.d.cts +3 -0
  133. package/dist/controllers/user-storage/mocks/index.d.cts.map +1 -0
  134. package/dist/controllers/user-storage/mocks/index.d.mts +3 -0
  135. package/dist/controllers/user-storage/mocks/index.d.mts.map +1 -0
  136. package/dist/controllers/user-storage/mocks/index.mjs +3 -0
  137. package/dist/controllers/user-storage/mocks/index.mjs.map +1 -0
  138. package/dist/controllers/user-storage/mocks/mockResponses.cjs +113 -0
  139. package/dist/controllers/user-storage/mocks/mockResponses.cjs.map +1 -0
  140. package/dist/controllers/user-storage/mocks/{mockResponses.d.ts → mockResponses.d.cts} +3 -3
  141. package/dist/controllers/user-storage/mocks/mockResponses.d.cts.map +1 -0
  142. package/dist/controllers/user-storage/mocks/mockResponses.d.mts +66 -0
  143. package/dist/controllers/user-storage/mocks/mockResponses.d.mts.map +1 -0
  144. package/dist/controllers/user-storage/mocks/{mockResponses.js → mockResponses.mjs} +4 -4
  145. package/dist/controllers/user-storage/mocks/mockResponses.mjs.map +1 -0
  146. package/dist/controllers/user-storage/mocks/mockStorage.cjs +36 -0
  147. package/dist/controllers/user-storage/mocks/mockStorage.cjs.map +1 -0
  148. package/dist/controllers/user-storage/mocks/{mockStorage.d.ts → mockStorage.d.cts} +1 -1
  149. package/dist/controllers/user-storage/mocks/mockStorage.d.cts.map +1 -0
  150. package/dist/controllers/user-storage/mocks/mockStorage.d.mts +5 -0
  151. package/dist/controllers/user-storage/mocks/mockStorage.d.mts.map +1 -0
  152. package/dist/controllers/user-storage/mocks/{mockStorage.js → mockStorage.mjs} +3 -3
  153. package/dist/controllers/user-storage/mocks/mockStorage.mjs.map +1 -0
  154. package/dist/controllers/user-storage/types.cjs +3 -0
  155. package/dist/controllers/user-storage/types.cjs.map +1 -0
  156. package/dist/controllers/user-storage/{types.d.ts → types.d.cts} +3 -3
  157. package/dist/controllers/user-storage/types.d.cts.map +1 -0
  158. package/dist/controllers/user-storage/types.d.mts +23 -0
  159. package/dist/controllers/user-storage/types.d.mts.map +1 -0
  160. package/dist/controllers/user-storage/types.mjs +2 -0
  161. package/dist/controllers/user-storage/types.mjs.map +1 -0
  162. package/dist/controllers/user-storage/utils.cjs +32 -0
  163. package/dist/controllers/user-storage/utils.cjs.map +1 -0
  164. package/dist/controllers/user-storage/{utils.d.ts → utils.d.cts} +1 -1
  165. package/dist/controllers/user-storage/utils.d.cts.map +1 -0
  166. package/dist/controllers/user-storage/utils.d.mts +19 -0
  167. package/dist/controllers/user-storage/utils.d.mts.map +1 -0
  168. package/dist/controllers/user-storage/{utils.js → utils.mjs} +1 -1
  169. package/dist/controllers/user-storage/utils.mjs.map +1 -0
  170. package/dist/index.cjs +30 -0
  171. package/dist/index.cjs.map +1 -0
  172. package/dist/index.d.cts +4 -0
  173. package/dist/index.d.cts.map +1 -0
  174. package/dist/index.d.mts +4 -0
  175. package/dist/index.d.mts.map +1 -0
  176. package/dist/index.mjs +4 -0
  177. package/dist/index.mjs.map +1 -0
  178. package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs +114 -0
  179. package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs.map +1 -0
  180. package/dist/sdk/authentication-jwt-bearer/{flow-siwe.d.ts → flow-siwe.d.cts} +2 -2
  181. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.cts.map +1 -0
  182. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts +25 -0
  183. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts.map +1 -0
  184. package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs +110 -0
  185. package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs.map +1 -0
  186. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +290 -0
  187. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +1 -0
  188. package/dist/sdk/authentication-jwt-bearer/{flow-srp.d.ts → flow-srp.d.cts} +5 -5
  189. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +1 -0
  190. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts +44 -0
  191. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +1 -0
  192. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs +263 -0
  193. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +1 -0
  194. package/dist/sdk/authentication-jwt-bearer/services.cjs +400 -0
  195. package/dist/sdk/authentication-jwt-bearer/services.cjs.map +1 -0
  196. package/dist/sdk/authentication-jwt-bearer/{services.d.ts → services.d.cts} +5 -5
  197. package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +1 -0
  198. package/dist/sdk/authentication-jwt-bearer/services.d.mts +105 -0
  199. package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +1 -0
  200. package/dist/sdk/authentication-jwt-bearer/{services.js → services.mjs} +6 -6
  201. package/dist/sdk/authentication-jwt-bearer/services.mjs.map +1 -0
  202. package/dist/sdk/authentication-jwt-bearer/types.cjs +12 -0
  203. package/dist/sdk/authentication-jwt-bearer/types.cjs.map +1 -0
  204. package/dist/sdk/authentication-jwt-bearer/{types.d.ts → types.d.cts} +2 -2
  205. package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +1 -0
  206. package/dist/sdk/authentication-jwt-bearer/types.d.mts +114 -0
  207. package/dist/sdk/authentication-jwt-bearer/types.d.mts.map +1 -0
  208. package/dist/sdk/authentication-jwt-bearer/{types.js → types.mjs} +1 -1
  209. package/dist/sdk/authentication-jwt-bearer/types.mjs.map +1 -0
  210. package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs +27 -0
  211. package/dist/sdk/authentication-jwt-bearer/utils/identifier.cjs.map +1 -0
  212. package/dist/sdk/authentication-jwt-bearer/utils/{identifier.d.ts → identifier.d.cts} +2 -2
  213. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.cts.map +1 -0
  214. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts +13 -0
  215. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.mts.map +1 -0
  216. package/dist/sdk/authentication-jwt-bearer/utils/{identifier.js → identifier.mjs} +2 -2
  217. package/dist/sdk/authentication-jwt-bearer/utils/identifier.mjs.map +1 -0
  218. package/dist/sdk/authentication-jwt-bearer/utils/time.cjs +17 -0
  219. package/dist/sdk/authentication-jwt-bearer/utils/time.cjs.map +1 -0
  220. package/dist/sdk/authentication-jwt-bearer/utils/{time.d.ts → time.d.cts} +1 -1
  221. package/dist/sdk/authentication-jwt-bearer/utils/time.d.cts.map +1 -0
  222. package/dist/sdk/authentication-jwt-bearer/utils/time.d.mts +8 -0
  223. package/dist/sdk/authentication-jwt-bearer/utils/time.d.mts.map +1 -0
  224. package/dist/sdk/authentication-jwt-bearer/utils/{time.js → time.mjs} +1 -1
  225. package/dist/sdk/authentication-jwt-bearer/utils/time.mjs.map +1 -0
  226. package/dist/sdk/authentication.cjs +132 -0
  227. package/dist/sdk/authentication.cjs.map +1 -0
  228. package/dist/sdk/{authentication.d.ts → authentication.d.cts} +9 -9
  229. package/dist/sdk/authentication.d.cts.map +1 -0
  230. package/dist/sdk/authentication.d.mts +38 -0
  231. package/dist/sdk/authentication.d.mts.map +1 -0
  232. package/dist/sdk/authentication.mjs +112 -0
  233. package/dist/sdk/authentication.mjs.map +1 -0
  234. package/dist/sdk/constants.cjs +7 -0
  235. package/dist/sdk/constants.cjs.map +1 -0
  236. package/dist/sdk/{constants.d.ts → constants.d.cts} +1 -1
  237. package/dist/sdk/constants.d.cts.map +1 -0
  238. package/dist/sdk/constants.d.mts +4 -0
  239. package/dist/sdk/constants.d.mts.map +1 -0
  240. package/dist/sdk/{constants.js → constants.mjs} +1 -1
  241. package/dist/sdk/constants.mjs.map +1 -0
  242. package/dist/sdk/errors.cjs +76 -0
  243. package/dist/sdk/errors.cjs.map +1 -0
  244. package/dist/sdk/{errors.d.ts → errors.d.cts} +1 -1
  245. package/dist/sdk/errors.d.cts.map +1 -0
  246. package/dist/sdk/errors.d.mts +34 -0
  247. package/dist/sdk/errors.d.mts.map +1 -0
  248. package/dist/sdk/{errors.js → errors.mjs} +3 -4
  249. package/dist/sdk/errors.mjs.map +1 -0
  250. package/dist/sdk/index.cjs +24 -0
  251. package/dist/sdk/index.cjs.map +1 -0
  252. package/dist/sdk/index.d.cts +8 -0
  253. package/dist/sdk/index.d.cts.map +1 -0
  254. package/dist/sdk/index.d.mts +8 -0
  255. package/dist/sdk/index.d.mts.map +1 -0
  256. package/dist/sdk/index.mjs +8 -0
  257. package/dist/sdk/index.mjs.map +1 -0
  258. package/dist/sdk/mocks/auth.cjs +82 -0
  259. package/dist/sdk/mocks/auth.cjs.map +1 -0
  260. package/dist/sdk/mocks/{auth.d.ts → auth.d.cts} +2 -2
  261. package/dist/sdk/mocks/auth.d.cts.map +1 -0
  262. package/dist/sdk/mocks/auth.d.mts +69 -0
  263. package/dist/sdk/mocks/auth.d.mts.map +1 -0
  264. package/dist/sdk/mocks/{auth.js → auth.mjs} +3 -3
  265. package/dist/sdk/mocks/auth.mjs.map +1 -0
  266. package/dist/sdk/mocks/userstorage.cjs +43 -0
  267. package/dist/sdk/mocks/userstorage.cjs.map +1 -0
  268. package/dist/sdk/mocks/{userstorage.d.ts → userstorage.d.cts} +1 -1
  269. package/dist/sdk/mocks/userstorage.d.cts.map +1 -0
  270. package/dist/sdk/mocks/userstorage.d.mts +10 -0
  271. package/dist/sdk/mocks/userstorage.d.mts.map +1 -0
  272. package/dist/sdk/mocks/{userstorage.js → userstorage.mjs} +5 -5
  273. package/dist/sdk/mocks/userstorage.mjs.map +1 -0
  274. package/dist/sdk/user-storage.cjs +386 -0
  275. package/dist/sdk/user-storage.cjs.map +1 -0
  276. package/dist/sdk/{user-storage.d.ts → user-storage.d.cts} +5 -5
  277. package/dist/sdk/user-storage.d.cts.map +1 -0
  278. package/dist/sdk/user-storage.d.mts +47 -0
  279. package/dist/sdk/user-storage.d.mts.map +1 -0
  280. package/dist/sdk/user-storage.mjs +358 -0
  281. package/dist/sdk/user-storage.mjs.map +1 -0
  282. package/dist/sdk/utils/eip-6963-metamask-provider.cjs +70 -0
  283. package/dist/sdk/utils/eip-6963-metamask-provider.cjs.map +1 -0
  284. package/dist/sdk/utils/{eip-6963-metamask-provider.d.ts → eip-6963-metamask-provider.d.cts} +2 -2
  285. package/dist/sdk/utils/eip-6963-metamask-provider.d.cts.map +1 -0
  286. package/dist/sdk/utils/eip-6963-metamask-provider.d.mts +25 -0
  287. package/dist/sdk/utils/eip-6963-metamask-provider.d.mts.map +1 -0
  288. package/dist/sdk/utils/{eip-6963-metamask-provider.js → eip-6963-metamask-provider.mjs} +1 -1
  289. package/dist/sdk/utils/eip-6963-metamask-provider.mjs.map +1 -0
  290. package/dist/sdk/utils/messaging-signing-snap-requests.cjs +96 -0
  291. package/dist/sdk/utils/messaging-signing-snap-requests.cjs.map +1 -0
  292. package/dist/sdk/utils/{messaging-signing-snap-requests.d.ts → messaging-signing-snap-requests.d.cts} +2 -2
  293. package/dist/sdk/utils/messaging-signing-snap-requests.d.cts.map +1 -0
  294. package/dist/sdk/utils/messaging-signing-snap-requests.d.mts +41 -0
  295. package/dist/sdk/utils/messaging-signing-snap-requests.d.mts.map +1 -0
  296. package/dist/sdk/utils/{messaging-signing-snap-requests.js → messaging-signing-snap-requests.mjs} +1 -1
  297. package/dist/sdk/utils/messaging-signing-snap-requests.mjs.map +1 -0
  298. package/dist/sdk/utils/validate-login-response.cjs +49 -0
  299. package/dist/sdk/utils/validate-login-response.cjs.map +1 -0
  300. package/dist/sdk/utils/{validate-login-response.d.ts → validate-login-response.d.cts} +2 -2
  301. package/dist/sdk/utils/validate-login-response.d.cts.map +1 -0
  302. package/dist/sdk/utils/validate-login-response.d.mts +14 -0
  303. package/dist/sdk/utils/validate-login-response.d.mts.map +1 -0
  304. package/dist/sdk/utils/{validate-login-response.js → validate-login-response.mjs} +1 -1
  305. package/dist/sdk/utils/validate-login-response.mjs.map +1 -0
  306. package/dist/sdk/utils/validate-pair-response.cjs +29 -0
  307. package/dist/sdk/utils/validate-pair-response.cjs.map +1 -0
  308. package/dist/sdk/utils/{validate-pair-response.d.ts → validate-pair-response.d.cts} +1 -1
  309. package/dist/sdk/utils/validate-pair-response.d.cts.map +1 -0
  310. package/dist/sdk/utils/validate-pair-response.d.mts +26 -0
  311. package/dist/sdk/utils/validate-pair-response.d.mts.map +1 -0
  312. package/dist/sdk/utils/{validate-pair-response.js → validate-pair-response.mjs} +1 -1
  313. package/dist/sdk/utils/validate-pair-response.mjs.map +1 -0
  314. package/dist/shared/encryption/cache.cjs +77 -0
  315. package/dist/shared/encryption/cache.cjs.map +1 -0
  316. package/dist/shared/encryption/{cache.d.ts → cache.d.cts} +1 -1
  317. package/dist/shared/encryption/cache.d.cts.map +1 -0
  318. package/dist/shared/encryption/cache.d.mts +32 -0
  319. package/dist/shared/encryption/cache.d.mts.map +1 -0
  320. package/dist/shared/encryption/{cache.js → cache.mjs} +4 -4
  321. package/dist/shared/encryption/cache.mjs.map +1 -0
  322. package/dist/shared/encryption/constants.cjs +17 -0
  323. package/dist/shared/encryption/constants.cjs.map +1 -0
  324. package/dist/shared/encryption/{constants.d.ts → constants.d.cts} +2 -2
  325. package/dist/shared/encryption/constants.d.cts.map +1 -0
  326. package/dist/shared/encryption/constants.d.mts +9 -0
  327. package/dist/shared/encryption/constants.d.mts.map +1 -0
  328. package/dist/shared/encryption/{constants.js → constants.mjs} +1 -1
  329. package/dist/shared/encryption/constants.mjs.map +1 -0
  330. package/dist/shared/encryption/encryption.cjs +209 -0
  331. package/dist/shared/encryption/encryption.cjs.map +1 -0
  332. package/dist/shared/encryption/{encryption.d.ts → encryption.d.cts} +3 -3
  333. package/dist/shared/encryption/encryption.d.cts.map +1 -0
  334. package/dist/shared/encryption/encryption.d.mts +30 -0
  335. package/dist/shared/encryption/encryption.d.mts.map +1 -0
  336. package/dist/shared/encryption/encryption.mjs +205 -0
  337. package/dist/shared/encryption/encryption.mjs.map +1 -0
  338. package/dist/shared/encryption/index.cjs +25 -0
  339. package/dist/shared/encryption/index.cjs.map +1 -0
  340. package/dist/shared/encryption/index.d.cts +5 -0
  341. package/dist/shared/encryption/index.d.cts.map +1 -0
  342. package/dist/shared/encryption/index.d.mts +5 -0
  343. package/dist/shared/encryption/index.d.mts.map +1 -0
  344. package/dist/shared/encryption/index.mjs +5 -0
  345. package/dist/shared/encryption/index.mjs.map +1 -0
  346. package/dist/shared/encryption/utils.cjs +21 -0
  347. package/dist/shared/encryption/utils.cjs.map +1 -0
  348. package/dist/shared/encryption/{utils.d.ts → utils.d.cts} +3 -3
  349. package/dist/shared/encryption/utils.d.cts.map +1 -0
  350. package/dist/shared/encryption/utils.d.mts +5 -0
  351. package/dist/shared/encryption/utils.d.mts.map +1 -0
  352. package/dist/shared/encryption/{utils.js → utils.mjs} +1 -1
  353. package/dist/shared/encryption/utils.mjs.map +1 -0
  354. package/dist/shared/env.cjs +85 -0
  355. package/dist/shared/env.cjs.map +1 -0
  356. package/dist/shared/{env.d.ts → env.d.cts} +1 -1
  357. package/dist/shared/env.d.cts.map +1 -0
  358. package/dist/shared/env.d.mts +34 -0
  359. package/dist/shared/env.d.mts.map +1 -0
  360. package/dist/shared/{env.js → env.mjs} +1 -1
  361. package/dist/shared/env.mjs.map +1 -0
  362. package/dist/shared/storage-schema.cjs +42 -0
  363. package/dist/shared/storage-schema.cjs.map +1 -0
  364. package/dist/shared/{storage-schema.d.ts → storage-schema.d.cts} +1 -1
  365. package/dist/shared/storage-schema.d.cts.map +1 -0
  366. package/dist/shared/storage-schema.d.mts +34 -0
  367. package/dist/shared/storage-schema.d.mts.map +1 -0
  368. package/dist/shared/{storage-schema.js → storage-schema.mjs} +2 -2
  369. package/dist/shared/storage-schema.mjs.map +1 -0
  370. package/dist/shared/types/encryption.cjs +3 -0
  371. package/dist/shared/types/encryption.cjs.map +1 -0
  372. package/dist/shared/types/{encryption.d.ts → encryption.d.cts} +1 -1
  373. package/dist/shared/types/encryption.d.cts.map +1 -0
  374. package/dist/shared/types/encryption.d.mts +2 -0
  375. package/dist/shared/types/encryption.d.mts.map +1 -0
  376. package/dist/shared/types/encryption.mjs +2 -0
  377. package/dist/shared/types/encryption.mjs.map +1 -0
  378. package/dist/shared/types/services.cjs +3 -0
  379. package/dist/shared/types/services.cjs.map +1 -0
  380. package/dist/shared/types/{services.d.ts → services.d.cts} +2 -2
  381. package/dist/shared/types/services.d.cts.map +1 -0
  382. package/dist/shared/types/services.d.mts +17 -0
  383. package/dist/shared/types/services.d.mts.map +1 -0
  384. package/dist/shared/types/services.mjs +2 -0
  385. package/dist/shared/types/services.mjs.map +1 -0
  386. package/dist/shared/utils/entropy-source.cjs +37 -0
  387. package/dist/shared/utils/entropy-source.cjs.map +1 -0
  388. package/dist/shared/utils/{entropy-source.d.ts → entropy-source.d.cts} +2 -2
  389. package/dist/shared/utils/entropy-source.d.cts.map +1 -0
  390. package/dist/shared/utils/entropy-source.d.mts +22 -0
  391. package/dist/shared/utils/entropy-source.d.mts.map +1 -0
  392. package/dist/shared/utils/{entropy-source.js → entropy-source.mjs} +2 -2
  393. package/dist/shared/utils/entropy-source.mjs.map +1 -0
  394. package/dist/shared/utils/event-queue.cjs +24 -0
  395. package/dist/shared/utils/event-queue.cjs.map +1 -0
  396. package/dist/shared/utils/{event-queue.d.ts → event-queue.d.cts} +1 -1
  397. package/dist/shared/utils/event-queue.d.cts.map +1 -0
  398. package/dist/shared/utils/event-queue.d.mts +6 -0
  399. package/dist/shared/utils/event-queue.d.mts.map +1 -0
  400. package/dist/shared/utils/{event-queue.js → event-queue.mjs} +4 -2
  401. package/dist/shared/utils/event-queue.mjs.map +1 -0
  402. package/dist/shared/utils/hd-keyring-seed.cjs +49 -0
  403. package/dist/shared/utils/hd-keyring-seed.cjs.map +1 -0
  404. package/dist/shared/utils/{hd-keyring-seed.d.ts → hd-keyring-seed.d.cts} +3 -3
  405. package/dist/shared/utils/hd-keyring-seed.d.cts.map +1 -0
  406. package/dist/shared/utils/hd-keyring-seed.d.mts +27 -0
  407. package/dist/shared/utils/hd-keyring-seed.d.mts.map +1 -0
  408. package/dist/shared/utils/{hd-keyring-seed.js → hd-keyring-seed.mjs} +1 -1
  409. package/dist/shared/utils/hd-keyring-seed.mjs.map +1 -0
  410. package/dist/shared/utils/message-signing.cjs +147 -0
  411. package/dist/shared/utils/message-signing.cjs.map +1 -0
  412. package/dist/shared/utils/{message-signing.d.ts → message-signing.d.cts} +1 -1
  413. package/dist/shared/utils/message-signing.d.cts.map +1 -0
  414. package/dist/shared/utils/message-signing.d.mts +73 -0
  415. package/dist/shared/utils/message-signing.d.mts.map +1 -0
  416. package/dist/shared/utils/{message-signing.js → message-signing.mjs} +7 -7
  417. package/dist/shared/utils/message-signing.mjs.map +1 -0
  418. package/package.json +56 -22
  419. package/dist/controllers/authentication/AuthenticationController-method-action-types.d.ts.map +0 -1
  420. package/dist/controllers/authentication/AuthenticationController-method-action-types.js.map +0 -1
  421. package/dist/controllers/authentication/AuthenticationController.d.ts.map +0 -1
  422. package/dist/controllers/authentication/AuthenticationController.js +0 -536
  423. package/dist/controllers/authentication/AuthenticationController.js.map +0 -1
  424. package/dist/controllers/authentication/index.d.ts.map +0 -1
  425. package/dist/controllers/authentication/index.js +0 -6
  426. package/dist/controllers/authentication/index.js.map +0 -1
  427. package/dist/controllers/authentication/mocks/index.d.ts +0 -2
  428. package/dist/controllers/authentication/mocks/index.d.ts.map +0 -1
  429. package/dist/controllers/authentication/mocks/index.js +0 -2
  430. package/dist/controllers/authentication/mocks/index.js.map +0 -1
  431. package/dist/controllers/authentication/mocks/mockResponses.d.ts.map +0 -1
  432. package/dist/controllers/authentication/mocks/mockResponses.js.map +0 -1
  433. package/dist/controllers/index.d.ts +0 -3
  434. package/dist/controllers/index.d.ts.map +0 -1
  435. package/dist/controllers/index.js +0 -3
  436. package/dist/controllers/index.js.map +0 -1
  437. package/dist/controllers/user-storage/UserStorageController-method-action-types.d.ts.map +0 -1
  438. package/dist/controllers/user-storage/UserStorageController-method-action-types.js.map +0 -1
  439. package/dist/controllers/user-storage/UserStorageController.d.ts.map +0 -1
  440. package/dist/controllers/user-storage/UserStorageController.js +0 -429
  441. package/dist/controllers/user-storage/UserStorageController.js.map +0 -1
  442. package/dist/controllers/user-storage/constants.d.ts +0 -15
  443. package/dist/controllers/user-storage/constants.d.ts.map +0 -1
  444. package/dist/controllers/user-storage/constants.js.map +0 -1
  445. package/dist/controllers/user-storage/contact-syncing/constants.d.ts.map +0 -1
  446. package/dist/controllers/user-storage/contact-syncing/constants.js.map +0 -1
  447. package/dist/controllers/user-storage/contact-syncing/controller-integration.d.ts.map +0 -1
  448. package/dist/controllers/user-storage/contact-syncing/controller-integration.js.map +0 -1
  449. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.d.ts.map +0 -1
  450. package/dist/controllers/user-storage/contact-syncing/setup-subscriptions.js.map +0 -1
  451. package/dist/controllers/user-storage/contact-syncing/sync-utils.d.ts.map +0 -1
  452. package/dist/controllers/user-storage/contact-syncing/sync-utils.js.map +0 -1
  453. package/dist/controllers/user-storage/contact-syncing/types.d.ts.map +0 -1
  454. package/dist/controllers/user-storage/contact-syncing/types.js +0 -2
  455. package/dist/controllers/user-storage/contact-syncing/types.js.map +0 -1
  456. package/dist/controllers/user-storage/contact-syncing/utils.d.ts.map +0 -1
  457. package/dist/controllers/user-storage/contact-syncing/utils.js.map +0 -1
  458. package/dist/controllers/user-storage/index.d.ts.map +0 -1
  459. package/dist/controllers/user-storage/index.js +0 -9
  460. package/dist/controllers/user-storage/index.js.map +0 -1
  461. package/dist/controllers/user-storage/mocks/index.d.ts +0 -3
  462. package/dist/controllers/user-storage/mocks/index.d.ts.map +0 -1
  463. package/dist/controllers/user-storage/mocks/index.js +0 -3
  464. package/dist/controllers/user-storage/mocks/index.js.map +0 -1
  465. package/dist/controllers/user-storage/mocks/mockResponses.d.ts.map +0 -1
  466. package/dist/controllers/user-storage/mocks/mockResponses.js.map +0 -1
  467. package/dist/controllers/user-storage/mocks/mockStorage.d.ts.map +0 -1
  468. package/dist/controllers/user-storage/mocks/mockStorage.js.map +0 -1
  469. package/dist/controllers/user-storage/types.d.ts.map +0 -1
  470. package/dist/controllers/user-storage/types.js +0 -2
  471. package/dist/controllers/user-storage/types.js.map +0 -1
  472. package/dist/controllers/user-storage/utils.d.ts.map +0 -1
  473. package/dist/controllers/user-storage/utils.js.map +0 -1
  474. package/dist/index.d.ts +0 -4
  475. package/dist/index.d.ts.map +0 -1
  476. package/dist/index.js +0 -4
  477. package/dist/index.js.map +0 -1
  478. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.ts.map +0 -1
  479. package/dist/sdk/authentication-jwt-bearer/flow-siwe.js +0 -99
  480. package/dist/sdk/authentication-jwt-bearer/flow-siwe.js.map +0 -1
  481. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.ts.map +0 -1
  482. package/dist/sdk/authentication-jwt-bearer/flow-srp.js +0 -255
  483. package/dist/sdk/authentication-jwt-bearer/flow-srp.js.map +0 -1
  484. package/dist/sdk/authentication-jwt-bearer/services.d.ts.map +0 -1
  485. package/dist/sdk/authentication-jwt-bearer/services.js.map +0 -1
  486. package/dist/sdk/authentication-jwt-bearer/types.d.ts.map +0 -1
  487. package/dist/sdk/authentication-jwt-bearer/types.js.map +0 -1
  488. package/dist/sdk/authentication-jwt-bearer/utils/identifier.d.ts.map +0 -1
  489. package/dist/sdk/authentication-jwt-bearer/utils/identifier.js.map +0 -1
  490. package/dist/sdk/authentication-jwt-bearer/utils/time.d.ts.map +0 -1
  491. package/dist/sdk/authentication-jwt-bearer/utils/time.js.map +0 -1
  492. package/dist/sdk/authentication.d.ts.map +0 -1
  493. package/dist/sdk/authentication.js +0 -100
  494. package/dist/sdk/authentication.js.map +0 -1
  495. package/dist/sdk/constants.d.ts.map +0 -1
  496. package/dist/sdk/constants.js.map +0 -1
  497. package/dist/sdk/errors.d.ts.map +0 -1
  498. package/dist/sdk/errors.js.map +0 -1
  499. package/dist/sdk/index.d.ts +0 -8
  500. package/dist/sdk/index.d.ts.map +0 -1
  501. package/dist/sdk/index.js +0 -8
  502. package/dist/sdk/index.js.map +0 -1
  503. package/dist/sdk/mocks/auth.d.ts.map +0 -1
  504. package/dist/sdk/mocks/auth.js.map +0 -1
  505. package/dist/sdk/mocks/userstorage.d.ts.map +0 -1
  506. package/dist/sdk/mocks/userstorage.js.map +0 -1
  507. package/dist/sdk/user-storage.d.ts.map +0 -1
  508. package/dist/sdk/user-storage.js +0 -364
  509. package/dist/sdk/user-storage.js.map +0 -1
  510. package/dist/sdk/utils/eip-6963-metamask-provider.d.ts.map +0 -1
  511. package/dist/sdk/utils/eip-6963-metamask-provider.js.map +0 -1
  512. package/dist/sdk/utils/messaging-signing-snap-requests.d.ts.map +0 -1
  513. package/dist/sdk/utils/messaging-signing-snap-requests.js.map +0 -1
  514. package/dist/sdk/utils/validate-login-response.d.ts.map +0 -1
  515. package/dist/sdk/utils/validate-login-response.js.map +0 -1
  516. package/dist/sdk/utils/validate-pair-response.d.ts.map +0 -1
  517. package/dist/sdk/utils/validate-pair-response.js.map +0 -1
  518. package/dist/shared/encryption/cache.d.ts.map +0 -1
  519. package/dist/shared/encryption/cache.js.map +0 -1
  520. package/dist/shared/encryption/constants.d.ts.map +0 -1
  521. package/dist/shared/encryption/constants.js.map +0 -1
  522. package/dist/shared/encryption/encryption.d.ts.map +0 -1
  523. package/dist/shared/encryption/encryption.js +0 -202
  524. package/dist/shared/encryption/encryption.js.map +0 -1
  525. package/dist/shared/encryption/index.d.ts +0 -5
  526. package/dist/shared/encryption/index.d.ts.map +0 -1
  527. package/dist/shared/encryption/index.js +0 -5
  528. package/dist/shared/encryption/index.js.map +0 -1
  529. package/dist/shared/encryption/utils.d.ts.map +0 -1
  530. package/dist/shared/encryption/utils.js.map +0 -1
  531. package/dist/shared/env.d.ts.map +0 -1
  532. package/dist/shared/env.js.map +0 -1
  533. package/dist/shared/storage-schema.d.ts.map +0 -1
  534. package/dist/shared/storage-schema.js.map +0 -1
  535. package/dist/shared/types/encryption.d.ts.map +0 -1
  536. package/dist/shared/types/encryption.js +0 -2
  537. package/dist/shared/types/encryption.js.map +0 -1
  538. package/dist/shared/types/services.d.ts.map +0 -1
  539. package/dist/shared/types/services.js +0 -2
  540. package/dist/shared/types/services.js.map +0 -1
  541. package/dist/shared/utils/entropy-source.d.ts.map +0 -1
  542. package/dist/shared/utils/entropy-source.js.map +0 -1
  543. package/dist/shared/utils/event-queue.d.ts.map +0 -1
  544. package/dist/shared/utils/event-queue.js.map +0 -1
  545. package/dist/shared/utils/hd-keyring-seed.d.ts.map +0 -1
  546. package/dist/shared/utils/hd-keyring-seed.js.map +0 -1
  547. package/dist/shared/utils/message-signing.d.ts.map +0 -1
  548. package/dist/shared/utils/message-signing.js.map +0 -1
@@ -0,0 +1,137 @@
1
+ /**
2
+ * This file is auto generated.
3
+ * Do not edit manually.
4
+ */
5
+ import type { UserStorageController } from "./UserStorageController.mjs";
6
+ /**
7
+ * Allows retrieval of stored data. Data stored is string formatted.
8
+ * Developers can extend the entry path and entry name through the `schema.ts` file.
9
+ *
10
+ * @param path - string in the form of `${feature}.${key}` that matches schema
11
+ * @param entropySourceId - The entropy source ID used to generate the encryption key.
12
+ * @returns the decrypted string contents found from user storage (or null if not found)
13
+ */
14
+ export type UserStorageControllerPerformGetStorageAction = {
15
+ type: `UserStorageController:performGetStorage`;
16
+ handler: UserStorageController['performGetStorage'];
17
+ };
18
+ /**
19
+ * Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings.
20
+ * Developers can extend the entry path through the `schema.ts` file.
21
+ *
22
+ * @param path - string in the form of `${feature}` that matches schema
23
+ * @param entropySourceId - The entropy source ID used to generate the encryption key.
24
+ * @returns the array of decrypted string contents found from user storage (or null if not found)
25
+ */
26
+ export type UserStorageControllerPerformGetStorageAllFeatureEntriesAction = {
27
+ type: `UserStorageController:performGetStorageAllFeatureEntries`;
28
+ handler: UserStorageController['performGetStorageAllFeatureEntries'];
29
+ };
30
+ /**
31
+ * Allows storage of user data. Data stored must be string formatted.
32
+ * Developers can extend the entry path and entry name through the `schema.ts` file.
33
+ *
34
+ * @param path - string in the form of `${feature}.${key}` that matches schema
35
+ * @param value - The string data you want to store.
36
+ * @param entropySourceId - The entropy source ID used to generate the encryption key.
37
+ * @returns nothing. NOTE that an error is thrown if fails to store data.
38
+ */
39
+ export type UserStorageControllerPerformSetStorageAction = {
40
+ type: `UserStorageController:performSetStorage`;
41
+ handler: UserStorageController['performSetStorage'];
42
+ };
43
+ /**
44
+ * Allows storage of multiple user data entries for one specific feature. Data stored must be string formatted.
45
+ * Developers can extend the entry path through the `schema.ts` file.
46
+ *
47
+ * @param path - string in the form of `${feature}` that matches schema
48
+ * @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs
49
+ * @param entropySourceId - The entropy source ID used to generate the encryption key.
50
+ * @returns nothing. NOTE that an error is thrown if fails to store data.
51
+ */
52
+ export type UserStorageControllerPerformBatchSetStorageAction = {
53
+ type: `UserStorageController:performBatchSetStorage`;
54
+ handler: UserStorageController['performBatchSetStorage'];
55
+ };
56
+ /**
57
+ * Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file.
58
+ *
59
+ * @param path - string in the form of `${feature}.${key}` that matches schema
60
+ * @param entropySourceId - The entropy source ID used to generate the encryption key.
61
+ * @returns nothing. NOTE that an error is thrown if fails to delete data.
62
+ */
63
+ export type UserStorageControllerPerformDeleteStorageAction = {
64
+ type: `UserStorageController:performDeleteStorage`;
65
+ handler: UserStorageController['performDeleteStorage'];
66
+ };
67
+ /**
68
+ * Allows deletion of all user data entries for a specific feature.
69
+ * Developers can extend the entry path through the `schema.ts` file.
70
+ *
71
+ * @param path - string in the form of `${feature}` that matches schema
72
+ * @param entropySourceId - The entropy source ID used to generate the encryption key.
73
+ * @returns nothing. NOTE that an error is thrown if fails to delete data.
74
+ */
75
+ export type UserStorageControllerPerformDeleteStorageAllFeatureEntriesAction = {
76
+ type: `UserStorageController:performDeleteStorageAllFeatureEntries`;
77
+ handler: UserStorageController['performDeleteStorageAllFeatureEntries'];
78
+ };
79
+ /**
80
+ * Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted.
81
+ * Developers can extend the entry path through the `schema.ts` file.
82
+ *
83
+ * @param path - string in the form of `${feature}` that matches schema
84
+ * @param values - data to store, in the form of an array of entryKey[]
85
+ * @param entropySourceId - The entropy source ID used to generate the encryption key.
86
+ * @returns nothing. NOTE that an error is thrown if fails to store data.
87
+ */
88
+ export type UserStorageControllerPerformBatchDeleteStorageAction = {
89
+ type: `UserStorageController:performBatchDeleteStorage`;
90
+ handler: UserStorageController['performBatchDeleteStorage'];
91
+ };
92
+ /**
93
+ * Retrieves the storage key, for internal use only!
94
+ *
95
+ * @returns the storage key
96
+ */
97
+ export type UserStorageControllerGetStorageKeyAction = {
98
+ type: `UserStorageController:getStorageKey`;
99
+ handler: UserStorageController['getStorageKey'];
100
+ };
101
+ /**
102
+ * Lists all the available HD keyring metadata IDs.
103
+ * These IDs can be used in a multi-SRP context to segregate data specific to different SRPs.
104
+ *
105
+ * @returns A promise that resolves to an array of HD keyring metadata IDs.
106
+ */
107
+ export type UserStorageControllerListEntropySourcesAction = {
108
+ type: `UserStorageController:listEntropySources`;
109
+ handler: UserStorageController['listEntropySources'];
110
+ };
111
+ export type UserStorageControllerSetIsBackupAndSyncFeatureEnabledAction = {
112
+ type: `UserStorageController:setIsBackupAndSyncFeatureEnabled`;
113
+ handler: UserStorageController['setIsBackupAndSyncFeatureEnabled'];
114
+ };
115
+ /**
116
+ * Sets the isContactSyncingInProgress flag to prevent infinite loops during contact synchronization
117
+ *
118
+ * @param isContactSyncingInProgress - Whether contact syncing is in progress
119
+ */
120
+ export type UserStorageControllerSetIsContactSyncingInProgressAction = {
121
+ type: `UserStorageController:setIsContactSyncingInProgress`;
122
+ handler: UserStorageController['setIsContactSyncingInProgress'];
123
+ };
124
+ /**
125
+ * Syncs the address book list with the user storage address book list.
126
+ * 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.
127
+ * 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.
128
+ */
129
+ export type UserStorageControllerSyncContactsWithUserStorageAction = {
130
+ type: `UserStorageController:syncContactsWithUserStorage`;
131
+ handler: UserStorageController['syncContactsWithUserStorage'];
132
+ };
133
+ /**
134
+ * Union of all UserStorageController action types.
135
+ */
136
+ export type UserStorageControllerMethodActions = UserStorageControllerPerformGetStorageAction | UserStorageControllerPerformGetStorageAllFeatureEntriesAction | UserStorageControllerPerformSetStorageAction | UserStorageControllerPerformBatchSetStorageAction | UserStorageControllerPerformDeleteStorageAction | UserStorageControllerPerformDeleteStorageAllFeatureEntriesAction | UserStorageControllerPerformBatchDeleteStorageAction | UserStorageControllerGetStorageKeyAction | UserStorageControllerListEntropySourcesAction | UserStorageControllerSetIsBackupAndSyncFeatureEnabledAction | UserStorageControllerSetIsContactSyncingInProgressAction | UserStorageControllerSyncContactsWithUserStorageAction;
137
+ //# sourceMappingURL=UserStorageController-method-action-types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserStorageController-method-action-types.d.mts","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,qBAAqB,EAAE,oCAAmC;AAExE;;;;;;;GAOG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,6DAA6D,GAAG;IAC1E,IAAI,EAAE,0DAA0D,CAAC;IACjE,OAAO,EAAE,qBAAqB,CAAC,oCAAoC,CAAC,CAAC;CACtE,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,4CAA4C,GAAG;IACzD,IAAI,EAAE,yCAAyC,CAAC;IAChD,OAAO,EAAE,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;CACrD,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,iDAAiD,GAAG;IAC9D,IAAI,EAAE,8CAA8C,CAAC;IACrD,OAAO,EAAE,qBAAqB,CAAC,wBAAwB,CAAC,CAAC;CAC1D,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,+CAA+C,GAAG;IAC5D,IAAI,EAAE,4CAA4C,CAAC;IACnD,OAAO,EAAE,qBAAqB,CAAC,sBAAsB,CAAC,CAAC;CACxD,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,gEAAgE,GAAG;IAC7E,IAAI,EAAE,6DAA6D,CAAC;IACpE,OAAO,EAAE,qBAAqB,CAAC,uCAAuC,CAAC,CAAC;CACzE,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,oDAAoD,GAAG;IACjE,IAAI,EAAE,iDAAiD,CAAC;IACxD,OAAO,EAAE,qBAAqB,CAAC,2BAA2B,CAAC,CAAC;CAC7D,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,qBAAqB,CAAC,eAAe,CAAC,CAAC;CACjD,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,6CAA6C,GAAG;IAC1D,IAAI,EAAE,0CAA0C,CAAC;IACjD,OAAO,EAAE,qBAAqB,CAAC,oBAAoB,CAAC,CAAC;CACtD,CAAC;AAEF,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,qBAAqB,CAAC,kCAAkC,CAAC,CAAC;CACpE,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,wDAAwD,GAAG;IACrE,IAAI,EAAE,qDAAqD,CAAC;IAC5D,OAAO,EAAE,qBAAqB,CAAC,+BAA+B,CAAC,CAAC;CACjE,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,sDAAsD,GAAG;IACnE,IAAI,EAAE,mDAAmD,CAAC;IAC1D,OAAO,EAAE,qBAAqB,CAAC,6BAA6B,CAAC,CAAC;CAC/D,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAC1C,4CAA4C,GAC5C,6DAA6D,GAC7D,4CAA4C,GAC5C,iDAAiD,GACjD,+CAA+C,GAC/C,gEAAgE,GAChE,oDAAoD,GACpD,wCAAwC,GACxC,6CAA6C,GAC7C,2DAA2D,GAC3D,wDAAwD,GACxD,sDAAsD,CAAC"}
@@ -3,4 +3,4 @@
3
3
  * Do not edit manually.
4
4
  */
5
5
  export {};
6
- //# sourceMappingURL=UserStorageController-method-action-types.js.map
6
+ //# sourceMappingURL=UserStorageController-method-action-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserStorageController-method-action-types.mjs","sourceRoot":"","sources":["../../../src/controllers/user-storage/UserStorageController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated.\n * Do not edit manually.\n */\n\nimport type { UserStorageController } from './UserStorageController.js';\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 */\nexport type UserStorageControllerPerformGetStorageAction = {\n type: `UserStorageController:performGetStorage`;\n handler: UserStorageController['performGetStorage'];\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 */\nexport type UserStorageControllerPerformGetStorageAllFeatureEntriesAction = {\n type: `UserStorageController:performGetStorageAllFeatureEntries`;\n handler: UserStorageController['performGetStorageAllFeatureEntries'];\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 */\nexport type UserStorageControllerPerformSetStorageAction = {\n type: `UserStorageController:performSetStorage`;\n handler: UserStorageController['performSetStorage'];\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 */\nexport type UserStorageControllerPerformBatchSetStorageAction = {\n type: `UserStorageController:performBatchSetStorage`;\n handler: UserStorageController['performBatchSetStorage'];\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 */\nexport type UserStorageControllerPerformDeleteStorageAction = {\n type: `UserStorageController:performDeleteStorage`;\n handler: UserStorageController['performDeleteStorage'];\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 */\nexport type UserStorageControllerPerformDeleteStorageAllFeatureEntriesAction = {\n type: `UserStorageController:performDeleteStorageAllFeatureEntries`;\n handler: UserStorageController['performDeleteStorageAllFeatureEntries'];\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 */\nexport type UserStorageControllerPerformBatchDeleteStorageAction = {\n type: `UserStorageController:performBatchDeleteStorage`;\n handler: UserStorageController['performBatchDeleteStorage'];\n};\n\n/**\n * Retrieves the storage key, for internal use only!\n *\n * @returns the storage key\n */\nexport type UserStorageControllerGetStorageKeyAction = {\n type: `UserStorageController:getStorageKey`;\n handler: UserStorageController['getStorageKey'];\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 */\nexport type UserStorageControllerListEntropySourcesAction = {\n type: `UserStorageController:listEntropySources`;\n handler: UserStorageController['listEntropySources'];\n};\n\nexport type UserStorageControllerSetIsBackupAndSyncFeatureEnabledAction = {\n type: `UserStorageController:setIsBackupAndSyncFeatureEnabled`;\n handler: UserStorageController['setIsBackupAndSyncFeatureEnabled'];\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 */\nexport type UserStorageControllerSetIsContactSyncingInProgressAction = {\n type: `UserStorageController:setIsContactSyncingInProgress`;\n handler: UserStorageController['setIsContactSyncingInProgress'];\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 */\nexport type UserStorageControllerSyncContactsWithUserStorageAction = {\n type: `UserStorageController:syncContactsWithUserStorage`;\n handler: UserStorageController['syncContactsWithUserStorage'];\n};\n\n/**\n * Union of all UserStorageController action types.\n */\nexport type UserStorageControllerMethodActions =\n | UserStorageControllerPerformGetStorageAction\n | UserStorageControllerPerformGetStorageAllFeatureEntriesAction\n | UserStorageControllerPerformSetStorageAction\n | UserStorageControllerPerformBatchSetStorageAction\n | UserStorageControllerPerformDeleteStorageAction\n | UserStorageControllerPerformDeleteStorageAllFeatureEntriesAction\n | UserStorageControllerPerformBatchDeleteStorageAction\n | UserStorageControllerGetStorageKeyAction\n | UserStorageControllerListEntropySourcesAction\n | UserStorageControllerSetIsBackupAndSyncFeatureEnabledAction\n | UserStorageControllerSetIsContactSyncingInProgressAction\n | UserStorageControllerSyncContactsWithUserStorageAction;\n"]}
@@ -0,0 +1,412 @@
1
+ "use strict";
2
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
5
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
6
+ };
7
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
8
+ if (kind === "m") throw new TypeError("Private method is not writable");
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
10
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
11
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
12
+ };
13
+ var _UserStorageController_instances, _UserStorageController_userStorage, _UserStorageController_auth, _UserStorageController_config, _UserStorageController_trace, _UserStorageController_isUnlocked, _UserStorageController_storageKeyCache, _UserStorageController_signMessageCache, _UserStorageController_keyringController, _UserStorageController_nativeScryptCrypto, _UserStorageController_getHdKeyringEntropySourceIds, _UserStorageController_getPrimaryEntropySourceId, _UserStorageController_scopedCacheKey, _UserStorageController_signMessage, _UserStorageController_setIsBackupAndSyncUpdateLoading;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.UserStorageController = exports.defaultState = void 0;
16
+ const base_controller_1 = require("@metamask/base-controller");
17
+ const index_js_1 = require("../../sdk/index.cjs");
18
+ const entropy_source_js_1 = require("../../shared/utils/entropy-source.cjs");
19
+ const event_queue_js_1 = require("../../shared/utils/event-queue.cjs");
20
+ const hd_keyring_seed_js_1 = require("../../shared/utils/hd-keyring-seed.cjs");
21
+ const message_signing_js_1 = require("../../shared/utils/message-signing.cjs");
22
+ const constants_js_1 = require("./constants.cjs");
23
+ const controller_integration_js_1 = require("./contact-syncing/controller-integration.cjs");
24
+ const setup_subscriptions_js_1 = require("./contact-syncing/setup-subscriptions.cjs");
25
+ const controllerName = 'UserStorageController';
26
+ exports.defaultState = {
27
+ isBackupAndSyncEnabled: true,
28
+ isBackupAndSyncUpdateLoading: false,
29
+ isAccountSyncingEnabled: true,
30
+ isContactSyncingEnabled: true,
31
+ isContactSyncingInProgress: false,
32
+ };
33
+ const metadata = {
34
+ isBackupAndSyncEnabled: {
35
+ includeInStateLogs: true,
36
+ persist: true,
37
+ includeInDebugSnapshot: true,
38
+ usedInUi: true,
39
+ },
40
+ isBackupAndSyncUpdateLoading: {
41
+ includeInStateLogs: false,
42
+ persist: false,
43
+ includeInDebugSnapshot: false,
44
+ usedInUi: true,
45
+ },
46
+ isAccountSyncingEnabled: {
47
+ includeInStateLogs: true,
48
+ persist: true,
49
+ includeInDebugSnapshot: true,
50
+ usedInUi: true,
51
+ },
52
+ isContactSyncingEnabled: {
53
+ includeInStateLogs: true,
54
+ persist: true,
55
+ includeInDebugSnapshot: true,
56
+ usedInUi: true,
57
+ },
58
+ isContactSyncingInProgress: {
59
+ includeInStateLogs: false,
60
+ persist: false,
61
+ includeInDebugSnapshot: false,
62
+ usedInUi: true,
63
+ },
64
+ };
65
+ const MESSENGER_EXPOSED_METHODS = [
66
+ 'performGetStorage',
67
+ 'performGetStorageAllFeatureEntries',
68
+ 'performSetStorage',
69
+ 'performBatchSetStorage',
70
+ 'performDeleteStorage',
71
+ 'performBatchDeleteStorage',
72
+ 'getStorageKey',
73
+ 'performDeleteStorageAllFeatureEntries',
74
+ 'listEntropySources',
75
+ 'setIsBackupAndSyncFeatureEnabled',
76
+ 'setIsContactSyncingInProgress',
77
+ 'syncContactsWithUserStorage',
78
+ ];
79
+ /**
80
+ * Reusable controller that allows any team to store synchronized data for a given user.
81
+ * These can be settings shared cross MetaMask clients, or data we want to persist when uninstalling/reinstalling.
82
+ *
83
+ * NOTE:
84
+ * - data stored on UserStorage is FULLY encrypted, with the only keys stored/managed on the client.
85
+ * - No one can access this data unless they are have the SRP and are able to run the signing snap.
86
+ */
87
+ class UserStorageController extends base_controller_1.BaseController {
88
+ constructor({ messenger, state, config, nativeScryptCrypto, trace, }) {
89
+ super({
90
+ messenger,
91
+ metadata,
92
+ name: controllerName,
93
+ state: { ...exports.defaultState, ...state },
94
+ });
95
+ _UserStorageController_instances.add(this);
96
+ _UserStorageController_userStorage.set(this, void 0);
97
+ _UserStorageController_auth.set(this, {
98
+ getProfileId: async (entropySourceId) => {
99
+ const sessionProfile = await this.messenger.call('AuthenticationController:getSessionProfile', entropySourceId);
100
+ return sessionProfile?.profileId;
101
+ },
102
+ isSignedIn: () => {
103
+ return this.messenger.call('AuthenticationController:isSignedIn');
104
+ },
105
+ signIn: async () => {
106
+ return await this.messenger.call('AuthenticationController:performSignIn');
107
+ },
108
+ });
109
+ _UserStorageController_config.set(this, {
110
+ env: index_js_1.Env.PRD,
111
+ });
112
+ _UserStorageController_trace.set(this, void 0);
113
+ _UserStorageController_isUnlocked.set(this, false);
114
+ // Both caches are keyed by `${entropySourceId}:${message}` (the primary SRP
115
+ // resolves to its HD keyring metadata ID) so two SRPs that transiently
116
+ // resolve to the same `profileId` can never share a cached storage key /
117
+ // signature and leak data across each other's user storage.
118
+ _UserStorageController_storageKeyCache.set(this, {});
119
+ _UserStorageController_signMessageCache.set(this, {});
120
+ _UserStorageController_keyringController.set(this, {
121
+ setupLockedStateSubscriptions: () => {
122
+ const { isUnlocked } = this.messenger.call('KeyringController:getState');
123
+ __classPrivateFieldSet(this, _UserStorageController_isUnlocked, isUnlocked, "f");
124
+ this.messenger.subscribe('KeyringController:unlock', () => {
125
+ __classPrivateFieldSet(this, _UserStorageController_isUnlocked, true, "f");
126
+ });
127
+ this.messenger.subscribe('KeyringController:lock', () => {
128
+ __classPrivateFieldSet(this, _UserStorageController_isUnlocked, false, "f");
129
+ });
130
+ },
131
+ });
132
+ _UserStorageController_nativeScryptCrypto.set(this, undefined);
133
+ this.eventQueue = new event_queue_js_1.EventQueue();
134
+ __classPrivateFieldSet(this, _UserStorageController_config, {
135
+ ...__classPrivateFieldGet(this, _UserStorageController_config, "f"),
136
+ ...config,
137
+ }, "f");
138
+ __classPrivateFieldSet(this, _UserStorageController_trace, trace ??
139
+ (async (_request, fn) => {
140
+ if (!fn) {
141
+ return undefined;
142
+ }
143
+ return await Promise.resolve(fn());
144
+ }), "f");
145
+ __classPrivateFieldSet(this, _UserStorageController_userStorage, new index_js_1.UserStorage({
146
+ env: __classPrivateFieldGet(this, _UserStorageController_config, "f").env,
147
+ auth: {
148
+ getAccessToken: (entropySourceId) => this.messenger.call('AuthenticationController:getBearerToken', entropySourceId),
149
+ getUserProfile: async (entropySourceId) => {
150
+ return await this.messenger.call('AuthenticationController:getSessionProfile', entropySourceId);
151
+ },
152
+ signMessage: (message, entropySourceId) => __classPrivateFieldGet(this, _UserStorageController_instances, "m", _UserStorageController_signMessage).call(this, message, entropySourceId),
153
+ },
154
+ }, {
155
+ storage: {
156
+ getStorageKey: async (message, entropySourceId) => {
157
+ // No derived key can exist while locked (the KeyringController
158
+ // clears its keyrings on lock, so the scope is unresolvable).
159
+ if (!__classPrivateFieldGet(this, _UserStorageController_isUnlocked, "f")) {
160
+ return null;
161
+ }
162
+ return (__classPrivateFieldGet(this, _UserStorageController_storageKeyCache, "f")[__classPrivateFieldGet(this, _UserStorageController_instances, "m", _UserStorageController_scopedCacheKey).call(this, message, entropySourceId)] ?? null);
163
+ },
164
+ // Only ever reached after a successful signature, i.e. while unlocked.
165
+ setStorageKey: async (message, key, entropySourceId) => {
166
+ __classPrivateFieldGet(this, _UserStorageController_storageKeyCache, "f")[__classPrivateFieldGet(this, _UserStorageController_instances, "m", _UserStorageController_scopedCacheKey).call(this, message, entropySourceId)] = key;
167
+ },
168
+ },
169
+ }), "f");
170
+ this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
171
+ __classPrivateFieldGet(this, _UserStorageController_keyringController, "f").setupLockedStateSubscriptions();
172
+ __classPrivateFieldSet(this, _UserStorageController_nativeScryptCrypto, nativeScryptCrypto, "f");
173
+ // Contact Syncing
174
+ (0, setup_subscriptions_js_1.setupContactSyncingSubscriptions)({
175
+ getUserStorageControllerInstance: () => this,
176
+ getMessenger: () => this.messenger,
177
+ trace: __classPrivateFieldGet(this, _UserStorageController_trace, "f"),
178
+ });
179
+ }
180
+ /**
181
+ * Allows retrieval of stored data. Data stored is string formatted.
182
+ * Developers can extend the entry path and entry name through the `schema.ts` file.
183
+ *
184
+ * @param path - string in the form of `${feature}.${key}` that matches schema
185
+ * @param entropySourceId - The entropy source ID used to generate the encryption key.
186
+ * @returns the decrypted string contents found from user storage (or null if not found)
187
+ */
188
+ async performGetStorage(path, entropySourceId) {
189
+ return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").getItem(path, {
190
+ nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
191
+ entropySourceId,
192
+ });
193
+ }
194
+ /**
195
+ * Allows retrieval of all stored data for a specific feature. Data stored is formatted as an array of strings.
196
+ * Developers can extend the entry path through the `schema.ts` file.
197
+ *
198
+ * @param path - string in the form of `${feature}` that matches schema
199
+ * @param entropySourceId - The entropy source ID used to generate the encryption key.
200
+ * @returns the array of decrypted string contents found from user storage (or null if not found)
201
+ */
202
+ async performGetStorageAllFeatureEntries(path, entropySourceId) {
203
+ return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").getAllFeatureItems(path, {
204
+ nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
205
+ entropySourceId,
206
+ });
207
+ }
208
+ /**
209
+ * Allows storage of user data. Data stored must be string formatted.
210
+ * Developers can extend the entry path and entry name through the `schema.ts` file.
211
+ *
212
+ * @param path - string in the form of `${feature}.${key}` that matches schema
213
+ * @param value - The string data you want to store.
214
+ * @param entropySourceId - The entropy source ID used to generate the encryption key.
215
+ * @returns nothing. NOTE that an error is thrown if fails to store data.
216
+ */
217
+ async performSetStorage(path, value, entropySourceId) {
218
+ return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").setItem(path, value, {
219
+ nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
220
+ entropySourceId,
221
+ });
222
+ }
223
+ /**
224
+ * Allows storage of multiple user data entries for one specific feature. Data stored must be string formatted.
225
+ * Developers can extend the entry path through the `schema.ts` file.
226
+ *
227
+ * @param path - string in the form of `${feature}` that matches schema
228
+ * @param values - data to store, in the form of an array of `[entryKey, entryValue]` pairs
229
+ * @param entropySourceId - The entropy source ID used to generate the encryption key.
230
+ * @returns nothing. NOTE that an error is thrown if fails to store data.
231
+ */
232
+ async performBatchSetStorage(path, values, entropySourceId) {
233
+ return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").batchSetItems(path, values, {
234
+ nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
235
+ entropySourceId,
236
+ });
237
+ }
238
+ /**
239
+ * Allows deletion of user data. Developers can extend the entry path and entry name through the `schema.ts` file.
240
+ *
241
+ * @param path - string in the form of `${feature}.${key}` that matches schema
242
+ * @param entropySourceId - The entropy source ID used to generate the encryption key.
243
+ * @returns nothing. NOTE that an error is thrown if fails to delete data.
244
+ */
245
+ async performDeleteStorage(path, entropySourceId) {
246
+ return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").deleteItem(path, {
247
+ nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
248
+ entropySourceId,
249
+ });
250
+ }
251
+ /**
252
+ * Allows deletion of all user data entries for a specific feature.
253
+ * Developers can extend the entry path through the `schema.ts` file.
254
+ *
255
+ * @param path - string in the form of `${feature}` that matches schema
256
+ * @param entropySourceId - The entropy source ID used to generate the encryption key.
257
+ * @returns nothing. NOTE that an error is thrown if fails to delete data.
258
+ */
259
+ async performDeleteStorageAllFeatureEntries(path, entropySourceId) {
260
+ return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").deleteAllFeatureItems(path, {
261
+ nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
262
+ entropySourceId,
263
+ });
264
+ }
265
+ /**
266
+ * Allows delete of multiple user data entries for one specific feature. Data deleted must be string formatted.
267
+ * Developers can extend the entry path through the `schema.ts` file.
268
+ *
269
+ * @param path - string in the form of `${feature}` that matches schema
270
+ * @param values - data to store, in the form of an array of entryKey[]
271
+ * @param entropySourceId - The entropy source ID used to generate the encryption key.
272
+ * @returns nothing. NOTE that an error is thrown if fails to store data.
273
+ */
274
+ async performBatchDeleteStorage(path, values, entropySourceId) {
275
+ return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").batchDeleteItems(path, values, {
276
+ nativeScryptCrypto: __classPrivateFieldGet(this, _UserStorageController_nativeScryptCrypto, "f"),
277
+ entropySourceId,
278
+ });
279
+ }
280
+ /**
281
+ * Retrieves the storage key, for internal use only!
282
+ *
283
+ * @returns the storage key
284
+ */
285
+ async getStorageKey() {
286
+ return await __classPrivateFieldGet(this, _UserStorageController_userStorage, "f").getStorageKey();
287
+ }
288
+ /**
289
+ * Flushes the storage key cache.
290
+ * CAUTION: This is only public for testing purposes.
291
+ * It should not be used in production code.
292
+ */
293
+ flushStorageKeyCache() {
294
+ __classPrivateFieldSet(this, _UserStorageController_storageKeyCache, {}, "f");
295
+ }
296
+ /**
297
+ * Lists all the available HD keyring metadata IDs.
298
+ * These IDs can be used in a multi-SRP context to segregate data specific to different SRPs.
299
+ *
300
+ * @returns A promise that resolves to an array of HD keyring metadata IDs.
301
+ */
302
+ async listEntropySources() {
303
+ if (!__classPrivateFieldGet(this, _UserStorageController_isUnlocked, "f")) {
304
+ throw new Error('listEntropySources - unable to list entropy sources, wallet is locked');
305
+ }
306
+ return __classPrivateFieldGet(this, _UserStorageController_instances, "m", _UserStorageController_getHdKeyringEntropySourceIds).call(this);
307
+ }
308
+ async setIsBackupAndSyncFeatureEnabled(feature, enabled) {
309
+ try {
310
+ __classPrivateFieldGet(this, _UserStorageController_instances, "m", _UserStorageController_setIsBackupAndSyncUpdateLoading).call(this, true);
311
+ if (enabled) {
312
+ // If any of the features are enabled, we need to ensure the user is signed in
313
+ const isSignedIn = __classPrivateFieldGet(this, _UserStorageController_auth, "f").isSignedIn();
314
+ if (!isSignedIn) {
315
+ await __classPrivateFieldGet(this, _UserStorageController_auth, "f").signIn();
316
+ }
317
+ }
318
+ this.update((state) => {
319
+ if (feature === constants_js_1.BACKUPANDSYNC_FEATURES.main) {
320
+ state.isBackupAndSyncEnabled = enabled;
321
+ }
322
+ if (feature === constants_js_1.BACKUPANDSYNC_FEATURES.accountSyncing) {
323
+ state.isAccountSyncingEnabled = enabled;
324
+ }
325
+ if (feature === constants_js_1.BACKUPANDSYNC_FEATURES.contactSyncing) {
326
+ state.isContactSyncingEnabled = enabled;
327
+ }
328
+ });
329
+ }
330
+ catch (e) {
331
+ // istanbul ignore next
332
+ const errorMessage = e instanceof Error ? e.message : JSON.stringify(e);
333
+ // istanbul ignore next
334
+ throw new Error(`${controllerName} - failed to ${enabled ? 'enable' : 'disable'} ${feature} - ${errorMessage}`);
335
+ }
336
+ finally {
337
+ __classPrivateFieldGet(this, _UserStorageController_instances, "m", _UserStorageController_setIsBackupAndSyncUpdateLoading).call(this, false);
338
+ }
339
+ }
340
+ /**
341
+ * Sets the isContactSyncingInProgress flag to prevent infinite loops during contact synchronization
342
+ *
343
+ * @param isContactSyncingInProgress - Whether contact syncing is in progress
344
+ */
345
+ async setIsContactSyncingInProgress(isContactSyncingInProgress) {
346
+ this.update((state) => {
347
+ state.isContactSyncingInProgress = isContactSyncingInProgress;
348
+ });
349
+ }
350
+ /**
351
+ * Syncs the address book list with the user storage address book list.
352
+ * 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.
353
+ * 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.
354
+ */
355
+ async syncContactsWithUserStorage() {
356
+ const profileId = await __classPrivateFieldGet(this, _UserStorageController_auth, "f").getProfileId();
357
+ const config = {
358
+ onContactUpdated: () => {
359
+ __classPrivateFieldGet(this, _UserStorageController_config, "f")?.contactSyncing?.onContactUpdated?.(profileId);
360
+ },
361
+ onContactDeleted: () => {
362
+ __classPrivateFieldGet(this, _UserStorageController_config, "f")?.contactSyncing?.onContactDeleted?.(profileId);
363
+ },
364
+ onContactSyncErroneousSituation: (errorMessage, sentryContext) => {
365
+ __classPrivateFieldGet(this, _UserStorageController_config, "f")?.contactSyncing?.onContactSyncErroneousSituation?.(profileId, errorMessage, sentryContext);
366
+ },
367
+ };
368
+ await (0, controller_integration_js_1.syncContactsWithUserStorage)(config, {
369
+ getMessenger: () => this.messenger,
370
+ getUserStorageControllerInstance: () => this,
371
+ trace: __classPrivateFieldGet(this, _UserStorageController_trace, "f"),
372
+ });
373
+ }
374
+ }
375
+ exports.UserStorageController = UserStorageController;
376
+ _UserStorageController_userStorage = new WeakMap(), _UserStorageController_auth = new WeakMap(), _UserStorageController_config = new WeakMap(), _UserStorageController_trace = new WeakMap(), _UserStorageController_isUnlocked = new WeakMap(), _UserStorageController_storageKeyCache = new WeakMap(), _UserStorageController_signMessageCache = new WeakMap(), _UserStorageController_keyringController = new WeakMap(), _UserStorageController_nativeScryptCrypto = new WeakMap(), _UserStorageController_instances = new WeakSet(), _UserStorageController_getHdKeyringEntropySourceIds = function _UserStorageController_getHdKeyringEntropySourceIds() {
377
+ const { keyrings } = this.messenger.call('KeyringController:getState');
378
+ return (0, entropy_source_js_1.getHdKeyringEntropySourceIds)(keyrings);
379
+ }, _UserStorageController_getPrimaryEntropySourceId = function _UserStorageController_getPrimaryEntropySourceId() {
380
+ const { keyrings } = this.messenger.call('KeyringController:getState');
381
+ return (0, entropy_source_js_1.getPrimaryHdKeyringEntropySourceId)(keyrings);
382
+ }, _UserStorageController_scopedCacheKey = function _UserStorageController_scopedCacheKey(message, entropySourceId) {
383
+ return `${entropySourceId ?? __classPrivateFieldGet(this, _UserStorageController_instances, "m", _UserStorageController_getPrimaryEntropySourceId).call(this)}:${message}`;
384
+ }, _UserStorageController_signMessage =
385
+ /**
386
+ * Signs a `metamask:…` message with the native SIP-6 message-signing key
387
+ * (same key as `@metamask/message-signing-snap` with empty salt).
388
+ *
389
+ * @param message - A specific tagged message to sign.
390
+ * @param entropySourceId - The entropy source ID used to derive the key,
391
+ * when multiple sources are available (Multi-SRP).
392
+ * @returns Compact secp256k1 signature hex.
393
+ */
394
+ async function _UserStorageController_signMessage(message, entropySourceId) {
395
+ if (!__classPrivateFieldGet(this, _UserStorageController_isUnlocked, "f")) {
396
+ throw new Error('#signMessage - unable to proceed, wallet is locked');
397
+ }
398
+ const cacheKey = __classPrivateFieldGet(this, _UserStorageController_instances, "m", _UserStorageController_scopedCacheKey).call(this, message, entropySourceId);
399
+ if (__classPrivateFieldGet(this, _UserStorageController_signMessageCache, "f")[cacheKey]) {
400
+ return __classPrivateFieldGet(this, _UserStorageController_signMessageCache, "f")[cacheKey];
401
+ }
402
+ const resolvedId = entropySourceId ?? __classPrivateFieldGet(this, _UserStorageController_instances, "m", _UserStorageController_getPrimaryEntropySourceId).call(this);
403
+ const seed = await (0, hd_keyring_seed_js_1.getHdKeyringSeed)(this.messenger, resolvedId);
404
+ const result = await (0, message_signing_js_1.signMessageWithMessageSigningKey)(message, seed);
405
+ __classPrivateFieldGet(this, _UserStorageController_signMessageCache, "f")[cacheKey] = result;
406
+ return result;
407
+ }, _UserStorageController_setIsBackupAndSyncUpdateLoading = function _UserStorageController_setIsBackupAndSyncUpdateLoading(isBackupAndSyncUpdateLoading) {
408
+ this.update((state) => {
409
+ state.isBackupAndSyncUpdateLoading = isBackupAndSyncUpdateLoading;
410
+ });
411
+ };
412
+ //# sourceMappingURL=UserStorageController.cjs.map