@metamask/profile-sync-controller 0.5.0 → 0.7.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 (611) hide show
  1. package/CHANGELOG.md +51 -1
  2. package/auth/mocks/package.json +2 -2
  3. package/auth/package.json +2 -2
  4. package/dist/controllers/authentication/AuthenticationController.cjs +211 -0
  5. package/dist/controllers/authentication/AuthenticationController.cjs.map +1 -0
  6. package/dist/{types/controllers/authentication/AuthenticationController.d.ts → controllers/authentication/AuthenticationController.d.cts} +5 -5
  7. package/dist/controllers/authentication/AuthenticationController.d.cts.map +1 -0
  8. package/dist/controllers/authentication/AuthenticationController.d.mts +78 -0
  9. package/dist/controllers/authentication/AuthenticationController.d.mts.map +1 -0
  10. package/dist/controllers/authentication/AuthenticationController.mjs +206 -11
  11. package/dist/controllers/authentication/AuthenticationController.mjs.map +1 -1
  12. package/dist/controllers/authentication/__fixtures__/index.cjs +18 -0
  13. package/dist/controllers/authentication/__fixtures__/index.cjs.map +1 -0
  14. package/dist/controllers/authentication/__fixtures__/index.d.cts +2 -0
  15. package/dist/controllers/authentication/__fixtures__/index.d.cts.map +1 -0
  16. package/dist/controllers/authentication/__fixtures__/index.d.mts +2 -0
  17. package/dist/controllers/authentication/__fixtures__/index.d.mts.map +1 -0
  18. package/dist/controllers/authentication/__fixtures__/index.mjs +2 -0
  19. package/dist/controllers/authentication/__fixtures__/index.mjs.map +1 -0
  20. package/dist/controllers/authentication/__fixtures__/mockResponses.cjs +52 -0
  21. package/dist/controllers/authentication/__fixtures__/mockResponses.cjs.map +1 -0
  22. package/dist/{types/controllers/authentication/__fixtures__/mockResponses.d.ts → controllers/authentication/__fixtures__/mockResponses.d.cts} +2 -2
  23. package/dist/controllers/authentication/__fixtures__/mockResponses.d.cts.map +1 -0
  24. package/dist/controllers/authentication/__fixtures__/mockResponses.d.mts +23 -0
  25. package/dist/controllers/authentication/__fixtures__/mockResponses.d.mts.map +1 -0
  26. package/dist/controllers/authentication/__fixtures__/mockResponses.mjs +46 -0
  27. package/dist/controllers/authentication/__fixtures__/mockResponses.mjs.map +1 -0
  28. package/dist/controllers/authentication/__fixtures__/mockServices.cjs +37 -0
  29. package/dist/controllers/authentication/__fixtures__/mockServices.cjs.map +1 -0
  30. package/dist/{types/controllers/authentication/__fixtures__/mockServices.d.ts → controllers/authentication/__fixtures__/mockServices.d.cts} +2 -2
  31. package/dist/controllers/authentication/__fixtures__/mockServices.d.cts.map +1 -0
  32. package/dist/controllers/authentication/__fixtures__/mockServices.d.mts +10 -0
  33. package/dist/controllers/authentication/__fixtures__/mockServices.d.mts.map +1 -0
  34. package/dist/controllers/authentication/__fixtures__/mockServices.mjs +35 -0
  35. package/dist/controllers/authentication/__fixtures__/mockServices.mjs.map +1 -0
  36. package/dist/controllers/authentication/auth-snap-requests.cjs +39 -0
  37. package/dist/controllers/authentication/auth-snap-requests.cjs.map +1 -0
  38. package/dist/{types/controllers/authentication/auth-snap-requests.d.ts → controllers/authentication/auth-snap-requests.d.cts} +2 -2
  39. package/dist/controllers/authentication/auth-snap-requests.d.cts.map +1 -0
  40. package/dist/controllers/authentication/auth-snap-requests.d.mts +17 -0
  41. package/dist/controllers/authentication/auth-snap-requests.d.mts.map +1 -0
  42. package/dist/controllers/authentication/auth-snap-requests.mjs +33 -9
  43. package/dist/controllers/authentication/auth-snap-requests.mjs.map +1 -1
  44. package/dist/controllers/authentication/index.cjs +39 -0
  45. package/dist/controllers/authentication/index.cjs.map +1 -0
  46. package/dist/controllers/authentication/index.d.cts +7 -0
  47. package/dist/controllers/authentication/index.d.cts.map +1 -0
  48. package/dist/controllers/authentication/index.d.mts +7 -0
  49. package/dist/controllers/authentication/index.d.mts.map +1 -0
  50. package/dist/controllers/authentication/index.mjs +6 -18
  51. package/dist/controllers/authentication/index.mjs.map +1 -1
  52. package/dist/controllers/authentication/services.cjs +127 -0
  53. package/dist/controllers/authentication/services.cjs.map +1 -0
  54. package/dist/{types/controllers/authentication/services.d.ts → controllers/authentication/services.d.cts} +1 -1
  55. package/dist/controllers/authentication/services.d.cts.map +1 -0
  56. package/dist/controllers/authentication/services.d.mts +70 -0
  57. package/dist/controllers/authentication/services.d.mts.map +1 -0
  58. package/dist/controllers/authentication/services.mjs +118 -19
  59. package/dist/controllers/authentication/services.mjs.map +1 -1
  60. package/dist/controllers/index.cjs +29 -0
  61. package/dist/controllers/index.cjs.map +1 -0
  62. package/dist/controllers/index.d.cts +3 -0
  63. package/dist/controllers/index.d.cts.map +1 -0
  64. package/dist/controllers/index.d.mts +3 -0
  65. package/dist/controllers/index.d.mts.map +1 -0
  66. package/dist/controllers/index.mjs +2 -24
  67. package/dist/controllers/index.mjs.map +1 -1
  68. package/dist/controllers/user-storage/UserStorageController.cjs +462 -0
  69. package/dist/controllers/user-storage/UserStorageController.cjs.map +1 -0
  70. package/dist/{types/controllers/user-storage/UserStorageController.d.ts → controllers/user-storage/UserStorageController.d.cts} +44 -15
  71. package/dist/controllers/user-storage/UserStorageController.d.cts.map +1 -0
  72. package/dist/controllers/user-storage/UserStorageController.d.mts +156 -0
  73. package/dist/controllers/user-storage/UserStorageController.d.mts.map +1 -0
  74. package/dist/controllers/user-storage/UserStorageController.mjs +457 -18
  75. package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -1
  76. package/dist/controllers/user-storage/__fixtures__/index.cjs +19 -0
  77. package/dist/controllers/user-storage/__fixtures__/index.cjs.map +1 -0
  78. package/dist/controllers/user-storage/__fixtures__/index.d.cts +3 -0
  79. package/dist/controllers/user-storage/__fixtures__/index.d.cts.map +1 -0
  80. package/dist/controllers/user-storage/__fixtures__/index.d.mts +3 -0
  81. package/dist/controllers/user-storage/__fixtures__/index.d.mts.map +1 -0
  82. package/dist/controllers/user-storage/__fixtures__/index.mjs +3 -0
  83. package/dist/controllers/user-storage/__fixtures__/index.mjs.map +1 -0
  84. package/dist/controllers/user-storage/__fixtures__/mockAccounts.cjs +127 -0
  85. package/dist/controllers/user-storage/__fixtures__/mockAccounts.cjs.map +1 -0
  86. package/dist/{types/controllers/user-storage/__fixtures__/mockAccounts.d.ts → controllers/user-storage/__fixtures__/mockAccounts.d.cts} +6 -6
  87. package/dist/controllers/user-storage/__fixtures__/mockAccounts.d.cts.map +1 -0
  88. package/dist/controllers/user-storage/__fixtures__/mockAccounts.d.mts +63 -0
  89. package/dist/controllers/user-storage/__fixtures__/mockAccounts.d.mts.map +1 -0
  90. package/dist/controllers/user-storage/__fixtures__/mockAccounts.mjs +123 -0
  91. package/dist/controllers/user-storage/__fixtures__/mockAccounts.mjs.map +1 -0
  92. package/dist/controllers/user-storage/__fixtures__/mockResponses.cjs +48 -0
  93. package/dist/controllers/user-storage/__fixtures__/mockResponses.cjs.map +1 -0
  94. package/dist/{types/controllers/user-storage/__fixtures__/mockResponses.d.ts → controllers/user-storage/__fixtures__/mockResponses.d.cts} +6 -4
  95. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.cts.map +1 -0
  96. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.mts +21 -0
  97. package/dist/controllers/user-storage/__fixtures__/mockResponses.d.mts.map +1 -0
  98. package/dist/controllers/user-storage/__fixtures__/mockResponses.mjs +39 -0
  99. package/dist/controllers/user-storage/__fixtures__/mockResponses.mjs.map +1 -0
  100. package/dist/controllers/user-storage/__fixtures__/mockServices.cjs +41 -0
  101. package/dist/controllers/user-storage/__fixtures__/mockServices.cjs.map +1 -0
  102. package/dist/{types/controllers/user-storage/__fixtures__/mockServices.d.ts → controllers/user-storage/__fixtures__/mockServices.d.cts} +3 -3
  103. package/dist/controllers/user-storage/__fixtures__/mockServices.d.cts.map +1 -0
  104. package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts +11 -0
  105. package/dist/controllers/user-storage/__fixtures__/mockServices.d.mts.map +1 -0
  106. package/dist/controllers/user-storage/__fixtures__/mockServices.mjs +39 -0
  107. package/dist/controllers/user-storage/__fixtures__/mockServices.mjs.map +1 -0
  108. package/dist/controllers/user-storage/__fixtures__/mockStorage.cjs +36 -0
  109. package/dist/controllers/user-storage/__fixtures__/mockStorage.cjs.map +1 -0
  110. package/dist/{types/controllers/user-storage/__fixtures__/mockStorage.d.ts → controllers/user-storage/__fixtures__/mockStorage.d.cts} +2 -2
  111. package/dist/controllers/user-storage/__fixtures__/mockStorage.d.cts.map +1 -0
  112. package/dist/controllers/user-storage/__fixtures__/mockStorage.d.mts +5 -0
  113. package/dist/controllers/user-storage/__fixtures__/mockStorage.d.mts.map +1 -0
  114. package/dist/controllers/user-storage/__fixtures__/mockStorage.mjs +9 -0
  115. package/dist/controllers/user-storage/__fixtures__/mockStorage.mjs.map +1 -0
  116. package/dist/controllers/user-storage/__fixtures__/test-utils.cjs +31 -0
  117. package/dist/controllers/user-storage/__fixtures__/test-utils.cjs.map +1 -0
  118. package/dist/controllers/user-storage/__fixtures__/test-utils.d.cts +14 -0
  119. package/dist/controllers/user-storage/__fixtures__/test-utils.d.cts.map +1 -0
  120. package/dist/controllers/user-storage/__fixtures__/test-utils.d.mts +14 -0
  121. package/dist/controllers/user-storage/__fixtures__/test-utils.d.mts.map +1 -0
  122. package/dist/controllers/user-storage/__fixtures__/test-utils.mjs +27 -0
  123. package/dist/controllers/user-storage/__fixtures__/test-utils.mjs.map +1 -0
  124. package/dist/controllers/user-storage/accounts/constants.cjs +51 -0
  125. package/dist/controllers/user-storage/accounts/constants.cjs.map +1 -0
  126. package/dist/{types/controllers/user-storage/accounts/constants.d.ts → controllers/user-storage/accounts/constants.d.cts} +1 -1
  127. package/dist/controllers/user-storage/accounts/constants.d.cts.map +1 -0
  128. package/dist/controllers/user-storage/accounts/constants.d.mts +4 -0
  129. package/dist/controllers/user-storage/accounts/constants.d.mts.map +1 -0
  130. package/dist/controllers/user-storage/accounts/constants.mjs +47 -11
  131. package/dist/controllers/user-storage/accounts/constants.mjs.map +1 -1
  132. package/dist/controllers/user-storage/accounts/user-storage.cjs +34 -0
  133. package/dist/controllers/user-storage/accounts/user-storage.cjs.map +1 -0
  134. package/dist/{types/controllers/user-storage/accounts/user-storage.d.ts → controllers/user-storage/accounts/user-storage.d.cts} +3 -3
  135. package/dist/controllers/user-storage/accounts/user-storage.d.cts.map +1 -0
  136. package/dist/controllers/user-storage/accounts/user-storage.d.mts +32 -0
  137. package/dist/controllers/user-storage/accounts/user-storage.d.mts.map +1 -0
  138. package/dist/controllers/user-storage/accounts/user-storage.mjs +27 -9
  139. package/dist/controllers/user-storage/accounts/user-storage.mjs.map +1 -1
  140. package/dist/controllers/user-storage/encryption/cache.cjs +79 -0
  141. package/dist/controllers/user-storage/encryption/cache.cjs.map +1 -0
  142. package/dist/{types/controllers/user-storage/encryption/cache.d.ts → controllers/user-storage/encryption/cache.d.cts} +1 -1
  143. package/dist/controllers/user-storage/encryption/cache.d.cts.map +1 -0
  144. package/dist/controllers/user-storage/encryption/cache.d.mts +31 -0
  145. package/dist/controllers/user-storage/encryption/cache.d.mts.map +1 -0
  146. package/dist/controllers/user-storage/encryption/cache.mjs +71 -11
  147. package/dist/controllers/user-storage/encryption/cache.mjs.map +1 -1
  148. package/dist/controllers/user-storage/encryption/encryption.cjs +151 -0
  149. package/dist/controllers/user-storage/encryption/encryption.cjs.map +1 -0
  150. package/dist/{types/controllers/user-storage/encryption/encryption.d.ts → controllers/user-storage/encryption/encryption.d.cts} +2 -2
  151. package/dist/controllers/user-storage/encryption/encryption.d.cts.map +1 -0
  152. package/dist/controllers/user-storage/encryption/encryption.d.mts +27 -0
  153. package/dist/controllers/user-storage/encryption/encryption.d.mts.map +1 -0
  154. package/dist/controllers/user-storage/encryption/encryption.mjs +145 -10
  155. package/dist/controllers/user-storage/encryption/encryption.mjs.map +1 -1
  156. package/dist/controllers/user-storage/encryption/index.cjs +25 -0
  157. package/dist/controllers/user-storage/encryption/index.cjs.map +1 -0
  158. package/dist/controllers/user-storage/encryption/index.d.cts +5 -0
  159. package/dist/controllers/user-storage/encryption/index.d.cts.map +1 -0
  160. package/dist/controllers/user-storage/encryption/index.d.mts +5 -0
  161. package/dist/controllers/user-storage/encryption/index.d.mts.map +1 -0
  162. package/dist/controllers/user-storage/encryption/index.mjs +4 -15
  163. package/dist/controllers/user-storage/encryption/index.mjs.map +1 -1
  164. package/dist/controllers/user-storage/encryption/utils.cjs +17 -0
  165. package/dist/controllers/user-storage/encryption/utils.cjs.map +1 -0
  166. package/dist/{types/controllers/user-storage/encryption/utils.d.ts → controllers/user-storage/encryption/utils.d.cts} +1 -1
  167. package/dist/controllers/user-storage/encryption/utils.d.cts.map +1 -0
  168. package/dist/controllers/user-storage/encryption/utils.d.mts +4 -0
  169. package/dist/controllers/user-storage/encryption/utils.d.mts.map +1 -0
  170. package/dist/controllers/user-storage/encryption/utils.mjs +9 -10
  171. package/dist/controllers/user-storage/encryption/utils.mjs.map +1 -1
  172. package/dist/controllers/user-storage/index.cjs +40 -0
  173. package/dist/controllers/user-storage/index.cjs.map +1 -0
  174. package/dist/controllers/user-storage/index.d.cts +8 -0
  175. package/dist/controllers/user-storage/index.d.cts.map +1 -0
  176. package/dist/controllers/user-storage/index.d.mts +8 -0
  177. package/dist/controllers/user-storage/index.d.mts.map +1 -0
  178. package/dist/controllers/user-storage/index.mjs +7 -30
  179. package/dist/controllers/user-storage/index.mjs.map +1 -1
  180. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.cjs +25 -0
  181. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.cjs.map +1 -0
  182. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.cts +4 -0
  183. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.cts.map +1 -0
  184. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.mts +4 -0
  185. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.d.mts.map +1 -0
  186. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.mjs +20 -0
  187. package/dist/controllers/user-storage/network-syncing/__fixtures__/mockNetwork.mjs.map +1 -0
  188. package/dist/controllers/user-storage/network-syncing/controller-integration.cjs +65 -0
  189. package/dist/controllers/user-storage/network-syncing/controller-integration.cjs.map +1 -0
  190. package/dist/controllers/user-storage/network-syncing/controller-integration.d.cts +13 -0
  191. package/dist/controllers/user-storage/network-syncing/controller-integration.d.cts.map +1 -0
  192. package/dist/controllers/user-storage/network-syncing/controller-integration.d.mts +13 -0
  193. package/dist/controllers/user-storage/network-syncing/controller-integration.d.mts.map +1 -0
  194. package/dist/controllers/user-storage/network-syncing/controller-integration.mjs +65 -0
  195. package/dist/controllers/user-storage/network-syncing/controller-integration.mjs.map +1 -0
  196. package/dist/controllers/user-storage/network-syncing/services.cjs +64 -0
  197. package/dist/controllers/user-storage/network-syncing/services.cjs.map +1 -0
  198. package/dist/controllers/user-storage/network-syncing/services.d.cts +21 -0
  199. package/dist/controllers/user-storage/network-syncing/services.d.cts.map +1 -0
  200. package/dist/controllers/user-storage/network-syncing/services.d.mts +21 -0
  201. package/dist/controllers/user-storage/network-syncing/services.d.mts.map +1 -0
  202. package/dist/controllers/user-storage/network-syncing/services.mjs +58 -0
  203. package/dist/controllers/user-storage/network-syncing/services.mjs.map +1 -0
  204. package/dist/controllers/user-storage/network-syncing/sync-all.cjs +171 -0
  205. package/dist/controllers/user-storage/network-syncing/sync-all.cjs.map +1 -0
  206. package/dist/controllers/user-storage/network-syncing/sync-all.d.cts +35 -0
  207. package/dist/controllers/user-storage/network-syncing/sync-all.d.cts.map +1 -0
  208. package/dist/controllers/user-storage/network-syncing/sync-all.d.mts +35 -0
  209. package/dist/controllers/user-storage/network-syncing/sync-all.d.mts.map +1 -0
  210. package/dist/controllers/user-storage/network-syncing/sync-all.mjs +162 -0
  211. package/dist/controllers/user-storage/network-syncing/sync-all.mjs.map +1 -0
  212. package/dist/controllers/user-storage/network-syncing/sync-mutations.cjs +28 -0
  213. package/dist/controllers/user-storage/network-syncing/sync-mutations.cjs.map +1 -0
  214. package/dist/controllers/user-storage/network-syncing/sync-mutations.d.cts +9 -0
  215. package/dist/controllers/user-storage/network-syncing/sync-mutations.d.cts.map +1 -0
  216. package/dist/controllers/user-storage/network-syncing/sync-mutations.d.mts +9 -0
  217. package/dist/controllers/user-storage/network-syncing/sync-mutations.d.mts.map +1 -0
  218. package/dist/controllers/user-storage/network-syncing/sync-mutations.mjs +22 -0
  219. package/dist/controllers/user-storage/network-syncing/sync-mutations.mjs.map +1 -0
  220. package/dist/controllers/user-storage/network-syncing/types.cjs +16 -0
  221. package/dist/controllers/user-storage/network-syncing/types.cjs.map +1 -0
  222. package/dist/controllers/user-storage/network-syncing/types.d.cts +18 -0
  223. package/dist/controllers/user-storage/network-syncing/types.d.cts.map +1 -0
  224. package/dist/controllers/user-storage/network-syncing/types.d.mts +18 -0
  225. package/dist/controllers/user-storage/network-syncing/types.d.mts.map +1 -0
  226. package/dist/controllers/user-storage/network-syncing/types.mjs +11 -0
  227. package/dist/controllers/user-storage/network-syncing/types.mjs.map +1 -0
  228. package/dist/controllers/user-storage/schema.cjs +56 -0
  229. package/dist/controllers/user-storage/schema.cjs.map +1 -0
  230. package/dist/{types/controllers/user-storage/schema.d.ts → controllers/user-storage/schema.d.cts} +2 -1
  231. package/dist/controllers/user-storage/schema.d.cts.map +1 -0
  232. package/dist/controllers/user-storage/schema.d.mts +38 -0
  233. package/dist/controllers/user-storage/schema.d.mts.map +1 -0
  234. package/dist/controllers/user-storage/schema.mjs +48 -16
  235. package/dist/controllers/user-storage/schema.mjs.map +1 -1
  236. package/dist/controllers/user-storage/services.cjs +119 -0
  237. package/dist/controllers/user-storage/services.cjs.map +1 -0
  238. package/dist/{types/controllers/user-storage/services.d.ts → controllers/user-storage/services.d.cts} +4 -5
  239. package/dist/controllers/user-storage/services.d.cts.map +1 -0
  240. package/dist/controllers/user-storage/services.d.mts +48 -0
  241. package/dist/controllers/user-storage/services.d.mts.map +1 -0
  242. package/dist/controllers/user-storage/services.mjs +116 -21
  243. package/dist/controllers/user-storage/services.mjs.map +1 -1
  244. package/dist/controllers/user-storage/utils.cjs +30 -0
  245. package/dist/controllers/user-storage/utils.cjs.map +1 -0
  246. package/dist/controllers/user-storage/utils.d.cts +17 -0
  247. package/dist/controllers/user-storage/utils.d.cts.map +1 -0
  248. package/dist/controllers/user-storage/utils.d.mts +17 -0
  249. package/dist/controllers/user-storage/utils.d.mts.map +1 -0
  250. package/dist/controllers/user-storage/utils.mjs +25 -0
  251. package/dist/controllers/user-storage/utils.mjs.map +1 -0
  252. package/dist/index.cjs +30 -0
  253. package/dist/index.cjs.map +1 -0
  254. package/dist/index.d.cts +4 -0
  255. package/dist/index.d.cts.map +1 -0
  256. package/dist/index.d.mts +4 -0
  257. package/dist/index.d.mts.map +1 -0
  258. package/dist/index.mjs +3 -39
  259. package/dist/index.mjs.map +1 -1
  260. package/dist/sdk/__fixtures__/mock-auth.cjs +139 -0
  261. package/dist/sdk/__fixtures__/mock-auth.cjs.map +1 -0
  262. package/dist/{types/sdk/__fixtures__/mock-auth.d.ts → sdk/__fixtures__/mock-auth.d.cts} +2 -2
  263. package/dist/sdk/__fixtures__/mock-auth.d.cts.map +1 -0
  264. package/dist/sdk/__fixtures__/mock-auth.d.mts +42 -0
  265. package/dist/sdk/__fixtures__/mock-auth.d.mts.map +1 -0
  266. package/dist/sdk/__fixtures__/mock-auth.mjs +134 -0
  267. package/dist/sdk/__fixtures__/mock-auth.mjs.map +1 -0
  268. package/dist/sdk/__fixtures__/mock-userstorage.cjs +58 -0
  269. package/dist/sdk/__fixtures__/mock-userstorage.cjs.map +1 -0
  270. package/dist/{types/sdk/__fixtures__/mock-userstorage.d.ts → sdk/__fixtures__/mock-userstorage.d.cts} +2 -2
  271. package/dist/sdk/__fixtures__/mock-userstorage.d.cts.map +1 -0
  272. package/dist/sdk/__fixtures__/mock-userstorage.d.mts +19 -0
  273. package/dist/sdk/__fixtures__/mock-userstorage.d.mts.map +1 -0
  274. package/dist/sdk/__fixtures__/mock-userstorage.mjs +54 -0
  275. package/dist/sdk/__fixtures__/mock-userstorage.mjs.map +1 -0
  276. package/dist/sdk/__fixtures__/test-utils.cjs +74 -0
  277. package/dist/sdk/__fixtures__/test-utils.cjs.map +1 -0
  278. package/dist/{types/sdk/__fixtures__/test-utils.d.ts → sdk/__fixtures__/test-utils.d.cts} +6 -6
  279. package/dist/sdk/__fixtures__/test-utils.d.cts.map +1 -0
  280. package/dist/sdk/__fixtures__/test-utils.d.mts +25 -0
  281. package/dist/sdk/__fixtures__/test-utils.d.mts.map +1 -0
  282. package/dist/sdk/__fixtures__/test-utils.mjs +69 -0
  283. package/dist/sdk/__fixtures__/test-utils.mjs.map +1 -0
  284. package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs +106 -0
  285. package/dist/sdk/authentication-jwt-bearer/flow-siwe.cjs.map +1 -0
  286. package/dist/{types/sdk/authentication-jwt-bearer/flow-siwe.d.ts → sdk/authentication-jwt-bearer/flow-siwe.d.cts} +2 -2
  287. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.cts.map +1 -0
  288. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts +23 -0
  289. package/dist/sdk/authentication-jwt-bearer/flow-siwe.d.mts.map +1 -0
  290. package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs +101 -11
  291. package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs.map +1 -1
  292. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs +125 -0
  293. package/dist/sdk/authentication-jwt-bearer/flow-srp.cjs.map +1 -0
  294. package/dist/{types/sdk/authentication-jwt-bearer/flow-srp.d.ts → sdk/authentication-jwt-bearer/flow-srp.d.cts} +4 -2
  295. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.cts.map +1 -0
  296. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts +19 -0
  297. package/dist/sdk/authentication-jwt-bearer/flow-srp.d.mts.map +1 -0
  298. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs +119 -13
  299. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs.map +1 -1
  300. package/dist/sdk/authentication-jwt-bearer/services.cjs +180 -0
  301. package/dist/sdk/authentication-jwt-bearer/services.cjs.map +1 -0
  302. package/dist/{types/sdk/authentication-jwt-bearer/services.d.ts → sdk/authentication-jwt-bearer/services.d.cts} +4 -4
  303. package/dist/sdk/authentication-jwt-bearer/services.d.cts.map +1 -0
  304. package/dist/sdk/authentication-jwt-bearer/services.d.mts +63 -0
  305. package/dist/sdk/authentication-jwt-bearer/services.d.mts.map +1 -0
  306. package/dist/sdk/authentication-jwt-bearer/services.mjs +166 -25
  307. package/dist/sdk/authentication-jwt-bearer/services.mjs.map +1 -1
  308. package/dist/sdk/authentication-jwt-bearer/types.cjs +12 -0
  309. package/dist/sdk/authentication-jwt-bearer/types.cjs.map +1 -0
  310. package/dist/{types/sdk/authentication-jwt-bearer/types.d.ts → sdk/authentication-jwt-bearer/types.d.cts} +2 -2
  311. package/dist/sdk/authentication-jwt-bearer/types.d.cts.map +1 -0
  312. package/dist/sdk/authentication-jwt-bearer/types.d.mts +67 -0
  313. package/dist/sdk/authentication-jwt-bearer/types.d.mts.map +1 -0
  314. package/dist/sdk/authentication-jwt-bearer/types.mjs +8 -7
  315. package/dist/sdk/authentication-jwt-bearer/types.mjs.map +1 -1
  316. package/dist/sdk/authentication.cjs +124 -0
  317. package/dist/sdk/authentication.cjs.map +1 -0
  318. package/dist/{types/sdk/authentication.d.ts → sdk/authentication.d.cts} +7 -7
  319. package/dist/sdk/authentication.d.cts.map +1 -0
  320. package/dist/sdk/authentication.d.mts +32 -0
  321. package/dist/sdk/authentication.d.mts.map +1 -0
  322. package/dist/sdk/authentication.mjs +102 -24
  323. package/dist/sdk/authentication.mjs.map +1 -1
  324. package/dist/sdk/encryption.cjs +23 -0
  325. package/dist/sdk/encryption.cjs.map +1 -0
  326. package/dist/sdk/encryption.d.cts +4 -0
  327. package/dist/sdk/encryption.d.cts.map +1 -0
  328. package/dist/sdk/encryption.d.mts +4 -0
  329. package/dist/sdk/encryption.d.mts.map +1 -0
  330. package/dist/sdk/encryption.mjs +3 -13
  331. package/dist/sdk/encryption.mjs.map +1 -1
  332. package/dist/sdk/env.cjs +85 -0
  333. package/dist/sdk/env.cjs.map +1 -0
  334. package/dist/{types/sdk/env.d.ts → sdk/env.d.cts} +1 -1
  335. package/dist/sdk/env.d.cts.map +1 -0
  336. package/dist/sdk/env.d.mts +34 -0
  337. package/dist/sdk/env.d.mts.map +1 -0
  338. package/dist/sdk/env.mjs +78 -12
  339. package/dist/sdk/env.mjs.map +1 -1
  340. package/dist/sdk/errors.cjs +53 -0
  341. package/dist/sdk/errors.cjs.map +1 -0
  342. package/dist/{types/sdk/errors.d.ts → sdk/errors.d.cts} +1 -1
  343. package/dist/sdk/errors.d.cts.map +1 -0
  344. package/dist/sdk/errors.d.mts +22 -0
  345. package/dist/sdk/errors.d.mts.map +1 -0
  346. package/dist/sdk/errors.mjs +42 -19
  347. package/dist/sdk/errors.mjs.map +1 -1
  348. package/dist/sdk/index.cjs +23 -0
  349. package/dist/sdk/index.cjs.map +1 -0
  350. package/dist/sdk/index.d.cts +7 -0
  351. package/dist/sdk/index.d.cts.map +1 -0
  352. package/dist/sdk/index.d.mts +7 -0
  353. package/dist/sdk/index.d.mts.map +1 -0
  354. package/dist/sdk/index.mjs +6 -78
  355. package/dist/sdk/index.mjs.map +1 -1
  356. package/dist/sdk/user-storage.cjs +176 -0
  357. package/dist/sdk/user-storage.cjs.map +1 -0
  358. package/dist/{types/sdk/user-storage.d.ts → sdk/user-storage.d.cts} +4 -4
  359. package/dist/sdk/user-storage.d.cts.map +1 -0
  360. package/dist/sdk/user-storage.d.mts +27 -0
  361. package/dist/sdk/user-storage.d.mts.map +1 -0
  362. package/dist/sdk/user-storage.mjs +146 -16
  363. package/dist/sdk/user-storage.mjs.map +1 -1
  364. package/dist/sdk/utils/eip-6963-metamask-provider.cjs +70 -0
  365. package/dist/sdk/utils/eip-6963-metamask-provider.cjs.map +1 -0
  366. package/dist/{types/sdk/utils/eip-6963-metamask-provider.d.ts → sdk/utils/eip-6963-metamask-provider.d.cts} +2 -2
  367. package/dist/sdk/utils/eip-6963-metamask-provider.d.cts.map +1 -0
  368. package/dist/sdk/utils/eip-6963-metamask-provider.d.mts +25 -0
  369. package/dist/sdk/utils/eip-6963-metamask-provider.d.mts.map +1 -0
  370. package/dist/sdk/utils/eip-6963-metamask-provider.mjs +64 -8
  371. package/dist/sdk/utils/eip-6963-metamask-provider.mjs.map +1 -1
  372. package/dist/sdk/utils/messaging-signing-snap-requests.cjs +73 -0
  373. package/dist/sdk/utils/messaging-signing-snap-requests.cjs.map +1 -0
  374. package/dist/{types/sdk/utils/messaging-signing-snap-requests.d.ts → sdk/utils/messaging-signing-snap-requests.d.cts} +2 -7
  375. package/dist/sdk/utils/messaging-signing-snap-requests.d.cts.map +1 -0
  376. package/dist/sdk/utils/messaging-signing-snap-requests.d.mts +35 -0
  377. package/dist/sdk/utils/messaging-signing-snap-requests.d.mts.map +1 -0
  378. package/dist/sdk/utils/messaging-signing-snap-requests.mjs +65 -16
  379. package/dist/sdk/utils/messaging-signing-snap-requests.mjs.map +1 -1
  380. package/dist/sdk/utils/validate-login-response.cjs +22 -0
  381. package/dist/sdk/utils/validate-login-response.cjs.map +1 -0
  382. package/dist/{types/sdk/utils/validate-login-response.d.ts → sdk/utils/validate-login-response.d.cts} +2 -2
  383. package/dist/sdk/utils/validate-login-response.d.cts.map +1 -0
  384. package/dist/sdk/utils/validate-login-response.d.mts +10 -0
  385. package/dist/sdk/utils/validate-login-response.d.mts.map +1 -0
  386. package/dist/sdk/utils/validate-login-response.mjs +17 -7
  387. package/dist/sdk/utils/validate-login-response.mjs.map +1 -1
  388. package/package.json +62 -30
  389. package/sdk/package.json +9 -0
  390. package/user-storage/mocks/package.json +2 -2
  391. package/user-storage/package.json +2 -2
  392. package/dist/chunk-2CWF7ZTL.mjs +0 -129
  393. package/dist/chunk-2CWF7ZTL.mjs.map +0 -1
  394. package/dist/chunk-2VEMA6OE.mjs +0 -47
  395. package/dist/chunk-2VEMA6OE.mjs.map +0 -1
  396. package/dist/chunk-4LMFZDL4.js +0 -114
  397. package/dist/chunk-4LMFZDL4.js.map +0 -1
  398. package/dist/chunk-4TMLEABQ.js +0 -79
  399. package/dist/chunk-4TMLEABQ.js.map +0 -1
  400. package/dist/chunk-5MQUI24U.js +0 -47
  401. package/dist/chunk-5MQUI24U.js.map +0 -1
  402. package/dist/chunk-5XSXZTED.mjs +0 -57
  403. package/dist/chunk-5XSXZTED.mjs.map +0 -1
  404. package/dist/chunk-6DAK2U35.mjs +0 -11
  405. package/dist/chunk-6DAK2U35.mjs.map +0 -1
  406. package/dist/chunk-76NMME23.mjs +0 -114
  407. package/dist/chunk-76NMME23.mjs.map +0 -1
  408. package/dist/chunk-76VRE4BI.mjs +0 -18
  409. package/dist/chunk-76VRE4BI.mjs.map +0 -1
  410. package/dist/chunk-BKQE7DB5.js +0 -170
  411. package/dist/chunk-BKQE7DB5.js.map +0 -1
  412. package/dist/chunk-CAIIVJAO.mjs +0 -11
  413. package/dist/chunk-CAIIVJAO.mjs.map +0 -1
  414. package/dist/chunk-COBJUBZE.mjs +0 -170
  415. package/dist/chunk-COBJUBZE.mjs.map +0 -1
  416. package/dist/chunk-D4SNJOID.mjs +0 -269
  417. package/dist/chunk-D4SNJOID.mjs.map +0 -1
  418. package/dist/chunk-DF24ZX4H.js +0 -76
  419. package/dist/chunk-DF24ZX4H.js.map +0 -1
  420. package/dist/chunk-DRB2MN4T.js +0 -16
  421. package/dist/chunk-DRB2MN4T.js.map +0 -1
  422. package/dist/chunk-EHZFPUJH.mjs +0 -53
  423. package/dist/chunk-EHZFPUJH.mjs.map +0 -1
  424. package/dist/chunk-F6BAOSH2.js +0 -269
  425. package/dist/chunk-F6BAOSH2.js.map +0 -1
  426. package/dist/chunk-GQXYWBFK.js +0 -28
  427. package/dist/chunk-GQXYWBFK.js.map +0 -1
  428. package/dist/chunk-H25EBXG5.mjs +0 -58
  429. package/dist/chunk-H25EBXG5.mjs.map +0 -1
  430. package/dist/chunk-IGY2S5BC.js +0 -36
  431. package/dist/chunk-IGY2S5BC.js.map +0 -1
  432. package/dist/chunk-JAQ5TPSZ.js +0 -53
  433. package/dist/chunk-JAQ5TPSZ.js.map +0 -1
  434. package/dist/chunk-KHASG4H3.mjs +0 -11
  435. package/dist/chunk-KHASG4H3.mjs.map +0 -1
  436. package/dist/chunk-KIVBL6OM.js +0 -129
  437. package/dist/chunk-KIVBL6OM.js.map +0 -1
  438. package/dist/chunk-KTCSRECK.mjs +0 -76
  439. package/dist/chunk-KTCSRECK.mjs.map +0 -1
  440. package/dist/chunk-LGXQBALM.mjs +0 -106
  441. package/dist/chunk-LGXQBALM.mjs.map +0 -1
  442. package/dist/chunk-LLG4D2SC.js +0 -157
  443. package/dist/chunk-LLG4D2SC.js.map +0 -1
  444. package/dist/chunk-M7AUA5W7.mjs +0 -79
  445. package/dist/chunk-M7AUA5W7.mjs.map +0 -1
  446. package/dist/chunk-MBTBE4P5.js +0 -54
  447. package/dist/chunk-MBTBE4P5.js.map +0 -1
  448. package/dist/chunk-MK7ABX2V.mjs +0 -186
  449. package/dist/chunk-MK7ABX2V.mjs.map +0 -1
  450. package/dist/chunk-NEBLEB3X.mjs +0 -107
  451. package/dist/chunk-NEBLEB3X.mjs.map +0 -1
  452. package/dist/chunk-NIUQ34PY.js +0 -11
  453. package/dist/chunk-NIUQ34PY.js.map +0 -1
  454. package/dist/chunk-NMIF3LSX.mjs +0 -29
  455. package/dist/chunk-NMIF3LSX.mjs.map +0 -1
  456. package/dist/chunk-OLFO6R7Z.mjs +0 -546
  457. package/dist/chunk-OLFO6R7Z.mjs.map +0 -1
  458. package/dist/chunk-PBRUOBEQ.js +0 -11
  459. package/dist/chunk-PBRUOBEQ.js.map +0 -1
  460. package/dist/chunk-PCOIRDTO.js +0 -18
  461. package/dist/chunk-PCOIRDTO.js.map +0 -1
  462. package/dist/chunk-PQMPSEVJ.js +0 -546
  463. package/dist/chunk-PQMPSEVJ.js.map +0 -1
  464. package/dist/chunk-PRYLTXW4.js +0 -92
  465. package/dist/chunk-PRYLTXW4.js.map +0 -1
  466. package/dist/chunk-PU7MAIST.mjs +0 -129
  467. package/dist/chunk-PU7MAIST.mjs.map +0 -1
  468. package/dist/chunk-QCQU4BQL.js +0 -68
  469. package/dist/chunk-QCQU4BQL.js.map +0 -1
  470. package/dist/chunk-QDGLIUUS.mjs +0 -16
  471. package/dist/chunk-QDGLIUUS.mjs.map +0 -1
  472. package/dist/chunk-RG4II6WH.js +0 -57
  473. package/dist/chunk-RG4II6WH.js.map +0 -1
  474. package/dist/chunk-TFFQFIJV.mjs +0 -54
  475. package/dist/chunk-TFFQFIJV.mjs.map +0 -1
  476. package/dist/chunk-TP7SP3AG.mjs +0 -133
  477. package/dist/chunk-TP7SP3AG.mjs.map +0 -1
  478. package/dist/chunk-U5UIDVOO.mjs +0 -36
  479. package/dist/chunk-U5UIDVOO.mjs.map +0 -1
  480. package/dist/chunk-UAXWZN5J.js +0 -58
  481. package/dist/chunk-UAXWZN5J.js.map +0 -1
  482. package/dist/chunk-UEHMUVQQ.js +0 -133
  483. package/dist/chunk-UEHMUVQQ.js.map +0 -1
  484. package/dist/chunk-UEWCUBMX.mjs +0 -68
  485. package/dist/chunk-UEWCUBMX.mjs.map +0 -1
  486. package/dist/chunk-UHP2Y32K.mjs +0 -92
  487. package/dist/chunk-UHP2Y32K.mjs.map +0 -1
  488. package/dist/chunk-UHX7HJAI.js +0 -11
  489. package/dist/chunk-UHX7HJAI.js.map +0 -1
  490. package/dist/chunk-UIRAMHNM.js +0 -186
  491. package/dist/chunk-UIRAMHNM.js.map +0 -1
  492. package/dist/chunk-VWDRFRJU.js +0 -107
  493. package/dist/chunk-VWDRFRJU.js.map +0 -1
  494. package/dist/chunk-Y45XUW33.js +0 -129
  495. package/dist/chunk-Y45XUW33.js.map +0 -1
  496. package/dist/chunk-YHGWG3EQ.js +0 -29
  497. package/dist/chunk-YHGWG3EQ.js.map +0 -1
  498. package/dist/chunk-YLURF2PF.mjs +0 -157
  499. package/dist/chunk-YLURF2PF.mjs.map +0 -1
  500. package/dist/chunk-ZUPTMFEA.mjs +0 -28
  501. package/dist/chunk-ZUPTMFEA.mjs.map +0 -1
  502. package/dist/chunk-ZX2KHPXG.js +0 -106
  503. package/dist/chunk-ZX2KHPXG.js.map +0 -1
  504. package/dist/controllers/authentication/AuthenticationController.js +0 -13
  505. package/dist/controllers/authentication/AuthenticationController.js.map +0 -1
  506. package/dist/controllers/authentication/auth-snap-requests.js +0 -10
  507. package/dist/controllers/authentication/auth-snap-requests.js.map +0 -1
  508. package/dist/controllers/authentication/index.js +0 -19
  509. package/dist/controllers/authentication/index.js.map +0 -1
  510. package/dist/controllers/authentication/services.js +0 -21
  511. package/dist/controllers/authentication/services.js.map +0 -1
  512. package/dist/controllers/index.js +0 -25
  513. package/dist/controllers/index.js.map +0 -1
  514. package/dist/controllers/user-storage/UserStorageController.js +0 -20
  515. package/dist/controllers/user-storage/UserStorageController.js.map +0 -1
  516. package/dist/controllers/user-storage/accounts/constants.js +0 -12
  517. package/dist/controllers/user-storage/accounts/constants.js.map +0 -1
  518. package/dist/controllers/user-storage/accounts/user-storage.js +0 -11
  519. package/dist/controllers/user-storage/accounts/user-storage.js.map +0 -1
  520. package/dist/controllers/user-storage/encryption/cache.js +0 -13
  521. package/dist/controllers/user-storage/encryption/cache.js.map +0 -1
  522. package/dist/controllers/user-storage/encryption/encryption.js +0 -12
  523. package/dist/controllers/user-storage/encryption/encryption.js.map +0 -1
  524. package/dist/controllers/user-storage/encryption/index.js +0 -16
  525. package/dist/controllers/user-storage/encryption/index.js.map +0 -1
  526. package/dist/controllers/user-storage/encryption/utils.js +0 -12
  527. package/dist/controllers/user-storage/encryption/utils.js.map +0 -1
  528. package/dist/controllers/user-storage/index.js +0 -31
  529. package/dist/controllers/user-storage/index.js.map +0 -1
  530. package/dist/controllers/user-storage/schema.js +0 -18
  531. package/dist/controllers/user-storage/schema.js.map +0 -1
  532. package/dist/controllers/user-storage/services.js +0 -22
  533. package/dist/controllers/user-storage/services.js.map +0 -1
  534. package/dist/index.js +0 -40
  535. package/dist/index.js.map +0 -1
  536. package/dist/sdk/authentication-jwt-bearer/flow-siwe.js +0 -13
  537. package/dist/sdk/authentication-jwt-bearer/flow-siwe.js.map +0 -1
  538. package/dist/sdk/authentication-jwt-bearer/flow-srp.js +0 -15
  539. package/dist/sdk/authentication-jwt-bearer/flow-srp.js.map +0 -1
  540. package/dist/sdk/authentication-jwt-bearer/services.js +0 -27
  541. package/dist/sdk/authentication-jwt-bearer/services.js.map +0 -1
  542. package/dist/sdk/authentication-jwt-bearer/types.js +0 -8
  543. package/dist/sdk/authentication-jwt-bearer/types.js.map +0 -1
  544. package/dist/sdk/authentication.js +0 -26
  545. package/dist/sdk/authentication.js.map +0 -1
  546. package/dist/sdk/encryption.js +0 -14
  547. package/dist/sdk/encryption.js.map +0 -1
  548. package/dist/sdk/env.js +0 -14
  549. package/dist/sdk/env.js.map +0 -1
  550. package/dist/sdk/errors.js +0 -20
  551. package/dist/sdk/errors.js.map +0 -1
  552. package/dist/sdk/index.js +0 -79
  553. package/dist/sdk/index.js.map +0 -1
  554. package/dist/sdk/user-storage.js +0 -18
  555. package/dist/sdk/user-storage.js.map +0 -1
  556. package/dist/sdk/utils/eip-6963-metamask-provider.js +0 -10
  557. package/dist/sdk/utils/eip-6963-metamask-provider.js.map +0 -1
  558. package/dist/sdk/utils/messaging-signing-snap-requests.js +0 -18
  559. package/dist/sdk/utils/messaging-signing-snap-requests.js.map +0 -1
  560. package/dist/sdk/utils/validate-login-response.js +0 -8
  561. package/dist/sdk/utils/validate-login-response.js.map +0 -1
  562. package/dist/tsconfig.build.tsbuildinfo +0 -1
  563. package/dist/types/controllers/authentication/AuthenticationController.d.ts.map +0 -1
  564. package/dist/types/controllers/authentication/__fixtures__/index.d.ts +0 -2
  565. package/dist/types/controllers/authentication/__fixtures__/index.d.ts.map +0 -1
  566. package/dist/types/controllers/authentication/__fixtures__/mockResponses.d.ts.map +0 -1
  567. package/dist/types/controllers/authentication/__fixtures__/mockServices.d.ts.map +0 -1
  568. package/dist/types/controllers/authentication/auth-snap-requests.d.ts.map +0 -1
  569. package/dist/types/controllers/authentication/index.d.ts +0 -7
  570. package/dist/types/controllers/authentication/index.d.ts.map +0 -1
  571. package/dist/types/controllers/authentication/services.d.ts.map +0 -1
  572. package/dist/types/controllers/index.d.ts +0 -3
  573. package/dist/types/controllers/index.d.ts.map +0 -1
  574. package/dist/types/controllers/user-storage/UserStorageController.d.ts.map +0 -1
  575. package/dist/types/controllers/user-storage/__fixtures__/index.d.ts +0 -3
  576. package/dist/types/controllers/user-storage/__fixtures__/index.d.ts.map +0 -1
  577. package/dist/types/controllers/user-storage/__fixtures__/mockAccounts.d.ts.map +0 -1
  578. package/dist/types/controllers/user-storage/__fixtures__/mockResponses.d.ts.map +0 -1
  579. package/dist/types/controllers/user-storage/__fixtures__/mockServices.d.ts.map +0 -1
  580. package/dist/types/controllers/user-storage/__fixtures__/mockStorage.d.ts.map +0 -1
  581. package/dist/types/controllers/user-storage/accounts/constants.d.ts.map +0 -1
  582. package/dist/types/controllers/user-storage/accounts/user-storage.d.ts.map +0 -1
  583. package/dist/types/controllers/user-storage/encryption/cache.d.ts.map +0 -1
  584. package/dist/types/controllers/user-storage/encryption/encryption.d.ts.map +0 -1
  585. package/dist/types/controllers/user-storage/encryption/index.d.ts +0 -5
  586. package/dist/types/controllers/user-storage/encryption/index.d.ts.map +0 -1
  587. package/dist/types/controllers/user-storage/encryption/utils.d.ts.map +0 -1
  588. package/dist/types/controllers/user-storage/index.d.ts +0 -8
  589. package/dist/types/controllers/user-storage/index.d.ts.map +0 -1
  590. package/dist/types/controllers/user-storage/schema.d.ts.map +0 -1
  591. package/dist/types/controllers/user-storage/services.d.ts.map +0 -1
  592. package/dist/types/index.d.ts +0 -4
  593. package/dist/types/index.d.ts.map +0 -1
  594. package/dist/types/sdk/__fixtures__/mock-auth.d.ts.map +0 -1
  595. package/dist/types/sdk/__fixtures__/mock-userstorage.d.ts.map +0 -1
  596. package/dist/types/sdk/__fixtures__/test-utils.d.ts.map +0 -1
  597. package/dist/types/sdk/authentication-jwt-bearer/flow-siwe.d.ts.map +0 -1
  598. package/dist/types/sdk/authentication-jwt-bearer/flow-srp.d.ts.map +0 -1
  599. package/dist/types/sdk/authentication-jwt-bearer/services.d.ts.map +0 -1
  600. package/dist/types/sdk/authentication-jwt-bearer/types.d.ts.map +0 -1
  601. package/dist/types/sdk/authentication.d.ts.map +0 -1
  602. package/dist/types/sdk/encryption.d.ts +0 -4
  603. package/dist/types/sdk/encryption.d.ts.map +0 -1
  604. package/dist/types/sdk/env.d.ts.map +0 -1
  605. package/dist/types/sdk/errors.d.ts.map +0 -1
  606. package/dist/types/sdk/index.d.ts +0 -7
  607. package/dist/types/sdk/index.d.ts.map +0 -1
  608. package/dist/types/sdk/user-storage.d.ts.map +0 -1
  609. package/dist/types/sdk/utils/eip-6963-metamask-provider.d.ts.map +0 -1
  610. package/dist/types/sdk/utils/messaging-signing-snap-requests.d.ts.map +0 -1
  611. package/dist/types/sdk/utils/validate-login-response.d.ts.map +0 -1
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ 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");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ 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");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _SIWEJwtBearerAuth_instances, _SIWEJwtBearerAuth_config, _SIWEJwtBearerAuth_options, _SIWEJwtBearerAuth_signer, _SIWEJwtBearerAuth_getAuthSession, _SIWEJwtBearerAuth_login, _SIWEJwtBearerAuth_createSiWELoginRawMessage, _SIWEJwtBearerAuth_assertSigner;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.SIWEJwtBearerAuth = void 0;
16
+ const siwe_1 = require("siwe");
17
+ const errors_1 = require("../errors.cjs");
18
+ const validate_login_response_1 = require("../utils/validate-login-response.cjs");
19
+ const services_1 = require("./services.cjs");
20
+ class SIWEJwtBearerAuth {
21
+ constructor(config, options) {
22
+ _SIWEJwtBearerAuth_instances.add(this);
23
+ _SIWEJwtBearerAuth_config.set(this, void 0);
24
+ _SIWEJwtBearerAuth_options.set(this, void 0);
25
+ _SIWEJwtBearerAuth_signer.set(this, void 0);
26
+ __classPrivateFieldSet(this, _SIWEJwtBearerAuth_config, config, "f");
27
+ __classPrivateFieldSet(this, _SIWEJwtBearerAuth_options, options, "f");
28
+ }
29
+ async getAccessToken() {
30
+ const session = await __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_getAuthSession).call(this);
31
+ if (session) {
32
+ return session.token.accessToken;
33
+ }
34
+ const loginResponse = await __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_login).call(this);
35
+ return loginResponse.token.accessToken;
36
+ }
37
+ async getUserProfile() {
38
+ const session = await __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_getAuthSession).call(this);
39
+ if (session) {
40
+ return session.profile;
41
+ }
42
+ const loginResponse = await __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_login).call(this);
43
+ return loginResponse.profile;
44
+ }
45
+ async getIdentifier() {
46
+ __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_assertSigner).call(this, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f"));
47
+ return __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f").address;
48
+ }
49
+ async signMessage(message) {
50
+ __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_assertSigner).call(this, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f"));
51
+ return await __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f").signMessage(message);
52
+ }
53
+ prepare(signer) {
54
+ __classPrivateFieldSet(this, _SIWEJwtBearerAuth_signer, signer, "f");
55
+ }
56
+ }
57
+ exports.SIWEJwtBearerAuth = SIWEJwtBearerAuth;
58
+ _SIWEJwtBearerAuth_config = new WeakMap(), _SIWEJwtBearerAuth_options = new WeakMap(), _SIWEJwtBearerAuth_signer = new WeakMap(), _SIWEJwtBearerAuth_instances = new WeakSet(), _SIWEJwtBearerAuth_getAuthSession =
59
+ // convert expiresIn from seconds to milliseconds and use 90% of expiresIn
60
+ async function _SIWEJwtBearerAuth_getAuthSession() {
61
+ const auth = await __classPrivateFieldGet(this, _SIWEJwtBearerAuth_options, "f").storage.getLoginResponse();
62
+ if (!(0, validate_login_response_1.validateLoginResponse)(auth)) {
63
+ return null;
64
+ }
65
+ const currentTime = Date.now();
66
+ const sessionAge = currentTime - auth.token.obtainedAt;
67
+ const refreshThreshold = auth.token.expiresIn * 1000 * 0.9;
68
+ if (sessionAge < refreshThreshold) {
69
+ return auth;
70
+ }
71
+ return null;
72
+ }, _SIWEJwtBearerAuth_login = async function _SIWEJwtBearerAuth_login() {
73
+ __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_assertSigner).call(this, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f"));
74
+ // Nonce
75
+ const address = await this.getIdentifier();
76
+ const nonceRes = await (0, services_1.getNonce)(address, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_config, "f").env);
77
+ const rawMessage = __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_createSiWELoginRawMessage).call(this, nonceRes.nonce);
78
+ const signature = await this.signMessage(rawMessage);
79
+ // Authenticate
80
+ const authResponse = await (0, services_1.authenticate)(rawMessage, signature, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_config, "f").type, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_config, "f").env);
81
+ // Authorize
82
+ const tokenResponse = await (0, services_1.authorizeOIDC)(authResponse.token, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_config, "f").env, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_config, "f").platform);
83
+ // Save
84
+ const result = {
85
+ profile: authResponse.profile,
86
+ token: tokenResponse,
87
+ };
88
+ await __classPrivateFieldGet(this, _SIWEJwtBearerAuth_options, "f").storage.setLoginResponse(result);
89
+ return result;
90
+ }, _SIWEJwtBearerAuth_createSiWELoginRawMessage = function _SIWEJwtBearerAuth_createSiWELoginRawMessage(nonce) {
91
+ __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_assertSigner).call(this, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f"));
92
+ return new siwe_1.SiweMessage({
93
+ domain: __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f")?.domain,
94
+ address: __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f")?.address,
95
+ uri: (0, services_1.SIWE_LOGIN_URL)(__classPrivateFieldGet(this, _SIWEJwtBearerAuth_config, "f").env),
96
+ version: '1',
97
+ chainId: __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f")?.chainId,
98
+ nonce,
99
+ issuedAt: new Date().toISOString(),
100
+ }).prepareMessage();
101
+ }, _SIWEJwtBearerAuth_assertSigner = function _SIWEJwtBearerAuth_assertSigner(signer) {
102
+ if (!signer) {
103
+ throw new errors_1.ValidationError(`you must call 'prepare()' before logging in`);
104
+ }
105
+ };
106
+ //# sourceMappingURL=flow-siwe.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-siwe.cjs","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/flow-siwe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAmC;AAEnC,0CAA4C;AAC5C,kFAAyE;AACzE,6CAKoB;AAyBpB,MAAa,iBAAiB;IAO5B,YACE,MAA4C,EAC5C,OAAmC;;QARrC,4CAAoB;QAEpB,6CAAqC;QAErC,4CAA+C;QAM7C,uBAAA,IAAI,6BAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,8BAAY,OAAO,MAAA,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,MAAM,OAAO,GAAG,MAAM,uBAAA,IAAI,uEAAgB,MAApB,IAAI,CAAkB,CAAC;QAC7C,IAAI,OAAO,EAAE;YACX,OAAO,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC;SAClC;QAED,MAAM,aAAa,GAAG,MAAM,uBAAA,IAAI,8DAAO,MAAX,IAAI,CAAS,CAAC;QAC1C,OAAO,aAAa,CAAC,KAAK,CAAC,WAAW,CAAC;IACzC,CAAC;IAED,KAAK,CAAC,cAAc;QAClB,MAAM,OAAO,GAAG,MAAM,uBAAA,IAAI,uEAAgB,MAApB,IAAI,CAAkB,CAAC;QAC7C,IAAI,OAAO,EAAE;YACX,OAAO,OAAO,CAAC,OAAO,CAAC;SACxB;QAED,MAAM,aAAa,GAAG,MAAM,uBAAA,IAAI,8DAAO,MAAX,IAAI,CAAS,CAAC;QAC1C,OAAO,aAAa,CAAC,OAAO,CAAC;IAC/B,CAAC;IAED,KAAK,CAAC,aAAa;QACjB,uBAAA,IAAI,qEAAc,MAAlB,IAAI,EAAe,uBAAA,IAAI,iCAAQ,CAAC,CAAC;QACjC,OAAO,uBAAA,IAAI,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CAAC,CAAC;KAC1E;AACH,CAAC","sourcesContent":["import { SiweMessage } from 'siwe';\n\nimport { ValidationError } from '../errors';\nimport { validateLoginResponse } from '../utils/validate-login-response';\nimport {\n SIWE_LOGIN_URL,\n authenticate,\n authorizeOIDC,\n getNonce,\n} from './services';\nimport type {\n AuthConfig,\n AuthStorageOptions,\n AuthType,\n IBaseAuth,\n LoginResponse,\n UserProfile,\n} from './types';\n\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 JwtBearerAuth_SIWE_Options = {\n storage: AuthStorageOptions;\n};\n\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 JwtBearerAuth_SIWE_Signer = {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n};\n\nexport class SIWEJwtBearerAuth implements IBaseAuth {\n #config: AuthConfig;\n\n #options: JwtBearerAuth_SIWE_Options;\n\n #signer: JwtBearerAuth_SIWE_Signer | undefined;\n\n constructor(\n config: AuthConfig & { type: AuthType.SiWE },\n options: JwtBearerAuth_SIWE_Options,\n ) {\n this.#config = config;\n this.#options = options;\n }\n\n async getAccessToken(): Promise<string> {\n const session = await this.#getAuthSession();\n if (session) {\n return session.token.accessToken;\n }\n\n const loginResponse = await this.#login();\n return loginResponse.token.accessToken;\n }\n\n async getUserProfile(): Promise<UserProfile> {\n const session = await this.#getAuthSession();\n if (session) {\n return session.profile;\n }\n\n const loginResponse = await this.#login();\n return loginResponse.profile;\n }\n\n async getIdentifier(): Promise<string> {\n this.#assertSigner(this.#signer);\n return this.#signer.address;\n }\n\n async signMessage(message: string): Promise<string> {\n this.#assertSigner(this.#signer);\n return await this.#signer.signMessage(message);\n }\n\n prepare(signer: JwtBearerAuth_SIWE_Signer) {\n this.#signer = signer;\n }\n\n // convert expiresIn from seconds to milliseconds and use 90% of expiresIn\n async #getAuthSession(): Promise<LoginResponse | null> {\n const auth = await this.#options.storage.getLoginResponse();\n if (!validateLoginResponse(auth)) {\n return null;\n }\n\n const currentTime = Date.now();\n const sessionAge = currentTime - auth.token.obtainedAt;\n const refreshThreshold = auth.token.expiresIn * 1000 * 0.9;\n\n if (sessionAge < refreshThreshold) {\n return auth;\n }\n return null;\n }\n\n async #login(): Promise<LoginResponse> {\n this.#assertSigner(this.#signer);\n\n // Nonce\n const address = await this.getIdentifier();\n const nonceRes = await getNonce(address, this.#config.env);\n const rawMessage = this.#createSiWELoginRawMessage(nonceRes.nonce);\n const signature = await this.signMessage(rawMessage);\n\n // Authenticate\n const authResponse = await authenticate(\n rawMessage,\n signature,\n this.#config.type,\n this.#config.env,\n );\n\n // Authorize\n const tokenResponse = await authorizeOIDC(\n authResponse.token,\n this.#config.env,\n this.#config.platform,\n );\n\n // Save\n const result: LoginResponse = {\n profile: authResponse.profile,\n token: tokenResponse,\n };\n\n await this.#options.storage.setLoginResponse(result);\n\n return result;\n }\n\n #createSiWELoginRawMessage(nonce: string): string {\n this.#assertSigner(this.#signer);\n\n return new SiweMessage({\n domain: this.#signer?.domain,\n address: this.#signer?.address,\n uri: SIWE_LOGIN_URL(this.#config.env),\n version: '1',\n chainId: this.#signer?.chainId,\n nonce,\n issuedAt: new Date().toISOString(),\n }).prepareMessage();\n }\n\n #assertSigner(\n signer?: JwtBearerAuth_SIWE_Signer,\n ): asserts signer is JwtBearerAuth_SIWE_Signer {\n if (!signer) {\n throw new ValidationError(`you must call 'prepare()' before logging in`);\n }\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { AuthConfig, AuthStorageOptions, AuthType, IBaseAuth, UserProfile } from './types';
1
+ import type { AuthConfig, AuthStorageOptions, AuthType, IBaseAuth, UserProfile } from "./types.cjs";
2
2
  type JwtBearerAuth_SIWE_Options = {
3
3
  storage: AuthStorageOptions;
4
4
  };
@@ -20,4 +20,4 @@ export declare class SIWEJwtBearerAuth implements IBaseAuth {
20
20
  prepare(signer: JwtBearerAuth_SIWE_Signer): void;
21
21
  }
22
22
  export {};
23
- //# sourceMappingURL=flow-siwe.d.ts.map
23
+ //# sourceMappingURL=flow-siwe.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-siwe.d.cts","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/flow-siwe.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,QAAQ,EACR,SAAS,EAET,WAAW,EACZ,oBAAgB;AAIjB,KAAK,0BAA0B,GAAG;IAChC,OAAO,EAAE,kBAAkB,CAAC;CAC7B,CAAC;AAIF,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,qBAAa,iBAAkB,YAAW,SAAS;;gBAQ/C,MAAM,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAA;KAAE,EAC5C,OAAO,EAAE,0BAA0B;IAM/B,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAUjC,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;IAUtC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAKhC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKnD,OAAO,CAAC,MAAM,EAAE,yBAAyB;CA6E1C"}
@@ -0,0 +1,23 @@
1
+ import type { AuthConfig, AuthStorageOptions, AuthType, IBaseAuth, UserProfile } from "./types.mjs";
2
+ type JwtBearerAuth_SIWE_Options = {
3
+ storage: AuthStorageOptions;
4
+ };
5
+ type JwtBearerAuth_SIWE_Signer = {
6
+ address: string;
7
+ chainId: number;
8
+ signMessage: (message: string) => Promise<string>;
9
+ domain: string;
10
+ };
11
+ export declare class SIWEJwtBearerAuth implements IBaseAuth {
12
+ #private;
13
+ constructor(config: AuthConfig & {
14
+ type: AuthType.SiWE;
15
+ }, options: JwtBearerAuth_SIWE_Options);
16
+ getAccessToken(): Promise<string>;
17
+ getUserProfile(): Promise<UserProfile>;
18
+ getIdentifier(): Promise<string>;
19
+ signMessage(message: string): Promise<string>;
20
+ prepare(signer: JwtBearerAuth_SIWE_Signer): void;
21
+ }
22
+ export {};
23
+ //# sourceMappingURL=flow-siwe.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-siwe.d.mts","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/flow-siwe.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,QAAQ,EACR,SAAS,EAET,WAAW,EACZ,oBAAgB;AAIjB,KAAK,0BAA0B,GAAG;IAChC,OAAO,EAAE,kBAAkB,CAAC;CAC7B,CAAC;AAIF,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,qBAAa,iBAAkB,YAAW,SAAS;;gBAQ/C,MAAM,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAA;KAAE,EAC5C,OAAO,EAAE,0BAA0B;IAM/B,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAUjC,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;IAUtC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAKhC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAKnD,OAAO,CAAC,MAAM,EAAE,yBAAyB;CA6E1C"}
@@ -1,13 +1,103 @@
1
- import {
2
- SIWEJwtBearerAuth
3
- } from "../../chunk-2CWF7ZTL.mjs";
4
- import "../../chunk-YLURF2PF.mjs";
5
- import "../../chunk-CAIIVJAO.mjs";
6
- import "../../chunk-QDGLIUUS.mjs";
7
- import "../../chunk-KTCSRECK.mjs";
8
- import "../../chunk-TFFQFIJV.mjs";
9
- import "../../chunk-U5UIDVOO.mjs";
10
- export {
11
- SIWEJwtBearerAuth
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;
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 _SIWEJwtBearerAuth_instances, _SIWEJwtBearerAuth_config, _SIWEJwtBearerAuth_options, _SIWEJwtBearerAuth_signer, _SIWEJwtBearerAuth_getAuthSession, _SIWEJwtBearerAuth_login, _SIWEJwtBearerAuth_createSiWELoginRawMessage, _SIWEJwtBearerAuth_assertSigner;
13
+ import $siwe from "siwe";
14
+ const { SiweMessage } = $siwe;
15
+ import { ValidationError } from "../errors.mjs";
16
+ import { validateLoginResponse } from "../utils/validate-login-response.mjs";
17
+ import { SIWE_LOGIN_URL, authenticate, authorizeOIDC, getNonce } from "./services.mjs";
18
+ export class SIWEJwtBearerAuth {
19
+ constructor(config, options) {
20
+ _SIWEJwtBearerAuth_instances.add(this);
21
+ _SIWEJwtBearerAuth_config.set(this, void 0);
22
+ _SIWEJwtBearerAuth_options.set(this, void 0);
23
+ _SIWEJwtBearerAuth_signer.set(this, void 0);
24
+ __classPrivateFieldSet(this, _SIWEJwtBearerAuth_config, config, "f");
25
+ __classPrivateFieldSet(this, _SIWEJwtBearerAuth_options, options, "f");
26
+ }
27
+ async getAccessToken() {
28
+ const session = await __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_getAuthSession).call(this);
29
+ if (session) {
30
+ return session.token.accessToken;
31
+ }
32
+ const loginResponse = await __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_login).call(this);
33
+ return loginResponse.token.accessToken;
34
+ }
35
+ async getUserProfile() {
36
+ const session = await __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_getAuthSession).call(this);
37
+ if (session) {
38
+ return session.profile;
39
+ }
40
+ const loginResponse = await __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_login).call(this);
41
+ return loginResponse.profile;
42
+ }
43
+ async getIdentifier() {
44
+ __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_assertSigner).call(this, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f"));
45
+ return __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f").address;
46
+ }
47
+ async signMessage(message) {
48
+ __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_assertSigner).call(this, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f"));
49
+ return await __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f").signMessage(message);
50
+ }
51
+ prepare(signer) {
52
+ __classPrivateFieldSet(this, _SIWEJwtBearerAuth_signer, signer, "f");
53
+ }
54
+ }
55
+ _SIWEJwtBearerAuth_config = new WeakMap(), _SIWEJwtBearerAuth_options = new WeakMap(), _SIWEJwtBearerAuth_signer = new WeakMap(), _SIWEJwtBearerAuth_instances = new WeakSet(), _SIWEJwtBearerAuth_getAuthSession =
56
+ // convert expiresIn from seconds to milliseconds and use 90% of expiresIn
57
+ async function _SIWEJwtBearerAuth_getAuthSession() {
58
+ const auth = await __classPrivateFieldGet(this, _SIWEJwtBearerAuth_options, "f").storage.getLoginResponse();
59
+ if (!validateLoginResponse(auth)) {
60
+ return null;
61
+ }
62
+ const currentTime = Date.now();
63
+ const sessionAge = currentTime - auth.token.obtainedAt;
64
+ const refreshThreshold = auth.token.expiresIn * 1000 * 0.9;
65
+ if (sessionAge < refreshThreshold) {
66
+ return auth;
67
+ }
68
+ return null;
69
+ }, _SIWEJwtBearerAuth_login = async function _SIWEJwtBearerAuth_login() {
70
+ __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_assertSigner).call(this, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f"));
71
+ // Nonce
72
+ const address = await this.getIdentifier();
73
+ const nonceRes = await getNonce(address, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_config, "f").env);
74
+ const rawMessage = __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_createSiWELoginRawMessage).call(this, nonceRes.nonce);
75
+ const signature = await this.signMessage(rawMessage);
76
+ // Authenticate
77
+ const authResponse = await authenticate(rawMessage, signature, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_config, "f").type, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_config, "f").env);
78
+ // Authorize
79
+ const tokenResponse = await authorizeOIDC(authResponse.token, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_config, "f").env, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_config, "f").platform);
80
+ // Save
81
+ const result = {
82
+ profile: authResponse.profile,
83
+ token: tokenResponse,
84
+ };
85
+ await __classPrivateFieldGet(this, _SIWEJwtBearerAuth_options, "f").storage.setLoginResponse(result);
86
+ return result;
87
+ }, _SIWEJwtBearerAuth_createSiWELoginRawMessage = function _SIWEJwtBearerAuth_createSiWELoginRawMessage(nonce) {
88
+ __classPrivateFieldGet(this, _SIWEJwtBearerAuth_instances, "m", _SIWEJwtBearerAuth_assertSigner).call(this, __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f"));
89
+ return new SiweMessage({
90
+ domain: __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f")?.domain,
91
+ address: __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f")?.address,
92
+ uri: SIWE_LOGIN_URL(__classPrivateFieldGet(this, _SIWEJwtBearerAuth_config, "f").env),
93
+ version: '1',
94
+ chainId: __classPrivateFieldGet(this, _SIWEJwtBearerAuth_signer, "f")?.chainId,
95
+ nonce,
96
+ issuedAt: new Date().toISOString(),
97
+ }).prepareMessage();
98
+ }, _SIWEJwtBearerAuth_assertSigner = function _SIWEJwtBearerAuth_assertSigner(signer) {
99
+ if (!signer) {
100
+ throw new ValidationError(`you must call 'prepare()' before logging in`);
101
+ }
12
102
  };
13
103
  //# sourceMappingURL=flow-siwe.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
1
+ {"version":3,"file":"flow-siwe.mjs","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/flow-siwe.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,OAAO,EAAE,eAAe,EAAE,sBAAkB;AAC5C,OAAO,EAAE,qBAAqB,EAAE,6CAAyC;AACzE,OAAO,EACL,cAAc,EACd,YAAY,EACZ,aAAa,EACb,QAAQ,EACT,uBAAmB;AAyBpB,MAAM,OAAO,iBAAiB;IAO5B,YACE,MAA4C,EAC5C,OAAmC;;QARrC,4CAAoB;QAEpB,6CAAqC;QAErC,4CAA+C;QAM7C,uBAAA,IAAI,6BAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,8BAAY,OAAO,MAAA,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AC;IAEF,MAAM,uBAAA,IAAI,kCAAS,CAAC,OAAO,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAErD,OAAO,MAAM,CAAC;AAChB,CAAC,uGAE0B,KAAa;IACtC,uBAAA,IAAI,qEAAc,MAAlB,IAAI,EAAe,uBAAA,IAAI,iCAAQ,CAAC,CAAC;IAEjC,OAAO,IAAI,WAAW,CAAC;QACrB,MAAM,EAAE,uBAAA,IAAI,iCAAQ,EAAE,MAAM;QAC5B,OAAO,EAAE,uBAAA,IAAI,iCAAQ,EAAE,OAAO;QAC9B,GAAG,EAAE,cAAc,CAAC,uBAAA,IAAI,iCAAQ,CAAC,GAAG,CAAC;QACrC,OAAO,EAAE,GAAG;QACZ,OAAO,EAAE,uBAAA,IAAI,iCAAQ,EAAE,OAAO;QAC9B,KAAK;QACL,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;KACnC,CAAC,CAAC,cAAc,EAAE,CAAC;AACtB,CAAC,6EAGC,MAAkC;IAElC,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,eAAe,CAAC,6CAA6C,CAAC,CAAC;KAC1E;AACH,CAAC","sourcesContent":["import { SiweMessage } from 'siwe';\n\nimport { ValidationError } from '../errors';\nimport { validateLoginResponse } from '../utils/validate-login-response';\nimport {\n SIWE_LOGIN_URL,\n authenticate,\n authorizeOIDC,\n getNonce,\n} from './services';\nimport type {\n AuthConfig,\n AuthStorageOptions,\n AuthType,\n IBaseAuth,\n LoginResponse,\n UserProfile,\n} from './types';\n\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 JwtBearerAuth_SIWE_Options = {\n storage: AuthStorageOptions;\n};\n\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 JwtBearerAuth_SIWE_Signer = {\n address: string;\n chainId: number;\n signMessage: (message: string) => Promise<string>;\n domain: string;\n};\n\nexport class SIWEJwtBearerAuth implements IBaseAuth {\n #config: AuthConfig;\n\n #options: JwtBearerAuth_SIWE_Options;\n\n #signer: JwtBearerAuth_SIWE_Signer | undefined;\n\n constructor(\n config: AuthConfig & { type: AuthType.SiWE },\n options: JwtBearerAuth_SIWE_Options,\n ) {\n this.#config = config;\n this.#options = options;\n }\n\n async getAccessToken(): Promise<string> {\n const session = await this.#getAuthSession();\n if (session) {\n return session.token.accessToken;\n }\n\n const loginResponse = await this.#login();\n return loginResponse.token.accessToken;\n }\n\n async getUserProfile(): Promise<UserProfile> {\n const session = await this.#getAuthSession();\n if (session) {\n return session.profile;\n }\n\n const loginResponse = await this.#login();\n return loginResponse.profile;\n }\n\n async getIdentifier(): Promise<string> {\n this.#assertSigner(this.#signer);\n return this.#signer.address;\n }\n\n async signMessage(message: string): Promise<string> {\n this.#assertSigner(this.#signer);\n return await this.#signer.signMessage(message);\n }\n\n prepare(signer: JwtBearerAuth_SIWE_Signer) {\n this.#signer = signer;\n }\n\n // convert expiresIn from seconds to milliseconds and use 90% of expiresIn\n async #getAuthSession(): Promise<LoginResponse | null> {\n const auth = await this.#options.storage.getLoginResponse();\n if (!validateLoginResponse(auth)) {\n return null;\n }\n\n const currentTime = Date.now();\n const sessionAge = currentTime - auth.token.obtainedAt;\n const refreshThreshold = auth.token.expiresIn * 1000 * 0.9;\n\n if (sessionAge < refreshThreshold) {\n return auth;\n }\n return null;\n }\n\n async #login(): Promise<LoginResponse> {\n this.#assertSigner(this.#signer);\n\n // Nonce\n const address = await this.getIdentifier();\n const nonceRes = await getNonce(address, this.#config.env);\n const rawMessage = this.#createSiWELoginRawMessage(nonceRes.nonce);\n const signature = await this.signMessage(rawMessage);\n\n // Authenticate\n const authResponse = await authenticate(\n rawMessage,\n signature,\n this.#config.type,\n this.#config.env,\n );\n\n // Authorize\n const tokenResponse = await authorizeOIDC(\n authResponse.token,\n this.#config.env,\n this.#config.platform,\n );\n\n // Save\n const result: LoginResponse = {\n profile: authResponse.profile,\n token: tokenResponse,\n };\n\n await this.#options.storage.setLoginResponse(result);\n\n return result;\n }\n\n #createSiWELoginRawMessage(nonce: string): string {\n this.#assertSigner(this.#signer);\n\n return new SiweMessage({\n domain: this.#signer?.domain,\n address: this.#signer?.address,\n uri: SIWE_LOGIN_URL(this.#config.env),\n version: '1',\n chainId: this.#signer?.chainId,\n nonce,\n issuedAt: new Date().toISOString(),\n }).prepareMessage();\n }\n\n #assertSigner(\n signer?: JwtBearerAuth_SIWE_Signer,\n ): asserts signer is JwtBearerAuth_SIWE_Signer {\n if (!signer) {\n throw new ValidationError(`you must call 'prepare()' before logging in`);\n }\n }\n}\n"]}
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
3
+ if (kind === "m") throw new TypeError("Private method is not writable");
4
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
5
+ 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");
6
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
7
+ };
8
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
9
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
10
+ 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");
11
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
12
+ };
13
+ var _SRPJwtBearerAuth_instances, _SRPJwtBearerAuth_config, _SRPJwtBearerAuth_options, _SRPJwtBearerAuth_getAuthSession, _SRPJwtBearerAuth_login, _SRPJwtBearerAuth_createSrpLoginRawMessage;
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.SRPJwtBearerAuth = void 0;
16
+ const errors_1 = require("../errors.cjs");
17
+ const eip_6963_metamask_provider_1 = require("../utils/eip-6963-metamask-provider.cjs");
18
+ const messaging_signing_snap_requests_1 = require("../utils/messaging-signing-snap-requests.cjs");
19
+ const validate_login_response_1 = require("../utils/validate-login-response.cjs");
20
+ const services_1 = require("./services.cjs");
21
+ const getDefaultEIP6963Provider = async () => {
22
+ const provider = await (0, eip_6963_metamask_provider_1.getMetaMaskProviderEIP6963)();
23
+ if (!provider) {
24
+ throw new errors_1.ValidationError('No MetaMask wallet connected');
25
+ }
26
+ return provider;
27
+ };
28
+ const defaultEIP6963SigningOptions = {
29
+ getIdentifier: async () => {
30
+ const provider = await getDefaultEIP6963Provider();
31
+ return await messaging_signing_snap_requests_1.MESSAGE_SIGNING_SNAP.getPublicKey(provider);
32
+ },
33
+ signMessage: async (message) => {
34
+ const provider = await getDefaultEIP6963Provider();
35
+ if (!message.startsWith('metamask:')) {
36
+ throw new errors_1.ValidationError('message must start with "metamask:"');
37
+ }
38
+ const formattedMessage = message;
39
+ return await messaging_signing_snap_requests_1.MESSAGE_SIGNING_SNAP.signMessage(provider, formattedMessage);
40
+ },
41
+ };
42
+ class SRPJwtBearerAuth {
43
+ constructor(config, options) {
44
+ _SRPJwtBearerAuth_instances.add(this);
45
+ _SRPJwtBearerAuth_config.set(this, void 0);
46
+ _SRPJwtBearerAuth_options.set(this, void 0);
47
+ __classPrivateFieldSet(this, _SRPJwtBearerAuth_config, config, "f");
48
+ __classPrivateFieldSet(this, _SRPJwtBearerAuth_options, {
49
+ storage: options.storage,
50
+ signing: options.signing ?? defaultEIP6963SigningOptions,
51
+ }, "f");
52
+ }
53
+ async getAccessToken() {
54
+ const session = await __classPrivateFieldGet(this, _SRPJwtBearerAuth_instances, "m", _SRPJwtBearerAuth_getAuthSession).call(this);
55
+ if (session) {
56
+ return session.token.accessToken;
57
+ }
58
+ const loginResponse = await __classPrivateFieldGet(this, _SRPJwtBearerAuth_instances, "m", _SRPJwtBearerAuth_login).call(this);
59
+ return loginResponse.token.accessToken;
60
+ }
61
+ async getUserProfile() {
62
+ const session = await __classPrivateFieldGet(this, _SRPJwtBearerAuth_instances, "m", _SRPJwtBearerAuth_getAuthSession).call(this);
63
+ if (session) {
64
+ return session.profile;
65
+ }
66
+ const loginResponse = await __classPrivateFieldGet(this, _SRPJwtBearerAuth_instances, "m", _SRPJwtBearerAuth_login).call(this);
67
+ return loginResponse.profile;
68
+ }
69
+ async getIdentifier() {
70
+ return await __classPrivateFieldGet(this, _SRPJwtBearerAuth_options, "f").signing.getIdentifier();
71
+ }
72
+ async signMessage(message) {
73
+ return await __classPrivateFieldGet(this, _SRPJwtBearerAuth_options, "f").signing.signMessage(message);
74
+ }
75
+ async isSnapConnected() {
76
+ const provider = await (0, eip_6963_metamask_provider_1.getMetaMaskProviderEIP6963)();
77
+ if (!provider) {
78
+ return false;
79
+ }
80
+ const isConnected = await (0, messaging_signing_snap_requests_1.isSnapConnected)(provider);
81
+ return isConnected;
82
+ }
83
+ async connectSnap() {
84
+ const provider = await getDefaultEIP6963Provider();
85
+ const res = await (0, messaging_signing_snap_requests_1.connectSnap)(provider);
86
+ return res;
87
+ }
88
+ }
89
+ exports.SRPJwtBearerAuth = SRPJwtBearerAuth;
90
+ _SRPJwtBearerAuth_config = new WeakMap(), _SRPJwtBearerAuth_options = new WeakMap(), _SRPJwtBearerAuth_instances = new WeakSet(), _SRPJwtBearerAuth_getAuthSession =
91
+ // convert expiresIn from seconds to milliseconds and use 90% of expiresIn
92
+ async function _SRPJwtBearerAuth_getAuthSession() {
93
+ const auth = await __classPrivateFieldGet(this, _SRPJwtBearerAuth_options, "f").storage.getLoginResponse();
94
+ if (!(0, validate_login_response_1.validateLoginResponse)(auth)) {
95
+ return null;
96
+ }
97
+ const currentTime = Date.now();
98
+ const sessionAge = currentTime - auth.token.obtainedAt;
99
+ const refreshThreshold = auth.token.expiresIn * 1000 * 0.9;
100
+ if (sessionAge < refreshThreshold) {
101
+ return auth;
102
+ }
103
+ return null;
104
+ }, _SRPJwtBearerAuth_login = async function _SRPJwtBearerAuth_login() {
105
+ // Nonce
106
+ const address = await this.getIdentifier();
107
+ const nonceRes = await (0, services_1.getNonce)(address, __classPrivateFieldGet(this, _SRPJwtBearerAuth_config, "f").env);
108
+ const publicKey = await __classPrivateFieldGet(this, _SRPJwtBearerAuth_options, "f").signing.getIdentifier();
109
+ const rawMessage = __classPrivateFieldGet(this, _SRPJwtBearerAuth_instances, "m", _SRPJwtBearerAuth_createSrpLoginRawMessage).call(this, nonceRes.nonce, publicKey);
110
+ const signature = await this.signMessage(rawMessage);
111
+ // Authenticate
112
+ const authResponse = await (0, services_1.authenticate)(rawMessage, signature, __classPrivateFieldGet(this, _SRPJwtBearerAuth_config, "f").type, __classPrivateFieldGet(this, _SRPJwtBearerAuth_config, "f").env);
113
+ // Authorize
114
+ const tokenResponse = await (0, services_1.authorizeOIDC)(authResponse.token, __classPrivateFieldGet(this, _SRPJwtBearerAuth_config, "f").env, __classPrivateFieldGet(this, _SRPJwtBearerAuth_config, "f").platform);
115
+ // Save
116
+ const result = {
117
+ profile: authResponse.profile,
118
+ token: tokenResponse,
119
+ };
120
+ await __classPrivateFieldGet(this, _SRPJwtBearerAuth_options, "f").storage.setLoginResponse(result);
121
+ return result;
122
+ }, _SRPJwtBearerAuth_createSrpLoginRawMessage = function _SRPJwtBearerAuth_createSrpLoginRawMessage(nonce, publicKey) {
123
+ return `metamask:${nonce}:${publicKey}`;
124
+ };
125
+ //# sourceMappingURL=flow-srp.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-srp.cjs","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/flow-srp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,0CAA4C;AAC5C,wFAAiF;AACjF,kGAIkD;AAClD,kFAAyE;AACzE,6CAAmE;AAkBnE,MAAM,yBAAyB,GAAG,KAAK,IAAI,EAAE;IAC3C,MAAM,QAAQ,GAAG,MAAM,IAAA,uDAA0B,GAAE,CAAC;IACpD,IAAI,CAAC,QAAQ,EAAE;QAC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AAgB,CAAC,MAAM,CAAC,CAAC;IAErD,OAAO,MAAM,CAAC;AAChB,CAAC,mGAGC,KAAa,EACb,SAAiB;IAEjB,OAAO,YAAY,KAAK,IAAI,SAAS,EAAW,CAAC;AACnD,CAAC","sourcesContent":["import { ValidationError } from '../errors';\nimport { getMetaMaskProviderEIP6963 } from '../utils/eip-6963-metamask-provider';\nimport {\n MESSAGE_SIGNING_SNAP,\n connectSnap,\n isSnapConnected,\n} from '../utils/messaging-signing-snap-requests';\nimport { validateLoginResponse } from '../utils/validate-login-response';\nimport { authenticate, authorizeOIDC, getNonce } from './services';\nimport type {\n AuthConfig,\n AuthSigningOptions,\n AuthStorageOptions,\n AuthType,\n IBaseAuth,\n LoginResponse,\n UserProfile,\n} from './types';\n\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 JwtBearerAuth_SRP_Options = {\n storage: AuthStorageOptions;\n signing?: AuthSigningOptions;\n};\n\nconst getDefaultEIP6963Provider = async () => {\n const provider = await getMetaMaskProviderEIP6963();\n if (!provider) {\n throw new ValidationError('No MetaMask wallet connected');\n }\n return provider;\n};\n\nconst defaultEIP6963SigningOptions: AuthSigningOptions = {\n getIdentifier: async (): Promise<string> => {\n const provider = await getDefaultEIP6963Provider();\n return await MESSAGE_SIGNING_SNAP.getPublicKey(provider);\n },\n signMessage: async (message: string): Promise<string> => {\n const provider = await getDefaultEIP6963Provider();\n if (!message.startsWith('metamask:')) {\n throw new ValidationError('message must start with \"metamask:\"');\n }\n const formattedMessage = message as `metamask:${string}`;\n return await MESSAGE_SIGNING_SNAP.signMessage(provider, formattedMessage);\n },\n};\n\nexport class SRPJwtBearerAuth implements IBaseAuth {\n #config: AuthConfig;\n\n #options: Required<JwtBearerAuth_SRP_Options>;\n\n constructor(\n config: AuthConfig & { type: AuthType.SRP },\n options: JwtBearerAuth_SRP_Options,\n ) {\n this.#config = config;\n this.#options = {\n storage: options.storage,\n signing: options.signing ?? defaultEIP6963SigningOptions,\n };\n }\n\n async getAccessToken(): Promise<string> {\n const session = await this.#getAuthSession();\n if (session) {\n return session.token.accessToken;\n }\n\n const loginResponse = await this.#login();\n return loginResponse.token.accessToken;\n }\n\n async getUserProfile(): Promise<UserProfile> {\n const session = await this.#getAuthSession();\n if (session) {\n return session.profile;\n }\n\n const loginResponse = await this.#login();\n return loginResponse.profile;\n }\n\n async getIdentifier(): Promise<string> {\n return await this.#options.signing.getIdentifier();\n }\n\n async signMessage(message: string): Promise<string> {\n return await this.#options.signing.signMessage(message);\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 connectSnap(): Promise<string> {\n const provider = await getDefaultEIP6963Provider();\n const res = await connectSnap(provider);\n return res;\n }\n\n // convert expiresIn from seconds to milliseconds and use 90% of expiresIn\n async #getAuthSession(): Promise<LoginResponse | null> {\n const auth = await this.#options.storage.getLoginResponse();\n if (!validateLoginResponse(auth)) {\n return null;\n }\n\n const currentTime = Date.now();\n const sessionAge = currentTime - auth.token.obtainedAt;\n const refreshThreshold = auth.token.expiresIn * 1000 * 0.9;\n\n if (sessionAge < refreshThreshold) {\n return auth;\n }\n return null;\n }\n\n async #login(): Promise<LoginResponse> {\n // Nonce\n const address = await this.getIdentifier();\n const nonceRes = await getNonce(address, this.#config.env);\n const publicKey = await this.#options.signing.getIdentifier();\n const rawMessage = this.#createSrpLoginRawMessage(\n nonceRes.nonce,\n publicKey,\n );\n const signature = await this.signMessage(rawMessage);\n\n // Authenticate\n const authResponse = await authenticate(\n rawMessage,\n signature,\n this.#config.type,\n this.#config.env,\n );\n\n // Authorize\n const tokenResponse = await authorizeOIDC(\n authResponse.token,\n this.#config.env,\n this.#config.platform,\n );\n\n // Save\n const result: LoginResponse = {\n profile: authResponse.profile,\n token: tokenResponse,\n };\n\n await this.#options.storage.setLoginResponse(result);\n\n return result;\n }\n\n #createSrpLoginRawMessage(\n nonce: string,\n publicKey: string,\n ): `metamask:${string}:${string}` {\n return `metamask:${nonce}:${publicKey}` as const;\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
- import type { AuthConfig, AuthSigningOptions, AuthStorageOptions, AuthType, IBaseAuth, UserProfile } from './types';
1
+ import type { AuthConfig, AuthSigningOptions, AuthStorageOptions, AuthType, IBaseAuth, UserProfile } from "./types.cjs";
2
2
  type JwtBearerAuth_SRP_Options = {
3
3
  storage: AuthStorageOptions;
4
4
  signing?: AuthSigningOptions;
@@ -12,6 +12,8 @@ export declare class SRPJwtBearerAuth implements IBaseAuth {
12
12
  getUserProfile(): Promise<UserProfile>;
13
13
  getIdentifier(): Promise<string>;
14
14
  signMessage(message: string): Promise<string>;
15
+ isSnapConnected(): Promise<boolean>;
16
+ connectSnap(): Promise<string>;
15
17
  }
16
18
  export {};
17
- //# sourceMappingURL=flow-srp.d.ts.map
19
+ //# sourceMappingURL=flow-srp.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-srp.d.cts","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/flow-srp.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,SAAS,EAET,WAAW,EACZ,oBAAgB;AAIjB,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B,CAAC;AAyBF,qBAAa,gBAAiB,YAAW,SAAS;;gBAM9C,MAAM,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAA;KAAE,EAC3C,OAAO,EAAE,yBAAyB;IAS9B,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAUjC,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;IAUtC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAIhC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI7C,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAUnC,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;CAkErC"}
@@ -0,0 +1,19 @@
1
+ import type { AuthConfig, AuthSigningOptions, AuthStorageOptions, AuthType, IBaseAuth, UserProfile } from "./types.mjs";
2
+ type JwtBearerAuth_SRP_Options = {
3
+ storage: AuthStorageOptions;
4
+ signing?: AuthSigningOptions;
5
+ };
6
+ export declare class SRPJwtBearerAuth implements IBaseAuth {
7
+ #private;
8
+ constructor(config: AuthConfig & {
9
+ type: AuthType.SRP;
10
+ }, options: JwtBearerAuth_SRP_Options);
11
+ getAccessToken(): Promise<string>;
12
+ getUserProfile(): Promise<UserProfile>;
13
+ getIdentifier(): Promise<string>;
14
+ signMessage(message: string): Promise<string>;
15
+ isSnapConnected(): Promise<boolean>;
16
+ connectSnap(): Promise<string>;
17
+ }
18
+ export {};
19
+ //# sourceMappingURL=flow-srp.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flow-srp.d.mts","sourceRoot":"","sources":["../../../src/sdk/authentication-jwt-bearer/flow-srp.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,SAAS,EAET,WAAW,EACZ,oBAAgB;AAIjB,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B,CAAC;AAyBF,qBAAa,gBAAiB,YAAW,SAAS;;gBAM9C,MAAM,EAAE,UAAU,GAAG;QAAE,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAA;KAAE,EAC3C,OAAO,EAAE,yBAAyB;IAS9B,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAUjC,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;IAUtC,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAIhC,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAI7C,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;IAUnC,WAAW,IAAI,OAAO,CAAC,MAAM,CAAC;CAkErC"}