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,174 @@
1
+ /**
2
+ * PasskeyShareUnwrapper — turns a passkey assertion into a usable
3
+ * `FrostDeviceShareHolder` that the FROST drivers consume.
4
+ *
5
+ * Two strategies, selected at runtime by capability:
6
+ *
7
+ * - PRF mode (preferred). Uses the WebAuthn PRF extension
8
+ * (CTAP2.1 hmac-secret). The authenticator returns
9
+ * `prfResults.first`, a 32-byte symmetric key that we use to
10
+ * decrypt a server-stored share envelope. No additional Tenzro
11
+ * round trip beyond fetching the wrapped envelope.
12
+ *
13
+ * - largeBlob mode (preferred when prf unavailable but largeBlob is).
14
+ * Reads the wrapped share directly from the passkey credential's
15
+ * `largeBlob` storage; no Tenzro round trip at all (the envelope
16
+ * ships with the passkey).
17
+ *
18
+ * - Escrow mode (fallback for authenticators without PRF/largeBlob —
19
+ * e.g. Apple's iOS 17- platform passkeys). The server holds the
20
+ * share encrypted under a key derived from the assertion + a
21
+ * Tenzro-issued pepper. Per assertion = per pepper, so each
22
+ * unwrap is single-use and rate-limited by the node.
23
+ *
24
+ * Tenzro endpoints (Tenzro implements; wallet kernel only consumes):
25
+ *
26
+ * PRF / largeBlob path:
27
+ * 1. `GET /wallet/share/envelope?credentialId=...&surfaceKey=...`
28
+ * Response: `{wrappedShare, alg, salt}`. `wrappedShare` is the
29
+ * ciphertext over the FROST share `s_i`; the device unwraps it
30
+ * with the PRF result (or the largeBlob blob).
31
+ *
32
+ * Escrow path:
33
+ * 1. `POST /wallet/share/escrow/challenge`
34
+ * Body: `{credentialId, surfaceKey}`.
35
+ * Response: `{nonce, expiresAt}`.
36
+ *
37
+ * 2. `POST /wallet/share/escrow/unwrap`
38
+ * Body: `{credentialId, surfaceKey, assertion, nonce}`.
39
+ * The node verifies the assertion against the registered
40
+ * passkey, then derives the per-assertion pepper and returns
41
+ * `{wrappedShare, pepper}`. The device combines them to
42
+ * recover `s_i`.
43
+ *
44
+ * Both paths are single-use per round (the node binds the response
45
+ * to the FROST `sessionId` once known).
46
+ *
47
+ * The unwrapper *itself* is browser-clean (`fetch` + WebCrypto). The
48
+ * authenticator interactions live above this layer in the host app's
49
+ * WebAuthn glue.
50
+ */
51
+ import type { FrostDeviceShareHolder, FrostScheme } from '../frost/coordinator.js';
52
+ export type ShareUnwrapMode = 'prf' | 'large-blob' | 'escrow';
53
+ /**
54
+ * Capability bag advertised by the host's WebAuthn glue. The host
55
+ * decides at navigator level whether the authenticator supports PRF
56
+ * (CTAP2.1) and largeBlob (CTAP2.1+ extension). The unwrapper consumes
57
+ * these flags and falls back through the priority chain.
58
+ */
59
+ export interface PasskeyCapabilities {
60
+ readonly prf: boolean;
61
+ readonly largeBlob: boolean;
62
+ /** Always true — escrow is the universal fallback. */
63
+ readonly escrow: true;
64
+ }
65
+ export interface ShareUnwrapRequest {
66
+ readonly credentialId: string;
67
+ readonly surfaceKeyId: string;
68
+ readonly scheme: FrostScheme;
69
+ }
70
+ /**
71
+ * Adapter the unwrapper calls into. Production implementation is the
72
+ * host's WebAuthn layer; tests inject a fake. None of the methods are
73
+ * required by every mode — the unwrapper checks capabilities first.
74
+ */
75
+ export interface PasskeyAuthenticatorAdapter {
76
+ /** PRF mode: navigate the assertion ceremony with `prf` extension. */
77
+ prfAssertion?(req: ShareUnwrapRequest): Promise<{
78
+ readonly prfOutput: Uint8Array;
79
+ readonly assertion: PasskeyAssertion;
80
+ }>;
81
+ /** largeBlob mode: read the wrapped share blob from the credential. */
82
+ readLargeBlob?(req: ShareUnwrapRequest): Promise<{
83
+ readonly blob: Uint8Array;
84
+ readonly assertion: PasskeyAssertion;
85
+ }>;
86
+ /** Escrow mode: do an assertion ceremony with no extension. */
87
+ basicAssertion(req: ShareUnwrapRequest & {
88
+ readonly nonce: string;
89
+ }): Promise<PasskeyAssertion>;
90
+ }
91
+ /** Same wire shape as `pairing/port.ts` — duplicated here to avoid coupling. */
92
+ export interface PasskeyAssertion {
93
+ readonly credentialId: string;
94
+ readonly clientDataJson: string;
95
+ readonly authenticatorData: string;
96
+ readonly signature: string;
97
+ }
98
+ /**
99
+ * Server transport. Implements the four `/wallet/share/*` endpoints
100
+ * documented in this file's header. Tenzro provides; kernel consumes.
101
+ */
102
+ export interface ShareEnvelopePort {
103
+ /** GET /wallet/share/envelope */
104
+ fetchEnvelope(req: ShareUnwrapRequest): Promise<{
105
+ readonly wrappedShare: Uint8Array;
106
+ /** AEAD identifier — `aes-256-gcm` baseline for M5. */
107
+ readonly alg: string;
108
+ /** Salt used by the wrapping HKDF. */
109
+ readonly salt: Uint8Array;
110
+ }>;
111
+ /** POST /wallet/share/escrow/challenge */
112
+ startEscrow(req: ShareUnwrapRequest): Promise<{
113
+ readonly nonce: string;
114
+ readonly expiresAt: number;
115
+ }>;
116
+ /** POST /wallet/share/escrow/unwrap */
117
+ finishEscrow(req: ShareUnwrapRequest & {
118
+ readonly assertion: PasskeyAssertion;
119
+ readonly nonce: string;
120
+ }): Promise<{
121
+ readonly wrappedShare: Uint8Array;
122
+ readonly pepper: Uint8Array;
123
+ }>;
124
+ }
125
+ /**
126
+ * Builds a `FrostDeviceShareHolder` from a passkey assertion. The
127
+ * actual FROST commit/respond computation runs inside the device's
128
+ * FROST library, fed with the unwrapped share `s_i`.
129
+ *
130
+ * Production needs a real FROST library binding (zk-crypto WASM,
131
+ * frost-core, etc.) injected as `runFrost`. This module only
132
+ * orchestrates the unwrap → bind → dispose sequence, so the FROST
133
+ * library can be swapped without touching the kernel.
134
+ */
135
+ export interface FrostBackend {
136
+ commit(args: {
137
+ share: Uint8Array;
138
+ scheme: FrostScheme;
139
+ }): Promise<Uint8Array>;
140
+ respond(args: {
141
+ readonly share: Uint8Array;
142
+ readonly scheme: FrostScheme;
143
+ readonly preimage: Uint8Array;
144
+ readonly groupCommitment: Uint8Array;
145
+ readonly signerSet: readonly string[];
146
+ readonly lambda: Uint8Array;
147
+ }): Promise<Uint8Array>;
148
+ }
149
+ export interface PasskeyShareUnwrapperOptions {
150
+ readonly capabilities: PasskeyCapabilities;
151
+ readonly authenticator: PasskeyAuthenticatorAdapter;
152
+ readonly envelope: ShareEnvelopePort;
153
+ readonly frost: FrostBackend;
154
+ /**
155
+ * Selects the symmetric-decrypt routine. WebCrypto is the default;
156
+ * tests inject a stub. Returns the raw share bytes.
157
+ */
158
+ readonly aeadDecrypt: (args: {
159
+ readonly key: Uint8Array;
160
+ readonly ciphertext: Uint8Array;
161
+ readonly alg: string;
162
+ readonly salt: Uint8Array;
163
+ }) => Promise<Uint8Array>;
164
+ }
165
+ export declare class PasskeyShareUnwrapper {
166
+ private readonly opts;
167
+ constructor(opts: PasskeyShareUnwrapperOptions);
168
+ /** Capability-driven mode selection. PRF > largeBlob > escrow. */
169
+ pickMode(): ShareUnwrapMode;
170
+ unwrap(req: ShareUnwrapRequest): Promise<FrostDeviceShareHolder>;
171
+ private unwrapShare;
172
+ private bindHolder;
173
+ }
174
+ //# sourceMappingURL=unwrapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unwrapper.d.ts","sourceRoot":"","sources":["../../../src/custody/passkey-share/unwrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEnF,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE9D;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,sDAAsD;IACtD,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;CAC9B;AAED;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C,sEAAsE;IACtE,YAAY,CAAC,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAC9C,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;QAC/B,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;KACtC,CAAC,CAAC;IACH,uEAAuE;IACvE,aAAa,CAAC,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC;QAC/C,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;QAC1B,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;KACtC,CAAC,CAAC;IACH,+DAA+D;IAC/D,cAAc,CAAC,GAAG,EAAE,kBAAkB,GAAG;QAAE,QAAQ,CAAC,KAAK,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+ *
7
+ * - PRF mode (preferred). Uses the WebAuthn PRF extension
8
+ * (CTAP2.1 hmac-secret). The authenticator returns
9
+ * `prfResults.first`, a 32-byte symmetric key that we use to
10
+ * decrypt a server-stored share envelope. No additional Tenzro
11
+ * round trip beyond fetching the wrapped envelope.
12
+ *
13
+ * - largeBlob mode (preferred when prf unavailable but largeBlob is).
14
+ * Reads the wrapped share directly from the passkey credential's
15
+ * `largeBlob` storage; no Tenzro round trip at all (the envelope
16
+ * ships with the passkey).
17
+ *
18
+ * - Escrow mode (fallback for authenticators without PRF/largeBlob —
19
+ * e.g. Apple's iOS 17- platform passkeys). The server holds the
20
+ * share encrypted under a key derived from the assertion + a
21
+ * Tenzro-issued pepper. Per assertion = per pepper, so each
22
+ * unwrap is single-use and rate-limited by the node.
23
+ *
24
+ * Tenzro endpoints (Tenzro implements; wallet kernel only consumes):
25
+ *
26
+ * PRF / largeBlob path:
27
+ * 1. `GET /wallet/share/envelope?credentialId=...&surfaceKey=...`
28
+ * Response: `{wrappedShare, alg, salt}`. `wrappedShare` is the
29
+ * ciphertext over the FROST share `s_i`; the device unwraps it
30
+ * with the PRF result (or the largeBlob blob).
31
+ *
32
+ * Escrow path:
33
+ * 1. `POST /wallet/share/escrow/challenge`
34
+ * Body: `{credentialId, surfaceKey}`.
35
+ * Response: `{nonce, expiresAt}`.
36
+ *
37
+ * 2. `POST /wallet/share/escrow/unwrap`
38
+ * Body: `{credentialId, surfaceKey, assertion, nonce}`.
39
+ * The node verifies the assertion against the registered
40
+ * passkey, then derives the per-assertion pepper and returns
41
+ * `{wrappedShare, pepper}`. The device combines them to
42
+ * recover `s_i`.
43
+ *
44
+ * Both paths are single-use per round (the node binds the response
45
+ * to the FROST `sessionId` once known).
46
+ *
47
+ * The unwrapper *itself* is browser-clean (`fetch` + WebCrypto). The
48
+ * authenticator interactions live above this layer in the host app's
49
+ * WebAuthn glue.
50
+ */
51
+ export class PasskeyShareUnwrapper {
52
+ opts;
53
+ constructor(opts) {
54
+ this.opts = opts;
55
+ }
56
+ /** Capability-driven mode selection. PRF > largeBlob > escrow. */
57
+ pickMode() {
58
+ if (this.opts.capabilities.prf && this.opts.authenticator.prfAssertion) {
59
+ return 'prf';
60
+ }
61
+ if (this.opts.capabilities.largeBlob && this.opts.authenticator.readLargeBlob) {
62
+ return 'large-blob';
63
+ }
64
+ return 'escrow';
65
+ }
66
+ async unwrap(req) {
67
+ const mode = this.pickMode();
68
+ const share = await this.unwrapShare(mode, req);
69
+ return this.bindHolder(share, req.scheme);
70
+ }
71
+ async unwrapShare(mode, req) {
72
+ if (mode === 'prf') {
73
+ const { prfOutput } = await this.opts.authenticator.prfAssertion(req);
74
+ const env = await this.opts.envelope.fetchEnvelope(req);
75
+ return this.opts.aeadDecrypt({
76
+ key: prfOutput,
77
+ ciphertext: env.wrappedShare,
78
+ alg: env.alg,
79
+ salt: env.salt,
80
+ });
81
+ }
82
+ if (mode === 'large-blob') {
83
+ const { blob } = await this.opts.authenticator.readLargeBlob(req);
84
+ // The largeBlob carries the share already decrypted at provision
85
+ // time (the credential acts as the trust boundary). The blob is
86
+ // the share bytes; pass through.
87
+ return blob;
88
+ }
89
+ // escrow
90
+ const challenge = await this.opts.envelope.startEscrow(req);
91
+ const assertion = await this.opts.authenticator.basicAssertion({
92
+ ...req,
93
+ nonce: challenge.nonce,
94
+ });
95
+ const { wrappedShare, pepper } = await this.opts.envelope.finishEscrow({
96
+ ...req,
97
+ assertion,
98
+ nonce: challenge.nonce,
99
+ });
100
+ return this.opts.aeadDecrypt({
101
+ key: pepper,
102
+ ciphertext: wrappedShare,
103
+ alg: 'aes-256-gcm',
104
+ salt: new Uint8Array(0),
105
+ });
106
+ }
107
+ bindHolder(share, scheme) {
108
+ const { frost } = this.opts;
109
+ let disposed = false;
110
+ const wipe = () => {
111
+ if (disposed)
112
+ return;
113
+ share.fill(0);
114
+ disposed = true;
115
+ };
116
+ return {
117
+ scheme,
118
+ async commit() {
119
+ if (disposed)
120
+ throw new Error('share holder already disposed');
121
+ return frost.commit({ share, scheme });
122
+ },
123
+ async respond(args) {
124
+ if (disposed)
125
+ throw new Error('share holder already disposed');
126
+ return frost.respond({ share, scheme, ...args });
127
+ },
128
+ dispose: wipe,
129
+ };
130
+ }
131
+ }
132
+ //# sourceMappingURL=unwrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unwrapper.js","sourceRoot":"","sources":["../../../src/custody/passkey-share/unwrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AA4HH,MAAM,OAAO,qBAAqB;IACH;IAA7B,YAA6B,IAAkC;QAAlC,SAAI,GAAJ,IAAI,CAA8B;IAAG,CAAC;IAEnE,kEAAkE;IAClE,QAAQ;QACN,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,YAAY,EAAE,CAAC;YACvE,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,SAAS,IAAI,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,aAAa,EAAE,CAAC;YAC9E,OAAO,YAAY,CAAC;QACtB,CAAC;QACD,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,GAAuB;QAClC,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC7B,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAChD,OAAO,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IAEO,KAAK,CAAC,WAAW,CAAC,IAAqB,EAAE,GAAuB;QACtE,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;YACnB,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,IAAI,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,CAAC;IAEO,UAAU,CAAC,KAAiB,EAAE,MAAmB;QACvD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;QAC5B,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,MAAM,IAAI,GAAG,GAAG,EAAE;YAChB,IAAI,QAAQ;gBAAE,OAAO;YACrB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACd,QAAQ,GAAG,IAAI,CAAC;QAClB,CAAC,CAAC;QACF,OAAO;YACL,MAAM;YACN,KAAK,CAAC,MAAM;gBACV,IAAI,QAAQ;oBAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;gBAC/D,OAAO,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;YACzC,CAAC;YACD,KAAK,CAAC,OAAO,CAAC,IAAI;gBAChB,IAAI,QAAQ;oBAAE,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;gBAC/D,OAAO,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,CAAC;YACnD,CAAC;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * WebAuthnAuthenticatorAdapter — browser implementation of the
3
+ * `PasskeyAuthenticatorAdapter` port. Wraps `navigator.credentials.get`
4
+ * for the three modes the unwrapper consumes:
5
+ *
6
+ * 1. PRF (preferred). CTAP2.1 hmac-secret exposed through the WebAuthn
7
+ * `prf` extension. Authenticator returns a 32-byte symmetric key
8
+ * via `clientExtensionResults.prf.results.first` that the
9
+ * unwrapper uses to AEAD-decrypt the wrapped FROST share.
10
+ *
11
+ * `prf.eval.first` is set to a stable per-surface salt so the
12
+ * authenticator-derived key is bound to a specific surface key.
13
+ * Per WebAuthn L3 §10.1.4, the salt is hashed inside the
14
+ * authenticator with a domain-separation prefix, so we don't
15
+ * pre-hash here.
16
+ *
17
+ * 2. largeBlob. Read-mode call with `largeBlob: { read: true }`.
18
+ * Returns the wrapped share blob. We don't write to largeBlob
19
+ * here — that happens at provisioning time.
20
+ *
21
+ * 3. Basic assertion (escrow fallback). No extensions. The challenge
22
+ * is the Tenzro-issued nonce so the assertion is replay-bound.
23
+ *
24
+ * All three paths surface the assertion in the same shape the
25
+ * `PasskeyAssertion` port expects (base64url strings — that's what the
26
+ * native browser API hands us already; we just rewrap the buffers).
27
+ *
28
+ * Browser-only. Importing this file in a Node environment is a host
29
+ * configuration mistake — the kernel itself never imports it. Keep all
30
+ * `navigator` access behind methods so the module file itself is safe
31
+ * to import for tree-shaking.
32
+ */
33
+ import type { PasskeyAssertion, PasskeyAuthenticatorAdapter, ShareUnwrapRequest } from './unwrapper.js';
34
+ export interface WebAuthnAdapterConfig {
35
+ /** Relying-party id (`rp.id`) — usually the wallet's apex domain. */
36
+ readonly rpId: string;
37
+ /**
38
+ * Resolves the salt fed to the PRF extension for a given surface key.
39
+ * Default: SHA-256 of `surfaceKeyId` UTF-8 bytes. Hosts wanting a
40
+ * versioned/rotation-safe scheme can override.
41
+ */
42
+ readonly prfSalt?: (req: ShareUnwrapRequest) => Promise<Uint8Array> | Uint8Array;
43
+ /**
44
+ * Override `navigator.credentials` for tests. In production, leave
45
+ * unset — the adapter reads `globalThis.navigator.credentials`.
46
+ */
47
+ readonly credentials?: CredentialsContainer;
48
+ }
49
+ /**
50
+ * Subset of `CredentialsContainer` we exercise. Mirrors the lib.dom
51
+ * shape so passing the real `navigator.credentials` works directly.
52
+ */
53
+ export interface CredentialsContainer {
54
+ get(options: PublicKeyCredentialRequestOptionsLike): Promise<PublicKeyCredentialLike | null>;
55
+ }
56
+ /** Subset of `CredentialRequestOptions` we set. */
57
+ export interface PublicKeyCredentialRequestOptionsLike {
58
+ publicKey: {
59
+ challenge: ArrayBuffer | Uint8Array;
60
+ rpId: string;
61
+ allowCredentials?: ReadonlyArray<{
62
+ id: ArrayBuffer | Uint8Array;
63
+ type: 'public-key';
64
+ }>;
65
+ userVerification?: 'required' | 'preferred' | 'discouraged';
66
+ extensions?: {
67
+ prf?: {
68
+ eval: {
69
+ first: ArrayBuffer | Uint8Array;
70
+ };
71
+ };
72
+ largeBlob?: {
73
+ read?: boolean;
74
+ };
75
+ };
76
+ };
77
+ }
78
+ /** Subset of `PublicKeyCredential` + `AuthenticatorAssertionResponse` shape. */
79
+ export interface PublicKeyCredentialLike {
80
+ rawId: ArrayBuffer;
81
+ response: {
82
+ clientDataJSON: ArrayBuffer;
83
+ authenticatorData: ArrayBuffer;
84
+ signature: ArrayBuffer;
85
+ };
86
+ getClientExtensionResults?(): {
87
+ prf?: {
88
+ results?: {
89
+ first?: ArrayBuffer;
90
+ };
91
+ };
92
+ largeBlob?: {
93
+ blob?: ArrayBuffer;
94
+ };
95
+ };
96
+ }
97
+ export declare class WebAuthnAuthenticatorAdapter implements PasskeyAuthenticatorAdapter {
98
+ #private;
99
+ constructor(cfg: WebAuthnAdapterConfig);
100
+ prfAssertion(req: ShareUnwrapRequest): Promise<{
101
+ prfOutput: Uint8Array;
102
+ assertion: PasskeyAssertion;
103
+ }>;
104
+ readLargeBlob(req: ShareUnwrapRequest): Promise<{
105
+ blob: Uint8Array;
106
+ assertion: PasskeyAssertion;
107
+ }>;
108
+ basicAssertion(req: ShareUnwrapRequest & {
109
+ readonly nonce: string;
110
+ }): Promise<PasskeyAssertion>;
111
+ }
112
+ //# sourceMappingURL=webauthn-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webauthn-adapter.d.ts","sourceRoot":"","sources":["../../../src/custody/passkey-share/webauthn-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,2BAA2B,EAC3B,kBAAkB,EACnB,MAAM,gBAAgB,CAAC;AAExB,MAAM,WAAW,qBAAqB;IACpC,qEAA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WAAW,CAAA;aAAE,CAAA;SAAE,CAAC;QAC5C,SAAS,CAAC,EAAE;YAAE,IAAI,CAAC,EAAE,WAAW,CAAA;SAAE,CAAC;KACpC,CAAC;CACH;AAED,qBAAa,4BAA6B,YAAW,2BAA2B;;gBAGlE,GAAG,EAAE,qBAAqB;IAIhC,YAAY,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC;QACnD,SAAS,EAAE,UAAU,CAAC;QACtB,SAAS,EAAE,gBAAgB,CAAC;KAC7B,CAAC;IA6BI,aAAa,CAAC,GAAG,EAAE,kBAAkB,GAAG,OAAO,CAAC;QACpD,IAAI,EAAE,UAAU,CAAC;QACjB,SAAS,EAAE,gBAAgB,CAAC;KAC7B,CAAC;IAkBI,cAAc,CAClB,GAAG,EAAE,kBAAkB,GAAG;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GACnD,OAAO,CAAC,gBAAgB,CAAC;CAsC7B"}
@@ -0,0 +1,150 @@
1
+ /**
2
+ * WebAuthnAuthenticatorAdapter — browser implementation of the
3
+ * `PasskeyAuthenticatorAdapter` port. Wraps `navigator.credentials.get`
4
+ * for the three modes the unwrapper consumes:
5
+ *
6
+ * 1. PRF (preferred). CTAP2.1 hmac-secret exposed through the WebAuthn
7
+ * `prf` extension. Authenticator returns a 32-byte symmetric key
8
+ * via `clientExtensionResults.prf.results.first` that the
9
+ * unwrapper uses to AEAD-decrypt the wrapped FROST share.
10
+ *
11
+ * `prf.eval.first` is set to a stable per-surface salt so the
12
+ * authenticator-derived key is bound to a specific surface key.
13
+ * Per WebAuthn L3 §10.1.4, the salt is hashed inside the
14
+ * authenticator with a domain-separation prefix, so we don't
15
+ * pre-hash here.
16
+ *
17
+ * 2. largeBlob. Read-mode call with `largeBlob: { read: true }`.
18
+ * Returns the wrapped share blob. We don't write to largeBlob
19
+ * here — that happens at provisioning time.
20
+ *
21
+ * 3. Basic assertion (escrow fallback). No extensions. The challenge
22
+ * is the Tenzro-issued nonce so the assertion is replay-bound.
23
+ *
24
+ * All three paths surface the assertion in the same shape the
25
+ * `PasskeyAssertion` port expects (base64url strings — that's what the
26
+ * native browser API hands us already; we just rewrap the buffers).
27
+ *
28
+ * Browser-only. Importing this file in a Node environment is a host
29
+ * configuration mistake — the kernel itself never imports it. Keep all
30
+ * `navigator` access behind methods so the module file itself is safe
31
+ * to import for tree-shaking.
32
+ */
33
+ export class WebAuthnAuthenticatorAdapter {
34
+ #cfg;
35
+ constructor(cfg) {
36
+ this.#cfg = cfg;
37
+ }
38
+ async prfAssertion(req) {
39
+ const salt = await this.#prfSalt(req);
40
+ // PRF binds to an authenticator-derived hmac key, so the WebAuthn
41
+ // challenge itself is independent of the salt. Use 32 random bytes
42
+ // to keep the assertion fresh; the unwrapper wraps the round in a
43
+ // server-issued envelope fetch so replay is bounded there.
44
+ const challenge = randomBytes(32);
45
+ const cred = await this.#get({
46
+ publicKey: {
47
+ challenge,
48
+ rpId: this.#cfg.rpId,
49
+ allowCredentials: [{ id: base64UrlDecode(req.credentialId), type: 'public-key' }],
50
+ userVerification: 'required',
51
+ extensions: { prf: { eval: { first: salt } } },
52
+ },
53
+ });
54
+ const ext = cred.getClientExtensionResults?.();
55
+ const first = ext?.prf?.results?.first;
56
+ if (!first) {
57
+ throw new Error('WebAuthn PRF unavailable on this credential — caller must fall back to escrow');
58
+ }
59
+ return {
60
+ prfOutput: new Uint8Array(first),
61
+ assertion: toAssertion(cred),
62
+ };
63
+ }
64
+ async readLargeBlob(req) {
65
+ const cred = await this.#get({
66
+ publicKey: {
67
+ challenge: randomBytes(32),
68
+ rpId: this.#cfg.rpId,
69
+ allowCredentials: [{ id: base64UrlDecode(req.credentialId), type: 'public-key' }],
70
+ userVerification: 'required',
71
+ extensions: { largeBlob: { read: true } },
72
+ },
73
+ });
74
+ const ext = cred.getClientExtensionResults?.();
75
+ const blob = ext?.largeBlob?.blob;
76
+ if (!blob) {
77
+ throw new Error('WebAuthn largeBlob read returned empty — caller must fall back to escrow');
78
+ }
79
+ return { blob: new Uint8Array(blob), assertion: toAssertion(cred) };
80
+ }
81
+ async basicAssertion(req) {
82
+ // Escrow path: server-issued nonce becomes the WebAuthn challenge,
83
+ // so the resulting signature is replay-bound to that nonce.
84
+ const cred = await this.#get({
85
+ publicKey: {
86
+ challenge: base64UrlDecode(req.nonce),
87
+ rpId: this.#cfg.rpId,
88
+ allowCredentials: [{ id: base64UrlDecode(req.credentialId), type: 'public-key' }],
89
+ userVerification: 'required',
90
+ },
91
+ });
92
+ return toAssertion(cred);
93
+ }
94
+ // --- internals ---
95
+ async #get(options) {
96
+ const creds = this.#cfg.credentials ??
97
+ globalThis.navigator
98
+ ?.credentials;
99
+ if (!creds) {
100
+ throw new Error('navigator.credentials unavailable — WebAuthnAuthenticatorAdapter requires a browser context');
101
+ }
102
+ const cred = await creds.get(options);
103
+ if (!cred)
104
+ throw new Error('WebAuthn assertion cancelled or returned null');
105
+ return cred;
106
+ }
107
+ async #prfSalt(req) {
108
+ if (this.#cfg.prfSalt) {
109
+ const out = await this.#cfg.prfSalt(req);
110
+ return out;
111
+ }
112
+ return defaultPrfSalt(req.surfaceKeyId);
113
+ }
114
+ }
115
+ // ─── helpers ──────────────────────────────────────────────────────────────
116
+ function toAssertion(cred) {
117
+ return {
118
+ credentialId: base64UrlEncode(new Uint8Array(cred.rawId)),
119
+ clientDataJson: base64UrlEncode(new Uint8Array(cred.response.clientDataJSON)),
120
+ authenticatorData: base64UrlEncode(new Uint8Array(cred.response.authenticatorData)),
121
+ signature: base64UrlEncode(new Uint8Array(cred.response.signature)),
122
+ };
123
+ }
124
+ async function defaultPrfSalt(surfaceKeyId) {
125
+ const enc = new TextEncoder().encode(surfaceKeyId);
126
+ const digest = await crypto.subtle.digest('SHA-256', enc);
127
+ return new Uint8Array(digest);
128
+ }
129
+ function randomBytes(n) {
130
+ const out = new Uint8Array(n);
131
+ crypto.getRandomValues(out);
132
+ return out;
133
+ }
134
+ // base64url (RFC 4648 §5) — what WebAuthn naturally hands back.
135
+ function base64UrlEncode(bytes) {
136
+ let s = '';
137
+ for (let i = 0; i < bytes.length; i++)
138
+ s += String.fromCharCode(bytes[i]);
139
+ return btoa(s).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '');
140
+ }
141
+ function base64UrlDecode(b64u) {
142
+ const pad = b64u.length % 4 === 0 ? '' : '='.repeat(4 - (b64u.length % 4));
143
+ const b64 = b64u.replace(/-/g, '+').replace(/_/g, '/') + pad;
144
+ const bin = atob(b64);
145
+ const out = new Uint8Array(bin.length);
146
+ for (let i = 0; i < bin.length; i++)
147
+ out[i] = bin.charCodeAt(i);
148
+ return out;
149
+ }
150
+ //# sourceMappingURL=webauthn-adapter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webauthn-adapter.js","sourceRoot":"","sources":["../../../src/custody/passkey-share/webauthn-adapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AA+DH,MAAM,OAAO,4BAA4B;IAC9B,IAAI,CAAwB;IAErC,YAAY,GAA0B;QACpC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,GAAuB;QAIxC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACtC,kEAAkE;QAClE,mEAAmE;QACnE,kEAAkE;QAClE,2DAA2D;QAC3D,MAAM,SAAS,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;QAClC,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC;YAC3B,SAAS,EAAE;gBACT,SAAS;gBACT,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI;gBACpB,gBAAgB,EAAE,CAAC,EAAE,EAAE,EAAE,eAAe,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;gBACjF,gBAAgB,EAAE,UAAU;gBAC5B,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G,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAC5E,CAAC;AAED,SAAS,eAAe,CAAC,IAAY;IACnC,MAAM,GAAG,GAAG,IAAI,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;IAC3E,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC;IAC7D,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACtB,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE;QAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAChE,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Canonical wire identifier for a `SurfaceKey`. Used as the
3
+ * `surfaceKey` field on Tenzro custody endpoint payloads
4
+ * (`/wallet/frost/*`, `/wallet/mldsa/*`, etc.) so the node can find
5
+ * the correct share-set without the wallet shipping public-key bytes
6
+ * inline on every request.
7
+ *
8
+ * Convention:
9
+ * - tenzro-native / svm-on-tenzro: `{surface}:{address}`
10
+ * - evm-on-tenzro: `{surface}:{address}` (lower-case hex)
11
+ * - canton-{internal,external}: `{surface}:{partyId}`
12
+ */
13
+ import type { SurfaceKey } from '../types/identity.js';
14
+ export declare function surfaceKeyId(key: SurfaceKey): string;
15
+ //# sourceMappingURL=surface-key-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surface-key-id.d.ts","sourceRoot":"","sources":["../../src/custody/surface-key-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,wBAAgB,YAAY,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAWpD"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Canonical wire identifier for a `SurfaceKey`. Used as the
3
+ * `surfaceKey` field on Tenzro custody endpoint payloads
4
+ * (`/wallet/frost/*`, `/wallet/mldsa/*`, etc.) so the node can find
5
+ * the correct share-set without the wallet shipping public-key bytes
6
+ * inline on every request.
7
+ *
8
+ * Convention:
9
+ * - tenzro-native / svm-on-tenzro: `{surface}:{address}`
10
+ * - evm-on-tenzro: `{surface}:{address}` (lower-case hex)
11
+ * - canton-{internal,external}: `{surface}:{partyId}`
12
+ */
13
+ export function surfaceKeyId(key) {
14
+ switch (key.surface) {
15
+ case 'tenzro-native':
16
+ case 'svm-on-tenzro':
17
+ return `${key.surface}:${key.address}`;
18
+ case 'evm-on-tenzro':
19
+ return `${key.surface}:${key.address.toLowerCase()}`;
20
+ case 'canton-internal':
21
+ case 'canton-external':
22
+ return `${key.surface}:${key.partyId}`;
23
+ }
24
+ }
25
+ //# sourceMappingURL=surface-key-id.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"surface-key-id.js","sourceRoot":"","sources":["../../src/custody/surface-key-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,MAAM,UAAU,YAAY,CAAC,GAAe;IAC1C,QAAQ,GAAG,CAAC,OAAO,EAAE,CAAC;QACpB,KAAK,eAAe,CAAC;QACrB,KAAK,eAAe;YAClB,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QACzC,KAAK,eAAe;YAClB,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC;QACvD,KAAK,iBAAiB,CAAC;QACvB,KAAK,iBAAiB;YACpB,OAAO,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;IAC3C,CAAC;AACH,CAAC"}