@dfns/sdk 0.2.2 → 0.2.3-rc.1

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 (377) hide show
  1. package/baseAuthApi.ts +236 -0
  2. package/codegen/Assets/AssetsClient.ts +137 -0
  3. package/codegen/Assets/DelegatedAssetsClient.ts +201 -0
  4. package/codegen/Assets/index.ts +3 -0
  5. package/codegen/Assets/types.ts +45 -0
  6. package/codegen/Auth/AuthClient.ts +729 -0
  7. package/codegen/Auth/DelegatedAuthClient.ts +1508 -0
  8. package/codegen/Auth/index.ts +3 -0
  9. package/codegen/Auth/types.ts +262 -0
  10. package/codegen/Blockchains/BlockchainsClient.ts +25 -0
  11. package/codegen/Blockchains/DelegatedBlockchainsClient.ts +25 -0
  12. package/codegen/Blockchains/index.ts +3 -0
  13. package/codegen/Blockchains/types.ts +8 -0
  14. package/codegen/Callbacks/CallbacksClient.ts +107 -0
  15. package/codegen/Callbacks/DelegatedCallbacksClient.ts +172 -0
  16. package/codegen/Callbacks/index.ts +3 -0
  17. package/codegen/Callbacks/{types.d.ts → types.ts} +26 -18
  18. package/codegen/Permissions/DelegatedPermissionsClient.ts +468 -0
  19. package/codegen/Permissions/PermissionsClient.ts +223 -0
  20. package/codegen/Permissions/index.ts +3 -0
  21. package/codegen/Permissions/types.ts +82 -0
  22. package/codegen/PolicyExecution/DelegatedPolicyExecutionClient.ts +99 -0
  23. package/codegen/PolicyExecution/PolicyExecutionClient.ts +63 -0
  24. package/codegen/PolicyExecution/index.ts +3 -0
  25. package/codegen/PolicyExecution/types.ts +24 -0
  26. package/codegen/PolicyManagement/DelegatedPolicyManagementClient.ts +384 -0
  27. package/codegen/PolicyManagement/PolicyManagementClient.ts +205 -0
  28. package/codegen/PolicyManagement/index.ts +3 -0
  29. package/codegen/PolicyManagement/{types.d.ts → types.ts} +56 -40
  30. package/codegen/PublicKeys/DelegatedPublicKeysClient.ts +299 -0
  31. package/codegen/PublicKeys/PublicKeysClient.ts +179 -0
  32. package/codegen/PublicKeys/index.ts +3 -0
  33. package/codegen/PublicKeys/types.ts +68 -0
  34. package/codegen/Signers/DelegatedSignersClient.ts +22 -0
  35. package/codegen/Signers/SignersClient.ts +22 -0
  36. package/codegen/Signers/index.ts +3 -0
  37. package/codegen/Signers/types.ts +3 -0
  38. package/codegen/Wallets/DelegatedWalletsClient.ts +511 -0
  39. package/codegen/Wallets/WalletsClient.ts +310 -0
  40. package/codegen/Wallets/index.ts +3 -0
  41. package/codegen/Wallets/types.ts +137 -0
  42. package/codegen/datamodel/ApiKeys/errors.ts +9 -0
  43. package/codegen/datamodel/ApiKeys/index.ts +3 -0
  44. package/codegen/datamodel/ApiKeys/responses.ts +68 -0
  45. package/codegen/datamodel/ApiKeys/types.ts +81 -0
  46. package/codegen/datamodel/Assets/errors.ts +24 -0
  47. package/codegen/datamodel/Assets/index.ts +3 -0
  48. package/codegen/datamodel/Assets/responses.ts +146 -0
  49. package/codegen/datamodel/Assets/types.ts +417 -0
  50. package/codegen/datamodel/Auth/index.ts +2 -0
  51. package/codegen/datamodel/Auth/responses.ts +1110 -0
  52. package/codegen/datamodel/Auth/types.ts +1404 -0
  53. package/codegen/datamodel/BlockchainIndexing/index.ts +1 -0
  54. package/codegen/datamodel/BlockchainIndexing/{responses.d.ts → responses.ts} +10 -5
  55. package/codegen/datamodel/Blockchains/index.ts +2 -0
  56. package/codegen/datamodel/Blockchains/responses.ts +41 -0
  57. package/codegen/datamodel/Blockchains/types.ts +695 -0
  58. package/codegen/datamodel/Callbacks/index.ts +2 -0
  59. package/codegen/datamodel/Callbacks/responses.ts +110 -0
  60. package/codegen/datamodel/Callbacks/types.ts +100 -0
  61. package/codegen/datamodel/Foundations/errors.ts +299 -0
  62. package/codegen/datamodel/Foundations/index.ts +2 -0
  63. package/codegen/datamodel/Foundations/types.ts +57921 -0
  64. package/codegen/datamodel/Orgs/index.ts +2 -0
  65. package/codegen/datamodel/Orgs/responses.ts +104 -0
  66. package/codegen/datamodel/Orgs/types.ts +322 -0
  67. package/codegen/datamodel/Permissions/index.ts +2 -0
  68. package/codegen/datamodel/Permissions/responses.ts +258 -0
  69. package/codegen/datamodel/Permissions/types.ts +221 -0
  70. package/codegen/datamodel/PolicyExecution/errors.ts +24 -0
  71. package/codegen/datamodel/PolicyExecution/index.ts +3 -0
  72. package/codegen/datamodel/PolicyExecution/responses.ts +59 -0
  73. package/codegen/datamodel/PolicyExecution/types.ts +122 -0
  74. package/codegen/datamodel/PolicyManagement/index.ts +2 -0
  75. package/codegen/datamodel/PolicyManagement/responses.ts +255 -0
  76. package/codegen/datamodel/PolicyManagement/types.ts +711 -0
  77. package/codegen/datamodel/PublicKeys/index.ts +2 -0
  78. package/codegen/datamodel/PublicKeys/responses.ts +190 -0
  79. package/codegen/datamodel/PublicKeys/types.ts +558 -0
  80. package/codegen/datamodel/Signers/index.ts +2 -0
  81. package/codegen/datamodel/Signers/responses.ts +64 -0
  82. package/codegen/datamodel/Signers/types.ts +31 -0
  83. package/codegen/datamodel/Wallets/errors.ts +0 -0
  84. package/codegen/datamodel/Wallets/index.ts +2 -0
  85. package/codegen/datamodel/Wallets/responses.ts +318 -0
  86. package/codegen/datamodel/Wallets/types.ts +1268 -0
  87. package/dfnsApiClient.ts +76 -0
  88. package/dfnsAuthenticator.ts +59 -0
  89. package/dfnsDelegatedApiClient.ts +75 -0
  90. package/dfnsError.ts +5 -0
  91. package/generated/permissions/client.ts +125 -0
  92. package/generated/permissions/delegatedClient.ts +266 -0
  93. package/generated/permissions/index.ts +3 -0
  94. package/generated/permissions/types.ts +202 -0
  95. package/generated/policies/client.ts +110 -0
  96. package/generated/policies/delegatedClient.ts +223 -0
  97. package/generated/policies/index.ts +3 -0
  98. package/generated/policies/{types.d.ts → types.ts} +29 -17
  99. package/generated/signers/client.ts +22 -0
  100. package/generated/signers/delegatedClient.ts +23 -0
  101. package/generated/signers/index.ts +3 -0
  102. package/generated/signers/{types.d.ts → types.ts} +1 -0
  103. package/generated/wallets/client.ts +282 -0
  104. package/generated/wallets/delegatedClient.ts +507 -0
  105. package/generated/wallets/index.ts +3 -0
  106. package/generated/wallets/{types.d.ts → types.ts} +120 -48
  107. package/generated/webhooks/client.ts +124 -0
  108. package/generated/webhooks/delegatedClient.ts +237 -0
  109. package/generated/webhooks/index.ts +3 -0
  110. package/generated/webhooks/{types.d.ts → types.ts} +34 -16
  111. package/index.ts +7 -0
  112. package/package.json +1 -8
  113. package/project.json +14 -0
  114. package/signer.ts +60 -0
  115. package/store.ts +99 -0
  116. package/tsconfig.json +7 -0
  117. package/typedoc.json +21 -0
  118. package/types/policies.ts +1 -0
  119. package/types/signers.ts +1 -0
  120. package/types/wallets.ts +1 -0
  121. package/types/webhooks.ts +1 -0
  122. package/utils/base64.ts +19 -0
  123. package/utils/fetch.ts +130 -0
  124. package/utils/index.ts +4 -0
  125. package/utils/nonce.ts +12 -0
  126. package/utils/url.ts +19 -0
  127. package/baseAuthApi.d.ts +0 -113
  128. package/baseAuthApi.js +0 -97
  129. package/codegen/Assets/AssetsClient.d.ts +0 -13
  130. package/codegen/Assets/AssetsClient.js +0 -93
  131. package/codegen/Assets/DelegatedAssetsClient.d.ts +0 -16
  132. package/codegen/Assets/DelegatedAssetsClient.js +0 -124
  133. package/codegen/Assets/index.d.ts +0 -3
  134. package/codegen/Assets/index.js +0 -19
  135. package/codegen/Assets/types.d.ts +0 -37
  136. package/codegen/Assets/types.js +0 -2
  137. package/codegen/Auth/AuthClient.d.ts +0 -50
  138. package/codegen/Auth/AuthClient.js +0 -518
  139. package/codegen/Auth/DelegatedAuthClient.d.ts +0 -78
  140. package/codegen/Auth/DelegatedAuthClient.js +0 -936
  141. package/codegen/Auth/index.d.ts +0 -3
  142. package/codegen/Auth/index.js +0 -19
  143. package/codegen/Auth/types.d.ts +0 -177
  144. package/codegen/Auth/types.js +0 -2
  145. package/codegen/Blockchains/BlockchainsClient.d.ts +0 -7
  146. package/codegen/Blockchains/BlockchainsClient.js +0 -23
  147. package/codegen/Blockchains/DelegatedBlockchainsClient.d.ts +0 -7
  148. package/codegen/Blockchains/DelegatedBlockchainsClient.js +0 -23
  149. package/codegen/Blockchains/index.d.ts +0 -3
  150. package/codegen/Blockchains/index.js +0 -19
  151. package/codegen/Blockchains/types.d.ts +0 -6
  152. package/codegen/Blockchains/types.js +0 -2
  153. package/codegen/Callbacks/CallbacksClient.d.ts +0 -12
  154. package/codegen/Callbacks/CallbacksClient.js +0 -78
  155. package/codegen/Callbacks/DelegatedCallbacksClient.d.ts +0 -15
  156. package/codegen/Callbacks/DelegatedCallbacksClient.js +0 -110
  157. package/codegen/Callbacks/index.d.ts +0 -3
  158. package/codegen/Callbacks/index.js +0 -19
  159. package/codegen/Callbacks/types.js +0 -2
  160. package/codegen/Permissions/DelegatedPermissionsClient.d.ts +0 -27
  161. package/codegen/Permissions/DelegatedPermissionsClient.js +0 -284
  162. package/codegen/Permissions/PermissionsClient.d.ts +0 -18
  163. package/codegen/Permissions/PermissionsClient.js +0 -156
  164. package/codegen/Permissions/index.d.ts +0 -3
  165. package/codegen/Permissions/index.js +0 -19
  166. package/codegen/Permissions/types.d.ts +0 -62
  167. package/codegen/Permissions/types.js +0 -2
  168. package/codegen/PolicyExecution/DelegatedPolicyExecutionClient.d.ts +0 -11
  169. package/codegen/PolicyExecution/DelegatedPolicyExecutionClient.js +0 -61
  170. package/codegen/PolicyExecution/PolicyExecutionClient.d.ts +0 -9
  171. package/codegen/PolicyExecution/PolicyExecutionClient.js +0 -45
  172. package/codegen/PolicyExecution/index.d.ts +0 -3
  173. package/codegen/PolicyExecution/index.js +0 -19
  174. package/codegen/PolicyExecution/types.d.ts +0 -18
  175. package/codegen/PolicyExecution/types.js +0 -2
  176. package/codegen/PolicyManagement/DelegatedPolicyManagementClient.d.ts +0 -25
  177. package/codegen/PolicyManagement/DelegatedPolicyManagementClient.js +0 -240
  178. package/codegen/PolicyManagement/PolicyManagementClient.d.ts +0 -18
  179. package/codegen/PolicyManagement/PolicyManagementClient.js +0 -146
  180. package/codegen/PolicyManagement/index.d.ts +0 -3
  181. package/codegen/PolicyManagement/index.js +0 -19
  182. package/codegen/PolicyManagement/types.js +0 -2
  183. package/codegen/PublicKeys/DelegatedPublicKeysClient.d.ts +0 -21
  184. package/codegen/PublicKeys/DelegatedPublicKeysClient.js +0 -189
  185. package/codegen/PublicKeys/PublicKeysClient.d.ts +0 -16
  186. package/codegen/PublicKeys/PublicKeysClient.js +0 -128
  187. package/codegen/PublicKeys/index.d.ts +0 -3
  188. package/codegen/PublicKeys/index.js +0 -19
  189. package/codegen/PublicKeys/types.d.ts +0 -51
  190. package/codegen/PublicKeys/types.js +0 -2
  191. package/codegen/Signers/DelegatedSignersClient.d.ts +0 -7
  192. package/codegen/Signers/DelegatedSignersClient.js +0 -22
  193. package/codegen/Signers/SignersClient.d.ts +0 -7
  194. package/codegen/Signers/SignersClient.js +0 -22
  195. package/codegen/Signers/index.d.ts +0 -3
  196. package/codegen/Signers/index.js +0 -19
  197. package/codegen/Signers/types.d.ts +0 -2
  198. package/codegen/Signers/types.js +0 -2
  199. package/codegen/Wallets/DelegatedWalletsClient.d.ts +0 -32
  200. package/codegen/Wallets/DelegatedWalletsClient.js +0 -325
  201. package/codegen/Wallets/WalletsClient.d.ts +0 -24
  202. package/codegen/Wallets/WalletsClient.js +0 -219
  203. package/codegen/Wallets/index.d.ts +0 -3
  204. package/codegen/Wallets/index.js +0 -19
  205. package/codegen/Wallets/types.d.ts +0 -101
  206. package/codegen/Wallets/types.js +0 -2
  207. package/codegen/datamodel/ApiKeys/errors.d.ts +0 -6
  208. package/codegen/datamodel/ApiKeys/errors.js +0 -15
  209. package/codegen/datamodel/ApiKeys/index.d.ts +0 -3
  210. package/codegen/datamodel/ApiKeys/index.js +0 -19
  211. package/codegen/datamodel/ApiKeys/responses.d.ts +0 -25
  212. package/codegen/datamodel/ApiKeys/responses.js +0 -2
  213. package/codegen/datamodel/ApiKeys/types.d.ts +0 -32
  214. package/codegen/datamodel/ApiKeys/types.js +0 -11
  215. package/codegen/datamodel/Assets/errors.d.ts +0 -11
  216. package/codegen/datamodel/Assets/errors.js +0 -17
  217. package/codegen/datamodel/Assets/index.d.ts +0 -3
  218. package/codegen/datamodel/Assets/index.js +0 -19
  219. package/codegen/datamodel/Assets/responses.d.ts +0 -47
  220. package/codegen/datamodel/Assets/responses.js +0 -2
  221. package/codegen/datamodel/Assets/types.d.ts +0 -225
  222. package/codegen/datamodel/Assets/types.js +0 -75
  223. package/codegen/datamodel/Auth/errors.js +0 -1
  224. package/codegen/datamodel/Auth/index.d.ts +0 -2
  225. package/codegen/datamodel/Auth/index.js +0 -18
  226. package/codegen/datamodel/Auth/responses.d.ts +0 -358
  227. package/codegen/datamodel/Auth/responses.js +0 -2
  228. package/codegen/datamodel/Auth/types.d.ts +0 -615
  229. package/codegen/datamodel/Auth/types.js +0 -127
  230. package/codegen/datamodel/BlockchainIndexing/errors.js +0 -1
  231. package/codegen/datamodel/BlockchainIndexing/index.d.ts +0 -1
  232. package/codegen/datamodel/BlockchainIndexing/index.js +0 -17
  233. package/codegen/datamodel/BlockchainIndexing/responses.js +0 -2
  234. package/codegen/datamodel/BlockchainIndexing/types.js +0 -1
  235. package/codegen/datamodel/Blockchains/errors.js +0 -1
  236. package/codegen/datamodel/Blockchains/index.d.ts +0 -2
  237. package/codegen/datamodel/Blockchains/index.js +0 -18
  238. package/codegen/datamodel/Blockchains/responses.d.ts +0 -12
  239. package/codegen/datamodel/Blockchains/responses.js +0 -2
  240. package/codegen/datamodel/Blockchains/types.d.ts +0 -270
  241. package/codegen/datamodel/Blockchains/types.js +0 -53
  242. package/codegen/datamodel/Callbacks/errors.js +0 -1
  243. package/codegen/datamodel/Callbacks/index.d.ts +0 -2
  244. package/codegen/datamodel/Callbacks/index.js +0 -18
  245. package/codegen/datamodel/Callbacks/responses.d.ts +0 -36
  246. package/codegen/datamodel/Callbacks/responses.js +0 -2
  247. package/codegen/datamodel/Callbacks/types.d.ts +0 -43
  248. package/codegen/datamodel/Callbacks/types.js +0 -39
  249. package/codegen/datamodel/Foundations/errors.d.ts +0 -131
  250. package/codegen/datamodel/Foundations/errors.js +0 -182
  251. package/codegen/datamodel/Foundations/index.d.ts +0 -2
  252. package/codegen/datamodel/Foundations/index.js +0 -18
  253. package/codegen/datamodel/Foundations/responses.js +0 -1
  254. package/codegen/datamodel/Foundations/types.d.ts +0 -9759
  255. package/codegen/datamodel/Foundations/types.js +0 -57755
  256. package/codegen/datamodel/Orgs/errors.js +0 -1
  257. package/codegen/datamodel/Orgs/index.d.ts +0 -2
  258. package/codegen/datamodel/Orgs/index.js +0 -18
  259. package/codegen/datamodel/Orgs/responses.d.ts +0 -45
  260. package/codegen/datamodel/Orgs/responses.js +0 -2
  261. package/codegen/datamodel/Orgs/types.d.ts +0 -240
  262. package/codegen/datamodel/Orgs/types.js +0 -39
  263. package/codegen/datamodel/Permissions/errors.js +0 -1
  264. package/codegen/datamodel/Permissions/index.d.ts +0 -2
  265. package/codegen/datamodel/Permissions/index.js +0 -18
  266. package/codegen/datamodel/Permissions/responses.d.ts +0 -75
  267. package/codegen/datamodel/Permissions/responses.js +0 -2
  268. package/codegen/datamodel/Permissions/types.d.ts +0 -93
  269. package/codegen/datamodel/Permissions/types.js +0 -43
  270. package/codegen/datamodel/PolicyExecution/errors.d.ts +0 -11
  271. package/codegen/datamodel/PolicyExecution/errors.js +0 -17
  272. package/codegen/datamodel/PolicyExecution/index.d.ts +0 -3
  273. package/codegen/datamodel/PolicyExecution/index.js +0 -19
  274. package/codegen/datamodel/PolicyExecution/responses.d.ts +0 -19
  275. package/codegen/datamodel/PolicyExecution/responses.js +0 -2
  276. package/codegen/datamodel/PolicyExecution/types.d.ts +0 -60
  277. package/codegen/datamodel/PolicyExecution/types.js +0 -17
  278. package/codegen/datamodel/PolicyManagement/errors.js +0 -1
  279. package/codegen/datamodel/PolicyManagement/index.d.ts +0 -2
  280. package/codegen/datamodel/PolicyManagement/index.js +0 -18
  281. package/codegen/datamodel/PolicyManagement/responses.d.ts +0 -83
  282. package/codegen/datamodel/PolicyManagement/responses.js +0 -2
  283. package/codegen/datamodel/PolicyManagement/types.d.ts +0 -391
  284. package/codegen/datamodel/PolicyManagement/types.js +0 -95
  285. package/codegen/datamodel/PublicKeys/errors.js +0 -1
  286. package/codegen/datamodel/PublicKeys/index.d.ts +0 -2
  287. package/codegen/datamodel/PublicKeys/index.js +0 -18
  288. package/codegen/datamodel/PublicKeys/responses.d.ts +0 -56
  289. package/codegen/datamodel/PublicKeys/responses.js +0 -2
  290. package/codegen/datamodel/PublicKeys/types.d.ts +0 -223
  291. package/codegen/datamodel/PublicKeys/types.js +0 -59
  292. package/codegen/datamodel/Signers/errors.js +0 -1
  293. package/codegen/datamodel/Signers/index.d.ts +0 -2
  294. package/codegen/datamodel/Signers/index.js +0 -18
  295. package/codegen/datamodel/Signers/responses.d.ts +0 -27
  296. package/codegen/datamodel/Signers/responses.js +0 -2
  297. package/codegen/datamodel/Signers/types.d.ts +0 -21
  298. package/codegen/datamodel/Signers/types.js +0 -2
  299. package/codegen/datamodel/Wallets/errors.js +0 -1
  300. package/codegen/datamodel/Wallets/index.d.ts +0 -2
  301. package/codegen/datamodel/Wallets/index.js +0 -18
  302. package/codegen/datamodel/Wallets/responses.d.ts +0 -92
  303. package/codegen/datamodel/Wallets/responses.js +0 -2
  304. package/codegen/datamodel/Wallets/types.d.ts +0 -677
  305. package/codegen/datamodel/Wallets/types.js +0 -251
  306. package/dfnsApiClient.d.ts +0 -39
  307. package/dfnsApiClient.js +0 -63
  308. package/dfnsAuthenticator.d.ts +0 -17
  309. package/dfnsAuthenticator.js +0 -29
  310. package/dfnsDelegatedApiClient.d.ts +0 -38
  311. package/dfnsDelegatedApiClient.js +0 -63
  312. package/dfnsError.d.ts +0 -5
  313. package/dfnsError.js +0 -11
  314. package/generated/policies/client.d.ts +0 -13
  315. package/generated/policies/client.js +0 -92
  316. package/generated/policies/delegatedClient.d.ts +0 -18
  317. package/generated/policies/delegatedClient.js +0 -153
  318. package/generated/policies/index.d.ts +0 -3
  319. package/generated/policies/index.js +0 -19
  320. package/generated/policies/types.js +0 -2
  321. package/generated/signers/client.d.ts +0 -7
  322. package/generated/signers/client.js +0 -22
  323. package/generated/signers/delegatedClient.d.ts +0 -7
  324. package/generated/signers/delegatedClient.js +0 -22
  325. package/generated/signers/index.d.ts +0 -3
  326. package/generated/signers/index.js +0 -19
  327. package/generated/signers/types.js +0 -2
  328. package/generated/wallets/client.d.ts +0 -25
  329. package/generated/wallets/client.js +0 -228
  330. package/generated/wallets/delegatedClient.d.ts +0 -34
  331. package/generated/wallets/delegatedClient.js +0 -349
  332. package/generated/wallets/index.d.ts +0 -3
  333. package/generated/wallets/index.js +0 -19
  334. package/generated/wallets/types.js +0 -2
  335. package/generated/webhooks/client.d.ts +0 -14
  336. package/generated/webhooks/client.js +0 -103
  337. package/generated/webhooks/delegatedClient.d.ts +0 -19
  338. package/generated/webhooks/delegatedClient.js +0 -164
  339. package/generated/webhooks/index.d.ts +0 -3
  340. package/generated/webhooks/index.js +0 -19
  341. package/generated/webhooks/types.js +0 -2
  342. package/index.d.ts +0 -7
  343. package/index.js +0 -23
  344. package/signer.d.ts +0 -52
  345. package/signer.js +0 -2
  346. package/store.d.ts +0 -79
  347. package/store.js +0 -2
  348. package/types/policies.d.ts +0 -1
  349. package/types/policies.js +0 -17
  350. package/types/signers.d.ts +0 -1
  351. package/types/signers.js +0 -17
  352. package/types/wallets.d.ts +0 -1
  353. package/types/wallets.js +0 -17
  354. package/types/webhooks.d.ts +0 -1
  355. package/types/webhooks.js +0 -17
  356. package/utils/base64.d.ts +0 -3
  357. package/utils/base64.js +0 -20
  358. package/utils/fetch.d.ts +0 -12
  359. package/utils/fetch.js +0 -94
  360. package/utils/index.d.ts +0 -4
  361. package/utils/index.js +0 -20
  362. package/utils/nonce.d.ts +0 -1
  363. package/utils/nonce.js +0 -12
  364. package/utils/url.d.ts +0 -4
  365. package/utils/url.js +0 -16
  366. /package/{codegen/datamodel/Auth/errors.d.ts → README.md} +0 -0
  367. /package/codegen/datamodel/{BlockchainIndexing/errors.d.ts → Auth/errors.ts} +0 -0
  368. /package/codegen/datamodel/BlockchainIndexing/{types.d.ts → errors.ts} +0 -0
  369. /package/codegen/datamodel/{Blockchains/errors.d.ts → BlockchainIndexing/types.ts} +0 -0
  370. /package/codegen/datamodel/{Callbacks/errors.d.ts → Blockchains/errors.ts} +0 -0
  371. /package/codegen/datamodel/{Foundations/responses.d.ts → Callbacks/errors.ts} +0 -0
  372. /package/codegen/datamodel/{Orgs/errors.d.ts → Foundations/responses.ts} +0 -0
  373. /package/codegen/datamodel/{Permissions/errors.d.ts → Orgs/errors.ts} +0 -0
  374. /package/codegen/datamodel/{PolicyManagement/errors.d.ts → Permissions/errors.ts} +0 -0
  375. /package/codegen/datamodel/{PublicKeys/errors.d.ts → PolicyManagement/errors.ts} +0 -0
  376. /package/codegen/datamodel/{Signers/errors.d.ts → PublicKeys/errors.ts} +0 -0
  377. /package/codegen/datamodel/{Wallets/errors.d.ts → Signers/errors.ts} +0 -0
@@ -0,0 +1,237 @@
1
+ import { BaseAuthApi, SignUserActionChallengeRequest, UserActionChallengeResponse } from '../../baseAuthApi'
2
+ import { DfnsDelegatedApiClientOptions } from '../../dfnsDelegatedApiClient'
3
+ import { simpleFetch } from '../../utils/fetch'
4
+ import { buildPathAndQuery } from '../../utils/url'
5
+ import * as T from './types'
6
+
7
+ export class DelegatedWebhooksClient {
8
+ constructor(private apiOptions: DfnsDelegatedApiClientOptions) {}
9
+
10
+ async createWebhookInit(request: T.CreateWebhookRequest): Promise<UserActionChallengeResponse> {
11
+ const path = buildPathAndQuery('/webhooks', {
12
+ path: request ?? {},
13
+ query: {},
14
+ })
15
+
16
+ const challenge = await BaseAuthApi.createUserActionChallenge(
17
+ {
18
+ userActionHttpMethod: 'POST',
19
+ userActionHttpPath: path,
20
+ userActionPayload: JSON.stringify(request.body),
21
+ userActionServerKind: 'Api',
22
+ },
23
+ this.apiOptions
24
+ )
25
+
26
+ return challenge
27
+ }
28
+
29
+ async createWebhookComplete(
30
+ request: T.CreateWebhookRequest,
31
+ signedChallenge: SignUserActionChallengeRequest
32
+ ): Promise<T.CreateWebhookResponse> {
33
+ const path = buildPathAndQuery('/webhooks', {
34
+ path: request ?? {},
35
+ query: {},
36
+ })
37
+
38
+ const { userAction } = await BaseAuthApi.signUserActionChallenge(
39
+ signedChallenge,
40
+ this.apiOptions
41
+ )
42
+
43
+ const response = await simpleFetch(path, {
44
+ method: 'POST',
45
+ body: request.body,
46
+ headers: { 'x-dfns-useraction': userAction },
47
+ apiOptions: this.apiOptions,
48
+ })
49
+
50
+ return response.json()
51
+ }
52
+
53
+ async deleteWebhookInit(request: T.DeleteWebhookRequest): Promise<UserActionChallengeResponse> {
54
+ const path = buildPathAndQuery('/webhooks/:webhookId', {
55
+ path: request ?? {},
56
+ query: {},
57
+ })
58
+
59
+ const challenge = await BaseAuthApi.createUserActionChallenge(
60
+ {
61
+ userActionHttpMethod: 'DELETE',
62
+ userActionHttpPath: path,
63
+ userActionPayload: JSON.stringify({}),
64
+ userActionServerKind: 'Api',
65
+ },
66
+ this.apiOptions
67
+ )
68
+
69
+ return challenge
70
+ }
71
+
72
+ async deleteWebhookComplete(
73
+ request: T.DeleteWebhookRequest,
74
+ signedChallenge: SignUserActionChallengeRequest
75
+ ): Promise<T.DeleteWebhookResponse> {
76
+ const path = buildPathAndQuery('/webhooks/:webhookId', {
77
+ path: request ?? {},
78
+ query: {},
79
+ })
80
+
81
+ const { userAction } = await BaseAuthApi.signUserActionChallenge(
82
+ signedChallenge,
83
+ this.apiOptions
84
+ )
85
+
86
+ const response = await simpleFetch(path, {
87
+ method: 'DELETE',
88
+ body: {},
89
+ headers: { 'x-dfns-useraction': userAction },
90
+ apiOptions: this.apiOptions,
91
+ })
92
+
93
+ return response.json()
94
+ }
95
+
96
+ async getWebhook(request: T.GetWebhookRequest): Promise<T.GetWebhookResponse> {
97
+ const path = buildPathAndQuery('/webhooks/:webhookId', {
98
+ path: request ?? {},
99
+ query: {},
100
+ })
101
+
102
+ const response = await simpleFetch(path, {
103
+ method: 'GET',
104
+ apiOptions: this.apiOptions,
105
+ })
106
+
107
+ return response.json()
108
+ }
109
+
110
+ async getWebhookEvent(request: T.GetWebhookEventRequest): Promise<T.GetWebhookEventResponse> {
111
+ const path = buildPathAndQuery('/webhooks/:webhookId/events/:webhookEventId', {
112
+ path: request ?? {},
113
+ query: {},
114
+ })
115
+
116
+ const response = await simpleFetch(path, {
117
+ method: 'GET',
118
+ apiOptions: this.apiOptions,
119
+ })
120
+
121
+ return response.json()
122
+ }
123
+
124
+ async listWebhookEvents(request: T.ListWebhookEventsRequest): Promise<T.ListWebhookEventsResponse> {
125
+ const path = buildPathAndQuery('/webhooks/:webhookId/events', {
126
+ path: request ?? {},
127
+ query: request.query ?? {},
128
+ })
129
+
130
+ const response = await simpleFetch(path, {
131
+ method: 'GET',
132
+ apiOptions: this.apiOptions,
133
+ })
134
+
135
+ return response.json()
136
+ }
137
+
138
+ async listWebhooks(request?: T.ListWebhooksRequest): Promise<T.ListWebhooksResponse> {
139
+ const path = buildPathAndQuery('/webhooks', {
140
+ path: request ?? {},
141
+ query: request?.query ?? {},
142
+ })
143
+
144
+ const response = await simpleFetch(path, {
145
+ method: 'GET',
146
+ apiOptions: this.apiOptions,
147
+ })
148
+
149
+ return response.json()
150
+ }
151
+
152
+ async pingWebhookInit(request: T.PingWebhookRequest): Promise<UserActionChallengeResponse> {
153
+ const path = buildPathAndQuery('/webhooks/:webhookId/ping', {
154
+ path: request ?? {},
155
+ query: {},
156
+ })
157
+
158
+ const challenge = await BaseAuthApi.createUserActionChallenge(
159
+ {
160
+ userActionHttpMethod: 'POST',
161
+ userActionHttpPath: path,
162
+ userActionPayload: JSON.stringify({}),
163
+ userActionServerKind: 'Api',
164
+ },
165
+ this.apiOptions
166
+ )
167
+
168
+ return challenge
169
+ }
170
+
171
+ async pingWebhookComplete(
172
+ request: T.PingWebhookRequest,
173
+ signedChallenge: SignUserActionChallengeRequest
174
+ ): Promise<T.PingWebhookResponse> {
175
+ const path = buildPathAndQuery('/webhooks/:webhookId/ping', {
176
+ path: request ?? {},
177
+ query: {},
178
+ })
179
+
180
+ const { userAction } = await BaseAuthApi.signUserActionChallenge(
181
+ signedChallenge,
182
+ this.apiOptions
183
+ )
184
+
185
+ const response = await simpleFetch(path, {
186
+ method: 'POST',
187
+ body: {},
188
+ headers: { 'x-dfns-useraction': userAction },
189
+ apiOptions: this.apiOptions,
190
+ })
191
+
192
+ return response.json()
193
+ }
194
+
195
+ async updateWebhookInit(request: T.UpdateWebhookRequest): Promise<UserActionChallengeResponse> {
196
+ const path = buildPathAndQuery('/webhooks/:webhookId', {
197
+ path: request ?? {},
198
+ query: {},
199
+ })
200
+
201
+ const challenge = await BaseAuthApi.createUserActionChallenge(
202
+ {
203
+ userActionHttpMethod: 'PUT',
204
+ userActionHttpPath: path,
205
+ userActionPayload: JSON.stringify(request.body),
206
+ userActionServerKind: 'Api',
207
+ },
208
+ this.apiOptions
209
+ )
210
+
211
+ return challenge
212
+ }
213
+
214
+ async updateWebhookComplete(
215
+ request: T.UpdateWebhookRequest,
216
+ signedChallenge: SignUserActionChallengeRequest
217
+ ): Promise<T.UpdateWebhookResponse> {
218
+ const path = buildPathAndQuery('/webhooks/:webhookId', {
219
+ path: request ?? {},
220
+ query: {},
221
+ })
222
+
223
+ const { userAction } = await BaseAuthApi.signUserActionChallenge(
224
+ signedChallenge,
225
+ this.apiOptions
226
+ )
227
+
228
+ const response = await simpleFetch(path, {
229
+ method: 'PUT',
230
+ body: request.body,
231
+ headers: { 'x-dfns-useraction': userAction },
232
+ apiOptions: this.apiOptions,
233
+ })
234
+
235
+ return response.json()
236
+ }
237
+ }
@@ -0,0 +1,3 @@
1
+ export * from './types'
2
+ export * from './client'
3
+ export * from './delegatedClient'
@@ -5,6 +5,7 @@ export type CreateWebhookBody = {
5
5
  description?: string | undefined;
6
6
  events: ("*" | "wallet.created" | "wallet.exported" | "wallet.delegated" | "wallet.signature.requested" | "wallet.signature.failed" | "wallet.signature.rejected" | "wallet.signature.signed" | "wallet.transaction.requested" | "wallet.transaction.failed" | "wallet.transaction.rejected" | "wallet.transaction.broadcasted" | "wallet.transaction.confirmed" | "wallet.transfer.requested" | "wallet.transfer.failed" | "wallet.transfer.rejected" | "wallet.transfer.broadcasted" | "wallet.transfer.confirmed" | "wallet.blockchainevent.detected")[];
7
7
  };
8
+
8
9
  export type CreateWebhookResponse = {
9
10
  /** Webhook ID */
10
11
  id: string;
@@ -23,19 +24,23 @@ export type CreateWebhookResponse = {
23
24
  /** The secret associated with this webhook, with which webhook requests will be signed. */
24
25
  secret: string;
25
26
  };
26
- export type CreateWebhookRequest = {
27
- body: CreateWebhookBody;
28
- };
27
+
28
+ export type CreateWebhookRequest = { body: CreateWebhookBody }
29
+
29
30
  export type DeleteWebhookParams = {
30
31
  webhookId: string;
31
32
  };
33
+
32
34
  export type DeleteWebhookResponse = {
33
35
  deleted: true;
34
36
  };
35
- export type DeleteWebhookRequest = DeleteWebhookParams;
37
+
38
+ export type DeleteWebhookRequest = DeleteWebhookParams
39
+
36
40
  export type GetWebhookParams = {
37
41
  webhookId: string;
38
42
  };
43
+
39
44
  export type GetWebhookResponse = {
40
45
  /** Webhook ID */
41
46
  id: string;
@@ -52,11 +57,14 @@ export type GetWebhookResponse = {
52
57
  /** Date when webhook was last updated */
53
58
  dateUpdated: string;
54
59
  };
55
- export type GetWebhookRequest = GetWebhookParams;
60
+
61
+ export type GetWebhookRequest = GetWebhookParams
62
+
56
63
  export type GetWebhookEventParams = {
57
64
  webhookId: string;
58
65
  webhookEventId: string;
59
66
  };
67
+
60
68
  export type GetWebhookEventResponse = {
61
69
  /** WebhookEvent ID */
62
70
  id: string;
@@ -74,15 +82,19 @@ export type GetWebhookEventResponse = {
74
82
  /** Unix timestamp when the event was forwarded to the webhook url by our servers. */
75
83
  timestampSent: number;
76
84
  };
77
- export type GetWebhookEventRequest = GetWebhookEventParams;
85
+
86
+ export type GetWebhookEventRequest = GetWebhookEventParams
87
+
78
88
  export type ListWebhookEventsParams = {
79
89
  webhookId: string;
80
90
  };
91
+
81
92
  export type ListWebhookEventsQuery = {
82
93
  kind?: ("*" | "wallet.created" | "wallet.exported" | "wallet.delegated" | "wallet.signature.requested" | "wallet.signature.failed" | "wallet.signature.rejected" | "wallet.signature.signed" | "wallet.transaction.requested" | "wallet.transaction.failed" | "wallet.transaction.rejected" | "wallet.transaction.broadcasted" | "wallet.transaction.confirmed" | "wallet.transfer.requested" | "wallet.transfer.failed" | "wallet.transfer.rejected" | "wallet.transfer.broadcasted" | "wallet.transfer.confirmed" | "wallet.blockchainevent.detected") | undefined;
83
94
  limit?: number | undefined;
84
95
  paginationToken?: string | undefined;
85
96
  };
97
+
86
98
  export type ListWebhookEventsResponse = {
87
99
  items: {
88
100
  /** WebhookEvent ID */
@@ -103,13 +115,14 @@ export type ListWebhookEventsResponse = {
103
115
  }[];
104
116
  nextPageToken?: string | undefined;
105
117
  };
106
- export type ListWebhookEventsRequest = ListWebhookEventsParams & {
107
- query?: ListWebhookEventsQuery;
108
- };
118
+
119
+ export type ListWebhookEventsRequest = ListWebhookEventsParams & { query?: ListWebhookEventsQuery }
120
+
109
121
  export type ListWebhooksQuery = {
110
122
  limit?: number | undefined;
111
123
  paginationToken?: string | undefined;
112
124
  };
125
+
113
126
  export type ListWebhooksResponse = {
114
127
  items: {
115
128
  /** Webhook ID */
@@ -129,17 +142,20 @@ export type ListWebhooksResponse = {
129
142
  }[];
130
143
  nextPageToken?: string | undefined;
131
144
  };
132
- export type ListWebhooksRequest = {
133
- query?: ListWebhooksQuery;
134
- };
145
+
146
+ export type ListWebhooksRequest = { query?: ListWebhooksQuery }
147
+
135
148
  export type PingWebhookParams = {
136
149
  webhookId: string;
137
150
  };
151
+
138
152
  export type PingWebhookResponse = {
139
153
  status: string;
140
154
  error?: string | undefined;
141
155
  };
142
- export type PingWebhookRequest = PingWebhookParams;
156
+
157
+ export type PingWebhookRequest = PingWebhookParams
158
+
143
159
  export type UpdateWebhookBody = {
144
160
  url?: string | undefined;
145
161
  description?: (string | undefined) | undefined;
@@ -147,9 +163,11 @@ export type UpdateWebhookBody = {
147
163
  /** Webhook status */
148
164
  status?: (("Enabled" | "Disabled") | undefined) | undefined;
149
165
  };
166
+
150
167
  export type UpdateWebhookParams = {
151
168
  webhookId: string;
152
169
  };
170
+
153
171
  export type UpdateWebhookResponse = {
154
172
  /** Webhook ID */
155
173
  id: string;
@@ -166,6 +184,6 @@ export type UpdateWebhookResponse = {
166
184
  /** Date when webhook was last updated */
167
185
  dateUpdated: string;
168
186
  };
169
- export type UpdateWebhookRequest = UpdateWebhookParams & {
170
- body: UpdateWebhookBody;
171
- };
187
+
188
+ export type UpdateWebhookRequest = UpdateWebhookParams & { body: UpdateWebhookBody }
189
+
package/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ export * from './baseAuthApi'
2
+ export * from './dfnsApiClient'
3
+ export * from './dfnsAuthenticator'
4
+ export * from './dfnsDelegatedApiClient'
5
+ export * from './dfnsError'
6
+ export * from './signer'
7
+ export * from './store'
package/package.json CHANGED
@@ -1,11 +1,4 @@
1
1
  {
2
2
  "name": "@dfns/sdk",
3
- "version": "0.2.2",
4
- "dependencies": {
5
- "buffer": "6.0.3",
6
- "cross-fetch": "3.1.6",
7
- "uuid": "9.0.0"
8
- },
9
- "main": "./index.js",
10
- "type": "commonjs"
3
+ "version": "0.2.3-rc.1"
11
4
  }
package/project.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "targets": {
3
+ "cb": {
4
+ "executor": "@nx/js:tsc",
5
+ "options": {
6
+ "outputPath": "dist/@dfns/sdk",
7
+ "clean": true,
8
+ "main": "packages/sdk/index.ts",
9
+ "tsConfig": "packages/sdk/tsconfig.json",
10
+ "updateBuildableProjectDepsInPackageJson": true
11
+ }
12
+ }
13
+ }
14
+ }
package/signer.ts ADDED
@@ -0,0 +1,60 @@
1
+ export type CredentialKind = 'Key' | 'Fido2' | 'Password' | 'Totp' | 'RecoveryKey'
2
+
3
+ export type CredentialTransport = 'usb' | 'nfc' | 'ble' | 'internal'
4
+
5
+ export type AllowCredential = {
6
+ type: 'public-key'
7
+ id: string
8
+ transports: CredentialTransport[]
9
+ }
10
+
11
+ export type KeyAssertion = {
12
+ kind: 'Key'
13
+ credentialAssertion: {
14
+ credId: string
15
+ clientData: string
16
+ signature: string
17
+ algorithm?: string
18
+ }
19
+ }
20
+
21
+ export type Fido2Assertion = {
22
+ kind: 'Fido2'
23
+ credentialAssertion: {
24
+ credId: string
25
+ clientData: string
26
+ authenticatorData: string
27
+ signature: string
28
+ userHandle: string
29
+ }
30
+ }
31
+
32
+ export type PasswordAssertion = {
33
+ kind: 'Password'
34
+ password: string
35
+ }
36
+
37
+ export type TotpAssertion = {
38
+ kind: 'Totp'
39
+ otpCode: string
40
+ }
41
+
42
+ export type RecoveryKeyAssertion = {
43
+ kind: 'RecoveryKey'
44
+ credentialAssertion: {
45
+ credId: string
46
+ clientData: string
47
+ signature: string
48
+ algorithm?: string
49
+ }
50
+ }
51
+
52
+ export type FirstFactorAssertion = KeyAssertion | Fido2Assertion | PasswordAssertion
53
+
54
+ export type SecondFactorAssertion = KeyAssertion | Fido2Assertion | TotpAssertion
55
+
56
+ export type CredentialAssertion = KeyAssertion | Fido2Assertion | PasswordAssertion | TotpAssertion
57
+
58
+ export interface CredentialSigner<T extends CredentialAssertion = FirstFactorAssertion> {
59
+ sign(challenge: string, allowCredentials: { key: AllowCredential[]; webauthn: AllowCredential[] }): Promise<T>
60
+ }
package/store.ts ADDED
@@ -0,0 +1,99 @@
1
+ import { AllowCredential, CredentialKind } from './signer'
2
+
3
+ export type AuthenticatorAttachment = 'platform' | 'cross-platform'
4
+
5
+ export type ResidentKeyRequirement = 'required' | 'preferred' | 'discouraged'
6
+
7
+ export type UserVerificationRequirement = 'required' | 'preferred' | 'discouraged'
8
+
9
+ export type AttestationConveyancePreference = 'none' | 'indirect' | 'direct' | 'enterprise'
10
+
11
+ export type UserRegistrationChallenge = {
12
+ temporaryAuthenticationToken: string
13
+ rp: {
14
+ id: string
15
+ name: string
16
+ }
17
+ user: {
18
+ id: string
19
+ name: string
20
+ displayName: string
21
+ }
22
+ supportedCredentialKinds: {
23
+ firstFactor: CredentialKind[]
24
+ secondFactor: CredentialKind[]
25
+ }
26
+ otpUrl: string
27
+ challenge: string
28
+ authenticatorSelection: {
29
+ authenticatorAttachment?: AuthenticatorAttachment
30
+ requireResidentKey: boolean
31
+ residentKey: ResidentKeyRequirement
32
+ userVerification: UserVerificationRequirement
33
+ }
34
+ attestation: AttestationConveyancePreference
35
+ pubKeyCredParams: {
36
+ type: 'public-key'
37
+ alg: number
38
+ }[]
39
+ excludeCredentials: AllowCredential[]
40
+ }
41
+
42
+ export type KeyAttestation = {
43
+ credentialKind: 'Key'
44
+ credentialInfo: {
45
+ credId: string
46
+ clientData: string
47
+ attestationData: string
48
+ }
49
+ }
50
+
51
+ export type Fido2Attestation = {
52
+ credentialKind: 'Fido2'
53
+ credentialInfo: {
54
+ credId: string
55
+ clientData: string
56
+ attestationData: string
57
+ }
58
+ }
59
+
60
+ export type PasswordAttestation = {
61
+ credentialKind: 'Password'
62
+ credentialInfo: {
63
+ password: string
64
+ }
65
+ }
66
+
67
+ export type TotpAttestation = {
68
+ credentialKind: 'Totp'
69
+ credentialInfo: {
70
+ otpCode: string
71
+ }
72
+ }
73
+
74
+ export type FirstFactorAttestation = KeyAttestation | Fido2Attestation | PasswordAttestation
75
+
76
+ export type SecondFactorAttestation = KeyAttestation | Fido2Attestation | TotpAttestation
77
+
78
+ export type RecoveryKeyAttestation = {
79
+ credentialKind: 'RecoveryKey'
80
+ credentialInfo: {
81
+ credId: string
82
+ clientData: string
83
+ attestationData: string
84
+ }
85
+ encryptedPrivateKey?: string
86
+ }
87
+
88
+ export type RecoveryFactorAttestation = RecoveryKeyAttestation
89
+
90
+ export type CredentialAttestation =
91
+ | KeyAttestation
92
+ | Fido2Attestation
93
+ | PasswordAttestation
94
+ | TotpAttestation
95
+ | RecoveryKeyAttestation
96
+
97
+ export interface CredentialStore<T extends CredentialAttestation = FirstFactorAttestation> {
98
+ create(challenge: UserRegistrationChallenge): Promise<T>
99
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "include": ["*.ts", "**/*.ts"],
4
+ "compilerOptions": {
5
+ "baseUrl": "./"
6
+ }
7
+ }
package/typedoc.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://typedoc.org/schema.json",
3
+ "includeVersion": true,
4
+ "readme": "./README.md",
5
+ "entryPoints": [
6
+ "./index.ts",
7
+ "./generated/signers/index.ts",
8
+ "./generated/wallets/index.ts",
9
+ "./generated/webhooks/index.ts",
10
+ "./types/signers.ts",
11
+ "./types/wallets.ts",
12
+ "./types/webhooks.ts",
13
+ "./utils/index.ts",
14
+ "./codegen/Auth/index.ts",
15
+ "./codegen/Permissions/index.ts",
16
+ "./codegen/datamodel/Auth/index.ts",
17
+ "./codegen/datamodel/Foundations/index.ts",
18
+ "./codegen/datamodel/Orgs/index.ts",
19
+ "./codegen/datamodel/Permissions/index.ts"
20
+ ]
21
+ }
@@ -0,0 +1 @@
1
+ export * from '../generated/policies/types'
@@ -0,0 +1 @@
1
+ export * from '../generated/signers/types'
@@ -0,0 +1 @@
1
+ export * from '../generated/wallets/types'
@@ -0,0 +1 @@
1
+ export * from '../generated/webhooks/types'
@@ -0,0 +1,19 @@
1
+ import { Buffer } from 'buffer'
2
+
3
+ export const toBase64Url = (buffer: string | Buffer): string => {
4
+ if (typeof buffer === 'string') {
5
+ buffer = Buffer.from(buffer)
6
+ }
7
+
8
+ return buffer.toString('base64').replace(/=/g, '').replace(/\+/g, '-').replace(/\//g, '_')
9
+ }
10
+
11
+ export const fromBase64Url = (encoded: string): Buffer => {
12
+ const padLength = 4 - (encoded.length % 4)
13
+ if (padLength < 4) {
14
+ encoded += '='.repeat(padLength)
15
+ }
16
+
17
+ encoded = encoded.replace(/\-/g, '+').replace(/_/g, '/')
18
+ return Buffer.from(encoded, 'base64')
19
+ }