@metamask/profile-sync-controller 0.0.0 → 0.1.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 (272) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/dist/chunk-26CCETCM.mjs +70 -0
  3. package/dist/chunk-2MVOZPBN.js +98 -0
  4. package/dist/chunk-2MVOZPBN.js.map +1 -0
  5. package/dist/chunk-3FJQHCCQ.mjs +106 -0
  6. package/dist/chunk-3FJQHCCQ.mjs.map +1 -0
  7. package/dist/chunk-4OMJ7A6A.js +77 -0
  8. package/dist/chunk-4OMJ7A6A.js.map +1 -0
  9. package/dist/chunk-6P6CUKKI.mjs +30 -0
  10. package/dist/chunk-6P6CUKKI.mjs.map +1 -0
  11. package/dist/{chunk-OF3TQWGX.js → chunk-6TK7544L.js} +34 -34
  12. package/dist/chunk-6TK7544L.js.map +1 -0
  13. package/dist/chunk-76VRE4BI.mjs +18 -0
  14. package/dist/chunk-76VRE4BI.mjs.map +1 -0
  15. package/dist/chunk-772MKTIO.mjs +25 -0
  16. package/dist/chunk-772MKTIO.mjs.map +1 -0
  17. package/dist/chunk-7FCK4BY3.js +25 -0
  18. package/dist/chunk-7FCK4BY3.js.map +1 -0
  19. package/dist/{chunk-CYGZ4WLJ.mjs → chunk-7VMXBDXN.mjs} +36 -5
  20. package/dist/chunk-7VMXBDXN.mjs.map +1 -0
  21. package/dist/chunk-ARWL2LBB.js +273 -0
  22. package/dist/chunk-ARWL2LBB.js.map +1 -0
  23. package/dist/chunk-BFE6TB7Y.mjs +11 -0
  24. package/dist/chunk-BFE6TB7Y.mjs.map +1 -0
  25. package/dist/chunk-BVM4HBM4.js +112 -0
  26. package/dist/chunk-BVM4HBM4.js.map +1 -0
  27. package/dist/chunk-DHHBHLVN.mjs +70 -0
  28. package/dist/chunk-DHHBHLVN.mjs.map +1 -0
  29. package/dist/chunk-DLXLU44Z.js +106 -0
  30. package/dist/chunk-DLXLU44Z.js.map +1 -0
  31. package/dist/chunk-GJJT2CAL.js +3342 -0
  32. package/dist/chunk-GJJT2CAL.js.map +1 -0
  33. package/dist/{chunk-VZXD5DCQ.js → chunk-GLDUXN2T.js} +36 -27
  34. package/dist/chunk-GLDUXN2T.js.map +1 -0
  35. package/dist/chunk-GLS4QZF6.mjs +77 -0
  36. package/dist/chunk-GLS4QZF6.mjs.map +1 -0
  37. package/dist/chunk-H25EBXG5.mjs +58 -0
  38. package/dist/chunk-H25EBXG5.mjs.map +1 -0
  39. package/dist/chunk-IPSBQ3MS.js +30 -0
  40. package/dist/chunk-IPSBQ3MS.js.map +1 -0
  41. package/dist/chunk-IZHWP5VW.mjs +79 -0
  42. package/dist/chunk-IZHWP5VW.mjs.map +1 -0
  43. package/dist/chunk-JAGWB4JI.mjs +102 -0
  44. package/dist/chunk-JAGWB4JI.mjs.map +1 -0
  45. package/dist/chunk-JMU3OVPK.mjs +3342 -0
  46. package/dist/chunk-JMU3OVPK.mjs.map +1 -0
  47. package/dist/chunk-JTDFOATG.js +11 -0
  48. package/dist/chunk-JTDFOATG.js.map +1 -0
  49. package/dist/chunk-JWTNHCVG.js +158 -0
  50. package/dist/chunk-JWTNHCVG.js.map +1 -0
  51. package/dist/chunk-K6G7X6PX.js +70 -0
  52. package/dist/chunk-K6G7X6PX.js.map +1 -0
  53. package/dist/chunk-LHDVZNW5.js +126 -0
  54. package/dist/chunk-LHDVZNW5.js.map +1 -0
  55. package/dist/{chunk-VXPVURGH.mjs → chunk-LN2BY2QF.mjs} +9 -9
  56. package/dist/chunk-LN2BY2QF.mjs.map +1 -0
  57. package/dist/{chunk-6X6I3HZU.js → chunk-LUKNP4HM.js} +28 -26
  58. package/dist/chunk-LUKNP4HM.js.map +1 -0
  59. package/dist/{chunk-GQLHSQGZ.js → chunk-MBTBE4P5.js} +9 -2
  60. package/dist/chunk-MBTBE4P5.js.map +1 -0
  61. package/dist/chunk-PCOIRDTO.js +18 -0
  62. package/dist/chunk-PCOIRDTO.js.map +1 -0
  63. package/dist/chunk-PNZGAAT4.mjs +273 -0
  64. package/dist/chunk-PNZGAAT4.mjs.map +1 -0
  65. package/dist/chunk-PRDECQM6.mjs +221 -0
  66. package/dist/chunk-PRDECQM6.mjs.map +1 -0
  67. package/dist/chunk-QE2F5AZL.mjs +158 -0
  68. package/dist/chunk-QE2F5AZL.mjs.map +1 -0
  69. package/dist/chunk-QHL6SQTC.mjs +112 -0
  70. package/dist/chunk-QHL6SQTC.mjs.map +1 -0
  71. package/dist/chunk-QILE6KIE.js +79 -0
  72. package/dist/chunk-QILE6KIE.js.map +1 -0
  73. package/dist/{chunk-CFST6GWE.js → chunk-T77FC4PB.js} +1 -1
  74. package/dist/chunk-T77FC4PB.js.map +1 -0
  75. package/dist/{chunk-BHVT2QEA.mjs → chunk-TFFQFIJV.mjs} +8 -1
  76. package/dist/chunk-TFFQFIJV.mjs.map +1 -0
  77. package/dist/chunk-UAXWZN5J.js +58 -0
  78. package/dist/chunk-UAXWZN5J.js.map +1 -0
  79. package/dist/{chunk-CZ7YK35S.mjs → chunk-UEZI2POO.mjs} +7 -5
  80. package/dist/{chunk-CZ7YK35S.mjs.map → chunk-UEZI2POO.mjs.map} +1 -1
  81. package/dist/{chunk-4NGEEDGV.mjs → chunk-UWRKMJBI.mjs} +9 -9
  82. package/dist/chunk-UWRKMJBI.mjs.map +1 -0
  83. package/dist/chunk-V46WVGWN.js +70 -0
  84. package/dist/{chunk-UMKBFFZ5.mjs → chunk-VTM5T7Y4.mjs} +13 -4
  85. package/dist/chunk-VTM5T7Y4.mjs.map +1 -0
  86. package/dist/chunk-VYE2DKST.js +102 -0
  87. package/dist/chunk-VYE2DKST.js.map +1 -0
  88. package/dist/chunk-W7JFFMEZ.mjs +98 -0
  89. package/dist/chunk-W7JFFMEZ.mjs.map +1 -0
  90. package/dist/chunk-WAS6V24H.js +221 -0
  91. package/dist/chunk-WAS6V24H.js.map +1 -0
  92. package/dist/{chunk-NRH6O4QZ.js → chunk-XUPRRLBI.js} +45 -14
  93. package/dist/chunk-XUPRRLBI.js.map +1 -0
  94. package/dist/{chunk-2FZSWVHT.mjs → chunk-YWA77VMP.mjs} +1 -1
  95. package/dist/chunk-YWA77VMP.mjs.map +1 -0
  96. package/dist/controllers/authentication/AuthenticationController.js +22 -0
  97. package/dist/controllers/authentication/AuthenticationController.mjs +22 -0
  98. package/dist/controllers/authentication/auth-snap-requests.js +10 -0
  99. package/dist/controllers/authentication/auth-snap-requests.mjs +10 -0
  100. package/dist/controllers/authentication/index.js +27 -0
  101. package/dist/controllers/authentication/index.js.map +1 -0
  102. package/dist/controllers/authentication/index.mjs +27 -0
  103. package/dist/controllers/authentication/index.mjs.map +1 -0
  104. package/dist/controllers/authentication/services.js +32 -0
  105. package/dist/controllers/authentication/services.js.map +1 -0
  106. package/dist/controllers/authentication/services.mjs +32 -0
  107. package/dist/controllers/authentication/services.mjs.map +1 -0
  108. package/dist/controllers/index.js +35 -0
  109. package/dist/controllers/index.js.map +1 -0
  110. package/dist/controllers/index.mjs +35 -0
  111. package/dist/controllers/index.mjs.map +1 -0
  112. package/dist/controllers/user-storage/UserStorageController.js +27 -0
  113. package/dist/controllers/user-storage/UserStorageController.js.map +1 -0
  114. package/dist/controllers/user-storage/UserStorageController.mjs +27 -0
  115. package/dist/controllers/user-storage/UserStorageController.mjs.map +1 -0
  116. package/dist/controllers/user-storage/encryption/cache.js +13 -0
  117. package/dist/controllers/user-storage/encryption/cache.js.map +1 -0
  118. package/dist/controllers/user-storage/encryption/cache.mjs +13 -0
  119. package/dist/controllers/user-storage/encryption/cache.mjs.map +1 -0
  120. package/dist/controllers/user-storage/encryption/encryption.js +12 -0
  121. package/dist/controllers/user-storage/encryption/encryption.js.map +1 -0
  122. package/dist/controllers/user-storage/encryption/encryption.mjs +12 -0
  123. package/dist/controllers/user-storage/encryption/encryption.mjs.map +1 -0
  124. package/dist/controllers/user-storage/encryption/index.js +16 -0
  125. package/dist/controllers/user-storage/encryption/index.js.map +1 -0
  126. package/dist/controllers/user-storage/encryption/index.mjs +16 -0
  127. package/dist/controllers/user-storage/encryption/index.mjs.map +1 -0
  128. package/dist/controllers/user-storage/encryption/utils.js +12 -0
  129. package/dist/controllers/user-storage/encryption/utils.js.map +1 -0
  130. package/dist/controllers/user-storage/encryption/utils.mjs +12 -0
  131. package/dist/controllers/user-storage/encryption/utils.mjs.map +1 -0
  132. package/dist/controllers/user-storage/index.js +37 -0
  133. package/dist/controllers/user-storage/index.js.map +1 -0
  134. package/dist/controllers/user-storage/index.mjs +37 -0
  135. package/dist/controllers/user-storage/index.mjs.map +1 -0
  136. package/dist/controllers/user-storage/schema.js +14 -0
  137. package/dist/controllers/user-storage/schema.js.map +1 -0
  138. package/dist/controllers/user-storage/schema.mjs +14 -0
  139. package/dist/controllers/user-storage/schema.mjs.map +1 -0
  140. package/dist/controllers/user-storage/services.js +31 -0
  141. package/dist/controllers/user-storage/services.js.map +1 -0
  142. package/dist/controllers/user-storage/services.mjs +31 -0
  143. package/dist/controllers/user-storage/services.mjs.map +1 -0
  144. package/dist/index.js +32 -62
  145. package/dist/index.mjs +33 -63
  146. package/dist/sdk/authentication-jwt-bearer/flow-siwe.js +7 -8
  147. package/dist/sdk/authentication-jwt-bearer/flow-siwe.mjs +6 -7
  148. package/dist/sdk/authentication-jwt-bearer/flow-srp.js +7 -8
  149. package/dist/sdk/authentication-jwt-bearer/flow-srp.mjs +6 -7
  150. package/dist/sdk/authentication-jwt-bearer/services.js +10 -6
  151. package/dist/sdk/authentication-jwt-bearer/services.mjs +11 -7
  152. package/dist/sdk/authentication-jwt-bearer/types.js +3 -3
  153. package/dist/sdk/authentication-jwt-bearer/types.mjs +2 -2
  154. package/dist/sdk/authentication.js +9 -10
  155. package/dist/sdk/authentication.mjs +8 -9
  156. package/dist/sdk/encryption.js +5 -3
  157. package/dist/sdk/encryption.mjs +4 -2
  158. package/dist/sdk/env.js +5 -3
  159. package/dist/sdk/env.mjs +4 -2
  160. package/dist/sdk/errors.js +5 -3
  161. package/dist/sdk/errors.mjs +4 -2
  162. package/dist/sdk/index.js +18 -13
  163. package/dist/sdk/index.mjs +17 -12
  164. package/dist/sdk/user-storage.js +6 -6
  165. package/dist/sdk/user-storage.mjs +5 -5
  166. package/dist/sdk/utils/eip-6963-metamask-provider.js +1 -1
  167. package/dist/sdk/utils/eip-6963-metamask-provider.mjs +1 -1
  168. package/dist/sdk/utils/messaging-signing-snap-requests.js +1 -1
  169. package/dist/sdk/utils/messaging-signing-snap-requests.mjs +1 -1
  170. package/dist/tsconfig.build.tsbuildinfo +1 -1
  171. package/dist/types/controllers/authentication/AuthenticationController.d.ts +73 -0
  172. package/dist/types/controllers/authentication/AuthenticationController.d.ts.map +1 -0
  173. package/dist/types/controllers/authentication/__fixtures__/index.d.ts +3 -0
  174. package/dist/types/controllers/authentication/__fixtures__/index.d.ts.map +1 -0
  175. package/dist/types/controllers/authentication/__fixtures__/mockResponses.d.ts +23 -0
  176. package/dist/types/controllers/authentication/__fixtures__/mockResponses.d.ts.map +1 -0
  177. package/dist/types/controllers/authentication/__fixtures__/mockServices.d.ts +10 -0
  178. package/dist/types/controllers/authentication/__fixtures__/mockServices.d.ts.map +1 -0
  179. package/dist/types/controllers/authentication/auth-snap-requests.d.ts +17 -0
  180. package/dist/types/controllers/authentication/auth-snap-requests.d.ts.map +1 -0
  181. package/dist/types/controllers/authentication/index.d.ts +5 -0
  182. package/dist/types/controllers/authentication/index.d.ts.map +1 -0
  183. package/dist/types/controllers/authentication/services.d.ts +69 -0
  184. package/dist/types/controllers/authentication/services.d.ts.map +1 -0
  185. package/dist/types/controllers/index.d.ts +3 -0
  186. package/dist/types/controllers/index.d.ts.map +1 -0
  187. package/dist/types/controllers/user-storage/UserStorageController.d.ts +84 -0
  188. package/dist/types/controllers/user-storage/UserStorageController.d.ts.map +1 -0
  189. package/dist/types/controllers/user-storage/__fixtures__/index.d.ts +4 -0
  190. package/dist/types/controllers/user-storage/__fixtures__/index.d.ts.map +1 -0
  191. package/dist/types/controllers/user-storage/__fixtures__/mockResponses.d.ts +13 -0
  192. package/dist/types/controllers/user-storage/__fixtures__/mockResponses.d.ts.map +1 -0
  193. package/dist/types/controllers/user-storage/__fixtures__/mockServices.d.ts +9 -0
  194. package/dist/types/controllers/user-storage/__fixtures__/mockServices.d.ts.map +1 -0
  195. package/dist/types/controllers/user-storage/__fixtures__/mockStorage.d.ts +5 -0
  196. package/dist/types/controllers/user-storage/__fixtures__/mockStorage.d.ts.map +1 -0
  197. package/dist/types/controllers/user-storage/encryption/cache.d.ts +31 -0
  198. package/dist/types/controllers/user-storage/encryption/cache.d.ts.map +1 -0
  199. package/dist/types/controllers/user-storage/encryption/encryption.d.ts +26 -0
  200. package/dist/types/controllers/user-storage/encryption/encryption.d.ts.map +1 -0
  201. package/dist/types/controllers/user-storage/encryption/index.d.ts +5 -0
  202. package/dist/types/controllers/user-storage/encryption/index.d.ts.map +1 -0
  203. package/dist/types/controllers/user-storage/encryption/utils.d.ts +4 -0
  204. package/dist/types/controllers/user-storage/encryption/utils.d.ts.map +1 -0
  205. package/dist/types/controllers/user-storage/index.d.ts +6 -0
  206. package/dist/types/controllers/user-storage/index.d.ts.map +1 -0
  207. package/dist/types/controllers/user-storage/schema.d.ts +22 -0
  208. package/dist/types/controllers/user-storage/schema.d.ts.map +1 -0
  209. package/dist/types/controllers/user-storage/services.d.ts +30 -0
  210. package/dist/types/controllers/user-storage/services.d.ts.map +1 -0
  211. package/dist/types/index.d.ts +3 -1
  212. package/dist/types/index.d.ts.map +1 -1
  213. package/dist/types/sdk/__fixtures__/mock-auth.d.ts +3 -0
  214. package/dist/types/sdk/__fixtures__/mock-auth.d.ts.map +1 -1
  215. package/dist/types/sdk/__fixtures__/mock-userstorage.d.ts.map +1 -1
  216. package/dist/types/sdk/__fixtures__/test-utils.d.ts.map +1 -1
  217. package/dist/types/sdk/authentication-jwt-bearer/flow-siwe.d.ts.map +1 -1
  218. package/dist/types/sdk/authentication-jwt-bearer/flow-srp.d.ts.map +1 -1
  219. package/dist/types/sdk/authentication-jwt-bearer/services.d.ts +20 -2
  220. package/dist/types/sdk/authentication-jwt-bearer/services.d.ts.map +1 -1
  221. package/dist/types/sdk/authentication-jwt-bearer/types.d.ts +8 -1
  222. package/dist/types/sdk/authentication-jwt-bearer/types.d.ts.map +1 -1
  223. package/dist/types/sdk/authentication.d.ts +2 -1
  224. package/dist/types/sdk/authentication.d.ts.map +1 -1
  225. package/dist/types/sdk/encryption.d.ts +2 -2
  226. package/dist/types/sdk/encryption.d.ts.map +1 -1
  227. package/dist/types/sdk/env.d.ts +8 -1
  228. package/dist/types/sdk/env.d.ts.map +1 -1
  229. package/dist/types/sdk/errors.d.ts +3 -0
  230. package/dist/types/sdk/errors.d.ts.map +1 -1
  231. package/dist/types/sdk/user-storage.d.ts.map +1 -1
  232. package/package.json +15 -2
  233. package/dist/chunk-2FZSWVHT.mjs.map +0 -1
  234. package/dist/chunk-4NGEEDGV.mjs.map +0 -1
  235. package/dist/chunk-6X6I3HZU.js.map +0 -1
  236. package/dist/chunk-BARZBXO7.js +0 -7
  237. package/dist/chunk-BARZBXO7.js.map +0 -1
  238. package/dist/chunk-BHVT2QEA.mjs.map +0 -1
  239. package/dist/chunk-CFST6GWE.js.map +0 -1
  240. package/dist/chunk-CYGZ4WLJ.mjs.map +0 -1
  241. package/dist/chunk-DEATIRII.js +0 -1
  242. package/dist/chunk-GQLHSQGZ.js.map +0 -1
  243. package/dist/chunk-GVMIXMYB.mjs +0 -67
  244. package/dist/chunk-GVMIXMYB.mjs.map +0 -1
  245. package/dist/chunk-KHFPE566.js +0 -49
  246. package/dist/chunk-KHFPE566.js.map +0 -1
  247. package/dist/chunk-KKRIOEXD.mjs +0 -7
  248. package/dist/chunk-KKRIOEXD.mjs.map +0 -1
  249. package/dist/chunk-MKJYSWME.mjs +0 -1
  250. package/dist/chunk-NRH6O4QZ.js.map +0 -1
  251. package/dist/chunk-OF3TQWGX.js.map +0 -1
  252. package/dist/chunk-UMKBFFZ5.mjs.map +0 -1
  253. package/dist/chunk-UVJVONBF.js +0 -126
  254. package/dist/chunk-UVJVONBF.js.map +0 -1
  255. package/dist/chunk-VHUU4HEY.js +0 -67
  256. package/dist/chunk-VHUU4HEY.js.map +0 -1
  257. package/dist/chunk-VXPVURGH.mjs.map +0 -1
  258. package/dist/chunk-VZXD5DCQ.js.map +0 -1
  259. package/dist/chunk-WJRV2JCX.mjs +0 -49
  260. package/dist/chunk-WJRV2JCX.mjs.map +0 -1
  261. package/dist/chunk-XUI43LEZ.mjs +0 -30
  262. package/dist/chunk-Z4BLTVTB.js +0 -30
  263. package/dist/sdk/authentication-jwt-bearer/constants.js +0 -8
  264. package/dist/sdk/authentication-jwt-bearer/constants.mjs +0 -8
  265. package/dist/types/sdk/authentication-jwt-bearer/constants.d.ts +0 -2
  266. package/dist/types/sdk/authentication-jwt-bearer/constants.d.ts.map +0 -1
  267. /package/dist/{chunk-MKJYSWME.mjs.map → chunk-26CCETCM.mjs.map} +0 -0
  268. /package/dist/{chunk-DEATIRII.js.map → chunk-V46WVGWN.js.map} +0 -0
  269. /package/dist/{chunk-Z4BLTVTB.js.map → controllers/authentication/AuthenticationController.js.map} +0 -0
  270. /package/dist/{chunk-XUI43LEZ.mjs.map → controllers/authentication/AuthenticationController.mjs.map} +0 -0
  271. /package/dist/{sdk/authentication-jwt-bearer/constants.js.map → controllers/authentication/auth-snap-requests.js.map} +0 -0
  272. /package/dist/{sdk/authentication-jwt-bearer/constants.mjs.map → controllers/authentication/auth-snap-requests.mjs.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AuthenticationController.d.ts","sourceRoot":"","sources":["../../../../src/controllers/authentication/AuthenticationController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAE9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO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C,mBAAmB,CAAC,CAAC;AAClC,MAAM,MAAM,kCAAkC,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;AAG1E,MAAM,MAAM,cAAc,GACtB,iBAAiB,GACjB,0CAA0C,CAAC;AAG/C,MAAM,MAAM,iCAAiC,GAAG,6BAA6B,CAC3E,OAAO,cAAc,EACrB,OAAO,GAAG,cAAc,EACxB,KAAK,EACL,cAAc,CAAC,MAAM,CAAC,EACtB,KAAK,CACN,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,wBAAyB,SAAQ,cAAc,CAClE,OAAO,cAAc,EACrB,6BAA6B,EAC7B,iCAAiC,CAClC;;gBAGa,EACV,SAAS,EACT,KAAK,EACL,WAAW,GACZ,EAAE;QACD,SAAS,EAAE,iCAAiC,CAAC;QAC7C,KAAK,CAAC,EAAE,6BAA6B,CAAC;QACtC;;;WAGG;QACH,WAAW,EAAE,eAAe,CAAC;KAC9B;IA4CY,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;IAKtC,cAAc,IAAI,IAAI;IAShB,cAAc,IAAI,OAAO,CAAC,MAAM,CAAC;IAW9C;;;;;OAKG;IACU,iBAAiB,IAAI,OAAO,CAAC,cAAc,CAAC;IAWlD,UAAU,IAAI,OAAO;CAsH7B"}
@@ -0,0 +1,3 @@
1
+ export * from './mockResponses';
2
+ export * from './mockServices';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/authentication/__fixtures__/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,23 @@
1
+ import type { LoginResponse, NonceResponse, OAuthTokenResponse } from '../services';
2
+ export declare const MOCK_NONCE = "4cbfqzoQpcNxVImGv";
3
+ export declare const MOCK_NONCE_RESPONSE: NonceResponse;
4
+ export declare const getMockAuthNonceResponse: () => {
5
+ url: string;
6
+ requestMethod: "GET";
7
+ response: NonceResponse;
8
+ };
9
+ export declare const MOCK_JWT = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
10
+ export declare const MOCK_LOGIN_RESPONSE: LoginResponse;
11
+ export declare const getMockAuthLoginResponse: () => {
12
+ url: string;
13
+ requestMethod: "POST";
14
+ response: LoginResponse;
15
+ };
16
+ export declare const MOCK_ACCESS_TOKEN: string;
17
+ export declare const MOCK_OATH_TOKEN_RESPONSE: OAuthTokenResponse;
18
+ export declare const getMockAuthAccessTokenResponse: () => {
19
+ url: string;
20
+ requestMethod: "POST";
21
+ response: OAuthTokenResponse;
22
+ };
23
+ //# sourceMappingURL=mockResponses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockResponses.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/authentication/__fixtures__/mockResponses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAarB,eAAO,MAAM,UAAU,sBAAsB,CAAC;AAC9C,eAAO,MAAM,mBAAmB,EAAE,aAEjC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;CAMpC,CAAC;AAEF,eAAO,MAAM,QAAQ,gKAC0I,CAAC;AAChK,eAAO,MAAM,mBAAmB,EAAE,aAUjC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;CAMpC,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAkC,CAAC;AACjE,eAAO,MAAM,wBAAwB,EAAE,kBAKtC,CAAC;AAEF,eAAO,MAAM,8BAA8B;;;;CAM1C,CAAC"}
@@ -0,0 +1,10 @@
1
+ import nock from 'nock';
2
+ type MockReply = {
3
+ status: nock.StatusCode;
4
+ body?: nock.Body;
5
+ };
6
+ export declare const mockEndpointGetNonce: (mockReply?: MockReply) => nock.Scope;
7
+ export declare const mockEndpointLogin: (mockReply?: MockReply) => nock.Scope;
8
+ export declare const mockEndpointAccessToken: (mockReply?: MockReply) => nock.Scope;
9
+ export {};
10
+ //# sourceMappingURL=mockServices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockServices.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/authentication/__fixtures__/mockServices.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAQxB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,oBAAoB,eAAgB,SAAS,eASzD,CAAC;AAEF,eAAO,MAAM,iBAAiB,eAAgB,SAAS,eAQtD,CAAC;AAEF,eAAO,MAAM,uBAAuB,eAAgB,SAAS,eAQ5D,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { HandleSnapRequest } from '@metamask/snaps-controllers';
2
+ type SnapRPCRequest = Parameters<HandleSnapRequest['handler']>[0];
3
+ /**
4
+ * Constructs Request to Message Signing Snap to get Public Key
5
+ *
6
+ * @returns Snap Public Key Request
7
+ */
8
+ export declare function createSnapPublicKeyRequest(): SnapRPCRequest;
9
+ /**
10
+ * Constructs Request to get Message Signing Snap to sign a message.
11
+ *
12
+ * @param message - message to sign
13
+ * @returns Snap Sign Message Request
14
+ */
15
+ export declare function createSnapSignMessageRequest(message: `metamask:${string}`): SnapRPCRequest;
16
+ export {};
17
+ //# sourceMappingURL=auth-snap-requests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-snap-requests.d.ts","sourceRoot":"","sources":["../../../../src/controllers/authentication/auth-snap-requests.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAIrE,KAAK,cAAc,GAAG,UAAU,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAIlE;;;;GAIG;AACH,wBAAgB,0BAA0B,IAAI,cAAc,CAS3D;AAED;;;;;GAKG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,YAAY,MAAM,EAAE,GAC5B,cAAc,CAUhB"}
@@ -0,0 +1,5 @@
1
+ import Controller from './AuthenticationController';
2
+ export { Controller };
3
+ export * from './AuthenticationController';
4
+ export * as Mocks from './__fixtures__';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controllers/authentication/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,4BAA4B,CAAC;AAEpD,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,cAAc,4BAA4B,CAAC;AAC3C,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,69 @@
1
+ export declare const AUTH_NONCE_ENDPOINT: string;
2
+ export declare const AUTH_LOGIN_ENDPOINT: string;
3
+ export declare const OIDC_TOKENS_ENDPOINT: string;
4
+ export type NonceResponse = {
5
+ nonce: string;
6
+ };
7
+ /**
8
+ * Auth Service - Get Nonce. Used for the initial JWTBearer flow
9
+ *
10
+ * @param publicKey - public key to associate a nonce with
11
+ * @returns the nonce or null if failed
12
+ */
13
+ export declare function getNonce(publicKey: string): Promise<string | null>;
14
+ /**
15
+ * The Login API Server Response Shape
16
+ */
17
+ export type LoginResponse = {
18
+ token: string;
19
+ expires_in: string;
20
+ /**
21
+ * Contains anonymous information about the logged in profile.
22
+ *
23
+ * @property identifier_id - a deterministic unique identifier on the method used to sign in
24
+ * @property profile_id - a unique id for a given profile
25
+ * @property metametrics_id - an anonymous server id
26
+ */
27
+ profile: {
28
+ identifier_id: string;
29
+ profile_id: string;
30
+ };
31
+ };
32
+ type ClientMetaMetrics = {
33
+ metametricsId: string;
34
+ agent: 'extension' | 'mobile';
35
+ };
36
+ /**
37
+ * Auth Service - Login. Will perform login with a given signature and will return a single use JWT Token.
38
+ *
39
+ * @param rawMessage - the original message before signing
40
+ * @param signature - the signed message
41
+ * @param clientMetaMetrics - optional client metametrics id (to associate on backend)
42
+ * @returns The Login Response
43
+ */
44
+ export declare function login(rawMessage: string, signature: string, clientMetaMetrics: ClientMetaMetrics): Promise<LoginResponse | null>;
45
+ /**
46
+ * The Auth API Token Response Shape
47
+ */
48
+ export type OAuthTokenResponse = {
49
+ access_token: string;
50
+ expires_in: number;
51
+ };
52
+ /**
53
+ * OIDC Service - Access Token. Trades the Auth Token for an access token (to be used for other authenticated endpoints)
54
+ * NOTE - the access token is short lived, which means it is best practice to validate session before calling authenticated endpoints
55
+ *
56
+ * @param jwtToken - the JWT Auth Token, received from `/login`
57
+ * @returns JWT Access token to store and use on authorized endpoints.
58
+ */
59
+ export declare function getAccessToken(jwtToken: string): Promise<string | null>;
60
+ /**
61
+ * Utility to create the raw login message for the JWT bearer flow (via SRP)
62
+ *
63
+ * @param nonce - nonce received from `/nonce` endpoint
64
+ * @param publicKey - public key used to retrieve nonce and for message signing
65
+ * @returns Raw Message which will be used for signing & logging in.
66
+ */
67
+ export declare function createLoginRawMessage(nonce: string, publicKey: string): `metamask:${string}:${string}`;
68
+ export {};
69
+ //# sourceMappingURL=services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/controllers/authentication/services.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,mBAAmB,QAAkC,CAAC;AACnE,eAAO,MAAM,mBAAmB,QAAsC,CAAC;AAGvE,eAAO,MAAM,oBAAoB,QAAkC,CAAC;AAIpE,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgBxE;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IAEd,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,OAAO,EAAE;QAEP,aAAa,EAAE,MAAM,CAAC;QAEtB,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,KAAK,EAAE,WAAW,GAAG,QAAQ,CAAC;CAC/B,CAAC;AAEF;;;;;;;GAOG;AACH,wBAAsB,KAAK,CACzB,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,iBAAiB,GACnC,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CA6B/B;AAED;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAE/B,YAAY,EAAE,MAAM,CAAC;IAErB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA8B7E;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,MAAM,GAChB,YAAY,MAAM,IAAI,MAAM,EAAE,CAEhC"}
@@ -0,0 +1,3 @@
1
+ export * as Authentication from './authentication';
2
+ export * as UserStorage from './user-storage';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controllers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,84 @@
1
+ import type { RestrictedControllerMessenger } from '@metamask/base-controller';
2
+ import { BaseController } from '@metamask/base-controller';
3
+ import type { HandleSnapRequest } from '@metamask/snaps-controllers';
4
+ import type { AuthenticationControllerGetBearerToken, AuthenticationControllerGetSessionProfile, AuthenticationControllerIsSignedIn, AuthenticationControllerPerformSignIn, AuthenticationControllerPerformSignOut } from '../authentication/AuthenticationController';
5
+ import type { UserStorageEntryKeys } from './schema';
6
+ export declare type NotificationServicesControllerDisableNotificationServices = {
7
+ type: `NotificationServicesController:disableNotificationServices`;
8
+ handler: () => Promise<void>;
9
+ };
10
+ export declare type NotificationServicesControllerSelectIsNotificationServicesEnabled = {
11
+ type: `NotificationServicesController:selectIsNotificationServicesEnabled`;
12
+ handler: () => boolean;
13
+ };
14
+ declare const controllerName = "UserStorageController";
15
+ export type UserStorageControllerState = {
16
+ /**
17
+ * Condition used by UI and to determine if we can use some of the User Storage methods.
18
+ */
19
+ isProfileSyncingEnabled: boolean;
20
+ /**
21
+ * Loading state for the profile syncing update
22
+ */
23
+ isProfileSyncingUpdateLoading: boolean;
24
+ };
25
+ type CreateActionsObj<Controller extends keyof UserStorageController> = {
26
+ [K in Controller]: {
27
+ type: `${typeof controllerName}:${K}`;
28
+ handler: UserStorageController[K];
29
+ };
30
+ };
31
+ type ActionsObj = CreateActionsObj<'performGetStorage' | 'performSetStorage' | 'getStorageKey' | 'enableProfileSyncing' | 'disableProfileSyncing'>;
32
+ export type Actions = ActionsObj[keyof ActionsObj];
33
+ export type UserStorageControllerPerformGetStorage = ActionsObj['performGetStorage'];
34
+ export type UserStorageControllerPerformSetStorage = ActionsObj['performSetStorage'];
35
+ export type UserStorageControllerGetStorageKey = ActionsObj['getStorageKey'];
36
+ export type UserStorageControllerEnableProfileSyncing = ActionsObj['enableProfileSyncing'];
37
+ export type UserStorageControllerDisableProfileSyncing = ActionsObj['disableProfileSyncing'];
38
+ export type AllowedActions = HandleSnapRequest | AuthenticationControllerGetBearerToken | AuthenticationControllerGetSessionProfile | AuthenticationControllerPerformSignIn | AuthenticationControllerIsSignedIn | AuthenticationControllerPerformSignOut | NotificationServicesControllerDisableNotificationServices | NotificationServicesControllerSelectIsNotificationServicesEnabled;
39
+ export type UserStorageControllerMessenger = RestrictedControllerMessenger<typeof controllerName, Actions | AllowedActions, never, AllowedActions['type'], never>;
40
+ /**
41
+ * Reusable controller that allows any team to store synchronized data for a given user.
42
+ * These can be settings shared cross MetaMask clients, or data we want to persist when uninstalling/reinstalling.
43
+ *
44
+ * NOTE:
45
+ * - data stored on UserStorage is FULLY encrypted, with the only keys stored/managed on the client.
46
+ * - No one can access this data unless they are have the SRP and are able to run the signing snap.
47
+ */
48
+ export default class UserStorageController extends BaseController<typeof controllerName, UserStorageControllerState, UserStorageControllerMessenger> {
49
+ #private;
50
+ getMetaMetricsState: () => boolean;
51
+ constructor(params: {
52
+ messenger: UserStorageControllerMessenger;
53
+ state?: UserStorageControllerState;
54
+ getMetaMetricsState: () => boolean;
55
+ });
56
+ enableProfileSyncing(): Promise<void>;
57
+ setIsProfileSyncingEnabled(isProfileSyncingEnabled: boolean): Promise<void>;
58
+ disableProfileSyncing(): Promise<void>;
59
+ /**
60
+ * Allows retrieval of stored data. Data stored is string formatted.
61
+ * Developers can extend the entry path and entry name through the `schema.ts` file.
62
+ *
63
+ * @param entryKey - entry key that matches schema
64
+ * @returns the decrypted string contents found from user storage (or null if not found)
65
+ */
66
+ performGetStorage(entryKey: UserStorageEntryKeys): Promise<string | null>;
67
+ /**
68
+ * Allows storage of user data. Data stored must be string formatted.
69
+ * Developers can extend the entry path and entry name through the `schema.ts` file.
70
+ *
71
+ * @param entryKey - entry key that matches schema
72
+ * @param value - The string data you want to store.
73
+ * @returns nothing. NOTE that an error is thrown if fails to store data.
74
+ */
75
+ performSetStorage(entryKey: UserStorageEntryKeys, value: string): Promise<void>;
76
+ /**
77
+ * Retrieves the storage key, for internal use only!
78
+ *
79
+ * @returns the storage key
80
+ */
81
+ getStorageKey(): Promise<string>;
82
+ }
83
+ export {};
84
+ //# sourceMappingURL=UserStorageController.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UserStorageController.d.ts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/UserStorageController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAE9B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAGrE,OAAO,KAAK,EACV,sCAAsC,EACtC,yCAAyC,EACzC,kCAAkC,EAClC,qCAAqC,EACrC,sCAAsC,EACvC,MAAM,4CAA4C,CAAC;AAEpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAIrD,MAAM,CAAC,OAAO,MAAM,yDAAyD,GAC3E;IACE,IAAI,EAAE,4DAA4D,CAAC;IACnE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEJ,MAAM,CAAC,OAAO,MAAM,iEAAiE,GACnF;IACE,IAAI,EAAE,oEAAoE,CAAC;IAC3E,OAAO,EAAE,MAAM,OAAO,CAAC;CACxB,CAAC;AAEJ,QAAA,MAAM,cAAc,0BAA0B,CAAC;AAG/C,MAAM,MAAM,0BAA0B,GAAG;IACvC;;OAEG;IACH,uBAAuB,EAAE,OAAO,CAAC;IACjC;;OAEG;IACH,6BAA6B,EAAE,OAAO,CAAC;CACxC,CAAC;AAmBF,KAAK,gBAAgB,CAAC,UAAU,SAAS,MAAM,qBAAqB,IAAI;KACrE,CAAC,IAAI,UAAU,GAAG;QACjB,IAAI,EAAE,GAAG,OAAO,cAAc,IAAI,CAAC,EAAE,CAAC;QACtC,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC,CAAC;KACnC;CACF,CAAC;AACF,KAAK,UAAU,GAAG,gBAAgB,CAC9B,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,GACf,sBAAsB,GACtB,uBAAuB,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GAC7B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAazB;;;;;;;OAOG;IACU,iBAAiB,CAC5B,QAAQ,EAAE,oBAAoB,EAC9B,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,IAAI,CAAC;IAYhB;;;;OAIG;IACU,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC;CAkE9C"}
@@ -0,0 +1,4 @@
1
+ export * from './mockResponses';
2
+ export * from './mockServices';
3
+ export * from './mockStorage';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/__fixtures__/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { GetUserStorageResponse } from '../services';
2
+ export declare const MOCK_USER_STORAGE_NOTIFICATIONS_ENDPOINT: string;
3
+ export declare const getMockUserStorageGetResponse: () => {
4
+ url: string;
5
+ requestMethod: "GET";
6
+ response: GetUserStorageResponse;
7
+ };
8
+ export declare const getMockUserStoragePutResponse: () => {
9
+ url: string;
10
+ requestMethod: "PUT";
11
+ response: null;
12
+ };
13
+ //# sourceMappingURL=mockResponses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockResponses.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/__fixtures__/mockResponses.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAU1D,eAAO,MAAM,wCAAwC,QAGlD,CAAC;AAOJ,eAAO,MAAM,6BAA6B;;;;CAMzC,CAAC;AAEF,eAAO,MAAM,6BAA6B;;;;CAMzC,CAAC"}
@@ -0,0 +1,9 @@
1
+ import nock from 'nock';
2
+ type MockReply = {
3
+ status: nock.StatusCode;
4
+ body?: nock.Body;
5
+ };
6
+ export declare const mockEndpointGetUserStorage: (mockReply?: MockReply) => nock.Scope;
7
+ export declare const mockEndpointUpsertUserStorage: (mockReply?: Pick<MockReply, 'status'>) => nock.Scope;
8
+ export {};
9
+ //# sourceMappingURL=mockServices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockServices.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/__fixtures__/mockServices.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAOxB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,0BAA0B,eAAgB,SAAS,eAY/D,CAAC;AAEF,eAAO,MAAM,6BAA6B,eAC5B,KAAK,SAAS,EAAE,QAAQ,CAAC,eAOtC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export declare const MOCK_STORAGE_KEY_SIGNATURE = "mockStorageKey";
2
+ export declare const MOCK_STORAGE_KEY: string;
3
+ export declare const MOCK_STORAGE_DATA: string;
4
+ export declare const MOCK_ENCRYPTED_STORAGE_DATA: string;
5
+ //# sourceMappingURL=mockStorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mockStorage.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/__fixtures__/mockStorage.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,0BAA0B,mBAAmB,CAAC;AAC3D,eAAO,MAAM,gBAAgB,QAA+C,CAAC;AAC7E,eAAO,MAAM,iBAAiB,QAAqC,CAAC;AACpE,eAAO,MAAM,2BAA2B,QAGvC,CAAC"}
@@ -0,0 +1,31 @@
1
+ type CachedEntry = {
2
+ salt: Uint8Array;
3
+ base64Salt: string;
4
+ key: Uint8Array;
5
+ };
6
+ /**
7
+ * Returns a given cached derived key from a hashed password and salt
8
+ *
9
+ * @param hashedPassword - hashed password for cache lookup
10
+ * @param salt - provide salt to receive cached key
11
+ * @returns cached key
12
+ */
13
+ export declare function getCachedKeyBySalt(hashedPassword: string, salt: Uint8Array): CachedEntry | undefined;
14
+ /**
15
+ * Gets any cached key for a given hashed password
16
+ *
17
+ * @param hashedPassword - hashed password for cache lookup
18
+ * @returns any (the first) cached key
19
+ */
20
+ export declare function getAnyCachedKey(hashedPassword: string): CachedEntry | undefined;
21
+ /**
22
+ * Sets a key to the in memory cache.
23
+ * We have set an arbitrary size of 10 cached keys per hashed password.
24
+ *
25
+ * @param hashedPassword - hashed password for cache lookup
26
+ * @param salt - salt to set new derived key
27
+ * @param key - derived key we are setting
28
+ */
29
+ export declare function setCachedKey(hashedPassword: string, salt: Uint8Array, key: Uint8Array): void;
30
+ export {};
31
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/encryption/cache.ts"],"names":[],"mappings":"AAEA,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,UAAU,CAAC;CACjB,CAAC;AAiBF;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,UAAU,GACf,WAAW,GAAG,SAAS,CAazB;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,cAAc,EAAE,MAAM,GACrB,WAAW,GAAG,SAAS,CAmBzB;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAC1B,cAAc,EAAE,MAAM,EACtB,IAAI,EAAE,UAAU,EAChB,GAAG,EAAE,UAAU,GACd,IAAI,CAeN"}
@@ -0,0 +1,26 @@
1
+ export type EncryptedPayload = {
2
+ v: '1';
3
+ t: 'scrypt';
4
+ d: string;
5
+ o: {
6
+ N: number;
7
+ r: number;
8
+ p: number;
9
+ dkLen: number;
10
+ };
11
+ saltLen: number;
12
+ };
13
+ declare class EncryptorDecryptor {
14
+ #private;
15
+ encryptString(plaintext: string, password: string): string;
16
+ decryptString(encryptedDataStr: string, password: string): string;
17
+ }
18
+ declare const encryption: EncryptorDecryptor;
19
+ export default encryption;
20
+ /**
21
+ * Receive a SHA256 hash from a given string
22
+ * @param data - input
23
+ * @returns sha256 hash
24
+ */
25
+ export declare function createSHA256Hash(data: string): string;
26
+ //# sourceMappingURL=encryption.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encryption.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/encryption/encryption.ts"],"names":[],"mappings":"AASA,MAAM,MAAM,gBAAgB,GAAG;IAE7B,CAAC,EAAE,GAAG,CAAC;IAGP,CAAC,EAAE,QAAQ,CAAC;IAGZ,CAAC,EAAE,MAAM,CAAC;IAGV,CAAC,EAAE;QAED,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IAGF,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAeF,cAAM,kBAAkB;;IACtB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IAS1D,aAAa,CAAC,gBAAgB,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;CAsIlE;AAED,QAAA,MAAM,UAAU,oBAA2B,CAAC;AAC5C,eAAe,UAAU,CAAC;AAE1B;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGrD"}
@@ -0,0 +1,5 @@
1
+ import Encryption from './encryption';
2
+ export { Encryption };
3
+ export * from './encryption';
4
+ export default Encryption;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/encryption/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,eAAe,UAAU,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const byteArrayToBase64: (byteArray: Uint8Array) => string;
2
+ export declare const base64ToByteArray: (base64: string) => Uint8Array;
3
+ export declare const bytesToUtf8: (byteArray: Uint8Array) => string;
4
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../src/controllers/user-storage/encryption/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,iBAAiB,cAAe,UAAU,WAEtD,CAAC;AAEF,eAAO,MAAM,iBAAiB,WAAY,MAAM,eAE/C,CAAC;AAEF,eAAO,MAAM,WAAW,cAAe,UAAU,WAGhD,CAAC"}
@@ -0,0 +1,6 @@
1
+ import Controller from './UserStorageController';
2
+ export { Controller };
3
+ export * from './UserStorageController';
4
+ export * from './encryption';
5
+ export * as Mocks from './__fixtures__';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,yBAAyB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,CAAC;AACtB,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The User Storage Endpoint requires a path and an entry name.
3
+ * Developers can provide additional paths by extending this variable below
4
+ */
5
+ export declare const USER_STORAGE_ENTRIES: {
6
+ notificationSettings: {
7
+ path: string;
8
+ entryName: string;
9
+ };
10
+ };
11
+ export type UserStorageEntryKeys = keyof typeof USER_STORAGE_ENTRIES;
12
+ /**
13
+ * Constructs a unique entry path for a user.
14
+ * This can be done due to the uniqueness of the storage key (no users will share the same storage key).
15
+ * The users entry is a unique hash that cannot be reversed.
16
+ *
17
+ * @param entryKey - storage schema entry key
18
+ * @param storageKey - users storage key
19
+ * @returns path to store entry
20
+ */
21
+ export declare function createEntryPath(entryKey: UserStorageEntryKeys, storageKey: string): string;
22
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/schema.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,oBAAoB;;;;;CAKW,CAAC;AAE7C,MAAM,MAAM,oBAAoB,GAAG,MAAM,OAAO,oBAAoB,CAAC;AAErE;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,oBAAoB,EAC9B,UAAU,EAAE,MAAM,GACjB,MAAM,CAQR"}
@@ -0,0 +1,30 @@
1
+ import type { UserStorageEntryKeys } from './schema';
2
+ export declare const USER_STORAGE_API: string;
3
+ export declare const USER_STORAGE_ENDPOINT: string;
4
+ /**
5
+ * This is the Server Response shape
6
+ */
7
+ export type GetUserStorageResponse = {
8
+ HashedKey: string;
9
+ Data: string;
10
+ };
11
+ export type UserStorageOptions = {
12
+ bearerToken: string;
13
+ entryKey: UserStorageEntryKeys;
14
+ storageKey: string;
15
+ };
16
+ /**
17
+ * User Storage Service - Get Storage Entry.
18
+ *
19
+ * @param opts - User Storage Options
20
+ * @returns The storage entry, or null if fails to find entry
21
+ */
22
+ export declare function getUserStorage(opts: UserStorageOptions): Promise<string | null>;
23
+ /**
24
+ * User Storage Service - Set Storage Entry.
25
+ *
26
+ * @param data - data to store
27
+ * @param opts - storage options
28
+ */
29
+ export declare function upsertUserStorage(data: string, opts: UserStorageOptions): Promise<void>;
30
+ //# sourceMappingURL=services.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/controllers/user-storage/services.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAKrD,eAAO,MAAM,gBAAgB,EAAE,MAAmC,CAAC;AACnE,eAAO,MAAM,qBAAqB,QAA2C,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IAEnC,SAAS,EAAE,MAAM,CAAC;IAElB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,oBAAoB,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuCxB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,IAAI,CAAC,CAiBf"}
@@ -1,2 +1,4 @@
1
- export * from './sdk';
1
+ export * as SDK from './sdk';
2
+ export * as AuthenticationController from './controllers/authentication';
3
+ export * as UserStorageController from './controllers/user-storage';
2
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,wBAAwB,MAAM,8BAA8B,CAAC;AACzE,OAAO,KAAK,qBAAqB,MAAM,4BAA4B,CAAC"}
@@ -22,6 +22,7 @@ export declare const MOCK_OIDC_TOKEN_RESPONSE: {
22
22
  };
23
23
  export declare const handleMockNonce: (mockReply?: MockReply) => nock.Scope;
24
24
  export declare const handleMockSiweLogin: (mockReply?: MockReply) => nock.Scope;
25
+ export declare const handleMockPairIdentifiers: (mockReply?: MockReply) => nock.Scope;
25
26
  export declare const handleMockSrpLogin: (mockReply?: MockReply) => nock.Scope;
26
27
  export declare const handleMockOAuth2Token: (mockReply?: MockReply) => nock.Scope;
27
28
  export declare const arrangeAuthAPIs: (options?: {
@@ -29,11 +30,13 @@ export declare const arrangeAuthAPIs: (options?: {
29
30
  mockOAuth2TokenUrl?: MockReply;
30
31
  mockSrpLoginUrl?: MockReply;
31
32
  mockSiweLoginUrl?: MockReply;
33
+ mockPairIdentifiers?: MockReply;
32
34
  }) => {
33
35
  mockNonceUrl: nock.Scope;
34
36
  mockOAuth2TokenUrl: nock.Scope;
35
37
  mockSrpLoginUrl: nock.Scope;
36
38
  mockSiweLoginUrl: nock.Scope;
39
+ mockPairIdentifiersUrl: nock.Scope;
37
40
  };
38
41
  export {};
39
42
  //# sourceMappingURL=mock-auth.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mock-auth.d.ts","sourceRoot":"","sources":["../../../../src/sdk/__fixtures__/mock-auth.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAUxB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;AAOF,eAAO,MAAM,QAAQ,upBACioB,CAAC;AAEvpB,eAAO,MAAM,eAAe,gKACmI,CAAC;AAqBhK,eAAO,MAAM,uBAAuB;;;;;;;;;;CAWnC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAGpC,CAAC;AAEF,eAAO,MAAM,eAAe,eAAgB,SAAS,eAUpD,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAAgB,SAAS,eAQxD,CAAC;AAEF,eAAO,MAAM,kBAAkB,eAAgB,SAAS,eAQvD,CAAC;AAEF,eAAO,MAAM,qBAAqB,eAAgB,SAAS,eAQ1D,CAAC;AAEF,eAAO,MAAM,eAAe,aAAc;IACxC,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,gBAAgB,CAAC,EAAE,SAAS,CAAC;CAC9B;;;;;CAYA,CAAC"}
1
+ {"version":3,"file":"mock-auth.d.ts","sourceRoot":"","sources":["../../../../src/sdk/__fixtures__/mock-auth.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAWxB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;AAQF,eAAO,MAAM,QAAQ,upBACioB,CAAC;AAEvpB,eAAO,MAAM,eAAe,gKACmI,CAAC;AAmChK,eAAO,MAAM,uBAAuB;;;;;;;;;;CAuBnC,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;CAOpC,CAAC;AAEF,eAAO,MAAM,eAAe,eAAgB,SAAS,eAUpD,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAAgB,SAAS,eAQxD,CAAC;AAEF,eAAO,MAAM,yBAAyB,eAAgB,SAAS,eAQ9D,CAAC;AAEF,eAAO,MAAM,kBAAkB,eAAgB,SAAS,eAQvD,CAAC;AAEF,eAAO,MAAM,qBAAqB,eAAgB,SAAS,eAQ1D,CAAC;AAEF,eAAO,MAAM,eAAe,aAAc;IACxC,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,kBAAkB,CAAC,EAAE,SAAS,CAAC;IAC/B,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,mBAAmB,CAAC,EAAE,SAAS,CAAC;CACjC;;;;;;CAgBA,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"mock-userstorage.d.ts","sourceRoot":"","sources":["../../../../src/sdk/__fixtures__/mock-userstorage.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAMxB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;AAKF,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AACnD,eAAO,MAAM,uBAAuB;;CAAwB,CAAC;AAC7D,eAAO,MAAM,iCAAiC,QAG7C,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;CAGjC,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB,SAAS,eAQ7D,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB,SAAS,eAQ7D,CAAC"}
1
+ {"version":3,"file":"mock-userstorage.d.ts","sourceRoot":"","sources":["../../../../src/sdk/__fixtures__/mock-userstorage.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAMxB,KAAK,SAAS,GAAG;IACf,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;IACxB,IAAI,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC;CAClB,CAAC;AAKF,eAAO,MAAM,gBAAgB,qBAAqB,CAAC;AAGnD,eAAO,MAAM,uBAAuB;;CAAwB,CAAC;AAC7D,eAAO,MAAM,iCAAiC,QAG7C,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;CAGjC,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB,SAAS,eAQ7D,CAAC;AAEF,eAAO,MAAM,wBAAwB,eAAgB,SAAS,eAQ7D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../../../src/sdk/__fixtures__/test-utils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAK9D,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC;AAI/B,eAAO,MAAM,WAAW,wBAAyB,GAAG,EAAE,KAAK,GAAG,gDACnB,CAAC;AAqB5C;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,GAAG,QAAQ,EAAE,EACnB,aAAa,EAAE,MAAM,EACrB,mBAAmB,CAAC,EAAE;IACpB,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B;;;;;;EAmDF"}
1
+ {"version":3,"file":"test-utils.d.ts","sourceRoot":"","sources":["../../../../src/sdk/__fixtures__/test-utils.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EACV,kBAAkB,EAEnB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAK9D,MAAM,MAAM,YAAY,GAAG,GAAG,CAAC;AAK/B,eAAO,MAAM,WAAW,wBAAyB,GAAG,EAAE,KAAK,GAAG,gDACnB,CAAC;AAqB5C;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,GAAG,QAAQ,EAAE,EACnB,aAAa,EAAE,MAAM,EACrB,mBAAmB,CAAC,EAAE;IACpB,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B;;;;;;EAqDF"}
@@ -1 +1 @@
1
- {"version":3,"file":"flow-siwe.d.ts","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,MAAM,SAAS,CAAC;AAEjB,KAAK,0BAA0B,GAAG;IAChC,OAAO,EAAE,kBAAkB,CAAC;CAC7B,CAAC;AAEF,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,MAAM,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,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 +1 @@
1
- {"version":3,"file":"flow-srp.d.ts","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/flow-srp.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,SAAS,EAET,WAAW,EACZ,MAAM,SAAS,CAAC;AAEjB,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B,CAAC;AAuBF,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;CA4DpD"}
1
+ {"version":3,"file":"flow-srp.d.ts","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/flow-srp.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,UAAU,EACV,kBAAkB,EAClB,kBAAkB,EAClB,QAAQ,EACR,SAAS,EAET,WAAW,EACZ,MAAM,SAAS,CAAC;AAIjB,KAAK,yBAAyB,GAAG;IAC/B,OAAO,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAC9B,CAAC;AAuBF,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;CAgEpD"}
@@ -1,7 +1,8 @@
1
- import type { Env } from '../env';
1
+ import type { Env, Platform } from '../env';
2
2
  import type { AccessToken, UserProfile } from './types';
3
3
  import { AuthType } from './types';
4
4
  export declare const NONCE_URL: (env: Env) => string;
5
+ export declare const PAIR_IDENTIFIERS: (env: Env) => string;
5
6
  export declare const OIDC_TOKEN_URL: (env: Env) => string;
6
7
  export declare const SRP_LOGIN_URL: (env: Env) => string;
7
8
  export declare const SIWE_LOGIN_URL: (env: Env) => string;
@@ -10,6 +11,22 @@ type NonceResponse = {
10
11
  identifier: string;
11
12
  expiresIn: number;
12
13
  };
14
+ type PairRequest = {
15
+ signature: string;
16
+ raw_message: string;
17
+ encrypted_storage_key: string;
18
+ identifier_type: 'SIWE' | 'SRP';
19
+ };
20
+ /**
21
+ * Pair multiple identifiers under a single profile
22
+ *
23
+ * @param nonce - session nonce
24
+ * @param logins - pairing request payload
25
+ * @param accessToken - JWT access token used to access protected resources
26
+ * @param env - server environment
27
+ * @returns void.
28
+ */
29
+ export declare function pairIdentifiers(nonce: string, logins: PairRequest[], accessToken: string, env: Env): Promise<void>;
13
30
  /**
14
31
  * Service to Get Nonce for JWT Bearer Flow
15
32
  *
@@ -23,9 +40,10 @@ export declare function getNonce(id: string, env: Env): Promise<NonceResponse>;
23
40
  *
24
41
  * @param jwtToken - The original token received from Authentication. This is traded for the Access Token. (the authentication token is single-use)
25
42
  * @param env - server environment
43
+ * @param platform - SDK platform
26
44
  * @returns Access Token from Authorization server
27
45
  */
28
- export declare function authorizeOIDC(jwtToken: string, env: Env): Promise<AccessToken>;
46
+ export declare function authorizeOIDC(jwtToken: string, env: Env, platform: Platform): Promise<AccessToken>;
29
47
  type Authentication = {
30
48
  token: string;
31
49
  expiresIn: number;
@@ -1 +1 @@
1
- {"version":3,"file":"services.d.ts","sourceRoot":"","sources":["../../../../src/sdk/authentication-jwt-bearer/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AAGlC,OAAO,KAAK,EAAE,WAAW,EAAgB,WAAW,EAAE,MAAM,SAAS,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,eAAO,MAAM,SAAS,QAAS,GAAG,WACY,CAAC;AAE/C,eAAO,MAAM,cAAc,QAAS,GAAG,WACO,CAAC;AAE/C,eAAO,MAAM,aAAa,QAAS,GAAG,WACY,CAAC;AAEnD,eAAO,MAAM,cAAc,QAAS,GAAG,WACY,CAAC;AAgBpD,KAAK,aAAa,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,CAyB3E;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,GAAG,EAAE,GAAG,GACP,OAAO,CAAC,WAAW,CAAC,CAwCtB;AAED,KAAK,cAAc,GAAG;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,WAAW,CAAC;CACtB,CAAC;AACF;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAChC,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM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