tenzro-wallet 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 (471) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +128 -0
  3. package/dist/balance/aggregator.d.ts +16 -0
  4. package/dist/balance/aggregator.d.ts.map +1 -0
  5. package/dist/balance/aggregator.js +73 -0
  6. package/dist/balance/aggregator.js.map +1 -0
  7. package/dist/balance/index.d.ts +3 -0
  8. package/dist/balance/index.d.ts.map +1 -0
  9. package/dist/balance/index.js +2 -0
  10. package/dist/balance/index.js.map +1 -0
  11. package/dist/consent/index.d.ts +3 -0
  12. package/dist/consent/index.d.ts.map +1 -0
  13. package/dist/consent/index.js +2 -0
  14. package/dist/consent/index.js.map +1 -0
  15. package/dist/consent/policy.d.ts +27 -0
  16. package/dist/consent/policy.d.ts.map +1 -0
  17. package/dist/consent/policy.js +121 -0
  18. package/dist/consent/policy.js.map +1 -0
  19. package/dist/crypto/eip1559.d.ts +53 -0
  20. package/dist/crypto/eip1559.d.ts.map +1 -0
  21. package/dist/crypto/eip1559.js +79 -0
  22. package/dist/crypto/eip1559.js.map +1 -0
  23. package/dist/crypto/keccak256.d.ts +20 -0
  24. package/dist/crypto/keccak256.d.ts.map +1 -0
  25. package/dist/crypto/keccak256.js +167 -0
  26. package/dist/crypto/keccak256.js.map +1 -0
  27. package/dist/crypto/rlp.d.ts +30 -0
  28. package/dist/crypto/rlp.d.ts.map +1 -0
  29. package/dist/crypto/rlp.js +165 -0
  30. package/dist/crypto/rlp.js.map +1 -0
  31. package/dist/crypto/sha256.d.ts +14 -0
  32. package/dist/crypto/sha256.d.ts.map +1 -0
  33. package/dist/crypto/sha256.js +33 -0
  34. package/dist/crypto/sha256.js.map +1 -0
  35. package/dist/crypto/solana.d.ts +86 -0
  36. package/dist/crypto/solana.d.ts.map +1 -0
  37. package/dist/crypto/solana.js +218 -0
  38. package/dist/crypto/solana.js.map +1 -0
  39. package/dist/custody/frost/backend.d.ts +59 -0
  40. package/dist/custody/frost/backend.d.ts.map +1 -0
  41. package/dist/custody/frost/backend.js +83 -0
  42. package/dist/custody/frost/backend.js.map +1 -0
  43. package/dist/custody/frost/coordinator.d.ts +148 -0
  44. package/dist/custody/frost/coordinator.d.ts.map +1 -0
  45. package/dist/custody/frost/coordinator.js +58 -0
  46. package/dist/custody/frost/coordinator.js.map +1 -0
  47. package/dist/custody/frost/ed25519-driver.d.ts +30 -0
  48. package/dist/custody/frost/ed25519-driver.d.ts.map +1 -0
  49. package/dist/custody/frost/ed25519-driver.js +76 -0
  50. package/dist/custody/frost/ed25519-driver.js.map +1 -0
  51. package/dist/custody/frost/http-adapter.d.ts +77 -0
  52. package/dist/custody/frost/http-adapter.d.ts.map +1 -0
  53. package/dist/custody/frost/http-adapter.js +168 -0
  54. package/dist/custody/frost/http-adapter.js.map +1 -0
  55. package/dist/custody/frost/hybrid-driver.d.ts +37 -0
  56. package/dist/custody/frost/hybrid-driver.d.ts.map +1 -0
  57. package/dist/custody/frost/hybrid-driver.js +60 -0
  58. package/dist/custody/frost/hybrid-driver.js.map +1 -0
  59. package/dist/custody/frost/index.d.ts +12 -0
  60. package/dist/custody/frost/index.d.ts.map +1 -0
  61. package/dist/custody/frost/index.js +6 -0
  62. package/dist/custody/frost/index.js.map +1 -0
  63. package/dist/custody/frost/secp256k1-driver.d.ts +26 -0
  64. package/dist/custody/frost/secp256k1-driver.d.ts.map +1 -0
  65. package/dist/custody/frost/secp256k1-driver.js +78 -0
  66. package/dist/custody/frost/secp256k1-driver.js.map +1 -0
  67. package/dist/custody/index.d.ts +9 -0
  68. package/dist/custody/index.d.ts.map +1 -0
  69. package/dist/custody/index.js +11 -0
  70. package/dist/custody/index.js.map +1 -0
  71. package/dist/custody/internal-mpc.d.ts +14 -0
  72. package/dist/custody/internal-mpc.d.ts.map +1 -0
  73. package/dist/custody/internal-mpc.js +40 -0
  74. package/dist/custody/internal-mpc.js.map +1 -0
  75. package/dist/custody/mldsa/coordinator.d.ts +63 -0
  76. package/dist/custody/mldsa/coordinator.d.ts.map +1 -0
  77. package/dist/custody/mldsa/coordinator.js +44 -0
  78. package/dist/custody/mldsa/coordinator.js.map +1 -0
  79. package/dist/custody/mldsa/driver.d.ts +23 -0
  80. package/dist/custody/mldsa/driver.d.ts.map +1 -0
  81. package/dist/custody/mldsa/driver.js +43 -0
  82. package/dist/custody/mldsa/driver.js.map +1 -0
  83. package/dist/custody/mldsa/http-adapter.d.ts +59 -0
  84. package/dist/custody/mldsa/http-adapter.d.ts.map +1 -0
  85. package/dist/custody/mldsa/http-adapter.js +103 -0
  86. package/dist/custody/mldsa/http-adapter.js.map +1 -0
  87. package/dist/custody/mldsa/index.d.ts +7 -0
  88. package/dist/custody/mldsa/index.d.ts.map +1 -0
  89. package/dist/custody/mldsa/index.js +4 -0
  90. package/dist/custody/mldsa/index.js.map +1 -0
  91. package/dist/custody/pairing/http-adapter.d.ts +40 -0
  92. package/dist/custody/pairing/http-adapter.d.ts.map +1 -0
  93. package/dist/custody/pairing/http-adapter.js +113 -0
  94. package/dist/custody/pairing/http-adapter.js.map +1 -0
  95. package/dist/custody/pairing/index.d.ts +10 -0
  96. package/dist/custody/pairing/index.d.ts.map +1 -0
  97. package/dist/custody/pairing/index.js +8 -0
  98. package/dist/custody/pairing/index.js.map +1 -0
  99. package/dist/custody/pairing/port.d.ts +121 -0
  100. package/dist/custody/pairing/port.d.ts.map +1 -0
  101. package/dist/custody/pairing/port.js +40 -0
  102. package/dist/custody/pairing/port.js.map +1 -0
  103. package/dist/custody/passkey-share/http-adapter.d.ts +77 -0
  104. package/dist/custody/passkey-share/http-adapter.d.ts.map +1 -0
  105. package/dist/custody/passkey-share/http-adapter.js +125 -0
  106. package/dist/custody/passkey-share/http-adapter.js.map +1 -0
  107. package/dist/custody/passkey-share/index.d.ts +7 -0
  108. package/dist/custody/passkey-share/index.d.ts.map +1 -0
  109. package/dist/custody/passkey-share/index.js +4 -0
  110. package/dist/custody/passkey-share/index.js.map +1 -0
  111. package/dist/custody/passkey-share/unwrapper.d.ts +174 -0
  112. package/dist/custody/passkey-share/unwrapper.d.ts.map +1 -0
  113. package/dist/custody/passkey-share/unwrapper.js +132 -0
  114. package/dist/custody/passkey-share/unwrapper.js.map +1 -0
  115. package/dist/custody/passkey-share/webauthn-adapter.d.ts +112 -0
  116. package/dist/custody/passkey-share/webauthn-adapter.d.ts.map +1 -0
  117. package/dist/custody/passkey-share/webauthn-adapter.js +150 -0
  118. package/dist/custody/passkey-share/webauthn-adapter.js.map +1 -0
  119. package/dist/custody/surface-key-id.d.ts +15 -0
  120. package/dist/custody/surface-key-id.d.ts.map +1 -0
  121. package/dist/custody/surface-key-id.js +25 -0
  122. package/dist/custody/surface-key-id.js.map +1 -0
  123. package/dist/dapp/eip6963.d.ts +64 -0
  124. package/dist/dapp/eip6963.d.ts.map +1 -0
  125. package/dist/dapp/eip6963.js +55 -0
  126. package/dist/dapp/eip6963.js.map +1 -0
  127. package/dist/dapp/index.d.ts +21 -0
  128. package/dist/dapp/index.d.ts.map +1 -0
  129. package/dist/dapp/index.js +24 -0
  130. package/dist/dapp/index.js.map +1 -0
  131. package/dist/identity/delegate-set.d.ts +57 -0
  132. package/dist/identity/delegate-set.d.ts.map +1 -0
  133. package/dist/identity/delegate-set.js +85 -0
  134. package/dist/identity/delegate-set.js.map +1 -0
  135. package/dist/identity/did.d.ts +17 -0
  136. package/dist/identity/did.d.ts.map +1 -0
  137. package/dist/identity/did.js +60 -0
  138. package/dist/identity/did.js.map +1 -0
  139. package/dist/identity/index.d.ts +14 -0
  140. package/dist/identity/index.d.ts.map +1 -0
  141. package/dist/identity/index.js +8 -0
  142. package/dist/identity/index.js.map +1 -0
  143. package/dist/identity/provision.d.ts +13 -0
  144. package/dist/identity/provision.d.ts.map +1 -0
  145. package/dist/identity/provision.js +151 -0
  146. package/dist/identity/provision.js.map +1 -0
  147. package/dist/identity/provisioning-http-adapter.d.ts +81 -0
  148. package/dist/identity/provisioning-http-adapter.d.ts.map +1 -0
  149. package/dist/identity/provisioning-http-adapter.js +114 -0
  150. package/dist/identity/provisioning-http-adapter.js.map +1 -0
  151. package/dist/identity/recovery-http-adapter.d.ts +83 -0
  152. package/dist/identity/recovery-http-adapter.d.ts.map +1 -0
  153. package/dist/identity/recovery-http-adapter.js +139 -0
  154. package/dist/identity/recovery-http-adapter.js.map +1 -0
  155. package/dist/identity/wallet-new.d.ts +132 -0
  156. package/dist/identity/wallet-new.d.ts.map +1 -0
  157. package/dist/identity/wallet-new.js +94 -0
  158. package/dist/identity/wallet-new.js.map +1 -0
  159. package/dist/identity/wallet-recover.d.ts +116 -0
  160. package/dist/identity/wallet-recover.d.ts.map +1 -0
  161. package/dist/identity/wallet-recover.js +95 -0
  162. package/dist/identity/wallet-recover.js.map +1 -0
  163. package/dist/index.d.ts +12 -0
  164. package/dist/index.d.ts.map +1 -0
  165. package/dist/index.js +11 -0
  166. package/dist/index.js.map +1 -0
  167. package/dist/kernel.d.ts +119 -0
  168. package/dist/kernel.d.ts.map +1 -0
  169. package/dist/kernel.js +144 -0
  170. package/dist/kernel.js.map +1 -0
  171. package/dist/ports/adapters/tenzro-identity-adapter.d.ts +44 -0
  172. package/dist/ports/adapters/tenzro-identity-adapter.d.ts.map +1 -0
  173. package/dist/ports/adapters/tenzro-identity-adapter.js +60 -0
  174. package/dist/ports/adapters/tenzro-identity-adapter.js.map +1 -0
  175. package/dist/ports/adapters/tenzro-sdk-adapter.d.ts +86 -0
  176. package/dist/ports/adapters/tenzro-sdk-adapter.d.ts.map +1 -0
  177. package/dist/ports/adapters/tenzro-sdk-adapter.js +100 -0
  178. package/dist/ports/adapters/tenzro-sdk-adapter.js.map +1 -0
  179. package/dist/ports/agent/acp.d.ts +66 -0
  180. package/dist/ports/agent/acp.d.ts.map +1 -0
  181. package/dist/ports/agent/acp.js +27 -0
  182. package/dist/ports/agent/acp.js.map +1 -0
  183. package/dist/ports/agent/adapters/acp-adapter.d.ts +67 -0
  184. package/dist/ports/agent/adapters/acp-adapter.d.ts.map +1 -0
  185. package/dist/ports/agent/adapters/acp-adapter.js +70 -0
  186. package/dist/ports/agent/adapters/acp-adapter.js.map +1 -0
  187. package/dist/ports/agent/adapters/agent-bond-adapter.d.ts +31 -0
  188. package/dist/ports/agent/adapters/agent-bond-adapter.d.ts.map +1 -0
  189. package/dist/ports/agent/adapters/agent-bond-adapter.js +82 -0
  190. package/dist/ports/agent/adapters/agent-bond-adapter.js.map +1 -0
  191. package/dist/ports/agent/adapters/agent-payment-adapter.d.ts +66 -0
  192. package/dist/ports/agent/adapters/agent-payment-adapter.d.ts.map +1 -0
  193. package/dist/ports/agent/adapters/agent-payment-adapter.js +75 -0
  194. package/dist/ports/agent/adapters/agent-payment-adapter.js.map +1 -0
  195. package/dist/ports/agent/adapters/ap2-adapter.d.ts +28 -0
  196. package/dist/ports/agent/adapters/ap2-adapter.d.ts.map +1 -0
  197. package/dist/ports/agent/adapters/ap2-adapter.js +97 -0
  198. package/dist/ports/agent/adapters/ap2-adapter.js.map +1 -0
  199. package/dist/ports/agent/adapters/auth-approval-adapter.d.ts +26 -0
  200. package/dist/ports/agent/adapters/auth-approval-adapter.d.ts.map +1 -0
  201. package/dist/ports/agent/adapters/auth-approval-adapter.js +37 -0
  202. package/dist/ports/agent/adapters/auth-approval-adapter.js.map +1 -0
  203. package/dist/ports/agent/adapters/erc7802-adapter.d.ts +30 -0
  204. package/dist/ports/agent/adapters/erc7802-adapter.d.ts.map +1 -0
  205. package/dist/ports/agent/adapters/erc7802-adapter.js +60 -0
  206. package/dist/ports/agent/adapters/erc7802-adapter.js.map +1 -0
  207. package/dist/ports/agent/adapters/erc8004-adapter.d.ts +54 -0
  208. package/dist/ports/agent/adapters/erc8004-adapter.d.ts.map +1 -0
  209. package/dist/ports/agent/adapters/erc8004-adapter.js +53 -0
  210. package/dist/ports/agent/adapters/erc8004-adapter.js.map +1 -0
  211. package/dist/ports/agent/adapters/escrow-adapter.d.ts +33 -0
  212. package/dist/ports/agent/adapters/escrow-adapter.d.ts.map +1 -0
  213. package/dist/ports/agent/adapters/escrow-adapter.js +109 -0
  214. package/dist/ports/agent/adapters/escrow-adapter.js.map +1 -0
  215. package/dist/ports/agent/adapters/fee-estimator-adapter.d.ts +31 -0
  216. package/dist/ports/agent/adapters/fee-estimator-adapter.d.ts.map +1 -0
  217. package/dist/ports/agent/adapters/fee-estimator-adapter.js +103 -0
  218. package/dist/ports/agent/adapters/fee-estimator-adapter.js.map +1 -0
  219. package/dist/ports/agent/adapters/htlc-escrow-adapter.d.ts +68 -0
  220. package/dist/ports/agent/adapters/htlc-escrow-adapter.d.ts.map +1 -0
  221. package/dist/ports/agent/adapters/htlc-escrow-adapter.js +131 -0
  222. package/dist/ports/agent/adapters/htlc-escrow-adapter.js.map +1 -0
  223. package/dist/ports/agent/adapters/insurance-adapter.d.ts +32 -0
  224. package/dist/ports/agent/adapters/insurance-adapter.d.ts.map +1 -0
  225. package/dist/ports/agent/adapters/insurance-adapter.js +103 -0
  226. package/dist/ports/agent/adapters/insurance-adapter.js.map +1 -0
  227. package/dist/ports/agent/adapters/lifecycle-adapter.d.ts +26 -0
  228. package/dist/ports/agent/adapters/lifecycle-adapter.d.ts.map +1 -0
  229. package/dist/ports/agent/adapters/lifecycle-adapter.js +136 -0
  230. package/dist/ports/agent/adapters/lifecycle-adapter.js.map +1 -0
  231. package/dist/ports/agent/adapters/nanopayment-adapter.d.ts +62 -0
  232. package/dist/ports/agent/adapters/nanopayment-adapter.d.ts.map +1 -0
  233. package/dist/ports/agent/adapters/nanopayment-adapter.js +76 -0
  234. package/dist/ports/agent/adapters/nanopayment-adapter.js.map +1 -0
  235. package/dist/ports/agent/adapters/payment-rails-adapter.d.ts +67 -0
  236. package/dist/ports/agent/adapters/payment-rails-adapter.d.ts.map +1 -0
  237. package/dist/ports/agent/adapters/payment-rails-adapter.js +108 -0
  238. package/dist/ports/agent/adapters/payment-rails-adapter.js.map +1 -0
  239. package/dist/ports/agent/adapters/principal-chain-adapter.d.ts +23 -0
  240. package/dist/ports/agent/adapters/principal-chain-adapter.d.ts.map +1 -0
  241. package/dist/ports/agent/adapters/principal-chain-adapter.js +156 -0
  242. package/dist/ports/agent/adapters/principal-chain-adapter.js.map +1 -0
  243. package/dist/ports/agent/adapters/session-key-adapter.d.ts +45 -0
  244. package/dist/ports/agent/adapters/session-key-adapter.d.ts.map +1 -0
  245. package/dist/ports/agent/adapters/session-key-adapter.js +80 -0
  246. package/dist/ports/agent/adapters/session-key-adapter.js.map +1 -0
  247. package/dist/ports/agent/adapters/tee-attestation-adapter.d.ts +32 -0
  248. package/dist/ports/agent/adapters/tee-attestation-adapter.d.ts.map +1 -0
  249. package/dist/ports/agent/adapters/tee-attestation-adapter.js +38 -0
  250. package/dist/ports/agent/adapters/tee-attestation-adapter.js.map +1 -0
  251. package/dist/ports/agent/agent-bond.d.ts +80 -0
  252. package/dist/ports/agent/agent-bond.d.ts.map +1 -0
  253. package/dist/ports/agent/agent-bond.js +23 -0
  254. package/dist/ports/agent/agent-bond.js.map +1 -0
  255. package/dist/ports/agent/agent-payment.d.ts +72 -0
  256. package/dist/ports/agent/agent-payment.d.ts.map +1 -0
  257. package/dist/ports/agent/agent-payment.js +17 -0
  258. package/dist/ports/agent/agent-payment.js.map +1 -0
  259. package/dist/ports/agent/ap2.d.ts +104 -0
  260. package/dist/ports/agent/ap2.d.ts.map +1 -0
  261. package/dist/ports/agent/ap2.js +22 -0
  262. package/dist/ports/agent/ap2.js.map +1 -0
  263. package/dist/ports/agent/auth-approval.d.ts +40 -0
  264. package/dist/ports/agent/auth-approval.d.ts.map +1 -0
  265. package/dist/ports/agent/auth-approval.js +23 -0
  266. package/dist/ports/agent/auth-approval.js.map +1 -0
  267. package/dist/ports/agent/erc7802.d.ts +94 -0
  268. package/dist/ports/agent/erc7802.d.ts.map +1 -0
  269. package/dist/ports/agent/erc7802.js +30 -0
  270. package/dist/ports/agent/erc7802.js.map +1 -0
  271. package/dist/ports/agent/erc8004.d.ts +57 -0
  272. package/dist/ports/agent/erc8004.d.ts.map +1 -0
  273. package/dist/ports/agent/erc8004.js +20 -0
  274. package/dist/ports/agent/erc8004.js.map +1 -0
  275. package/dist/ports/agent/escrow.d.ts +74 -0
  276. package/dist/ports/agent/escrow.d.ts.map +1 -0
  277. package/dist/ports/agent/escrow.js +18 -0
  278. package/dist/ports/agent/escrow.js.map +1 -0
  279. package/dist/ports/agent/fee-estimator.d.ts +71 -0
  280. package/dist/ports/agent/fee-estimator.d.ts.map +1 -0
  281. package/dist/ports/agent/fee-estimator.js +21 -0
  282. package/dist/ports/agent/fee-estimator.js.map +1 -0
  283. package/dist/ports/agent/htlc-escrow.d.ts +94 -0
  284. package/dist/ports/agent/htlc-escrow.d.ts.map +1 -0
  285. package/dist/ports/agent/htlc-escrow.js +25 -0
  286. package/dist/ports/agent/htlc-escrow.js.map +1 -0
  287. package/dist/ports/agent/index.d.ts +58 -0
  288. package/dist/ports/agent/index.d.ts.map +1 -0
  289. package/dist/ports/agent/index.js +24 -0
  290. package/dist/ports/agent/index.js.map +1 -0
  291. package/dist/ports/agent/insurance.d.ts +65 -0
  292. package/dist/ports/agent/insurance.d.ts.map +1 -0
  293. package/dist/ports/agent/insurance.js +18 -0
  294. package/dist/ports/agent/insurance.js.map +1 -0
  295. package/dist/ports/agent/lifecycle.d.ts +69 -0
  296. package/dist/ports/agent/lifecycle.d.ts.map +1 -0
  297. package/dist/ports/agent/lifecycle.js +17 -0
  298. package/dist/ports/agent/lifecycle.js.map +1 -0
  299. package/dist/ports/agent/nanopayment.d.ts +72 -0
  300. package/dist/ports/agent/nanopayment.d.ts.map +1 -0
  301. package/dist/ports/agent/nanopayment.js +16 -0
  302. package/dist/ports/agent/nanopayment.js.map +1 -0
  303. package/dist/ports/agent/payment-rails.d.ts +140 -0
  304. package/dist/ports/agent/payment-rails.d.ts.map +1 -0
  305. package/dist/ports/agent/payment-rails.js +25 -0
  306. package/dist/ports/agent/payment-rails.js.map +1 -0
  307. package/dist/ports/agent/principal-chain.d.ts +95 -0
  308. package/dist/ports/agent/principal-chain.d.ts.map +1 -0
  309. package/dist/ports/agent/principal-chain.js +16 -0
  310. package/dist/ports/agent/principal-chain.js.map +1 -0
  311. package/dist/ports/agent/session-key.d.ts +94 -0
  312. package/dist/ports/agent/session-key.d.ts.map +1 -0
  313. package/dist/ports/agent/session-key.js +31 -0
  314. package/dist/ports/agent/session-key.js.map +1 -0
  315. package/dist/ports/agent/tee-attestation.d.ts +51 -0
  316. package/dist/ports/agent/tee-attestation.d.ts.map +1 -0
  317. package/dist/ports/agent/tee-attestation.js +28 -0
  318. package/dist/ports/agent/tee-attestation.js.map +1 -0
  319. package/dist/ports/bridge/adapters/bridge-adapter-base.d.ts +47 -0
  320. package/dist/ports/bridge/adapters/bridge-adapter-base.d.ts.map +1 -0
  321. package/dist/ports/bridge/adapters/bridge-adapter-base.js +144 -0
  322. package/dist/ports/bridge/adapters/bridge-adapter-base.js.map +1 -0
  323. package/dist/ports/bridge/adapters/canton-bridge-adapter.d.ts +30 -0
  324. package/dist/ports/bridge/adapters/canton-bridge-adapter.d.ts.map +1 -0
  325. package/dist/ports/bridge/adapters/canton-bridge-adapter.js +31 -0
  326. package/dist/ports/bridge/adapters/canton-bridge-adapter.js.map +1 -0
  327. package/dist/ports/bridge/adapters/ccip-adapter.d.ts +30 -0
  328. package/dist/ports/bridge/adapters/ccip-adapter.d.ts.map +1 -0
  329. package/dist/ports/bridge/adapters/ccip-adapter.js +31 -0
  330. package/dist/ports/bridge/adapters/ccip-adapter.js.map +1 -0
  331. package/dist/ports/bridge/adapters/debridge-adapter.d.ts +27 -0
  332. package/dist/ports/bridge/adapters/debridge-adapter.d.ts.map +1 -0
  333. package/dist/ports/bridge/adapters/debridge-adapter.js +28 -0
  334. package/dist/ports/bridge/adapters/debridge-adapter.js.map +1 -0
  335. package/dist/ports/bridge/adapters/layerzero-adapter.d.ts +30 -0
  336. package/dist/ports/bridge/adapters/layerzero-adapter.d.ts.map +1 -0
  337. package/dist/ports/bridge/adapters/layerzero-adapter.js +31 -0
  338. package/dist/ports/bridge/adapters/layerzero-adapter.js.map +1 -0
  339. package/dist/ports/bridge/adapters/lifi-adapter.d.ts +48 -0
  340. package/dist/ports/bridge/adapters/lifi-adapter.d.ts.map +1 -0
  341. package/dist/ports/bridge/adapters/lifi-adapter.js +49 -0
  342. package/dist/ports/bridge/adapters/lifi-adapter.js.map +1 -0
  343. package/dist/ports/bridge/adapters/wormhole-adapter.d.ts +26 -0
  344. package/dist/ports/bridge/adapters/wormhole-adapter.d.ts.map +1 -0
  345. package/dist/ports/bridge/adapters/wormhole-adapter.js +27 -0
  346. package/dist/ports/bridge/adapters/wormhole-adapter.js.map +1 -0
  347. package/dist/ports/bridge/bridge.d.ts +123 -0
  348. package/dist/ports/bridge/bridge.d.ts.map +1 -0
  349. package/dist/ports/bridge/bridge.js +20 -0
  350. package/dist/ports/bridge/bridge.js.map +1 -0
  351. package/dist/ports/bridge/index.d.ts +13 -0
  352. package/dist/ports/bridge/index.d.ts.map +1 -0
  353. package/dist/ports/bridge/index.js +11 -0
  354. package/dist/ports/bridge/index.js.map +1 -0
  355. package/dist/ports/canton/adapters/ledger-api-adapter.d.ts +52 -0
  356. package/dist/ports/canton/adapters/ledger-api-adapter.d.ts.map +1 -0
  357. package/dist/ports/canton/adapters/ledger-api-adapter.js +232 -0
  358. package/dist/ports/canton/adapters/ledger-api-adapter.js.map +1 -0
  359. package/dist/ports/canton/canton-identity.d.ts +60 -0
  360. package/dist/ports/canton/canton-identity.d.ts.map +1 -0
  361. package/dist/ports/canton/canton-identity.js +28 -0
  362. package/dist/ports/canton/canton-identity.js.map +1 -0
  363. package/dist/ports/canton/canton-validator.d.ts +182 -0
  364. package/dist/ports/canton/canton-validator.d.ts.map +1 -0
  365. package/dist/ports/canton/canton-validator.js +39 -0
  366. package/dist/ports/canton/canton-validator.js.map +1 -0
  367. package/dist/ports/canton/fingerprint.d.ts +24 -0
  368. package/dist/ports/canton/fingerprint.d.ts.map +1 -0
  369. package/dist/ports/canton/fingerprint.js +31 -0
  370. package/dist/ports/canton/fingerprint.js.map +1 -0
  371. package/dist/ports/canton/hash.d.ts +37 -0
  372. package/dist/ports/canton/hash.d.ts.map +1 -0
  373. package/dist/ports/canton/hash.js +68 -0
  374. package/dist/ports/canton/hash.js.map +1 -0
  375. package/dist/ports/canton/http.d.ts +64 -0
  376. package/dist/ports/canton/http.d.ts.map +1 -0
  377. package/dist/ports/canton/http.js +177 -0
  378. package/dist/ports/canton/http.js.map +1 -0
  379. package/dist/ports/cross-vm.d.ts +79 -0
  380. package/dist/ports/cross-vm.d.ts.map +1 -0
  381. package/dist/ports/cross-vm.js +81 -0
  382. package/dist/ports/cross-vm.js.map +1 -0
  383. package/dist/ports/index.d.ts +18 -0
  384. package/dist/ports/index.d.ts.map +1 -0
  385. package/dist/ports/index.js +11 -0
  386. package/dist/ports/index.js.map +1 -0
  387. package/dist/ports/tenzro-identity.d.ts +29 -0
  388. package/dist/ports/tenzro-identity.d.ts.map +1 -0
  389. package/dist/ports/tenzro-identity.js +19 -0
  390. package/dist/ports/tenzro-identity.js.map +1 -0
  391. package/dist/ports/tenzro-rpc.d.ts +79 -0
  392. package/dist/ports/tenzro-rpc.d.ts.map +1 -0
  393. package/dist/ports/tenzro-rpc.js +21 -0
  394. package/dist/ports/tenzro-rpc.js.map +1 -0
  395. package/dist/router/index.d.ts +3 -0
  396. package/dist/router/index.d.ts.map +1 -0
  397. package/dist/router/index.js +2 -0
  398. package/dist/router/index.js.map +1 -0
  399. package/dist/router/route.d.ts +17 -0
  400. package/dist/router/route.d.ts.map +1 -0
  401. package/dist/router/route.js +78 -0
  402. package/dist/router/route.js.map +1 -0
  403. package/dist/settlement/nanopayment-flow.d.ts +48 -0
  404. package/dist/settlement/nanopayment-flow.d.ts.map +1 -0
  405. package/dist/settlement/nanopayment-flow.js +111 -0
  406. package/dist/settlement/nanopayment-flow.js.map +1 -0
  407. package/dist/surfaces/canton-external.d.ts +43 -0
  408. package/dist/surfaces/canton-external.d.ts.map +1 -0
  409. package/dist/surfaces/canton-external.js +252 -0
  410. package/dist/surfaces/canton-external.js.map +1 -0
  411. package/dist/surfaces/canton-internal.d.ts +34 -0
  412. package/dist/surfaces/canton-internal.d.ts.map +1 -0
  413. package/dist/surfaces/canton-internal.js +163 -0
  414. package/dist/surfaces/canton-internal.js.map +1 -0
  415. package/dist/surfaces/canton-onboarding.d.ts +64 -0
  416. package/dist/surfaces/canton-onboarding.d.ts.map +1 -0
  417. package/dist/surfaces/canton-onboarding.js +113 -0
  418. package/dist/surfaces/canton-onboarding.js.map +1 -0
  419. package/dist/surfaces/evm-on-tenzro.d.ts +29 -0
  420. package/dist/surfaces/evm-on-tenzro.d.ts.map +1 -0
  421. package/dist/surfaces/evm-on-tenzro.js +226 -0
  422. package/dist/surfaces/evm-on-tenzro.js.map +1 -0
  423. package/dist/surfaces/index.d.ts +13 -0
  424. package/dist/surfaces/index.d.ts.map +1 -0
  425. package/dist/surfaces/index.js +7 -0
  426. package/dist/surfaces/index.js.map +1 -0
  427. package/dist/surfaces/svm-on-tenzro.d.ts +24 -0
  428. package/dist/surfaces/svm-on-tenzro.d.ts.map +1 -0
  429. package/dist/surfaces/svm-on-tenzro.js +238 -0
  430. package/dist/surfaces/svm-on-tenzro.js.map +1 -0
  431. package/dist/surfaces/tenzro-native.d.ts +45 -0
  432. package/dist/surfaces/tenzro-native.d.ts.map +1 -0
  433. package/dist/surfaces/tenzro-native.js +299 -0
  434. package/dist/surfaces/tenzro-native.js.map +1 -0
  435. package/dist/surfaces/util.d.ts +18 -0
  436. package/dist/surfaces/util.d.ts.map +1 -0
  437. package/dist/surfaces/util.js +36 -0
  438. package/dist/surfaces/util.js.map +1 -0
  439. package/dist/types/asset.d.ts +43 -0
  440. package/dist/types/asset.d.ts.map +1 -0
  441. package/dist/types/asset.js +13 -0
  442. package/dist/types/asset.js.map +1 -0
  443. package/dist/types/consent.d.ts +46 -0
  444. package/dist/types/consent.d.ts.map +1 -0
  445. package/dist/types/consent.js +18 -0
  446. package/dist/types/consent.js.map +1 -0
  447. package/dist/types/identity.d.ts +115 -0
  448. package/dist/types/identity.d.ts.map +1 -0
  449. package/dist/types/identity.js +12 -0
  450. package/dist/types/identity.js.map +1 -0
  451. package/dist/types/index.d.ts +10 -0
  452. package/dist/types/index.d.ts.map +1 -0
  453. package/dist/types/index.js +3 -0
  454. package/dist/types/index.js.map +1 -0
  455. package/dist/types/intent.d.ts +132 -0
  456. package/dist/types/intent.d.ts.map +1 -0
  457. package/dist/types/intent.js +8 -0
  458. package/dist/types/intent.js.map +1 -0
  459. package/dist/types/signing-driver.d.ts +48 -0
  460. package/dist/types/signing-driver.d.ts.map +1 -0
  461. package/dist/types/signing-driver.js +9 -0
  462. package/dist/types/signing-driver.js.map +1 -0
  463. package/dist/types/surface-module.d.ts +38 -0
  464. package/dist/types/surface-module.d.ts.map +1 -0
  465. package/dist/types/surface-module.js +19 -0
  466. package/dist/types/surface-module.js.map +1 -0
  467. package/dist/types/surface.d.ts +17 -0
  468. package/dist/types/surface.d.ts.map +1 -0
  469. package/dist/types/surface.js +28 -0
  470. package/dist/types/surface.js.map +1 -0
  471. package/package.json +84 -0
@@ -0,0 +1,182 @@
1
+ /**
2
+ * CantonValidatorPort — narrow port for the Canton validator surface area.
3
+ *
4
+ * Two protocol surfaces hide behind one port:
5
+ * 1. **Ledger API** (`/v2/...`) — the JSON Ledger API every Canton
6
+ * participant exposes. Interactive Submission Service for prepare/execute,
7
+ * command completions tail, active-contract reads.
8
+ * 2. **Splice validator-app** (`/api/validator/v0/...`) — the Tenzro-hosted
9
+ * validator's convenience endpoints for external-party onboarding (topology
10
+ * generation, setup-proposal acceptance, preapproval lookup via Scan proxy).
11
+ *
12
+ * Both surfaces sit on the same validator deployment and share auth (Auth0
13
+ * JWT, audience `https://canton.network.global`). One port, one adapter,
14
+ * one set of auth plumbing — the kernel doesn't care that two HTTP base URLs
15
+ * are involved.
16
+ *
17
+ * Both `canton-internal` and `canton-external` consume this port. The
18
+ * synchronizerId is a parameter on every call, not a port-level concern —
19
+ * the same Tenzro validator hosts parties on both the Tenzro-operated
20
+ * synchronizer and the Global Synchronizer.
21
+ *
22
+ * **Backed by:** `LedgerApiAdapter` (browser-clean, hand-rolled fetch
23
+ * client over the JSON Ledger API + Splice validator-app HTTP surface).
24
+ * Following Splice Wallet Kernel's reference pattern — no
25
+ * `@canton-network/wallet-sdk` dep (that package is Node-only, pulls
26
+ * `@grpc/grpc-js`). CIP-0103 explicitly endorses raw Ledger API access
27
+ * as a canonical source of truth.
28
+ *
29
+ * Spec refs:
30
+ * - DESIGN.md §4.4 (canton-internal) + §4.5 (canton-external)
31
+ * - Canton OSS `interactive_submission_service.proto` for the prepare/execute
32
+ * wire shape (vendored hash recomputation lives in `./hash.ts`)
33
+ * - https://docs.digitalasset.com/integrate/devnet/preparing-and-signing-transactions/
34
+ * - https://docs.global.canton.network.sync.global/
35
+ * - Splice Wallet Kernel `core/ledger-client` (the reference HTTP client
36
+ * pattern this adapter mirrors)
37
+ */
38
+ /**
39
+ * Hashing scheme version for `preparedTransactionHash` recomputation.
40
+ * Pin V2 explicitly; reject V3+ until the kernel knows the V3 canonicalisation
41
+ * rules. Per §4.5.1 and open-question #4 in DESIGN.md.
42
+ */
43
+ export type CantonHashingSchemeVersion = 'HASHING_SCHEME_VERSION_V2';
44
+ /**
45
+ * Canton signing curves accepted on `PartyToKeyMapping`. Ed25519 is the
46
+ * recommended default; ECDSA P-256 maps cleanly to WebAuthn ES256 for
47
+ * passkey-direct signing of the warm leg. secp256k1 acceptance on Global
48
+ * Synchronizer MainNet is unverified as of 2026-04 — see DESIGN.md open
49
+ * question #2.
50
+ */
51
+ export type CantonSigningScheme = 'ed25519' | 'ec-dsa-p256';
52
+ export interface PrepareSubmissionRequest {
53
+ /** Acting party id (`<hint>::<fingerprint>`). */
54
+ readonly actAs: string;
55
+ /** Synchronizer id — `global-domain::<fp>` for MainNet, Tenzro-operated
56
+ * synchronizer id for canton-internal. */
57
+ readonly synchronizerId: string;
58
+ /** Stable client-side identifier; tied to the eventual `updateId`. */
59
+ readonly commandId: string;
60
+ /** Pinned package id the wallet knows how to render. Post-2026-05-05
61
+ * baseline: `splice-amulet 0.1.17`. */
62
+ readonly packageIdSelectionPreference: string;
63
+ /** Daml `Commands` payload — opaque to the kernel; the SDK adapter shapes
64
+ * this from the high-level intent. M4 design phase keeps the type narrow;
65
+ * the SDK adapter widens it to the Splice `wallet-sdk` Commands shape. */
66
+ readonly commands: ReadonlyArray<unknown>;
67
+ }
68
+ export interface PrepareSubmissionResponse {
69
+ /** Canonical wire-format `PreparedTransaction` proto bytes. The wallet
70
+ * re-decodes these to verify what's being authorised. */
71
+ readonly preparedTransaction: Uint8Array;
72
+ /** SHA-256 hash with Canton hash purpose 11 prefix. The wallet recomputes
73
+ * this from `preparedTransaction` and asserts equality before signing. */
74
+ readonly preparedTransactionHash: Uint8Array;
75
+ readonly hashingSchemeVersion: CantonHashingSchemeVersion;
76
+ }
77
+ export interface ExecuteSubmissionRequest {
78
+ readonly preparedTransaction: Uint8Array;
79
+ /** The signature(s) over `preparedTransactionHash`. M-of-N signing keys
80
+ * per `PartyToKeyMapping` — array even when threshold = 1. */
81
+ readonly partySignatures: ReadonlyArray<{
82
+ readonly party: string;
83
+ readonly signature: Uint8Array;
84
+ readonly scheme: CantonSigningScheme;
85
+ /** Fingerprint of the signing public key — Canton uses this to look up
86
+ * the key in `PartyToKeyMapping` rather than carrying the pubkey on
87
+ * the wire. */
88
+ readonly signedBy: string;
89
+ }>;
90
+ readonly hashingSchemeVersion: CantonHashingSchemeVersion;
91
+ /** Same `commandId` from prepare. */
92
+ readonly submissionId: string;
93
+ }
94
+ export interface CompletionFilter {
95
+ readonly userId: string;
96
+ readonly actAs: ReadonlyArray<string>;
97
+ /** Resume from a prior offset; omit to start from the current head. */
98
+ readonly beginExclusive?: string;
99
+ }
100
+ export interface CantonCompletion {
101
+ readonly commandId: string;
102
+ /** On-ledger update id — the closest equivalent to a tx hash. */
103
+ readonly updateId: string;
104
+ readonly completionOffset: string;
105
+ readonly status: 'executed' | 'failed';
106
+ /** Status detail when `status === 'failed'`. */
107
+ readonly errorMessage?: string;
108
+ }
109
+ export interface ActiveContractsFilter {
110
+ readonly party: string;
111
+ readonly templateIds?: ReadonlyArray<string>;
112
+ }
113
+ export interface CantonActiveContract {
114
+ readonly contractId: string;
115
+ readonly templateId: string;
116
+ /** Daml record payload, opaque to the kernel; surface modules narrow this
117
+ * per template. */
118
+ readonly payload: unknown;
119
+ readonly createdAtOffset: string;
120
+ }
121
+ export interface TransferPreapproval {
122
+ readonly contractId: string;
123
+ readonly receiver: string;
124
+ readonly provider: string;
125
+ /** Unix ms epoch of preapproval expiry. The Tenzro validator auto-renews
126
+ * when within 30 days of expiry (see §4.5.6). */
127
+ readonly expiresAt: number;
128
+ }
129
+ export interface GenerateTopologyRequest {
130
+ readonly partyHint: string;
131
+ readonly namespacePublicKey: Uint8Array;
132
+ readonly signingPublicKeys: ReadonlyArray<{
133
+ readonly publicKey: Uint8Array;
134
+ readonly scheme: CantonSigningScheme;
135
+ }>;
136
+ readonly threshold: number;
137
+ }
138
+ export interface GenerateTopologyResponse {
139
+ /** The three unsigned topology transactions (NamespaceDelegation,
140
+ * PartyToKeyMapping, PartyToParticipant) as opaque bytes. The wallet
141
+ * doesn't decode these — it signs the bundle hash. */
142
+ readonly topologyTransactions: ReadonlyArray<Uint8Array>;
143
+ /** SHA-256 over the bundle, Canton hash purpose 55. */
144
+ readonly bundleHash: Uint8Array;
145
+ /** Resulting party id once the bundle is submitted. */
146
+ readonly partyId: string;
147
+ }
148
+ export interface SubmitTopologyRequest {
149
+ readonly topologyTransactions: ReadonlyArray<Uint8Array>;
150
+ readonly namespaceSignature: Uint8Array;
151
+ }
152
+ export interface SetupProposalRequest {
153
+ readonly partyId: string;
154
+ }
155
+ export interface PrepareAcceptSetupRequest {
156
+ readonly partyId: string;
157
+ }
158
+ export interface PrepareAcceptSetupResponse {
159
+ readonly preparedTransaction: Uint8Array;
160
+ readonly preparedTransactionHash: Uint8Array;
161
+ readonly hashingSchemeVersion: CantonHashingSchemeVersion;
162
+ }
163
+ export interface SubmitAcceptSetupRequest {
164
+ readonly preparedTransaction: Uint8Array;
165
+ readonly signature: Uint8Array;
166
+ readonly hashingSchemeVersion: CantonHashingSchemeVersion;
167
+ }
168
+ export interface CantonValidatorPort {
169
+ prepareSubmission(req: PrepareSubmissionRequest): Promise<PrepareSubmissionResponse>;
170
+ executeSubmission(req: ExecuteSubmissionRequest): Promise<void>;
171
+ tailCompletions(filter: CompletionFilter): AsyncIterable<CantonCompletion>;
172
+ getActiveContracts(filter: ActiveContractsFilter): AsyncIterable<CantonActiveContract>;
173
+ lookupPreapproval(party: string): Promise<TransferPreapproval | null>;
174
+ /** Canton Name Service: `name.cns` → party id. Returns null when unmapped. */
175
+ resolveCns(name: string): Promise<string | null>;
176
+ generateTopology(req: GenerateTopologyRequest): Promise<GenerateTopologyResponse>;
177
+ submitTopology(req: SubmitTopologyRequest): Promise<void>;
178
+ setupProposal(req: SetupProposalRequest): Promise<void>;
179
+ prepareAcceptSetup(req: PrepareAcceptSetupRequest): Promise<PrepareAcceptSetupResponse>;
180
+ submitAcceptSetup(req: SubmitAcceptSetupRequest): Promise<void>;
181
+ }
182
+ //# sourceMappingURL=canton-validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canton-validator.d.ts","sourceRoot":"","sources":["../../../src/ports/canton/canton-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAIH;;;;GAIG;AACH,MAAM,MAAM,0BAA0B,GAAG,2BAA2B,CAAC;AAErE;;;;;;GAMG;AACH,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,aAAa,CAAC;AAE5D,MAAM,WAAW,wBAAwB;IACvC,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;+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AAM,GAAG,IAAI,CAAC,CAAC;IAGjD,gBAAgB,CAAC,GAAG,EAAE,uBAAuB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAClF,cAAc,CAAC,GAAG,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,aAAa,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,kBAAkB,CAAC,GAAG,EAAE,yBAAyB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACxF,iBAAiB,CAAC,GAAG,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACjE"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * CantonValidatorPort — narrow port for the Canton validator surface area.
3
+ *
4
+ * Two protocol surfaces hide behind one port:
5
+ * 1. **Ledger API** (`/v2/...`) — the JSON Ledger API every Canton
6
+ * participant exposes. Interactive Submission Service for prepare/execute,
7
+ * command completions tail, active-contract reads.
8
+ * 2. **Splice validator-app** (`/api/validator/v0/...`) — the Tenzro-hosted
9
+ * validator's convenience endpoints for external-party onboarding (topology
10
+ * generation, setup-proposal acceptance, preapproval lookup via Scan proxy).
11
+ *
12
+ * Both surfaces sit on the same validator deployment and share auth (Auth0
13
+ * JWT, audience `https://canton.network.global`). One port, one adapter,
14
+ * one set of auth plumbing — the kernel doesn't care that two HTTP base URLs
15
+ * are involved.
16
+ *
17
+ * Both `canton-internal` and `canton-external` consume this port. The
18
+ * synchronizerId is a parameter on every call, not a port-level concern —
19
+ * the same Tenzro validator hosts parties on both the Tenzro-operated
20
+ * synchronizer and the Global Synchronizer.
21
+ *
22
+ * **Backed by:** `LedgerApiAdapter` (browser-clean, hand-rolled fetch
23
+ * client over the JSON Ledger API + Splice validator-app HTTP surface).
24
+ * Following Splice Wallet Kernel's reference pattern — no
25
+ * `@canton-network/wallet-sdk` dep (that package is Node-only, pulls
26
+ * `@grpc/grpc-js`). CIP-0103 explicitly endorses raw Ledger API access
27
+ * as a canonical source of truth.
28
+ *
29
+ * Spec refs:
30
+ * - DESIGN.md §4.4 (canton-internal) + §4.5 (canton-external)
31
+ * - Canton OSS `interactive_submission_service.proto` for the prepare/execute
32
+ * wire shape (vendored hash recomputation lives in `./hash.ts`)
33
+ * - https://docs.digitalasset.com/integrate/devnet/preparing-and-signing-transactions/
34
+ * - https://docs.global.canton.network.sync.global/
35
+ * - Splice Wallet Kernel `core/ledger-client` (the reference HTTP client
36
+ * pattern this adapter mirrors)
37
+ */
38
+ export {};
39
+ //# sourceMappingURL=canton-validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"canton-validator.js","sourceRoot":"","sources":["../../../src/ports/canton/canton-validator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG"}
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Canton key fingerprint computation.
3
+ *
4
+ * Canton identifies keys (and parties) by a `Fingerprint` string of the
5
+ * form `1220<lowercase-hex-sha256(publicKey)>`. The `1220` prefix is
6
+ * Canton's multihash header (`0x12` = sha2-256, `0x20` = 32 bytes), the
7
+ * same convention as multihash and IPFS CIDs.
8
+ *
9
+ * Used in two places:
10
+ * 1. As the `::xxxx` portion of a `PartyId` (`<hint>::<namespace-fingerprint>`).
11
+ * 2. As `signedBy` on every `partySignature` to `executeSubmission`, so
12
+ * the validator can look the public key up in `PartyToKeyMapping`
13
+ * without us carrying the bytes on the wire.
14
+ *
15
+ * Both call sites need the fingerprint to be precomputed at provision time
16
+ * (or at adapter-construction for an externally registered party) so the
17
+ * signing path stays synchronous after the SigningDriver returns.
18
+ */
19
+ /**
20
+ * Compute the Canton fingerprint string for a public key. Async because
21
+ * SHA-256 is async on WebCrypto; callers cache the result on `CantonPartyKey`.
22
+ */
23
+ export declare function cantonFingerprint(publicKey: Uint8Array): Promise<string>;
24
+ //# sourceMappingURL=fingerprint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fingerprint.d.ts","sourceRoot":"","sources":["../../../src/ports/canton/fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAK9E"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Canton key fingerprint computation.
3
+ *
4
+ * Canton identifies keys (and parties) by a `Fingerprint` string of the
5
+ * form `1220<lowercase-hex-sha256(publicKey)>`. The `1220` prefix is
6
+ * Canton's multihash header (`0x12` = sha2-256, `0x20` = 32 bytes), the
7
+ * same convention as multihash and IPFS CIDs.
8
+ *
9
+ * Used in two places:
10
+ * 1. As the `::xxxx` portion of a `PartyId` (`<hint>::<namespace-fingerprint>`).
11
+ * 2. As `signedBy` on every `partySignature` to `executeSubmission`, so
12
+ * the validator can look the public key up in `PartyToKeyMapping`
13
+ * without us carrying the bytes on the wire.
14
+ *
15
+ * Both call sites need the fingerprint to be precomputed at provision time
16
+ * (or at adapter-construction for an externally registered party) so the
17
+ * signing path stays synchronous after the SigningDriver returns.
18
+ */
19
+ import { sha256 } from "../../crypto/sha256.js";
20
+ /**
21
+ * Compute the Canton fingerprint string for a public key. Async because
22
+ * SHA-256 is async on WebCrypto; callers cache the result on `CantonPartyKey`.
23
+ */
24
+ export async function cantonFingerprint(publicKey) {
25
+ const hash = await sha256(publicKey);
26
+ let hex = '1220';
27
+ for (const b of hash)
28
+ hex += b.toString(16).padStart(2, '0');
29
+ return hex;
30
+ }
31
+ //# sourceMappingURL=fingerprint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fingerprint.js","sourceRoot":"","sources":["../../../src/ports/canton/fingerprint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,SAAqB;IAC3D,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,GAAG,GAAG,MAAM,CAAC;IACjB,KAAK,MAAM,CAAC,IAAI,IAAI;QAAE,GAAG,IAAI,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC7D,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Canton hash recomputation. The Interactive Submission Service returns a
3
+ * `preparedTransactionHash` alongside the `preparedTransaction` proto bytes;
4
+ * the wallet recomputes the hash locally and asserts equality before
5
+ * signing. Otherwise the wallet would be trusting the validator on what
6
+ * it's authorising — defeats the entire point of external signing.
7
+ *
8
+ * Canon (per Canton OSS `community/util-internal/src/main/scala/com/digitalasset/canton/crypto/HashPurpose.scala` and
9
+ * `HashAlgorithm.scala`):
10
+ *
11
+ * hashed = SHA-256( hash_purpose_be_u32 || hash_algorithm_byte || payload )
12
+ *
13
+ * - **hash_purpose** is a fixed 4-byte big-endian integer identifying what
14
+ * is being hashed. `PreparedTransaction = 11`.
15
+ * - **hash_algorithm_byte** identifies the SHA variant. `Sha256 = 0`.
16
+ * - **payload** is the canonical proto bytes returned in
17
+ * `preparedTransaction`.
18
+ *
19
+ * Hashing scheme version V2 is what 0.5.16 ships. V3 will change the
20
+ * canonicalisation rules; we reject V3 explicitly until the kernel
21
+ * implements them (see DESIGN.md §11 open question #4).
22
+ */
23
+ /**
24
+ * Recompute the `preparedTransactionHash` from the proto bytes the validator
25
+ * returned. The wallet calls this in `sign()` and asserts equality before
26
+ * handing the hash to the SigningDriver.
27
+ */
28
+ export declare function preparedTransactionHash(preparedTransaction: Uint8Array): Promise<Uint8Array>;
29
+ /**
30
+ * Recompute the topology bundle hash from the three onboarding txs the
31
+ * validator returned. The user signs *this* hash with the namespace key.
32
+ */
33
+ export declare function topologyBundleHash(bundle: ReadonlyArray<Uint8Array>): Promise<Uint8Array>;
34
+ /** Constant-time byte equality. Used after recomputing the hash so a
35
+ * mismatched validator can't leak information via timing. */
36
+ export declare function bytesEqualConstantTime(a: Uint8Array, b: Uint8Array): boolean;
37
+ //# sourceMappingURL=hash.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../src/ports/canton/hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAaH;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,mBAAmB,EAAE,UAAU,GAC9B,OAAO,CAAC,UAAU,CAAC,CAErB;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,aAAa,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAK/F;AAaD;8DAC8D;AAC9D,wBAAgB,sBAAsB,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,UAAU,GAAG,OAAO,CAK5E"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Canton hash recomputation. The Interactive Submission Service returns a
3
+ * `preparedTransactionHash` alongside the `preparedTransaction` proto bytes;
4
+ * the wallet recomputes the hash locally and asserts equality before
5
+ * signing. Otherwise the wallet would be trusting the validator on what
6
+ * it's authorising — defeats the entire point of external signing.
7
+ *
8
+ * Canon (per Canton OSS `community/util-internal/src/main/scala/com/digitalasset/canton/crypto/HashPurpose.scala` and
9
+ * `HashAlgorithm.scala`):
10
+ *
11
+ * hashed = SHA-256( hash_purpose_be_u32 || hash_algorithm_byte || payload )
12
+ *
13
+ * - **hash_purpose** is a fixed 4-byte big-endian integer identifying what
14
+ * is being hashed. `PreparedTransaction = 11`.
15
+ * - **hash_algorithm_byte** identifies the SHA variant. `Sha256 = 0`.
16
+ * - **payload** is the canonical proto bytes returned in
17
+ * `preparedTransaction`.
18
+ *
19
+ * Hashing scheme version V2 is what 0.5.16 ships. V3 will change the
20
+ * canonicalisation rules; we reject V3 explicitly until the kernel
21
+ * implements them (see DESIGN.md §11 open question #4).
22
+ */
23
+ import { concatBytes, sha256 } from "../../crypto/sha256.js";
24
+ /** `PreparedTransaction` per Canton's `HashPurpose`. */
25
+ const HASH_PURPOSE_PREPARED_TRANSACTION = 11;
26
+ /** `Sha256` per Canton's `HashAlgorithm`. */
27
+ const HASH_ALGORITHM_SHA256 = 0;
28
+ /** Canton bundle hash for multi-tx topology submissions (onboarding). */
29
+ const HASH_PURPOSE_TOPOLOGY_TRANSACTION_BUNDLE = 55;
30
+ /**
31
+ * Recompute the `preparedTransactionHash` from the proto bytes the validator
32
+ * returned. The wallet calls this in `sign()` and asserts equality before
33
+ * handing the hash to the SigningDriver.
34
+ */
35
+ export async function preparedTransactionHash(preparedTransaction) {
36
+ return cantonHash(HASH_PURPOSE_PREPARED_TRANSACTION, preparedTransaction);
37
+ }
38
+ /**
39
+ * Recompute the topology bundle hash from the three onboarding txs the
40
+ * validator returned. The user signs *this* hash with the namespace key.
41
+ */
42
+ export async function topologyBundleHash(bundle) {
43
+ // The bundle hash inputs are concatenated in their wire order. Canton
44
+ // doesn't length-prefix them at the hash layer — the proto's outer
45
+ // structure already disambiguates.
46
+ return cantonHash(HASH_PURPOSE_TOPOLOGY_TRANSACTION_BUNDLE, concatBytes(...bundle));
47
+ }
48
+ async function cantonHash(purpose, payload) {
49
+ const purposeBytes = new Uint8Array(4);
50
+ // Big-endian u32.
51
+ purposeBytes[0] = (purpose >>> 24) & 0xff;
52
+ purposeBytes[1] = (purpose >>> 16) & 0xff;
53
+ purposeBytes[2] = (purpose >>> 8) & 0xff;
54
+ purposeBytes[3] = purpose & 0xff;
55
+ const algoByte = new Uint8Array([HASH_ALGORITHM_SHA256]);
56
+ return sha256(concatBytes(purposeBytes, algoByte, payload));
57
+ }
58
+ /** Constant-time byte equality. Used after recomputing the hash so a
59
+ * mismatched validator can't leak information via timing. */
60
+ export function bytesEqualConstantTime(a, b) {
61
+ if (a.length !== b.length)
62
+ return false;
63
+ let diff = 0;
64
+ for (let i = 0; i < a.length; i++)
65
+ diff |= a[i] ^ b[i];
66
+ return diff === 0;
67
+ }
68
+ //# sourceMappingURL=hash.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../src/ports/canton/hash.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAE7D,wDAAwD;AACxD,MAAM,iCAAiC,GAAG,EAAE,CAAC;AAE7C,6CAA6C;AAC7C,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEhC,yEAAyE;AACzE,MAAM,wCAAwC,GAAG,EAAE,CAAC;AAEpD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,mBAA+B;IAE/B,OAAO,UAAU,CAAC,iCAAiC,EAAE,mBAAmB,CAAC,CAAC;AAC5E,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAiC;IACxE,sEAAsE;IACtE,mEAAmE;IACnE,mCAAmC;IACnC,OAAO,UAAU,CAAC,wCAAwC,EAAE,WAAW,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;AACtF,CAAC;AAED,KAAK,UAAU,UAAU,CAAC,OAAe,EAAE,OAAmB;IAC5D,MAAM,YAAY,GAAG,IAAI,UAAU,CAAC,CAAC,CAAC,CAAC;IACvC,kBAAkB;IAClB,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAC1C,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;IAC1C,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC;IACzC,YAAY,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC;IACjC,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC;IACzD,OAAO,MAAM,CAAC,WAAW,CAAC,YAAY,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED;8DAC8D;AAC9D,MAAM,UAAU,sBAAsB,CAAC,CAAa,EAAE,CAAa;IACjE,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IACxC,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,IAAI,IAAI,CAAC,CAAC,CAAC,CAAE,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC;IACzD,OAAO,IAAI,KAAK,CAAC,CAAC;AACpB,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Minimal `fetch`-based HTTP helpers for the Canton adapter. Browser-clean —
3
+ * uses only the platform `fetch` API. No openapi-fetch dep, no Buffer
4
+ * polyfills, no Node-only globals.
5
+ *
6
+ * Two distinct base URLs talk to one Canton validator deployment:
7
+ * - Ledger API (`/v2/...`) — port 7575 by default; the JSON Ledger API
8
+ * every Canton participant exposes.
9
+ * - Splice validator-app (`/api/validator/v0/...`) — port 5003 by default;
10
+ * the convenience endpoints for external-party onboarding and Scan
11
+ * proxying.
12
+ *
13
+ * Both share an Auth0 JWT (audience `https://canton.network.global`,
14
+ * client_credentials grant). The token provider is injected — the kernel
15
+ * doesn't manage the OAuth dance, that lives in the host app or the node-
16
+ * side `/wallet/*` endpoints.
17
+ */
18
+ export interface CantonHttpConfig {
19
+ /** Base URL for the JSON Ledger API, e.g. `https://canton.example:7575`. */
20
+ readonly ledgerBaseUrl: string;
21
+ /** Base URL for the Splice validator-app, e.g. `https://canton.example:5003`. */
22
+ readonly validatorBaseUrl: string;
23
+ /**
24
+ * Async token getter. Called per-request — the implementation can cache
25
+ * and refresh as it likes. Throwing here surfaces as a request failure.
26
+ */
27
+ readonly token: () => Promise<string>;
28
+ /**
29
+ * Optional `fetch` override. Defaults to `globalThis.fetch`. Tests inject
30
+ * a mock; real builds typically leave it unset.
31
+ */
32
+ readonly fetch?: typeof fetch;
33
+ }
34
+ export declare class CantonHttpError extends Error {
35
+ readonly status: number;
36
+ readonly url: string;
37
+ readonly body: string;
38
+ constructor(status: number, url: string, body: string);
39
+ }
40
+ /**
41
+ * POST a JSON body to either base URL and parse the JSON response. Throws
42
+ * `CantonHttpError` on non-2xx; the surface modules let those propagate.
43
+ *
44
+ * `base` selects the URL prefix. The path argument is the suffix
45
+ * (e.g. `/v2/interactive-submission/prepare`).
46
+ */
47
+ export declare function postJson<TReq, TRes>(cfg: CantonHttpConfig, base: 'ledger' | 'validator', path: string, body: TReq): Promise<TRes>;
48
+ /** GET a JSON resource. Same auth + error model as `postJson`. */
49
+ export declare function getJson<TRes>(cfg: CantonHttpConfig, base: 'ledger' | 'validator', path: string): Promise<TRes>;
50
+ /**
51
+ * Open a streaming response (Server-Sent Events shape used by
52
+ * `/v2/commands/completions` and `/v2/updates/flats`). Yields parsed JSON
53
+ * objects line-by-line.
54
+ *
55
+ * Canton's Ledger API streaming format: newline-delimited JSON over a
56
+ * keep-alive HTTP/1.1 connection. No SSE `data:` prefix on the JSON Ledger
57
+ * API path — that's the gRPC bridge's territory.
58
+ */
59
+ export declare function streamNdjson<T>(cfg: CantonHttpConfig, base: 'ledger' | 'validator', path: string, body: unknown, signal?: AbortSignal): AsyncIterable<T>;
60
+ /** Standard base64 (not base64url). Browser-clean, no Buffer dep. */
61
+ export declare function base64Encode(bytes: Uint8Array): string;
62
+ /** Standard base64 decode. */
63
+ export declare function base64Decode(s: string): Uint8Array;
64
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","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BAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAKtD;AAED,8BAA8B;AAC9B,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,GAAG,UAAU,CAKlD"}
@@ -0,0 +1,177 @@
1
+ /**
2
+ * Minimal `fetch`-based HTTP helpers for the Canton adapter. Browser-clean —
3
+ * uses only the platform `fetch` API. No openapi-fetch dep, no Buffer
4
+ * polyfills, no Node-only globals.
5
+ *
6
+ * Two distinct base URLs talk to one Canton validator deployment:
7
+ * - Ledger API (`/v2/...`) — port 7575 by default; the JSON Ledger API
8
+ * every Canton participant exposes.
9
+ * - Splice validator-app (`/api/validator/v0/...`) — port 5003 by default;
10
+ * the convenience endpoints for external-party onboarding and Scan
11
+ * proxying.
12
+ *
13
+ * Both share an Auth0 JWT (audience `https://canton.network.global`,
14
+ * client_credentials grant). The token provider is injected — the kernel
15
+ * doesn't manage the OAuth dance, that lives in the host app or the node-
16
+ * side `/wallet/*` endpoints.
17
+ */
18
+ export class CantonHttpError extends Error {
19
+ status;
20
+ url;
21
+ body;
22
+ constructor(status, url, body) {
23
+ super(`canton http ${status} on ${url}: ${truncate(body, 200)}`);
24
+ this.status = status;
25
+ this.url = url;
26
+ this.body = body;
27
+ this.name = 'CantonHttpError';
28
+ }
29
+ }
30
+ /**
31
+ * POST a JSON body to either base URL and parse the JSON response. Throws
32
+ * `CantonHttpError` on non-2xx; the surface modules let those propagate.
33
+ *
34
+ * `base` selects the URL prefix. The path argument is the suffix
35
+ * (e.g. `/v2/interactive-submission/prepare`).
36
+ */
37
+ export async function postJson(cfg, base, path, body) {
38
+ const baseUrl = base === 'ledger' ? cfg.ledgerBaseUrl : cfg.validatorBaseUrl;
39
+ const url = `${stripTrailingSlash(baseUrl)}${path}`;
40
+ const token = await cfg.token();
41
+ const f = cfg.fetch ?? globalThis.fetch;
42
+ if (!f)
43
+ throw new Error('canton http: no fetch implementation available');
44
+ const res = await f(url, {
45
+ method: 'POST',
46
+ headers: {
47
+ 'content-type': 'application/json',
48
+ authorization: `Bearer ${token}`,
49
+ },
50
+ body: JSON.stringify(body, replacer),
51
+ });
52
+ if (!res.ok) {
53
+ const text = await safeText(res);
54
+ throw new CantonHttpError(res.status, url, text);
55
+ }
56
+ return (await res.json());
57
+ }
58
+ /** GET a JSON resource. Same auth + error model as `postJson`. */
59
+ export async function getJson(cfg, base, path) {
60
+ const baseUrl = base === 'ledger' ? cfg.ledgerBaseUrl : cfg.validatorBaseUrl;
61
+ const url = `${stripTrailingSlash(baseUrl)}${path}`;
62
+ const token = await cfg.token();
63
+ const f = cfg.fetch ?? globalThis.fetch;
64
+ if (!f)
65
+ throw new Error('canton http: no fetch implementation available');
66
+ const res = await f(url, {
67
+ method: 'GET',
68
+ headers: { authorization: `Bearer ${token}` },
69
+ });
70
+ if (!res.ok) {
71
+ const text = await safeText(res);
72
+ throw new CantonHttpError(res.status, url, text);
73
+ }
74
+ return (await res.json());
75
+ }
76
+ /**
77
+ * Open a streaming response (Server-Sent Events shape used by
78
+ * `/v2/commands/completions` and `/v2/updates/flats`). Yields parsed JSON
79
+ * objects line-by-line.
80
+ *
81
+ * Canton's Ledger API streaming format: newline-delimited JSON over a
82
+ * keep-alive HTTP/1.1 connection. No SSE `data:` prefix on the JSON Ledger
83
+ * API path — that's the gRPC bridge's territory.
84
+ */
85
+ export async function* streamNdjson(cfg, base, path, body, signal) {
86
+ const baseUrl = base === 'ledger' ? cfg.ledgerBaseUrl : cfg.validatorBaseUrl;
87
+ const url = `${stripTrailingSlash(baseUrl)}${path}`;
88
+ const token = await cfg.token();
89
+ const f = cfg.fetch ?? globalThis.fetch;
90
+ if (!f)
91
+ throw new Error('canton http: no fetch implementation available');
92
+ const init = {
93
+ method: 'POST',
94
+ headers: {
95
+ 'content-type': 'application/json',
96
+ accept: 'application/x-ndjson, application/json',
97
+ authorization: `Bearer ${token}`,
98
+ },
99
+ body: JSON.stringify(body, replacer),
100
+ ...(signal !== undefined ? { signal } : {}),
101
+ };
102
+ const res = await f(url, init);
103
+ if (!res.ok) {
104
+ const text = await safeText(res);
105
+ throw new CantonHttpError(res.status, url, text);
106
+ }
107
+ if (!res.body)
108
+ throw new Error('canton http: streaming response has no body');
109
+ const reader = res.body.getReader();
110
+ const decoder = new TextDecoder();
111
+ let buffer = '';
112
+ while (true) {
113
+ const { done, value } = await reader.read();
114
+ if (done) {
115
+ // Flush a trailing line if present.
116
+ const trimmed = buffer.trim();
117
+ if (trimmed.length > 0)
118
+ yield JSON.parse(trimmed);
119
+ return;
120
+ }
121
+ buffer += decoder.decode(value, { stream: true });
122
+ let nl = buffer.indexOf('\n');
123
+ while (nl >= 0) {
124
+ const line = buffer.slice(0, nl).trim();
125
+ buffer = buffer.slice(nl + 1);
126
+ if (line.length > 0)
127
+ yield JSON.parse(line);
128
+ nl = buffer.indexOf('\n');
129
+ }
130
+ }
131
+ }
132
+ // ─────────────────────────── helpers ───────────────────────────
133
+ /**
134
+ * JSON.stringify replacer that handles bigint and Uint8Array — both common
135
+ * in Canton wire payloads (amounts as bigint kernel-side; proto bytes as
136
+ * Uint8Array). Bigint serialises as a decimal string; bytes serialise as
137
+ * standard base64. Canton's JSON Ledger API expects base64 for `bytes`
138
+ * fields per its OpenAPI spec.
139
+ */
140
+ function replacer(_k, v) {
141
+ if (typeof v === 'bigint')
142
+ return v.toString();
143
+ if (v instanceof Uint8Array)
144
+ return base64Encode(v);
145
+ return v;
146
+ }
147
+ function stripTrailingSlash(s) {
148
+ return s.endsWith('/') ? s.slice(0, -1) : s;
149
+ }
150
+ async function safeText(res) {
151
+ try {
152
+ return await res.text();
153
+ }
154
+ catch {
155
+ return '<unreadable body>';
156
+ }
157
+ }
158
+ function truncate(s, n) {
159
+ return s.length > n ? `${s.slice(0, n)}…` : s;
160
+ }
161
+ /** Standard base64 (not base64url). Browser-clean, no Buffer dep. */
162
+ export function base64Encode(bytes) {
163
+ let s = '';
164
+ for (let i = 0; i < bytes.length; i++)
165
+ s += String.fromCharCode(bytes[i]);
166
+ // btoa is universal in browsers and Node 16+.
167
+ return btoa(s);
168
+ }
169
+ /** Standard base64 decode. */
170
+ export function base64Decode(s) {
171
+ const bin = atob(s);
172
+ const out = new Uint8Array(bin.length);
173
+ for (let i = 0; i < bin.length; i++)
174
+ out[i] = bin.charCodeAt(i);
175
+ return out;
176
+ }
177
+ //# sourceMappingURL=http.js.map