@metamask/profile-sync-controller 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (606) hide show
  1. package/CHANGELOG.md +54 -1
  2. package/dist/controllers/authentication/AuthenticationController.cjs +211 -0
  3. package/dist/controllers/authentication/AuthenticationController.cjs.map +1 -0
  4. package/dist/{types/controllers/authentication/AuthenticationController.d.ts → controllers/authentication/AuthenticationController.d.cts} +5 -5
  5. package/dist/controllers/authentication/AuthenticationController.d.cts.map +1 -0
  6. package/dist/controllers/authentication/AuthenticationController.d.mts +78 -0
  7. package/dist/controllers/authentication/AuthenticationController.d.mts.map +1 -0
  8. package/dist/controllers/authentication/AuthenticationController.mjs +206 -11
  9. package/dist/controllers/authentication/AuthenticationController.mjs.map +1 -1
  10. package/dist/controllers/authentication/__fixtures__/index.cjs +18 -0
  11. package/dist/controllers/authentication/__fixtures__/index.cjs.map +1 -0
  12. package/dist/controllers/authentication/__fixtures__/index.d.cts +2 -0
  13. package/dist/controllers/authentication/__fixtures__/index.d.cts.map +1 -0
  14. package/dist/controllers/authentication/__fixtures__/index.d.mts +2 -0
  15. package/dist/controllers/authentication/__fixtures__/index.d.mts.map +1 -0
  16. package/dist/controllers/authentication/__fixtures__/index.mjs +2 -0
  17. package/dist/controllers/authentication/__fixtures__/index.mjs.map +1 -0
  18. package/dist/controllers/authentication/__fixtures__/mockResponses.cjs +52 -0
  19. package/dist/controllers/authentication/__fixtures__/mockResponses.cjs.map +1 -0
  20. package/dist/{types/controllers/authentication/__fixtures__/mockResponses.d.ts → controllers/authentication/__fixtures__/mockResponses.d.cts} +2 -2
  21. package/dist/controllers/authentication/__fixtures__/mockResponses.d.cts.map +1 -0
  22. package/dist/controllers/authentication/__fixtures__/mockResponses.d.mts +23 -0
  23. package/dist/controllers/authentication/__fixtures__/mockResponses.d.mts.map +1 -0
  24. package/dist/controllers/authentication/__fixtures__/mockResponses.mjs +46 -0
  25. package/dist/controllers/authentication/__fixtures__/mockResponses.mjs.map +1 -0
  26. package/dist/controllers/authentication/__fixtures__/mockServices.cjs +37 -0
  27. package/dist/controllers/authentication/__fixtures__/mockServices.cjs.map +1 -0
  28. package/dist/{types/controllers/authentication/__fixtures__/mockServices.d.ts → controllers/authentication/__fixtures__/mockServices.d.cts} +2 -2
  29. package/dist/controllers/authentication/__fixtures__/mockServices.d.cts.map +1 -0
  30. package/dist/controllers/authentication/__fixtures__/mockServices.d.mts +10 -0
  31. package/dist/controllers/authentication/__fixtures__/mockServices.d.mts.map +1 -0
  32. package/dist/controllers/authentication/__fixtures__/mockServices.mjs +35 -0
  33. package/dist/controllers/authentication/__fixtures__/mockServices.mjs.map +1 -0
  34. package/dist/controllers/authentication/auth-snap-requests.cjs +39 -0
  35. package/dist/controllers/authentication/auth-snap-requests.cjs.map +1 -0
  36. package/dist/{types/controllers/authentication/auth-snap-requests.d.ts → controllers/authentication/auth-snap-requests.d.cts} +2 -2
  37. package/dist/controllers/authentication/auth-snap-requests.d.cts.map +1 -0
  38. package/dist/controllers/authentication/auth-snap-requests.d.mts +17 -0
  39. package/dist/controllers/authentication/auth-snap-requests.d.mts.map +1 -0
  40. package/dist/controllers/authentication/auth-snap-requests.mjs +33 -9
  41. package/dist/controllers/authentication/auth-snap-requests.mjs.map +1 -1
  42. package/dist/controllers/authentication/index.cjs +39 -0
  43. package/dist/controllers/authentication/index.cjs.map +1 -0
  44. package/dist/controllers/authentication/index.d.cts +7 -0
  45. package/dist/controllers/authentication/index.d.cts.map +1 -0
  46. package/dist/controllers/authentication/index.d.mts +7 -0
  47. package/dist/controllers/authentication/index.d.mts.map +1 -0
  48. package/dist/controllers/authentication/index.mjs +6 -18
  49. package/dist/controllers/authentication/index.mjs.map +1 -1
  50. package/dist/controllers/authentication/services.cjs +127 -0
  51. package/dist/controllers/authentication/services.cjs.map +1 -0
  52. package/dist/{types/controllers/authentication/services.d.ts → controllers/authentication/services.d.cts} +1 -1
  53. package/dist/controllers/authentication/services.d.cts.map +1 -0
  54. package/dist/controllers/authentication/services.d.mts +70 -0
  55. package/dist/controllers/authentication/services.d.mts.map +1 -0
  56. package/dist/controllers/authentication/services.mjs +118 -19
  57. package/dist/controllers/authentication/services.mjs.map +1 -1
  58. package/dist/controllers/index.cjs +29 -0
  59. package/dist/controllers/index.cjs.map +1 -0
  60. package/dist/controllers/index.d.cts +3 -0
  61. package/dist/controllers/index.d.cts.map +1 -0
  62. package/dist/controllers/index.d.mts +3 -0
  63. package/dist/controllers/index.d.mts.map +1 -0
  64. package/dist/controllers/index.mjs +2 -24
  65. package/dist/controllers/index.mjs.map +1 -1
  66. package/dist/controllers/user-storage/UserStorageController.cjs +462 -0
  67. package/dist/controllers/user-storage/UserStorageController.cjs.map +1 -0
  68. package/dist/{types/controllers/user-storage/UserStorageController.d.ts → controllers/user-storage/UserStorageController.d.cts} +44 -16
  69. package/dist/controllers/user-storage/UserStorageController.d.cts.map +1 -0
  70. package/dist/controllers/user-storage/UserStorageController.d.mts +156 -0
  71. package/dist/controllers/user-storage/UserStorageController.d.mts.map +1 -0
  72. package/dist/controllers/user-storage/UserStorageController.mjs +457 -18
  73. package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -1
  74. package/dist/controllers/user-storage/__fixtures__/index.cjs +19 -0
  75. package/dist/controllers/user-storage/__fixtures__/index.cjs.map +1 -0
  76. package/dist/controllers/user-storage/__fixtures__/index.d.cts +3 -0
  77. package/dist/controllers/user-storage/__fixtures__/index.d.cts.map +1 -0
  78. package/dist/controllers/user-storage/__fixtures__/index.d.mts +3 -0
  79. package/dist/controllers/user-storage/__fixtures__/index.d.mts.map +1 -0
  80. package/dist/controllers/user-storage/__fixtures__/index.mjs +3 -0
  81. package/dist/controllers/user-storage/__fixtures__/index.mjs.map +1 -0
  82. package/dist/controllers/user-storage/__fixtures__/mockAccounts.cjs +127 -0
  83. package/dist/controllers/user-storage/__fixtures__/mockAccounts.cjs.map +1 -0
  84. package/dist/{types/controllers/user-storage/__fixtures__/mockAccounts.d.ts → controllers/user-storage/__fixtures__/mockAccounts.d.cts} +6 -6
  85. package/dist/controllers/user-storage/__fixtures__/mockAccounts.d.cts.map +1 -0
  86. package/dist/controllers/user-storage/__fixtures__/mockAccounts.d.mts +63 -0
  87. package/dist/controllers/user-storage/__fixtures__/mockAccounts.d.mts.map +1 -0
  88. package/dist/controllers/user-storage/__fixtures__/mockAccounts.mjs +123 -0
  89. package/dist/controllers/user-storage/__fixtures__/mockAccounts.mjs.map +1 -0
  90. package/dist/controllers/user-storage/__fixtures__/mockResponses.cjs +48 -0
  91. package/dist/controllers/user-storage/__fixtures__/mockResponses.cjs.map +1 -0
  92. package/dist/{types/controllers/user-storage/__fixtures__/mockResponses.d.ts → controllers/user-storage/__fixtures__/mockResponses.d.cts} +6 -4
  93. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.cts.map +1 -0
  94. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.mts +21 -0
  95. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.mts.map +1 -0
  96. package/dist/controllers/user-storage/__fixtures__/mockResponses.mjs +39 -0
  97. package/dist/controllers/user-storage/__fixtures__/mockResponses.mjs.map +1 -0
  98. package/dist/controllers/user-storage/__fixtures__/mockServices.cjs +41 -0
  99. package/dist/controllers/user-storage/__fixtures__/mockServices.cjs.map +1 -0
  100. package/dist/{types/controllers/user-storage/__fixtures__/mockServices.d.ts → controllers/user-storage/__fixtures__/mockServices.d.cts} +3 -3
  101. package/dist/controllers/user-storage/__fixtures__/mockServices.d.cts.map +1 -0
  102. package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts +11 -0
  103. package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts.map +1 -0
  104. package/dist/controllers/user-storage/__fixtures__/mockServices.mjs +39 -0
  105. package/dist/controllers/user-storage/__fixtures__/mockServices.mjs.map +1 -0
  106. package/dist/controllers/user-storage/__fixtures__/mockStorage.cjs +36 -0
  107. package/dist/controllers/user-storage/__fixtures__/mockStorage.cjs.map +1 -0
  108. package/dist/{types/controllers/user-storage/__fixtures__/mockStorage.d.ts → controllers/user-storage/__fixtures__/mockStorage.d.cts} +2 -2
  109. package/dist/controllers/user-storage/__fixtures__/mockStorage.d.cts.map +1 -0
  110. package/dist/controllers/user-storage/__fixtures__/mockStorage.d.mts +5 -0
  111. package/dist/controllers/user-storage/__fixtures__/mockStorage.d.mts.map +1 -0
  112. package/dist/controllers/user-storage/__fixtures__/mockStorage.mjs +9 -0
  113. package/dist/controllers/user-storage/__fixtures__/mockStorage.mjs.map +1 -0
  114. package/dist/controllers/user-storage/__fixtures__/test-utils.cjs +31 -0
  115. package/dist/controllers/user-storage/__fixtures__/test-utils.cjs.map +1 -0
  116. package/dist/controllers/user-storage/__fixtures__/test-utils.d.cts +14 -0
  117. package/dist/controllers/user-storage/__fixtures__/test-utils.d.cts.map +1 -0
  118. package/dist/controllers/user-storage/__fixtures__/test-utils.d.mts +14 -0
  119. package/dist/controllers/user-storage/__fixtures__/test-utils.d.mts.map +1 -0
  120. package/dist/controllers/user-storage/__fixtures__/test-utils.mjs +27 -0
  121. package/dist/controllers/user-storage/__fixtures__/test-utils.mjs.map +1 -0
  122. package/dist/controllers/user-storage/accounts/constants.cjs +51 -0
  123. package/dist/controllers/user-storage/accounts/constants.cjs.map +1 -0
  124. package/dist/{types/controllers/user-storage/accounts/constants.d.ts → controllers/user-storage/accounts/constants.d.cts} +1 -1
  125. package/dist/controllers/user-storage/accounts/constants.d.cts.map +1 -0
  126. package/dist/controllers/user-storage/accounts/constants.d.mts +4 -0
  127. package/dist/controllers/user-storage/accounts/constants.d.mts.map +1 -0
  128. package/dist/controllers/user-storage/accounts/constants.mjs +47 -11
  129. package/dist/controllers/user-storage/accounts/constants.mjs.map +1 -1
  130. package/dist/controllers/user-storage/accounts/user-storage.cjs +34 -0
  131. package/dist/controllers/user-storage/accounts/user-storage.cjs.map +1 -0
  132. package/dist/{types/controllers/user-storage/accounts/user-storage.d.ts → controllers/user-storage/accounts/user-storage.d.cts} +3 -3
  133. package/dist/controllers/user-storage/accounts/user-storage.d.cts.map +1 -0
  134. package/dist/controllers/user-storage/accounts/user-storage.d.mts +32 -0
  135. package/dist/controllers/user-storage/accounts/user-storage.d.mts.map +1 -0
  136. package/dist/controllers/user-storage/accounts/user-storage.mjs +27 -9
  137. package/dist/controllers/user-storage/accounts/user-storage.mjs.map +1 -1
  138. package/dist/controllers/user-storage/encryption/cache.cjs +79 -0
  139. package/dist/controllers/user-storage/encryption/cache.cjs.map +1 -0
  140. package/dist/{types/controllers/user-storage/encryption/cache.d.ts → controllers/user-storage/encryption/cache.d.cts} +1 -1
  141. package/dist/controllers/user-storage/encryption/cache.d.cts.map +1 -0
  142. package/dist/controllers/user-storage/encryption/cache.d.mts +31 -0
  143. package/dist/controllers/user-storage/encryption/cache.d.mts.map +1 -0
  144. package/dist/controllers/user-storage/encryption/cache.mjs +71 -11
  145. package/dist/controllers/user-storage/encryption/cache.mjs.map +1 -1
  146. package/dist/controllers/user-storage/encryption/encryption.cjs +151 -0
  147. package/dist/controllers/user-storage/encryption/encryption.cjs.map +1 -0
  148. package/dist/{types/controllers/user-storage/encryption/encryption.d.ts → controllers/user-storage/encryption/encryption.d.cts} +2 -2
  149. package/dist/controllers/user-storage/encryption/encryption.d.cts.map +1 -0
  150. package/dist/controllers/user-storage/encryption/encryption.d.mts +27 -0
  151. package/dist/controllers/user-storage/encryption/encryption.d.mts.map +1 -0
  152. package/dist/controllers/user-storage/encryption/encryption.mjs +145 -10
  153. package/dist/controllers/user-storage/encryption/encryption.mjs.map +1 -1
  154. package/dist/controllers/user-storage/encryption/index.cjs +25 -0
  155. package/dist/controllers/user-storage/encryption/index.cjs.map +1 -0
  156. package/dist/controllers/user-storage/encryption/index.d.cts +5 -0
  157. package/dist/controllers/user-storage/encryption/index.d.cts.map +1 -0
  158. package/dist/controllers/user-storage/encryption/index.d.mts +5 -0
  159. package/dist/controllers/user-storage/encryption/index.d.mts.map +1 -0
  160. package/dist/controllers/user-storage/encryption/index.mjs +4 -15
  161. package/dist/controllers/user-storage/encryption/index.mjs.map +1 -1
  162. package/dist/controllers/user-storage/encryption/utils.cjs +17 -0
  163. package/dist/controllers/user-storage/encryption/utils.cjs.map +1 -0
  164. package/dist/{types/controllers/user-storage/encryption/utils.d.ts → controllers/user-storage/encryption/utils.d.cts} +1 -1
  165. package/dist/controllers/user-storage/encryption/utils.d.cts.map +1 -0
  166. package/dist/controllers/user-storage/encryption/utils.d.mts +4 -0
  167. package/dist/controllers/user-storage/encryption/utils.d.mts.map +1 -0
  168. package/dist/controllers/user-storage/encryption/utils.mjs +9 -10
  169. package/dist/controllers/user-storage/encryption/utils.mjs.map +1 -1
  170. package/dist/controllers/user-storage/index.cjs +40 -0
  171. package/dist/controllers/user-storage/index.cjs.map +1 -0
  172. package/dist/controllers/user-storage/index.d.cts +8 -0
  173. package/dist/controllers/user-storage/index.d.cts.map +1 -0
  174. package/dist/controllers/user-storage/index.d.mts +8 -0
  175. package/dist/controllers/user-storage/index.d.mts.map +1 -0
  176. package/dist/controllers/user-storage/index.mjs +7 -30
  177. package/dist/controllers/user-storage/index.mjs.map +1 -1
  178. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.cjs +25 -0
  179. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.cjs.map +1 -0
  180. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.cts +4 -0
  181. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.cts.map +1 -0
  182. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.mts +4 -0
  183. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.mts.map +1 -0
  184. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.mjs +20 -0
  185. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.mjs.map +1 -0
  186. package/dist/controllers/user-storage/network-syncing/controller-integration.cjs +65 -0
  187. package/dist/controllers/user-storage/network-syncing/controller-integration.cjs.map +1 -0
  188. package/dist/controllers/user-storage/network-syncing/controller-integration.d.cts +13 -0
  189. package/dist/controllers/user-storage/network-syncing/controller-integration.d.cts.map +1 -0
  190. package/dist/controllers/user-storage/network-syncing/controller-integration.d.mts +13 -0
  191. package/dist/controllers/user-storage/network-syncing/controller-integration.d.mts.map +1 -0
  192. package/dist/controllers/user-storage/network-syncing/controller-integration.mjs +65 -0
  193. package/dist/controllers/user-storage/network-syncing/controller-integration.mjs.map +1 -0
  194. package/dist/controllers/user-storage/network-syncing/services.cjs +64 -0
  195. package/dist/controllers/user-storage/network-syncing/services.cjs.map +1 -0
  196. package/dist/controllers/user-storage/network-syncing/services.d.cts +21 -0
  197. package/dist/controllers/user-storage/network-syncing/services.d.cts.map +1 -0
  198. package/dist/controllers/user-storage/network-syncing/services.d.mts +21 -0
  199. package/dist/controllers/user-storage/network-syncing/services.d.mts.map +1 -0
  200. package/dist/controllers/user-storage/network-syncing/services.mjs +58 -0
  201. package/dist/controllers/user-storage/network-syncing/services.mjs.map +1 -0
  202. package/dist/controllers/user-storage/network-syncing/sync-all.cjs +171 -0
  203. package/dist/controllers/user-storage/network-syncing/sync-all.cjs.map +1 -0
  204. package/dist/controllers/user-storage/network-syncing/sync-all.d.cts +35 -0
  205. package/dist/controllers/user-storage/network-syncing/sync-all.d.cts.map +1 -0
  206. package/dist/controllers/user-storage/network-syncing/sync-all.d.mts +35 -0
  207. package/dist/controllers/user-storage/network-syncing/sync-all.d.mts.map +1 -0
  208. package/dist/controllers/user-storage/network-syncing/sync-all.mjs +162 -0
  209. package/dist/controllers/user-storage/network-syncing/sync-all.mjs.map +1 -0
  210. package/dist/controllers/user-storage/network-syncing/sync-mutations.cjs +28 -0
  211. package/dist/controllers/user-storage/network-syncing/sync-mutations.cjs.map +1 -0
  212. package/dist/controllers/user-storage/network-syncing/sync-mutations.d.cts +9 -0
  213. package/dist/controllers/user-storage/network-syncing/sync-mutations.d.cts.map +1 -0
  214. package/dist/controllers/user-storage/network-syncing/sync-mutations.d.mts +9 -0
  215. package/dist/controllers/user-storage/network-syncing/sync-mutations.d.mts.map +1 -0
  216. package/dist/controllers/user-storage/network-syncing/sync-mutations.mjs +22 -0
  217. package/dist/controllers/user-storage/network-syncing/sync-mutations.mjs.map +1 -0
  218. package/dist/controllers/user-storage/network-syncing/types.cjs +16 -0
  219. package/dist/controllers/user-storage/network-syncing/types.cjs.map +1 -0
  220. package/dist/controllers/user-storage/network-syncing/types.d.cts +18 -0
  221. package/dist/controllers/user-storage/network-syncing/types.d.cts.map +1 -0
  222. package/dist/controllers/user-storage/network-syncing/types.d.mts +18 -0
  223. package/dist/controllers/user-storage/network-syncing/types.d.mts.map +1 -0
  224. package/dist/controllers/user-storage/network-syncing/types.mjs +11 -0
  225. package/dist/controllers/user-storage/network-syncing/types.mjs.map +1 -0
  226. package/dist/controllers/user-storage/schema.cjs +56 -0
  227. package/dist/controllers/user-storage/schema.cjs.map +1 -0
  228. package/dist/{types/controllers/user-storage/schema.d.ts → controllers/user-storage/schema.d.cts} +2 -1
  229. package/dist/controllers/user-storage/schema.d.cts.map +1 -0
  230. package/dist/controllers/user-storage/schema.d.mts +38 -0
  231. package/dist/controllers/user-storage/schema.d.mts.map +1 -0
  232. package/dist/controllers/user-storage/schema.mjs +48 -16
  233. package/dist/controllers/user-storage/schema.mjs.map +1 -1
  234. package/dist/controllers/user-storage/services.cjs +119 -0
  235. package/dist/controllers/user-storage/services.cjs.map +1 -0
  236. package/dist/{types/controllers/user-storage/services.d.ts → controllers/user-storage/services.d.cts} +4 -5
  237. package/dist/controllers/user-storage/services.d.cts.map +1 -0
  238. package/dist/controllers/user-storage/services.d.mts +48 -0
  239. package/dist/controllers/user-storage/services.d.mts.map +1 -0
  240. package/dist/controllers/user-storage/services.mjs +116 -21
  241. package/dist/controllers/user-storage/services.mjs.map +1 -1
  242. package/dist/controllers/user-storage/utils.cjs +30 -0
  243. package/dist/controllers/user-storage/utils.cjs.map +1 -0
  244. package/dist/controllers/user-storage/utils.d.cts +17 -0
  245. package/dist/controllers/user-storage/utils.d.cts.map +1 -0
  246. package/dist/controllers/user-storage/utils.d.mts +17 -0
  247. package/dist/controllers/user-storage/utils.d.mts.map +1 -0
  248. package/dist/controllers/user-storage/utils.mjs +25 -0
  249. package/dist/controllers/user-storage/utils.mjs.map +1 -0
  250. package/dist/index.cjs +30 -0
  251. package/dist/index.cjs.map +1 -0
  252. package/dist/index.d.cts +4 -0
  253. package/dist/index.d.cts.map +1 -0
  254. package/dist/index.d.mts +4 -0
  255. package/dist/index.d.mts.map +1 -0
  256. package/dist/index.mjs +3 -39
  257. package/dist/index.mjs.map +1 -1
  258. package/dist/sdk/__fixtures__/mock-auth.cjs +139 -0
  259. package/dist/sdk/__fixtures__/mock-auth.cjs.map +1 -0
  260. package/dist/{types/sdk/__fixtures__/mock-auth.d.ts → sdk/__fixtures__/mock-auth.d.cts} +2 -2
  261. package/dist/sdk/__fixtures__/mock-auth.d.cts.map +1 -0
  262. package/dist/sdk/__fixtures__/mock-auth.d.mts +42 -0
  263. package/dist/sdk/__fixtures__/mock-auth.d.mts.map +1 -0
  264. package/dist/sdk/__fixtures__/mock-auth.mjs +134 -0
  265. package/dist/sdk/__fixtures__/mock-auth.mjs.map +1 -0
  266. package/dist/sdk/__fixtures__/mock-userstorage.cjs +58 -0
  267. package/dist/sdk/__fixtures__/mock-userstorage.cjs.map +1 -0
  268. package/dist/{types/sdk/__fixtures__/mock-userstorage.d.ts → sdk/__fixtures__/mock-userstorage.d.cts} +2 -2
  269. package/dist/sdk/__fixtures__/mock-userstorage.d.cts.map +1 -0
  270. package/dist/sdk/__fixtures__/mock-userstorage.d.mts +19 -0
  271. package/dist/sdk/__fixtures__/mock-userstorage.d.mts.map +1 -0
  272. package/dist/sdk/__fixtures__/mock-userstorage.mjs +54 -0
  273. package/dist/sdk/__fixtures__/mock-userstorage.mjs.map +1 -0
  274. package/dist/sdk/__fixtures__/test-utils.cjs +74 -0
  275. package/dist/sdk/__fixtures__/test-utils.cjs.map +1 -0
  276. package/dist/{types/sdk/__fixtures__/test-utils.d.ts → sdk/__fixtures__/test-utils.d.cts} +6 -6
  277. package/dist/sdk/__fixtures__/test-utils.d.cts.map +1 -0
  278. package/dist/sdk/__fixtures__/test-utils.d.mts +25 -0
  279. package/dist/sdk/__fixtures__/test-utils.d.mts.map +1 -0
  280. package/dist/sdk/__fixtures__/test-utils.mjs +69 -0
  281. package/dist/sdk/__fixtures__/test-utils.mjs.map +1 -0
  282. package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs +106 -0
  283. package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs.map +1 -0
  284. package/dist/{types/sdk/authentication-jwt-bearer/flow-siwe.d.ts → sdk/authentication-jwt-bearer/flow-siwe.d.cts} +2 -2
  285. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.cts.map +1 -0
  286. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts +23 -0
  287. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts.map +1 -0
  288. package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs +101 -11
  289. package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs.map +1 -1
  290. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +111 -0
  291. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +1 -0
  292. package/dist/{types/sdk/authentication-jwt-bearer/flow-srp.d.ts → sdk/authentication-jwt-bearer/flow-srp.d.cts} +2 -2
  293. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +1 -0
  294. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts +17 -0
  295. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +1 -0
  296. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs +105 -13
  297. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +1 -1
  298. package/dist/sdk/authentication-jwt-bearer/services.cjs +180 -0
  299. package/dist/sdk/authentication-jwt-bearer/services.cjs.map +1 -0
  300. package/dist/{types/sdk/authentication-jwt-bearer/services.d.ts → sdk/authentication-jwt-bearer/services.d.cts} +4 -4
  301. package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +1 -0
  302. package/dist/sdk/authentication-jwt-bearer/services.d.mts +63 -0
  303. package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +1 -0
  304. package/dist/sdk/authentication-jwt-bearer/services.mjs +166 -25
  305. package/dist/sdk/authentication-jwt-bearer/services.mjs.map +1 -1
  306. package/dist/sdk/authentication-jwt-bearer/types.cjs +12 -0
  307. package/dist/sdk/authentication-jwt-bearer/types.cjs.map +1 -0
  308. package/dist/{types/sdk/authentication-jwt-bearer/types.d.ts → sdk/authentication-jwt-bearer/types.d.cts} +2 -2
  309. package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +1 -0
  310. package/dist/sdk/authentication-jwt-bearer/types.d.mts +67 -0
  311. package/dist/sdk/authentication-jwt-bearer/types.d.mts.map +1 -0
  312. package/dist/sdk/authentication-jwt-bearer/types.mjs +8 -7
  313. package/dist/sdk/authentication-jwt-bearer/types.mjs.map +1 -1
  314. package/dist/sdk/authentication.cjs +129 -0
  315. package/dist/sdk/authentication.cjs.map +1 -0
  316. package/dist/{types/sdk/authentication.d.ts → sdk/authentication.d.cts} +8 -7
  317. package/dist/sdk/authentication.d.cts.map +1 -0
  318. package/dist/sdk/authentication.d.mts +32 -0
  319. package/dist/sdk/authentication.d.mts.map +1 -0
  320. package/dist/sdk/authentication.mjs +107 -24
  321. package/dist/sdk/authentication.mjs.map +1 -1
  322. package/dist/sdk/encryption.cjs +23 -0
  323. package/dist/sdk/encryption.cjs.map +1 -0
  324. package/dist/sdk/encryption.d.cts +4 -0
  325. package/dist/sdk/encryption.d.cts.map +1 -0
  326. package/dist/sdk/encryption.d.mts +4 -0
  327. package/dist/sdk/encryption.d.mts.map +1 -0
  328. package/dist/sdk/encryption.mjs +3 -13
  329. package/dist/sdk/encryption.mjs.map +1 -1
  330. package/dist/sdk/env.cjs +85 -0
  331. package/dist/sdk/env.cjs.map +1 -0
  332. package/dist/{types/sdk/env.d.ts → sdk/env.d.cts} +1 -1
  333. package/dist/sdk/env.d.cts.map +1 -0
  334. package/dist/sdk/env.d.mts +34 -0
  335. package/dist/sdk/env.d.mts.map +1 -0
  336. package/dist/sdk/env.mjs +78 -12
  337. package/dist/sdk/env.mjs.map +1 -1
  338. package/dist/sdk/errors.cjs +53 -0
  339. package/dist/sdk/errors.cjs.map +1 -0
  340. package/dist/{types/sdk/errors.d.ts → sdk/errors.d.cts} +1 -1
  341. package/dist/sdk/errors.d.cts.map +1 -0
  342. package/dist/sdk/errors.d.mts +22 -0
  343. package/dist/sdk/errors.d.mts.map +1 -0
  344. package/dist/sdk/errors.mjs +42 -19
  345. package/dist/sdk/errors.mjs.map +1 -1
  346. package/dist/sdk/index.cjs +23 -0
  347. package/dist/sdk/index.cjs.map +1 -0
  348. package/dist/sdk/index.d.cts +7 -0
  349. package/dist/sdk/index.d.cts.map +1 -0
  350. package/dist/sdk/index.d.mts +7 -0
  351. package/dist/sdk/index.d.mts.map +1 -0
  352. package/dist/sdk/index.mjs +6 -76
  353. package/dist/sdk/index.mjs.map +1 -1
  354. package/dist/sdk/user-storage.cjs +176 -0
  355. package/dist/sdk/user-storage.cjs.map +1 -0
  356. package/dist/{types/sdk/user-storage.d.ts → sdk/user-storage.d.cts} +4 -4
  357. package/dist/sdk/user-storage.d.cts.map +1 -0
  358. package/dist/sdk/user-storage.d.mts +27 -0
  359. package/dist/sdk/user-storage.d.mts.map +1 -0
  360. package/dist/sdk/user-storage.mjs +146 -16
  361. package/dist/sdk/user-storage.mjs.map +1 -1
  362. package/dist/sdk/utils/eip-6963-metamask-provider.cjs +70 -0
  363. package/dist/sdk/utils/eip-6963-metamask-provider.cjs.map +1 -0
  364. package/dist/{types/sdk/utils/eip-6963-metamask-provider.d.ts → sdk/utils/eip-6963-metamask-provider.d.cts} +2 -2
  365. package/dist/sdk/utils/eip-6963-metamask-provider.d.cts.map +1 -0
  366. package/dist/sdk/utils/eip-6963-metamask-provider.d.mts +25 -0
  367. package/dist/sdk/utils/eip-6963-metamask-provider.d.mts.map +1 -0
  368. package/dist/sdk/utils/eip-6963-metamask-provider.mjs +64 -8
  369. package/dist/sdk/utils/eip-6963-metamask-provider.mjs.map +1 -1
  370. package/dist/sdk/utils/messaging-signing-snap-requests.cjs +89 -0
  371. package/dist/sdk/utils/messaging-signing-snap-requests.cjs.map +1 -0
  372. package/dist/{types/sdk/utils/messaging-signing-snap-requests.d.ts → sdk/utils/messaging-signing-snap-requests.d.cts} +9 -2
  373. package/dist/sdk/utils/messaging-signing-snap-requests.d.cts.map +1 -0
  374. package/dist/sdk/utils/messaging-signing-snap-requests.d.mts +40 -0
  375. package/dist/sdk/utils/messaging-signing-snap-requests.d.mts.map +1 -0
  376. package/dist/sdk/utils/messaging-signing-snap-requests.mjs +80 -14
  377. package/dist/sdk/utils/messaging-signing-snap-requests.mjs.map +1 -1
  378. package/dist/sdk/utils/validate-login-response.cjs +22 -0
  379. package/dist/sdk/utils/validate-login-response.cjs.map +1 -0
  380. package/dist/{types/sdk/utils/validate-login-response.d.ts → sdk/utils/validate-login-response.d.cts} +2 -2
  381. package/dist/sdk/utils/validate-login-response.d.cts.map +1 -0
  382. package/dist/sdk/utils/validate-login-response.d.mts +10 -0
  383. package/dist/sdk/utils/validate-login-response.d.mts.map +1 -0
  384. package/dist/sdk/utils/validate-login-response.mjs +17 -7
  385. package/dist/sdk/utils/validate-login-response.mjs.map +1 -1
  386. package/package.json +20 -14
  387. package/dist/chunk-246Z6L5V.js +0 -534
  388. package/dist/chunk-246Z6L5V.js.map +0 -1
  389. package/dist/chunk-2677XY6G.mjs +0 -107
  390. package/dist/chunk-2677XY6G.mjs.map +0 -1
  391. package/dist/chunk-2CWF7ZTL.mjs +0 -129
  392. package/dist/chunk-2CWF7ZTL.mjs.map +0 -1
  393. package/dist/chunk-2VEMA6OE.mjs +0 -47
  394. package/dist/chunk-2VEMA6OE.mjs.map +0 -1
  395. package/dist/chunk-4LMFZDL4.js +0 -114
  396. package/dist/chunk-4LMFZDL4.js.map +0 -1
  397. package/dist/chunk-4ZGRRVMI.js +0 -133
  398. package/dist/chunk-4ZGRRVMI.js.map +0 -1
  399. package/dist/chunk-5EBUFNAN.mjs +0 -55
  400. package/dist/chunk-5EBUFNAN.mjs.map +0 -1
  401. package/dist/chunk-5MQUI24U.js +0 -47
  402. package/dist/chunk-5MQUI24U.js.map +0 -1
  403. package/dist/chunk-5XSXZTED.mjs +0 -57
  404. package/dist/chunk-5XSXZTED.mjs.map +0 -1
  405. package/dist/chunk-6DAK2U35.mjs +0 -11
  406. package/dist/chunk-6DAK2U35.mjs.map +0 -1
  407. package/dist/chunk-76NMME23.mjs +0 -114
  408. package/dist/chunk-76NMME23.mjs.map +0 -1
  409. package/dist/chunk-76VRE4BI.mjs +0 -18
  410. package/dist/chunk-76VRE4BI.mjs.map +0 -1
  411. package/dist/chunk-7MSQV43P.mjs +0 -77
  412. package/dist/chunk-7MSQV43P.mjs.map +0 -1
  413. package/dist/chunk-BKQE7DB5.js +0 -170
  414. package/dist/chunk-BKQE7DB5.js.map +0 -1
  415. package/dist/chunk-CAIIVJAO.mjs +0 -11
  416. package/dist/chunk-CAIIVJAO.mjs.map +0 -1
  417. package/dist/chunk-CHUZGCDV.js +0 -107
  418. package/dist/chunk-CHUZGCDV.js.map +0 -1
  419. package/dist/chunk-COBJUBZE.mjs +0 -170
  420. package/dist/chunk-COBJUBZE.mjs.map +0 -1
  421. package/dist/chunk-D4SNJOID.mjs +0 -269
  422. package/dist/chunk-D4SNJOID.mjs.map +0 -1
  423. package/dist/chunk-DF24ZX4H.js +0 -76
  424. package/dist/chunk-DF24ZX4H.js.map +0 -1
  425. package/dist/chunk-DRB2MN4T.js +0 -16
  426. package/dist/chunk-DRB2MN4T.js.map +0 -1
  427. package/dist/chunk-EHZFPUJH.mjs +0 -53
  428. package/dist/chunk-EHZFPUJH.mjs.map +0 -1
  429. package/dist/chunk-F6BAOSH2.js +0 -269
  430. package/dist/chunk-F6BAOSH2.js.map +0 -1
  431. package/dist/chunk-GQXYWBFK.js +0 -28
  432. package/dist/chunk-GQXYWBFK.js.map +0 -1
  433. package/dist/chunk-H25EBXG5.mjs +0 -58
  434. package/dist/chunk-H25EBXG5.mjs.map +0 -1
  435. package/dist/chunk-IGY2S5BC.js +0 -36
  436. package/dist/chunk-IGY2S5BC.js.map +0 -1
  437. package/dist/chunk-J7NSK6BO.mjs +0 -133
  438. package/dist/chunk-J7NSK6BO.mjs.map +0 -1
  439. package/dist/chunk-JAQ5TPSZ.js +0 -53
  440. package/dist/chunk-JAQ5TPSZ.js.map +0 -1
  441. package/dist/chunk-KHASG4H3.mjs +0 -11
  442. package/dist/chunk-KHASG4H3.mjs.map +0 -1
  443. package/dist/chunk-KIVBL6OM.js +0 -129
  444. package/dist/chunk-KIVBL6OM.js.map +0 -1
  445. package/dist/chunk-KTCSRECK.mjs +0 -76
  446. package/dist/chunk-KTCSRECK.mjs.map +0 -1
  447. package/dist/chunk-LGXQBALM.mjs +0 -106
  448. package/dist/chunk-LGXQBALM.mjs.map +0 -1
  449. package/dist/chunk-LLG4D2SC.js +0 -157
  450. package/dist/chunk-LLG4D2SC.js.map +0 -1
  451. package/dist/chunk-MBTBE4P5.js +0 -54
  452. package/dist/chunk-MBTBE4P5.js.map +0 -1
  453. package/dist/chunk-MK7ABX2V.mjs +0 -186
  454. package/dist/chunk-MK7ABX2V.mjs.map +0 -1
  455. package/dist/chunk-NIUQ34PY.js +0 -11
  456. package/dist/chunk-NIUQ34PY.js.map +0 -1
  457. package/dist/chunk-NMIF3LSX.mjs +0 -29
  458. package/dist/chunk-NMIF3LSX.mjs.map +0 -1
  459. package/dist/chunk-PBRUOBEQ.js +0 -11
  460. package/dist/chunk-PBRUOBEQ.js.map +0 -1
  461. package/dist/chunk-PCOIRDTO.js +0 -18
  462. package/dist/chunk-PCOIRDTO.js.map +0 -1
  463. package/dist/chunk-PQ5T4GHY.js +0 -55
  464. package/dist/chunk-PQ5T4GHY.js.map +0 -1
  465. package/dist/chunk-PRYLTXW4.js +0 -92
  466. package/dist/chunk-PRYLTXW4.js.map +0 -1
  467. package/dist/chunk-Q5KTSMRE.js +0 -120
  468. package/dist/chunk-Q5KTSMRE.js.map +0 -1
  469. package/dist/chunk-QDGLIUUS.mjs +0 -16
  470. package/dist/chunk-QDGLIUUS.mjs.map +0 -1
  471. package/dist/chunk-RG4II6WH.js +0 -57
  472. package/dist/chunk-RG4II6WH.js.map +0 -1
  473. package/dist/chunk-SZ6WMC6C.mjs +0 -534
  474. package/dist/chunk-SZ6WMC6C.mjs.map +0 -1
  475. package/dist/chunk-T2YURW25.js +0 -77
  476. package/dist/chunk-T2YURW25.js.map +0 -1
  477. package/dist/chunk-TFFQFIJV.mjs +0 -54
  478. package/dist/chunk-TFFQFIJV.mjs.map +0 -1
  479. package/dist/chunk-U5UIDVOO.mjs +0 -36
  480. package/dist/chunk-U5UIDVOO.mjs.map +0 -1
  481. package/dist/chunk-UAXWZN5J.js +0 -58
  482. package/dist/chunk-UAXWZN5J.js.map +0 -1
  483. package/dist/chunk-UHP2Y32K.mjs +0 -92
  484. package/dist/chunk-UHP2Y32K.mjs.map +0 -1
  485. package/dist/chunk-UHX7HJAI.js +0 -11
  486. package/dist/chunk-UHX7HJAI.js.map +0 -1
  487. package/dist/chunk-UIRAMHNM.js +0 -186
  488. package/dist/chunk-UIRAMHNM.js.map +0 -1
  489. package/dist/chunk-YHGWG3EQ.js +0 -29
  490. package/dist/chunk-YHGWG3EQ.js.map +0 -1
  491. package/dist/chunk-YKOMKXG4.mjs +0 -120
  492. package/dist/chunk-YKOMKXG4.mjs.map +0 -1
  493. package/dist/chunk-YLURF2PF.mjs +0 -157
  494. package/dist/chunk-YLURF2PF.mjs.map +0 -1
  495. package/dist/chunk-ZUPTMFEA.mjs +0 -28
  496. package/dist/chunk-ZUPTMFEA.mjs.map +0 -1
  497. package/dist/chunk-ZX2KHPXG.js +0 -106
  498. package/dist/chunk-ZX2KHPXG.js.map +0 -1
  499. package/dist/controllers/authentication/AuthenticationController.js +0 -13
  500. package/dist/controllers/authentication/AuthenticationController.js.map +0 -1
  501. package/dist/controllers/authentication/auth-snap-requests.js +0 -10
  502. package/dist/controllers/authentication/auth-snap-requests.js.map +0 -1
  503. package/dist/controllers/authentication/index.js +0 -19
  504. package/dist/controllers/authentication/index.js.map +0 -1
  505. package/dist/controllers/authentication/services.js +0 -21
  506. package/dist/controllers/authentication/services.js.map +0 -1
  507. package/dist/controllers/index.js +0 -25
  508. package/dist/controllers/index.js.map +0 -1
  509. package/dist/controllers/user-storage/UserStorageController.js +0 -20
  510. package/dist/controllers/user-storage/UserStorageController.js.map +0 -1
  511. package/dist/controllers/user-storage/accounts/constants.js +0 -12
  512. package/dist/controllers/user-storage/accounts/constants.js.map +0 -1
  513. package/dist/controllers/user-storage/accounts/user-storage.js +0 -11
  514. package/dist/controllers/user-storage/accounts/user-storage.js.map +0 -1
  515. package/dist/controllers/user-storage/encryption/cache.js +0 -13
  516. package/dist/controllers/user-storage/encryption/cache.js.map +0 -1
  517. package/dist/controllers/user-storage/encryption/encryption.js +0 -12
  518. package/dist/controllers/user-storage/encryption/encryption.js.map +0 -1
  519. package/dist/controllers/user-storage/encryption/index.js +0 -16
  520. package/dist/controllers/user-storage/encryption/index.js.map +0 -1
  521. package/dist/controllers/user-storage/encryption/utils.js +0 -12
  522. package/dist/controllers/user-storage/encryption/utils.js.map +0 -1
  523. package/dist/controllers/user-storage/index.js +0 -31
  524. package/dist/controllers/user-storage/index.js.map +0 -1
  525. package/dist/controllers/user-storage/schema.js +0 -18
  526. package/dist/controllers/user-storage/schema.js.map +0 -1
  527. package/dist/controllers/user-storage/services.js +0 -22
  528. package/dist/controllers/user-storage/services.js.map +0 -1
  529. package/dist/index.js +0 -40
  530. package/dist/index.js.map +0 -1
  531. package/dist/sdk/authentication-jwt-bearer/flow-siwe.js +0 -13
  532. package/dist/sdk/authentication-jwt-bearer/flow-siwe.js.map +0 -1
  533. package/dist/sdk/authentication-jwt-bearer/flow-srp.js +0 -15
  534. package/dist/sdk/authentication-jwt-bearer/flow-srp.js.map +0 -1
  535. package/dist/sdk/authentication-jwt-bearer/services.js +0 -27
  536. package/dist/sdk/authentication-jwt-bearer/services.js.map +0 -1
  537. package/dist/sdk/authentication-jwt-bearer/types.js +0 -8
  538. package/dist/sdk/authentication-jwt-bearer/types.js.map +0 -1
  539. package/dist/sdk/authentication.js +0 -26
  540. package/dist/sdk/authentication.js.map +0 -1
  541. package/dist/sdk/encryption.js +0 -14
  542. package/dist/sdk/encryption.js.map +0 -1
  543. package/dist/sdk/env.js +0 -14
  544. package/dist/sdk/env.js.map +0 -1
  545. package/dist/sdk/errors.js +0 -20
  546. package/dist/sdk/errors.js.map +0 -1
  547. package/dist/sdk/index.js +0 -77
  548. package/dist/sdk/index.js.map +0 -1
  549. package/dist/sdk/user-storage.js +0 -18
  550. package/dist/sdk/user-storage.js.map +0 -1
  551. package/dist/sdk/utils/eip-6963-metamask-provider.js +0 -10
  552. package/dist/sdk/utils/eip-6963-metamask-provider.js.map +0 -1
  553. package/dist/sdk/utils/messaging-signing-snap-requests.js +0 -16
  554. package/dist/sdk/utils/messaging-signing-snap-requests.js.map +0 -1
  555. package/dist/sdk/utils/validate-login-response.js +0 -8
  556. package/dist/sdk/utils/validate-login-response.js.map +0 -1
  557. package/dist/tsconfig.build.tsbuildinfo +0 -1
  558. package/dist/types/controllers/authentication/AuthenticationController.d.ts.map +0 -1
  559. package/dist/types/controllers/authentication/__fixtures__/index.d.ts +0 -2
  560. package/dist/types/controllers/authentication/__fixtures__/index.d.ts.map +0 -1
  561. package/dist/types/controllers/authentication/__fixtures__/mockResponses.d.ts.map +0 -1
  562. package/dist/types/controllers/authentication/__fixtures__/mockServices.d.ts.map +0 -1
  563. package/dist/types/controllers/authentication/auth-snap-requests.d.ts.map +0 -1
  564. package/dist/types/controllers/authentication/index.d.ts +0 -7
  565. package/dist/types/controllers/authentication/index.d.ts.map +0 -1
  566. package/dist/types/controllers/authentication/services.d.ts.map +0 -1
  567. package/dist/types/controllers/index.d.ts +0 -3
  568. package/dist/types/controllers/index.d.ts.map +0 -1
  569. package/dist/types/controllers/user-storage/UserStorageController.d.ts.map +0 -1
  570. package/dist/types/controllers/user-storage/__fixtures__/index.d.ts +0 -3
  571. package/dist/types/controllers/user-storage/__fixtures__/index.d.ts.map +0 -1
  572. package/dist/types/controllers/user-storage/__fixtures__/mockAccounts.d.ts.map +0 -1
  573. package/dist/types/controllers/user-storage/__fixtures__/mockResponses.d.ts.map +0 -1
  574. package/dist/types/controllers/user-storage/__fixtures__/mockServices.d.ts.map +0 -1
  575. package/dist/types/controllers/user-storage/__fixtures__/mockStorage.d.ts.map +0 -1
  576. package/dist/types/controllers/user-storage/accounts/constants.d.ts.map +0 -1
  577. package/dist/types/controllers/user-storage/accounts/user-storage.d.ts.map +0 -1
  578. package/dist/types/controllers/user-storage/encryption/cache.d.ts.map +0 -1
  579. package/dist/types/controllers/user-storage/encryption/encryption.d.ts.map +0 -1
  580. package/dist/types/controllers/user-storage/encryption/index.d.ts +0 -5
  581. package/dist/types/controllers/user-storage/encryption/index.d.ts.map +0 -1
  582. package/dist/types/controllers/user-storage/encryption/utils.d.ts.map +0 -1
  583. package/dist/types/controllers/user-storage/index.d.ts +0 -8
  584. package/dist/types/controllers/user-storage/index.d.ts.map +0 -1
  585. package/dist/types/controllers/user-storage/schema.d.ts.map +0 -1
  586. package/dist/types/controllers/user-storage/services.d.ts.map +0 -1
  587. package/dist/types/index.d.ts +0 -4
  588. package/dist/types/index.d.ts.map +0 -1
  589. package/dist/types/sdk/__fixtures__/mock-auth.d.ts.map +0 -1
  590. package/dist/types/sdk/__fixtures__/mock-userstorage.d.ts.map +0 -1
  591. package/dist/types/sdk/__fixtures__/test-utils.d.ts.map +0 -1
  592. package/dist/types/sdk/authentication-jwt-bearer/flow-siwe.d.ts.map +0 -1
  593. package/dist/types/sdk/authentication-jwt-bearer/flow-srp.d.ts.map +0 -1
  594. package/dist/types/sdk/authentication-jwt-bearer/services.d.ts.map +0 -1
  595. package/dist/types/sdk/authentication-jwt-bearer/types.d.ts.map +0 -1
  596. package/dist/types/sdk/authentication.d.ts.map +0 -1
  597. package/dist/types/sdk/encryption.d.ts +0 -4
  598. package/dist/types/sdk/encryption.d.ts.map +0 -1
  599. package/dist/types/sdk/env.d.ts.map +0 -1
  600. package/dist/types/sdk/errors.d.ts.map +0 -1
  601. package/dist/types/sdk/index.d.ts +0 -7
  602. package/dist/types/sdk/index.d.ts.map +0 -1
  603. package/dist/types/sdk/user-storage.d.ts.map +0 -1
  604. package/dist/types/sdk/utils/eip-6963-metamask-provider.d.ts.map +0 -1
  605. package/dist/types/sdk/utils/messaging-signing-snap-requests.d.ts.map +0 -1
  606. package/dist/types/sdk/utils/validate-login-response.d.ts.map +0 -1
@@ -1,8 +1,9 @@
1
- import {
2
- AuthType
3
- } from "../../chunk-CAIIVJAO.mjs";
4
- import "../../chunk-U5UIDVOO.mjs";
5
- export {
6
- AuthType
7
- };
1
+ export var AuthType;
2
+ (function (AuthType) {
3
+ /* sign in using a private key derived from your secret recovery phrase (SRP).
4
+ Uses message signing snap to perform this operation */
5
+ AuthType["SRP"] = "SRP";
6
+ /* sign in with Ethereum */
7
+ AuthType["SiWE"] = "SiWE";
8
+ })(AuthType || (AuthType = {}));
8
9
  //# sourceMappingURL=types.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,QAOX;AAPD,WAAY,QAAQ;IAClB;+DAC2D;IAC3D,uBAAW,CAAA;IAEX,2BAA2B;IAC3B,yBAAa,CAAA;AACf,CAAC,EAPW,QAAQ,KAAR,QAAQ,QAOnB","sourcesContent":["import type { Env, Platform } from '../env';\n\nexport enum AuthType {\n /* sign in using a private key derived from your secret recovery phrase (SRP). \n Uses message signing snap to perform this operation */\n SRP = 'SRP',\n\n /* sign in with Ethereum */\n SiWE = 'SiWE',\n}\n\nexport type AuthConfig = {\n env: Env;\n platform: Platform;\n type: AuthType;\n};\n\nexport type AccessToken = {\n /**\n * The JWT Access Token\n */\n accessToken: string;\n /**\n * Expiration in seconds\n */\n expiresIn: number;\n /**\n * Date in milliseconds\n */\n obtainedAt: number;\n};\n\nexport type UserProfile = {\n /**\n * The \"Identifier\" used to log in with.\n */\n identifierId: string;\n /**\n * The Unique profile for a logged in user. A Profile can be logged in via multiple Identifiers\n */\n profileId: string;\n /**\n * Server MetaMetrics ID. Allows grouping of user events cross platform.\n */\n metaMetricsId: string;\n};\n\nexport type LoginResponse = {\n token: AccessToken;\n profile: UserProfile;\n};\n\nexport type IBaseAuth = {\n getAccessToken: () => Promise<string>;\n getUserProfile: () => Promise<UserProfile>;\n getIdentifier: () => Promise<string>;\n signMessage: (message: string) => Promise<string>;\n};\n\nexport type AuthStorageOptions = {\n getLoginResponse: () => Promise<LoginResponse | null>;\n setLoginResponse: (val: LoginResponse) => Promise<void>;\n};\n\nexport type AuthSigningOptions = {\n signMessage: (message: string) => Promise<string>;\n getIdentifier: () => Promise<string>;\n};\n\nexport type ErrorMessage = {\n message: string;\n error: string;\n};\n\nexport type Pair = {\n identifier: string;\n encryptedStorageKey: string;\n identifierType: 'SIWE' | 'SRP';\n signMessage: (message: string) => Promise<string>;\n};\n"]}
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
17
+ if (kind === "m") throw new TypeError("Private method is not writable");
18
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
19
+ 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");
20
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
21
+ };
22
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
23
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
24
+ 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");
25
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
26
+ };
27
+ var _JwtBearerAuth_instances, _JwtBearerAuth_type, _JwtBearerAuth_env, _JwtBearerAuth_sdk, _JwtBearerAuth_assertSIWE;
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.SRPJwtBearerAuth = exports.SIWEJwtBearerAuth = exports.JwtBearerAuth = void 0;
30
+ const flow_siwe_1 = require("./authentication-jwt-bearer/flow-siwe.cjs");
31
+ const flow_srp_1 = require("./authentication-jwt-bearer/flow-srp.cjs");
32
+ const services_1 = require("./authentication-jwt-bearer/services.cjs");
33
+ const types_1 = require("./authentication-jwt-bearer/types.cjs");
34
+ const errors_1 = require("./errors.cjs");
35
+ const eip_6963_metamask_provider_1 = require("./utils/eip-6963-metamask-provider.cjs");
36
+ const messaging_signing_snap_requests_1 = require("./utils/messaging-signing-snap-requests.cjs");
37
+ class JwtBearerAuth {
38
+ constructor(...args) {
39
+ _JwtBearerAuth_instances.add(this);
40
+ _JwtBearerAuth_type.set(this, void 0);
41
+ _JwtBearerAuth_env.set(this, void 0);
42
+ _JwtBearerAuth_sdk.set(this, void 0);
43
+ __classPrivateFieldSet(this, _JwtBearerAuth_type, args[0].type, "f");
44
+ __classPrivateFieldSet(this, _JwtBearerAuth_env, args[0].env, "f");
45
+ if (args[0].type === types_1.AuthType.SRP) {
46
+ __classPrivateFieldSet(this, _JwtBearerAuth_sdk, new flow_srp_1.SRPJwtBearerAuth(args[0], args[1]), "f");
47
+ return;
48
+ }
49
+ if (args[0].type === types_1.AuthType.SiWE) {
50
+ __classPrivateFieldSet(this, _JwtBearerAuth_sdk, new flow_siwe_1.SIWEJwtBearerAuth(args[0], args[1]), "f");
51
+ return;
52
+ }
53
+ throw new errors_1.UnsupportedAuthTypeError('unsupported auth type');
54
+ }
55
+ async getAccessToken() {
56
+ return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").getAccessToken();
57
+ }
58
+ async connectSnap() {
59
+ const provider = await (0, eip_6963_metamask_provider_1.getMetaMaskProviderEIP6963)();
60
+ if (!provider) {
61
+ throw new Error('failed to get MetaMaskProviderEIP6963 provider');
62
+ }
63
+ const res = await (0, messaging_signing_snap_requests_1.connectSnap)(provider);
64
+ return res;
65
+ }
66
+ async isSnapConnected() {
67
+ const provider = await (0, eip_6963_metamask_provider_1.getMetaMaskProviderEIP6963)();
68
+ if (!provider) {
69
+ return false;
70
+ }
71
+ const isConnected = await (0, messaging_signing_snap_requests_1.isSnapConnected)(provider);
72
+ return isConnected;
73
+ }
74
+ async getUserProfile() {
75
+ return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").getUserProfile();
76
+ }
77
+ async getIdentifier() {
78
+ return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").getIdentifier();
79
+ }
80
+ async signMessage(message) {
81
+ return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").signMessage(message);
82
+ }
83
+ async pairIdentifiers(pairing) {
84
+ const profile = await this.getUserProfile();
85
+ const n = await (0, services_1.getNonce)(profile.profileId, __classPrivateFieldGet(this, _JwtBearerAuth_env, "f"));
86
+ const logins = await Promise.all(pairing.map(async (p) => {
87
+ try {
88
+ const raw = `metamask:${n.nonce}:${p.identifier}`;
89
+ const sig = await p.signMessage(raw);
90
+ return {
91
+ signature: sig,
92
+ // TODO: Either fix this lint violation or explain why it's necessary to ignore.
93
+ // eslint-disable-next-line @typescript-eslint/naming-convention
94
+ raw_message: raw,
95
+ // TODO: Either fix this lint violation or explain why it's necessary to ignore.
96
+ // eslint-disable-next-line @typescript-eslint/naming-convention
97
+ encrypted_storage_key: p.encryptedStorageKey,
98
+ // TODO: Either fix this lint violation or explain why it's necessary to ignore.
99
+ // eslint-disable-next-line @typescript-eslint/naming-convention
100
+ identifier_type: p.identifierType,
101
+ };
102
+ }
103
+ catch (e) {
104
+ /* istanbul ignore next */
105
+ const errorMessage = e instanceof Error ? e.message : JSON.stringify(e ?? '');
106
+ throw new errors_1.PairError(`failed to sign pairing message: ${errorMessage}`);
107
+ }
108
+ }));
109
+ const accessToken = await this.getAccessToken();
110
+ await (0, services_1.pairIdentifiers)(n.nonce, logins, accessToken, __classPrivateFieldGet(this, _JwtBearerAuth_env, "f"));
111
+ }
112
+ prepare(signer) {
113
+ __classPrivateFieldGet(this, _JwtBearerAuth_instances, "m", _JwtBearerAuth_assertSIWE).call(this, __classPrivateFieldGet(this, _JwtBearerAuth_type, "f"), __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f"));
114
+ __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").prepare(signer);
115
+ }
116
+ }
117
+ exports.JwtBearerAuth = JwtBearerAuth;
118
+ _JwtBearerAuth_type = new WeakMap(), _JwtBearerAuth_env = new WeakMap(), _JwtBearerAuth_sdk = new WeakMap(), _JwtBearerAuth_instances = new WeakSet(), _JwtBearerAuth_assertSIWE = function _JwtBearerAuth_assertSIWE(type, sdk) {
119
+ if (type === types_1.AuthType.SiWE) {
120
+ return;
121
+ }
122
+ throw new errors_1.UnsupportedAuthTypeError('This method is only available via SIWE auth type');
123
+ };
124
+ var flow_siwe_2 = require("./authentication-jwt-bearer/flow-siwe.cjs");
125
+ Object.defineProperty(exports, "SIWEJwtBearerAuth", { enumerable: true, get: function () { return flow_siwe_2.SIWEJwtBearerAuth; } });
126
+ var flow_srp_2 = require("./authentication-jwt-bearer/flow-srp.cjs");
127
+ Object.defineProperty(exports, "SRPJwtBearerAuth", { enumerable: true, get: function () { return flow_srp_2.SRPJwtBearerAuth; } });
128
+ __exportStar(require("./authentication-jwt-bearer/types.cjs"), exports);
129
+ //# sourceMappingURL=authentication.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.cjs","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":"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","sourcesContent":["import { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nimport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nimport {\n getNonce,\n pairIdentifiers,\n} from './authentication-jwt-bearer/services';\nimport type { UserProfile, Pair } from './authentication-jwt-bearer/types';\nimport { AuthType } from './authentication-jwt-bearer/types';\nimport type { Env } from './env';\nimport { PairError, UnsupportedAuthTypeError } from './errors';\nimport { getMetaMaskProviderEIP6963 } from './utils/eip-6963-metamask-provider';\nimport {\n connectSnap,\n isSnapConnected,\n} from './utils/messaging-signing-snap-requests';\n\n// Computing the Classes, so we only get back the public methods for the interface.\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/naming-convention\ntype Compute<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;\ntype SIWEInterface = Compute<SIWEJwtBearerAuth>;\ntype SRPInterface = Compute<SRPJwtBearerAuth>;\n\ntype SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;\ntype SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;\ntype JwtBearerAuthParams = SiweParams | SRPParams;\n\nexport class JwtBearerAuth implements SIWEInterface, SRPInterface {\n #type: AuthType;\n\n #env: Env;\n\n #sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth;\n\n constructor(...args: JwtBearerAuthParams) {\n this.#type = args[0].type;\n this.#env = args[0].env;\n\n if (args[0].type === AuthType.SRP) {\n this.#sdk = new SRPJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n if (args[0].type === AuthType.SiWE) {\n this.#sdk = new SIWEJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n throw new UnsupportedAuthTypeError('unsupported auth type');\n }\n\n async getAccessToken(): Promise<string> {\n return await this.#sdk.getAccessToken();\n }\n\n async connectSnap(): Promise<string> {\n const provider = await getMetaMaskProviderEIP6963();\n if (!provider) {\n throw new Error('failed to get MetaMaskProviderEIP6963 provider');\n }\n const res = await connectSnap(provider);\n return res;\n }\n\n async isSnapConnected(): Promise<boolean> {\n const provider = await getMetaMaskProviderEIP6963();\n if (!provider) {\n return false;\n }\n\n const isConnected = await isSnapConnected(provider);\n return isConnected;\n }\n\n async getUserProfile(): Promise<UserProfile> {\n return await this.#sdk.getUserProfile();\n }\n\n async getIdentifier(): Promise<string> {\n return await this.#sdk.getIdentifier();\n }\n\n async signMessage(message: string): Promise<string> {\n return await this.#sdk.signMessage(message);\n }\n\n async pairIdentifiers(pairing: Pair[]): Promise<void> {\n const profile = await this.getUserProfile();\n const n = await getNonce(profile.profileId, this.#env);\n\n const logins = await Promise.all(\n pairing.map(async (p) => {\n try {\n const raw = `metamask:${n.nonce}:${p.identifier}`;\n const sig = await p.signMessage(raw);\n return {\n signature: sig,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n raw_message: raw,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n encrypted_storage_key: p.encryptedStorageKey,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n identifier_type: p.identifierType,\n };\n } catch (e) {\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n throw new PairError(\n `failed to sign pairing message: ${errorMessage}`,\n );\n }\n }),\n );\n\n const accessToken = await this.getAccessToken();\n await pairIdentifiers(n.nonce, logins, accessToken, this.#env);\n }\n\n prepare(signer: {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n }): void {\n this.#assertSIWE(this.#type, this.#sdk);\n this.#sdk.prepare(signer);\n }\n\n #assertSIWE(\n type: AuthType,\n sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts sdk is SIWEJwtBearerAuth {\n if (type === AuthType.SiWE) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SIWE auth type',\n );\n }\n}\n\nexport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nexport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nexport * from './authentication-jwt-bearer/types';\n"]}
@@ -1,6 +1,6 @@
1
- import { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';
2
- import { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';
3
- import type { UserProfile, Pair } from './authentication-jwt-bearer/types';
1
+ import { SIWEJwtBearerAuth } from "./authentication-jwt-bearer/flow-siwe.cjs";
2
+ import { SRPJwtBearerAuth } from "./authentication-jwt-bearer/flow-srp.cjs";
3
+ import type { UserProfile, Pair } from "./authentication-jwt-bearer/types.cjs";
4
4
  type Compute<T> = T extends infer U ? {
5
5
  [K in keyof U]: U[K];
6
6
  } : never;
@@ -14,6 +14,7 @@ export declare class JwtBearerAuth implements SIWEInterface, SRPInterface {
14
14
  constructor(...args: JwtBearerAuthParams);
15
15
  getAccessToken(): Promise<string>;
16
16
  connectSnap(): Promise<string>;
17
+ isSnapConnected(): Promise<boolean>;
17
18
  getUserProfile(): Promise<UserProfile>;
18
19
  getIdentifier(): Promise<string>;
19
20
  signMessage(message: string): Promise<string>;
@@ -25,7 +26,7 @@ export declare class JwtBearerAuth implements SIWEInterface, SRPInterface {
25
26
  domain: string;
26
27
  }): void;
27
28
  }
28
- export { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';
29
- export { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';
30
- export * from './authentication-jwt-bearer/types';
31
- //# sourceMappingURL=authentication.d.ts.map
29
+ export { SIWEJwtBearerAuth } from "./authentication-jwt-bearer/flow-siwe.cjs";
30
+ export { SRPJwtBearerAuth } from "./authentication-jwt-bearer/flow-srp.cjs";
31
+ export * from "./authentication-jwt-bearer/types.cjs";
32
+ //# sourceMappingURL=authentication.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.d.cts","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AAKxE,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,8CAA0C;AAa3E,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,KAAK,CAAC;AACvE,KAAK,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAChD,KAAK,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE9C,KAAK,UAAU,GAAG,qBAAqB,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,KAAK,SAAS,GAAG,qBAAqB,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,KAAK,mBAAmB,GAAG,UAAU,GAAG,SAAS,CAAC;AAElD,qBAAa,aAAc,YAAW,aAAa,EAAE,YAAY;;gBAOnD,GAAG,IAAI,EAAE,mBAAmB;IAiBlC,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAIjC,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAS9B,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAUnC,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;IAItC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAIhC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI7C,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAoCrD,OAAO,CAAC,MAAM,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QAClD,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI;CAiBT;AAED,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AACxE,sDAAkD"}
@@ -0,0 +1,32 @@
1
+ import { SIWEJwtBearerAuth } from "./authentication-jwt-bearer/flow-siwe.mjs";
2
+ import { SRPJwtBearerAuth } from "./authentication-jwt-bearer/flow-srp.mjs";
3
+ import type { UserProfile, Pair } from "./authentication-jwt-bearer/types.mjs";
4
+ type Compute<T> = T extends infer U ? {
5
+ [K in keyof U]: U[K];
6
+ } : never;
7
+ type SIWEInterface = Compute<SIWEJwtBearerAuth>;
8
+ type SRPInterface = Compute<SRPJwtBearerAuth>;
9
+ type SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;
10
+ type SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;
11
+ type JwtBearerAuthParams = SiweParams | SRPParams;
12
+ export declare class JwtBearerAuth implements SIWEInterface, SRPInterface {
13
+ #private;
14
+ constructor(...args: JwtBearerAuthParams);
15
+ getAccessToken(): Promise<string>;
16
+ connectSnap(): Promise<string>;
17
+ isSnapConnected(): Promise<boolean>;
18
+ getUserProfile(): Promise<UserProfile>;
19
+ getIdentifier(): Promise<string>;
20
+ signMessage(message: string): Promise<string>;
21
+ pairIdentifiers(pairing: Pair[]): Promise<void>;
22
+ prepare(signer: {
23
+ address: string;
24
+ chainId: number;
25
+ signMessage: (message: string) => Promise<string>;
26
+ domain: string;
27
+ }): void;
28
+ }
29
+ export { SIWEJwtBearerAuth } from "./authentication-jwt-bearer/flow-siwe.mjs";
30
+ export { SRPJwtBearerAuth } from "./authentication-jwt-bearer/flow-srp.mjs";
31
+ export * from "./authentication-jwt-bearer/types.mjs";
32
+ //# sourceMappingURL=authentication.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authentication.d.mts","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AAKxE,OAAO,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,8CAA0C;AAa3E,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,KAAK,CAAC;AACvE,KAAK,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAChD,KAAK,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE9C,KAAK,UAAU,GAAG,qBAAqB,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAClE,KAAK,SAAS,GAAG,qBAAqB,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAChE,KAAK,mBAAmB,GAAG,UAAU,GAAG,SAAS,CAAC;AAElD,qBAAa,aAAc,YAAW,aAAa,EAAE,YAAY;;gBAOnD,GAAG,IAAI,EAAE,mBAAmB;IAiBlC,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAIjC,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;IAS9B,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAUnC,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;IAItC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAIhC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI7C,eAAe,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAoCrD,OAAO,CAAC,MAAM,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;QAChB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;QAClD,MAAM,EAAE,MAAM,CAAC;KAChB,GAAG,IAAI;CAiBT;AAED,OAAO,EAAE,iBAAiB,EAAE,kDAA8C;AAC1E,OAAO,EAAE,gBAAgB,EAAE,iDAA6C;AACxE,sDAAkD"}
@@ -1,26 +1,109 @@
1
- import {
2
- JwtBearerAuth
3
- } from "../chunk-YKOMKXG4.mjs";
4
- import {
5
- SIWEJwtBearerAuth
6
- } from "../chunk-2CWF7ZTL.mjs";
7
- import {
8
- SRPJwtBearerAuth
9
- } from "../chunk-J7NSK6BO.mjs";
10
- import "../chunk-YLURF2PF.mjs";
11
- import {
12
- AuthType
13
- } from "../chunk-CAIIVJAO.mjs";
14
- import "../chunk-5XSXZTED.mjs";
15
- import "../chunk-5EBUFNAN.mjs";
16
- import "../chunk-QDGLIUUS.mjs";
17
- import "../chunk-KTCSRECK.mjs";
18
- import "../chunk-TFFQFIJV.mjs";
19
- import "../chunk-U5UIDVOO.mjs";
20
- export {
21
- AuthType,
22
- JwtBearerAuth,
23
- SIWEJwtBearerAuth,
24
- SRPJwtBearerAuth
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ 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");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
25
6
  };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ 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");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _JwtBearerAuth_instances, _JwtBearerAuth_type, _JwtBearerAuth_env, _JwtBearerAuth_sdk, _JwtBearerAuth_assertSIWE;
13
+ import { SIWEJwtBearerAuth } from "./authentication-jwt-bearer/flow-siwe.mjs";
14
+ import { SRPJwtBearerAuth } from "./authentication-jwt-bearer/flow-srp.mjs";
15
+ import { getNonce, pairIdentifiers } from "./authentication-jwt-bearer/services.mjs";
16
+ import { AuthType } from "./authentication-jwt-bearer/types.mjs";
17
+ import { PairError, UnsupportedAuthTypeError } from "./errors.mjs";
18
+ import { getMetaMaskProviderEIP6963 } from "./utils/eip-6963-metamask-provider.mjs";
19
+ import { connectSnap, isSnapConnected } from "./utils/messaging-signing-snap-requests.mjs";
20
+ export class JwtBearerAuth {
21
+ constructor(...args) {
22
+ _JwtBearerAuth_instances.add(this);
23
+ _JwtBearerAuth_type.set(this, void 0);
24
+ _JwtBearerAuth_env.set(this, void 0);
25
+ _JwtBearerAuth_sdk.set(this, void 0);
26
+ __classPrivateFieldSet(this, _JwtBearerAuth_type, args[0].type, "f");
27
+ __classPrivateFieldSet(this, _JwtBearerAuth_env, args[0].env, "f");
28
+ if (args[0].type === AuthType.SRP) {
29
+ __classPrivateFieldSet(this, _JwtBearerAuth_sdk, new SRPJwtBearerAuth(args[0], args[1]), "f");
30
+ return;
31
+ }
32
+ if (args[0].type === AuthType.SiWE) {
33
+ __classPrivateFieldSet(this, _JwtBearerAuth_sdk, new SIWEJwtBearerAuth(args[0], args[1]), "f");
34
+ return;
35
+ }
36
+ throw new UnsupportedAuthTypeError('unsupported auth type');
37
+ }
38
+ async getAccessToken() {
39
+ return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").getAccessToken();
40
+ }
41
+ async connectSnap() {
42
+ const provider = await getMetaMaskProviderEIP6963();
43
+ if (!provider) {
44
+ throw new Error('failed to get MetaMaskProviderEIP6963 provider');
45
+ }
46
+ const res = await connectSnap(provider);
47
+ return res;
48
+ }
49
+ async isSnapConnected() {
50
+ const provider = await getMetaMaskProviderEIP6963();
51
+ if (!provider) {
52
+ return false;
53
+ }
54
+ const isConnected = await isSnapConnected(provider);
55
+ return isConnected;
56
+ }
57
+ async getUserProfile() {
58
+ return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").getUserProfile();
59
+ }
60
+ async getIdentifier() {
61
+ return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").getIdentifier();
62
+ }
63
+ async signMessage(message) {
64
+ return await __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").signMessage(message);
65
+ }
66
+ async pairIdentifiers(pairing) {
67
+ const profile = await this.getUserProfile();
68
+ const n = await getNonce(profile.profileId, __classPrivateFieldGet(this, _JwtBearerAuth_env, "f"));
69
+ const logins = await Promise.all(pairing.map(async (p) => {
70
+ try {
71
+ const raw = `metamask:${n.nonce}:${p.identifier}`;
72
+ const sig = await p.signMessage(raw);
73
+ return {
74
+ signature: sig,
75
+ // TODO: Either fix this lint violation or explain why it's necessary to ignore.
76
+ // eslint-disable-next-line @typescript-eslint/naming-convention
77
+ raw_message: raw,
78
+ // TODO: Either fix this lint violation or explain why it's necessary to ignore.
79
+ // eslint-disable-next-line @typescript-eslint/naming-convention
80
+ encrypted_storage_key: p.encryptedStorageKey,
81
+ // TODO: Either fix this lint violation or explain why it's necessary to ignore.
82
+ // eslint-disable-next-line @typescript-eslint/naming-convention
83
+ identifier_type: p.identifierType,
84
+ };
85
+ }
86
+ catch (e) {
87
+ /* istanbul ignore next */
88
+ const errorMessage = e instanceof Error ? e.message : JSON.stringify(e ?? '');
89
+ throw new PairError(`failed to sign pairing message: ${errorMessage}`);
90
+ }
91
+ }));
92
+ const accessToken = await this.getAccessToken();
93
+ await pairIdentifiers(n.nonce, logins, accessToken, __classPrivateFieldGet(this, _JwtBearerAuth_env, "f"));
94
+ }
95
+ prepare(signer) {
96
+ __classPrivateFieldGet(this, _JwtBearerAuth_instances, "m", _JwtBearerAuth_assertSIWE).call(this, __classPrivateFieldGet(this, _JwtBearerAuth_type, "f"), __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f"));
97
+ __classPrivateFieldGet(this, _JwtBearerAuth_sdk, "f").prepare(signer);
98
+ }
99
+ }
100
+ _JwtBearerAuth_type = new WeakMap(), _JwtBearerAuth_env = new WeakMap(), _JwtBearerAuth_sdk = new WeakMap(), _JwtBearerAuth_instances = new WeakSet(), _JwtBearerAuth_assertSIWE = function _JwtBearerAuth_assertSIWE(type, sdk) {
101
+ if (type === AuthType.SiWE) {
102
+ return;
103
+ }
104
+ throw new UnsupportedAuthTypeError('This method is only available via SIWE auth type');
105
+ };
106
+ export { SIWEJwtBearerAuth } from "./authentication-jwt-bearer/flow-siwe.mjs";
107
+ export { SRPJwtBearerAuth } from "./authentication-jwt-bearer/flow-srp.mjs";
108
+ export * from "./authentication-jwt-bearer/types.mjs";
26
109
  //# sourceMappingURL=authentication.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"file":"authentication.mjs","sourceRoot":"","sources":["../../src/sdk/authentication.ts"],"names":[],"mappings":"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","sourcesContent":["import { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nimport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nimport {\n getNonce,\n pairIdentifiers,\n} from './authentication-jwt-bearer/services';\nimport type { UserProfile, Pair } from './authentication-jwt-bearer/types';\nimport { AuthType } from './authentication-jwt-bearer/types';\nimport type { Env } from './env';\nimport { PairError, UnsupportedAuthTypeError } from './errors';\nimport { getMetaMaskProviderEIP6963 } from './utils/eip-6963-metamask-provider';\nimport {\n connectSnap,\n isSnapConnected,\n} from './utils/messaging-signing-snap-requests';\n\n// Computing the Classes, so we only get back the public methods for the interface.\n// TODO: Either fix this lint violation or explain why it's necessary to ignore.\n// eslint-disable-next-line @typescript-eslint/naming-convention\ntype Compute<T> = T extends infer U ? { [K in keyof U]: U[K] } : never;\ntype SIWEInterface = Compute<SIWEJwtBearerAuth>;\ntype SRPInterface = Compute<SRPJwtBearerAuth>;\n\ntype SiweParams = ConstructorParameters<typeof SIWEJwtBearerAuth>;\ntype SRPParams = ConstructorParameters<typeof SRPJwtBearerAuth>;\ntype JwtBearerAuthParams = SiweParams | SRPParams;\n\nexport class JwtBearerAuth implements SIWEInterface, SRPInterface {\n #type: AuthType;\n\n #env: Env;\n\n #sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth;\n\n constructor(...args: JwtBearerAuthParams) {\n this.#type = args[0].type;\n this.#env = args[0].env;\n\n if (args[0].type === AuthType.SRP) {\n this.#sdk = new SRPJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n if (args[0].type === AuthType.SiWE) {\n this.#sdk = new SIWEJwtBearerAuth(args[0], args[1]);\n return;\n }\n\n throw new UnsupportedAuthTypeError('unsupported auth type');\n }\n\n async getAccessToken(): Promise<string> {\n return await this.#sdk.getAccessToken();\n }\n\n async connectSnap(): Promise<string> {\n const provider = await getMetaMaskProviderEIP6963();\n if (!provider) {\n throw new Error('failed to get MetaMaskProviderEIP6963 provider');\n }\n const res = await connectSnap(provider);\n return res;\n }\n\n async isSnapConnected(): Promise<boolean> {\n const provider = await getMetaMaskProviderEIP6963();\n if (!provider) {\n return false;\n }\n\n const isConnected = await isSnapConnected(provider);\n return isConnected;\n }\n\n async getUserProfile(): Promise<UserProfile> {\n return await this.#sdk.getUserProfile();\n }\n\n async getIdentifier(): Promise<string> {\n return await this.#sdk.getIdentifier();\n }\n\n async signMessage(message: string): Promise<string> {\n return await this.#sdk.signMessage(message);\n }\n\n async pairIdentifiers(pairing: Pair[]): Promise<void> {\n const profile = await this.getUserProfile();\n const n = await getNonce(profile.profileId, this.#env);\n\n const logins = await Promise.all(\n pairing.map(async (p) => {\n try {\n const raw = `metamask:${n.nonce}:${p.identifier}`;\n const sig = await p.signMessage(raw);\n return {\n signature: sig,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n raw_message: raw,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n encrypted_storage_key: p.encryptedStorageKey,\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n identifier_type: p.identifierType,\n };\n } catch (e) {\n /* istanbul ignore next */\n const errorMessage =\n e instanceof Error ? e.message : JSON.stringify(e ?? '');\n throw new PairError(\n `failed to sign pairing message: ${errorMessage}`,\n );\n }\n }),\n );\n\n const accessToken = await this.getAccessToken();\n await pairIdentifiers(n.nonce, logins, accessToken, this.#env);\n }\n\n prepare(signer: {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n }): void {\n this.#assertSIWE(this.#type, this.#sdk);\n this.#sdk.prepare(signer);\n }\n\n #assertSIWE(\n type: AuthType,\n sdk: SIWEJwtBearerAuth | SRPJwtBearerAuth,\n ): asserts sdk is SIWEJwtBearerAuth {\n if (type === AuthType.SiWE) {\n return;\n }\n\n throw new UnsupportedAuthTypeError(\n 'This method is only available via SIWE auth type',\n );\n }\n}\n\nexport { SIWEJwtBearerAuth } from './authentication-jwt-bearer/flow-siwe';\nexport { SRPJwtBearerAuth } from './authentication-jwt-bearer/flow-srp';\nexport * from './authentication-jwt-bearer/types';\n"]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ var __importDefault = (this && this.__importDefault) || function (mod) {
17
+ return (mod && mod.__esModule) ? mod : { "default": mod };
18
+ };
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ const encryption_1 = __importDefault(require("../controllers/user-storage/encryption/encryption.cjs"));
21
+ __exportStar(require("../controllers/user-storage/encryption/encryption.cjs"), exports);
22
+ exports.default = encryption_1.default;
23
+ //# sourceMappingURL=encryption.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption.cjs","sourceRoot":"","sources":["../../src/sdk/encryption.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,uGAA2E;AAE3E,wFAAkE;AAClE,kBAAe,oBAAU,CAAC","sourcesContent":["import encryption from '../controllers/user-storage/encryption/encryption';\n\nexport * from '../controllers/user-storage/encryption/encryption';\nexport default encryption;\n"]}
@@ -0,0 +1,4 @@
1
+ import encryption from "../controllers/user-storage/encryption/encryption.cjs";
2
+ export * from "../controllers/user-storage/encryption/encryption.cjs";
3
+ export default encryption;
4
+ //# sourceMappingURL=encryption.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption.d.cts","sourceRoot":"","sources":["../../src/sdk/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,8DAA0D;AAE3E,sEAAkE;AAClE,eAAe,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ import encryption from "../controllers/user-storage/encryption/encryption.mjs";
2
+ export * from "../controllers/user-storage/encryption/encryption.mjs";
3
+ export default encryption;
4
+ //# sourceMappingURL=encryption.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption.d.mts","sourceRoot":"","sources":["../../src/sdk/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,8DAA0D;AAE3E,sEAAkE;AAClE,eAAe,UAAU,CAAC"}
@@ -1,14 +1,4 @@
1
- import {
2
- encryption_default
3
- } from "../chunk-6DAK2U35.mjs";
4
- import {
5
- createSHA256Hash
6
- } from "../chunk-COBJUBZE.mjs";
7
- import "../chunk-H25EBXG5.mjs";
8
- import "../chunk-76VRE4BI.mjs";
9
- import "../chunk-U5UIDVOO.mjs";
10
- export {
11
- createSHA256Hash,
12
- encryption_default as default
13
- };
1
+ import encryption from "../controllers/user-storage/encryption/encryption.mjs";
2
+ export * from "../controllers/user-storage/encryption/encryption.mjs";
3
+ export default encryption;
14
4
  //# sourceMappingURL=encryption.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"file":"encryption.mjs","sourceRoot":"","sources":["../../src/sdk/encryption.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,8DAA0D;AAE3E,sEAAkE;AAClE,eAAe,UAAU,CAAC","sourcesContent":["import encryption from '../controllers/user-storage/encryption/encryption';\n\nexport * from '../controllers/user-storage/encryption/encryption';\nexport default encryption;\n"]}
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOidcClientId = exports.getEnvUrls = exports.Platform = exports.Env = void 0;
4
+ var Env;
5
+ (function (Env) {
6
+ Env["DEV"] = "dev";
7
+ Env["UAT"] = "uat";
8
+ Env["PRD"] = "prd";
9
+ })(Env || (exports.Env = Env = {}));
10
+ var Platform;
11
+ (function (Platform) {
12
+ Platform["MOBILE"] = "mobile";
13
+ Platform["EXTENSION"] = "extension";
14
+ Platform["PORTFOLIO"] = "portfolio";
15
+ Platform["INFURA"] = "infura";
16
+ })(Platform || (exports.Platform = Platform = {}));
17
+ const ENV_URLS = {
18
+ dev: {
19
+ authApiUrl: 'https://authentication.dev-api.cx.metamask.io',
20
+ oidcApiUrl: 'https://oidc.dev-api.cx.metamask.io',
21
+ userStorageApiUrl: 'https://user-storage.dev-api.cx.metamask.io',
22
+ },
23
+ uat: {
24
+ authApiUrl: 'https://authentication.uat-api.cx.metamask.io',
25
+ oidcApiUrl: 'https://oidc.uat-api.cx.metamask.io',
26
+ userStorageApiUrl: 'https://user-storage.uat-api.cx.metamask.io',
27
+ },
28
+ prd: {
29
+ authApiUrl: 'https://authentication.api.cx.metamask.io',
30
+ oidcApiUrl: 'https://oidc.api.cx.metamask.io',
31
+ userStorageApiUrl: 'https://user-storage.api.cx.metamask.io',
32
+ },
33
+ };
34
+ /**
35
+ * Validates and returns correct environment endpoints
36
+ *
37
+ * @param env - environment field
38
+ * @returns the correct environment url
39
+ * @throws on invalid environment passed
40
+ */
41
+ function getEnvUrls(env) {
42
+ if (!ENV_URLS[env]) {
43
+ throw new Error('invalid environment configuration');
44
+ }
45
+ return ENV_URLS[env];
46
+ }
47
+ exports.getEnvUrls = getEnvUrls;
48
+ /**
49
+ * Returns the valid OIDC Client ID (used during authorization)
50
+ *
51
+ * @param env - environment field
52
+ * @param platform - platform field
53
+ * @returns the OIDC client id for the environment
54
+ */
55
+ function getOidcClientId(env, platform) {
56
+ const clientIds = {
57
+ [Env.DEV]: {
58
+ [Platform.PORTFOLIO]: 'c7ca94a0-5d52-4635-9502-1a50a9c410cc',
59
+ [Platform.MOBILE]: 'e83c7cc9-267d-4fb4-8fec-f0e3bbe5ae8e',
60
+ [Platform.EXTENSION]: 'f1a963d7-50dc-4cb5-8d81-f1f3654f0df3',
61
+ [Platform.INFURA]: 'bd887006-0d55-481a-a395-5ff9a0dc52c9',
62
+ },
63
+ [Env.UAT]: {
64
+ [Platform.PORTFOLIO]: '8f2dd4ac-db07-4819-9ba5-1ee0ec1b56d1',
65
+ [Platform.MOBILE]: 'c3cfdcd2-51d6-4fae-ad2c-ff238c8fef53',
66
+ [Platform.EXTENSION]: 'a9de167c-c9a6-43d8-af39-d301fd44c485',
67
+ [Platform.INFURA]: '01929890-7002-4c97-9913-8f6c09a6d674',
68
+ },
69
+ [Env.PRD]: {
70
+ [Platform.PORTFOLIO]: '35e1cd62-49c5-4be8-8b6e-a5212f2d2cfb',
71
+ [Platform.MOBILE]: '75fa62a3-9ca0-4b91-9fe5-76bec86b0257',
72
+ [Platform.EXTENSION]: '1132f10a-b4e5-4390-a5f2-d9c6022db564',
73
+ [Platform.INFURA]: 'fdde9417-e193-4d23-9943-a8346b18d097',
74
+ },
75
+ };
76
+ if (!clientIds[env]) {
77
+ throw new Error(`invalid env ${env}: cannot determine oidc client id`);
78
+ }
79
+ if (!clientIds[env][platform]) {
80
+ throw new Error(`invalid env ${env} and platform ${platform} combination: cannot determine oidc client id`);
81
+ }
82
+ return clientIds[env][platform];
83
+ }
84
+ exports.getOidcClientId = getOidcClientId;
85
+ //# sourceMappingURL=env.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.cjs","sourceRoot":"","sources":["../../src/sdk/env.ts"],"names":[],"mappings":";;;AAAA,IAAY,GAIX;AAJD,WAAY,GAAG;IACb,kBAAW,CAAA;IACX,kBAAW,CAAA;IACX,kBAAW,CAAA;AACb,CAAC,EAJW,GAAG,mBAAH,GAAG,QAId;AAED,IAAY,QAKX;AALD,WAAY,QAAQ;IAClB,6BAAiB,CAAA;IACjB,mCAAuB,CAAA;IACvB,mCAAuB,CAAA;IACvB,6BAAiB,CAAA;AACnB,CAAC,EALW,QAAQ,wBAAR,QAAQ,QAKnB;AAQD,MAAM,QAAQ,GAA8B;IAC1C,GAAG,EAAE;QACH,UAAU,EAAE,+CAA+C;QAC3D,UAAU,EAAE,qCAAqC;QACjD,iBAAiB,EAAE,6CAA6C;KACjE;IACD,GAAG,EAAE;QACH,UAAU,EAAE,+CAA+C;QAC3D,UAAU,EAAE,qCAAqC;QACjD,iBAAiB,EAAE,6CAA6C;KACjE;IACD,GAAG,EAAE;QACH,UAAU,EAAE,2CAA2C;QACvD,UAAU,EAAE,iCAAiC;QAC7C,iBAAiB,EAAE,yCAAyC;KAC7D;CACF,CAAC;AAEF;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,GAAQ;IACjC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAClB,MAAM,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC;KACtD;IACD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC;AALD,gCAKC;AAED;;;;;;GAMG;AACH,SAAgB,eAAe,CAAC,GAAQ,EAAE,QAAkB;IAC1D,MAAM,SAAS,GAAG;QAChB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACT,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,sCAAsC;YAC5D,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,sCAAsC;YACzD,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,sCAAsC;YAC5D,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,sCAAsC;SAC1D;QACD,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACT,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,sCAAsC;YAC5D,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,sCAAsC;YACzD,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,sCAAsC;YAC5D,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,sCAAsC;SAC1D;QACD,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;YACT,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,sCAAsC;YAC5D,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,sCAAsC;YACzD,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,sCAAsC;YAC5D,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,sCAAsC;SAC1D;KACF,CAAC;IAEF,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,EAAE;QACnB,MAAM,IAAI,KAAK,CAAC,eAAe,GAAG,mCAAmC,CAAC,CAAC;KACxE;IAED,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,EAAE;QAC7B,MAAM,IAAI,KAAK,CACb,eAAe,GAAG,iBAAiB,QAAQ,+CAA+C,CAC3F,CAAC;KACH;IAED,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AAjCD,0CAiCC","sourcesContent":["export enum Env {\n DEV = 'dev',\n UAT = 'uat',\n PRD = 'prd',\n}\n\nexport enum Platform {\n MOBILE = 'mobile',\n EXTENSION = 'extension',\n PORTFOLIO = 'portfolio',\n INFURA = 'infura',\n}\n\ntype EnvUrlsEntry = {\n authApiUrl: string;\n oidcApiUrl: string;\n userStorageApiUrl: string;\n};\n\nconst ENV_URLS: Record<Env, EnvUrlsEntry> = {\n dev: {\n authApiUrl: 'https://authentication.dev-api.cx.metamask.io',\n oidcApiUrl: 'https://oidc.dev-api.cx.metamask.io',\n userStorageApiUrl: 'https://user-storage.dev-api.cx.metamask.io',\n },\n uat: {\n authApiUrl: 'https://authentication.uat-api.cx.metamask.io',\n oidcApiUrl: 'https://oidc.uat-api.cx.metamask.io',\n userStorageApiUrl: 'https://user-storage.uat-api.cx.metamask.io',\n },\n prd: {\n authApiUrl: 'https://authentication.api.cx.metamask.io',\n oidcApiUrl: 'https://oidc.api.cx.metamask.io',\n userStorageApiUrl: 'https://user-storage.api.cx.metamask.io',\n },\n};\n\n/**\n * Validates and returns correct environment endpoints\n *\n * @param env - environment field\n * @returns the correct environment url\n * @throws on invalid environment passed\n */\nexport function getEnvUrls(env: Env): EnvUrlsEntry {\n if (!ENV_URLS[env]) {\n throw new Error('invalid environment configuration');\n }\n return ENV_URLS[env];\n}\n\n/**\n * Returns the valid OIDC Client ID (used during authorization)\n *\n * @param env - environment field\n * @param platform - platform field\n * @returns the OIDC client id for the environment\n */\nexport function getOidcClientId(env: Env, platform: Platform): string {\n const clientIds = {\n [Env.DEV]: {\n [Platform.PORTFOLIO]: 'c7ca94a0-5d52-4635-9502-1a50a9c410cc',\n [Platform.MOBILE]: 'e83c7cc9-267d-4fb4-8fec-f0e3bbe5ae8e',\n [Platform.EXTENSION]: 'f1a963d7-50dc-4cb5-8d81-f1f3654f0df3',\n [Platform.INFURA]: 'bd887006-0d55-481a-a395-5ff9a0dc52c9',\n },\n [Env.UAT]: {\n [Platform.PORTFOLIO]: '8f2dd4ac-db07-4819-9ba5-1ee0ec1b56d1',\n [Platform.MOBILE]: 'c3cfdcd2-51d6-4fae-ad2c-ff238c8fef53',\n [Platform.EXTENSION]: 'a9de167c-c9a6-43d8-af39-d301fd44c485',\n [Platform.INFURA]: '01929890-7002-4c97-9913-8f6c09a6d674',\n },\n [Env.PRD]: {\n [Platform.PORTFOLIO]: '35e1cd62-49c5-4be8-8b6e-a5212f2d2cfb',\n [Platform.MOBILE]: '75fa62a3-9ca0-4b91-9fe5-76bec86b0257',\n [Platform.EXTENSION]: '1132f10a-b4e5-4390-a5f2-d9c6022db564',\n [Platform.INFURA]: 'fdde9417-e193-4d23-9943-a8346b18d097',\n },\n };\n\n if (!clientIds[env]) {\n throw new Error(`invalid env ${env}: cannot determine oidc client id`);\n }\n\n if (!clientIds[env][platform]) {\n throw new Error(\n `invalid env ${env} and platform ${platform} combination: cannot determine oidc client id`,\n );\n }\n\n return clientIds[env][platform];\n}\n"]}
@@ -31,4 +31,4 @@ export declare function getEnvUrls(env: Env): EnvUrlsEntry;
31
31
  */
32
32
  export declare function getOidcClientId(env: Env, platform: Platform): string;
33
33
  export {};
34
- //# sourceMappingURL=env.d.ts.map
34
+ //# sourceMappingURL=env.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.cts","sourceRoot":"","sources":["../../src/sdk/env.ts"],"names":[],"mappings":"AAAA,oBAAY,GAAG;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED,oBAAY,QAAQ;IAClB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB;AAED,KAAK,YAAY,GAAG;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAoBF;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,YAAY,CAKjD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAiCpE"}
@@ -0,0 +1,34 @@
1
+ export declare enum Env {
2
+ DEV = "dev",
3
+ UAT = "uat",
4
+ PRD = "prd"
5
+ }
6
+ export declare enum Platform {
7
+ MOBILE = "mobile",
8
+ EXTENSION = "extension",
9
+ PORTFOLIO = "portfolio",
10
+ INFURA = "infura"
11
+ }
12
+ type EnvUrlsEntry = {
13
+ authApiUrl: string;
14
+ oidcApiUrl: string;
15
+ userStorageApiUrl: string;
16
+ };
17
+ /**
18
+ * Validates and returns correct environment endpoints
19
+ *
20
+ * @param env - environment field
21
+ * @returns the correct environment url
22
+ * @throws on invalid environment passed
23
+ */
24
+ export declare function getEnvUrls(env: Env): EnvUrlsEntry;
25
+ /**
26
+ * Returns the valid OIDC Client ID (used during authorization)
27
+ *
28
+ * @param env - environment field
29
+ * @param platform - platform field
30
+ * @returns the OIDC client id for the environment
31
+ */
32
+ export declare function getOidcClientId(env: Env, platform: Platform): string;
33
+ export {};
34
+ //# sourceMappingURL=env.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.d.mts","sourceRoot":"","sources":["../../src/sdk/env.ts"],"names":[],"mappings":"AAAA,oBAAY,GAAG;IACb,GAAG,QAAQ;IACX,GAAG,QAAQ;IACX,GAAG,QAAQ;CACZ;AAED,oBAAY,QAAQ;IAClB,MAAM,WAAW;IACjB,SAAS,cAAc;IACvB,SAAS,cAAc;IACvB,MAAM,WAAW;CAClB;AAED,KAAK,YAAY,GAAG;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAoBF;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,GAAG,GAAG,YAAY,CAKjD;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAiCpE"}