@primuslabs/fhetransform-sdk 0.4.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 (302) hide show
  1. package/README.md +198 -0
  2. package/dist/abis/acl.abi.d.ts +379 -0
  3. package/dist/abis/acl.abi.js +495 -0
  4. package/dist/abis/acl.abi.js.map +1 -0
  5. package/dist/abis/alphatrion_reward.abi.d.ts +407 -0
  6. package/dist/abis/alphatrion_reward.abi.js +532 -0
  7. package/dist/abis/alphatrion_reward.abi.js.map +1 -0
  8. package/dist/abis/ciphertext_digests.abi.d.ts +336 -0
  9. package/dist/abis/ciphertext_digests.abi.js +444 -0
  10. package/dist/abis/ciphertext_digests.abi.js.map +1 -0
  11. package/dist/abis/ciphertext_verification.abi.d.ts +637 -0
  12. package/dist/abis/ciphertext_verification.abi.js +830 -0
  13. package/dist/abis/ciphertext_verification.abi.js.map +1 -0
  14. package/dist/abis/convert_token.abi.d.ts +922 -0
  15. package/dist/abis/convert_token.abi.js +1208 -0
  16. package/dist/abis/convert_token.abi.js.map +1 -0
  17. package/dist/abis/decryption.abi.d.ts +956 -0
  18. package/dist/abis/decryption.abi.js +1244 -0
  19. package/dist/abis/decryption.abi.js.map +1 -0
  20. package/dist/abis/erc20.abi.d.ts +265 -0
  21. package/dist/abis/erc20.abi.js +350 -0
  22. package/dist/abis/erc20.abi.js.map +1 -0
  23. package/dist/abis/fhe_executor.abi.d.ts +1535 -0
  24. package/dist/abis/fhe_executor.abi.js +1962 -0
  25. package/dist/abis/fhe_executor.abi.js.map +1 -0
  26. package/dist/abis/space_bridge_config.abi.d.ts +792 -0
  27. package/dist/abis/space_bridge_config.abi.js +1032 -0
  28. package/dist/abis/space_bridge_config.abi.js.map +1 -0
  29. package/dist/abis/token.abi.d.ts +630 -0
  30. package/dist/abis/token.abi.js +828 -0
  31. package/dist/abis/token.abi.js.map +1 -0
  32. package/dist/cli/eusdc.d.ts +2 -0
  33. package/dist/cli/eusdc.js +41 -0
  34. package/dist/cli/eusdc.js.map +1 -0
  35. package/dist/contract/callbacks.d.ts +59 -0
  36. package/dist/contract/callbacks.js +2 -0
  37. package/dist/contract/callbacks.js.map +1 -0
  38. package/dist/contract/convert-token.d.ts +107 -0
  39. package/dist/contract/convert-token.js +249 -0
  40. package/dist/contract/convert-token.js.map +1 -0
  41. package/dist/contract/token.d.ts +167 -0
  42. package/dist/contract/token.js +404 -0
  43. package/dist/contract/token.js.map +1 -0
  44. package/dist/contract/transaction.d.ts +29 -0
  45. package/dist/contract/transaction.js +2 -0
  46. package/dist/contract/transaction.js.map +1 -0
  47. package/dist/core/address.d.ts +118 -0
  48. package/dist/core/address.js +200 -0
  49. package/dist/core/address.js.map +1 -0
  50. package/dist/core/auth.d.ts +68 -0
  51. package/dist/core/auth.js +58 -0
  52. package/dist/core/auth.js.map +1 -0
  53. package/dist/core/bytes.d.ts +48 -0
  54. package/dist/core/bytes.js +117 -0
  55. package/dist/core/bytes.js.map +1 -0
  56. package/dist/core/cache-manager.d.ts +138 -0
  57. package/dist/core/cache-manager.js +440 -0
  58. package/dist/core/cache-manager.js.map +1 -0
  59. package/dist/core/chain.d.ts +41 -0
  60. package/dist/core/chain.js +59 -0
  61. package/dist/core/chain.js.map +1 -0
  62. package/dist/core/constants.d.ts +24 -0
  63. package/dist/core/constants.js +25 -0
  64. package/dist/core/constants.js.map +1 -0
  65. package/dist/core/error.d.ts +2 -0
  66. package/dist/core/error.js +14 -0
  67. package/dist/core/error.js.map +1 -0
  68. package/dist/core/errors/error-catalog.d.ts +29 -0
  69. package/dist/core/errors/error-catalog.js +84 -0
  70. package/dist/core/errors/error-catalog.js.map +1 -0
  71. package/dist/core/errors/error-codes.d.ts +52 -0
  72. package/dist/core/errors/error-codes.js +61 -0
  73. package/dist/core/errors/error-codes.js.map +1 -0
  74. package/dist/core/errors/error-utils.d.ts +27 -0
  75. package/dist/core/errors/error-utils.js +110 -0
  76. package/dist/core/errors/error-utils.js.map +1 -0
  77. package/dist/core/errors/fhe-error.d.ts +98 -0
  78. package/dist/core/errors/fhe-error.js +190 -0
  79. package/dist/core/errors/fhe-error.js.map +1 -0
  80. package/dist/core/errors/index.d.ts +4 -0
  81. package/dist/core/errors/index.js +5 -0
  82. package/dist/core/errors/index.js.map +1 -0
  83. package/dist/core/estimate.d.ts +39 -0
  84. package/dist/core/estimate.js +111 -0
  85. package/dist/core/estimate.js.map +1 -0
  86. package/dist/core/event.d.ts +212 -0
  87. package/dist/core/event.js +42 -0
  88. package/dist/core/event.js.map +1 -0
  89. package/dist/core/fhe-type.d.ts +75 -0
  90. package/dist/core/fhe-type.js +115 -0
  91. package/dist/core/fhe-type.js.map +1 -0
  92. package/dist/core/fhe.d.ts +11 -0
  93. package/dist/core/fhe.js +23 -0
  94. package/dist/core/fhe.js.map +1 -0
  95. package/dist/core/handle.d.ts +42 -0
  96. package/dist/core/handle.js +99 -0
  97. package/dist/core/handle.js.map +1 -0
  98. package/dist/core/json-utils.d.ts +18 -0
  99. package/dist/core/json-utils.js +37 -0
  100. package/dist/core/json-utils.js.map +1 -0
  101. package/dist/core/kms.d.ts +42 -0
  102. package/dist/core/kms.js +70 -0
  103. package/dist/core/kms.js.map +1 -0
  104. package/dist/core/logger.d.ts +3 -0
  105. package/dist/core/logger.js +11 -0
  106. package/dist/core/logger.js.map +1 -0
  107. package/dist/core/pretty-print.d.ts +18 -0
  108. package/dist/core/pretty-print.js +84 -0
  109. package/dist/core/pretty-print.js.map +1 -0
  110. package/dist/core/primitives.d.ts +22 -0
  111. package/dist/core/primitives.js +2 -0
  112. package/dist/core/primitives.js.map +1 -0
  113. package/dist/core/retryable-handler.d.ts +74 -0
  114. package/dist/core/retryable-handler.js +227 -0
  115. package/dist/core/retryable-handler.js.map +1 -0
  116. package/dist/core/signer-address-info.d.ts +15 -0
  117. package/dist/core/signer-address-info.js +33 -0
  118. package/dist/core/signer-address-info.js.map +1 -0
  119. package/dist/core/string.d.ts +28 -0
  120. package/dist/core/string.js +33 -0
  121. package/dist/core/string.js.map +1 -0
  122. package/dist/core/swallow.d.ts +23 -0
  123. package/dist/core/swallow.js +37 -0
  124. package/dist/core/swallow.js.map +1 -0
  125. package/dist/core/system-contract-info.d.ts +17 -0
  126. package/dist/core/system-contract-info.js +41 -0
  127. package/dist/core/system-contract-info.js.map +1 -0
  128. package/dist/core/ttl-cache.d.ts +81 -0
  129. package/dist/core/ttl-cache.js +113 -0
  130. package/dist/core/ttl-cache.js.map +1 -0
  131. package/dist/core/tx-error-parser.d.ts +40 -0
  132. package/dist/core/tx-error-parser.js +83 -0
  133. package/dist/core/tx-error-parser.js.map +1 -0
  134. package/dist/core/utils.d.ts +62 -0
  135. package/dist/core/utils.js +143 -0
  136. package/dist/core/utils.js.map +1 -0
  137. package/dist/index.d.ts +40 -0
  138. package/dist/index.js +48 -0
  139. package/dist/index.js.map +1 -0
  140. package/dist/jazz/encrypt-key-p.d.ts +65 -0
  141. package/dist/jazz/encrypt-key-p.js +283 -0
  142. package/dist/jazz/encrypt-key-p.js.map +1 -0
  143. package/dist/jazz/encrypt-p.d.ts +82 -0
  144. package/dist/jazz/encrypt-p.js +139 -0
  145. package/dist/jazz/encrypt-p.js.map +1 -0
  146. package/dist/jazz/encrypt.d.ts +58 -0
  147. package/dist/jazz/encrypt.js +155 -0
  148. package/dist/jazz/encrypt.js.map +1 -0
  149. package/dist/jazz/input-proof-p.d.ts +122 -0
  150. package/dist/jazz/input-proof-p.js +265 -0
  151. package/dist/jazz/input-proof-p.js.map +1 -0
  152. package/dist/jazz/jazz-client-i.d.ts +16 -0
  153. package/dist/jazz/jazz-client-i.js +2 -0
  154. package/dist/jazz/jazz-client-i.js.map +1 -0
  155. package/dist/jazz/jazz-client.d.ts +18 -0
  156. package/dist/jazz/jazz-client.js +24 -0
  157. package/dist/jazz/jazz-client.js.map +1 -0
  158. package/dist/jazz/key-pair.d.ts +50 -0
  159. package/dist/jazz/key-pair.js +166 -0
  160. package/dist/jazz/key-pair.js.map +1 -0
  161. package/dist/jazz/mock/fake.d.ts +3 -0
  162. package/dist/jazz/mock/fake.js +23 -0
  163. package/dist/jazz/mock/fake.js.map +1 -0
  164. package/dist/jazz/mock/fetch-input-proof.d.ts +4 -0
  165. package/dist/jazz/mock/fetch-input-proof.js +63 -0
  166. package/dist/jazz/mock/fetch-input-proof.js.map +1 -0
  167. package/dist/jazz/mock/fetch-key-url.d.ts +3 -0
  168. package/dist/jazz/mock/fetch-key-url.js +15 -0
  169. package/dist/jazz/mock/fetch-key-url.js.map +1 -0
  170. package/dist/jazz/mock/fetch-public-decrypt.d.ts +3 -0
  171. package/dist/jazz/mock/fetch-public-decrypt.js +81 -0
  172. package/dist/jazz/mock/fetch-public-decrypt.js.map +1 -0
  173. package/dist/jazz/mock/fetch-user-decrypt.d.ts +4 -0
  174. package/dist/jazz/mock/fetch-user-decrypt.js +174 -0
  175. package/dist/jazz/mock/fetch-user-decrypt.js.map +1 -0
  176. package/dist/jazz/module/fetch-input-proof.d.ts +19 -0
  177. package/dist/jazz/module/fetch-input-proof.js +72 -0
  178. package/dist/jazz/module/fetch-input-proof.js.map +1 -0
  179. package/dist/jazz/module/fetch-key-url.d.ts +17 -0
  180. package/dist/jazz/module/fetch-key-url.js +46 -0
  181. package/dist/jazz/module/fetch-key-url.js.map +1 -0
  182. package/dist/jazz/module/fetch-public-decrypt.d.ts +19 -0
  183. package/dist/jazz/module/fetch-public-decrypt.js +65 -0
  184. package/dist/jazz/module/fetch-public-decrypt.js.map +1 -0
  185. package/dist/jazz/module/fetch-user-decrypt.d.ts +19 -0
  186. package/dist/jazz/module/fetch-user-decrypt.js +109 -0
  187. package/dist/jazz/module/fetch-user-decrypt.js.map +1 -0
  188. package/dist/jazz/module/jazz-async-request.d.ts +102 -0
  189. package/dist/jazz/module/jazz-async-request.js +515 -0
  190. package/dist/jazz/module/jazz-async-request.js.map +1 -0
  191. package/dist/jazz/module/jazz-p.d.ts +61 -0
  192. package/dist/jazz/module/jazz-p.js +33 -0
  193. package/dist/jazz/module/jazz-p.js.map +1 -0
  194. package/dist/jazz/module/s3-download.d.ts +85 -0
  195. package/dist/jazz/module/s3-download.js +293 -0
  196. package/dist/jazz/module/s3-download.js.map +1 -0
  197. package/dist/jazz/permit.d.ts +200 -0
  198. package/dist/jazz/permit.js +319 -0
  199. package/dist/jazz/permit.js.map +1 -0
  200. package/dist/jazz/public-decrypt-p.d.ts +96 -0
  201. package/dist/jazz/public-decrypt-p.js +258 -0
  202. package/dist/jazz/public-decrypt-p.js.map +1 -0
  203. package/dist/jazz/public-decrypt.d.ts +48 -0
  204. package/dist/jazz/public-decrypt.js +156 -0
  205. package/dist/jazz/public-decrypt.js.map +1 -0
  206. package/dist/jazz/read-contract.d.ts +81 -0
  207. package/dist/jazz/read-contract.js +125 -0
  208. package/dist/jazz/read-contract.js.map +1 -0
  209. package/dist/jazz/types/common.d.ts +17 -0
  210. package/dist/jazz/types/common.js +2 -0
  211. package/dist/jazz/types/common.js.map +1 -0
  212. package/dist/jazz/types/input-proof.d.ts +76 -0
  213. package/dist/jazz/types/input-proof.js +2 -0
  214. package/dist/jazz/types/input-proof.js.map +1 -0
  215. package/dist/jazz/types/key-url.d.ts +68 -0
  216. package/dist/jazz/types/key-url.js +5 -0
  217. package/dist/jazz/types/key-url.js.map +1 -0
  218. package/dist/jazz/types/public-decrypt.d.ts +61 -0
  219. package/dist/jazz/types/public-decrypt.js +2 -0
  220. package/dist/jazz/types/public-decrypt.js.map +1 -0
  221. package/dist/jazz/types/user-decrypt.d.ts +123 -0
  222. package/dist/jazz/types/user-decrypt.js +2 -0
  223. package/dist/jazz/types/user-decrypt.js.map +1 -0
  224. package/dist/jazz/user-decrypt-p.d.ts +111 -0
  225. package/dist/jazz/user-decrypt-p.js +280 -0
  226. package/dist/jazz/user-decrypt-p.js.map +1 -0
  227. package/dist/jazz/user-decrypt.d.ts +74 -0
  228. package/dist/jazz/user-decrypt.js +143 -0
  229. package/dist/jazz/user-decrypt.js.map +1 -0
  230. package/dist/native/fhe-api.js +5959 -0
  231. package/dist/native/fhe-api.node.cjs +6167 -0
  232. package/dist/native/fhe-api.node.worker.cjs +210 -0
  233. package/dist/native/fhe-api.wasm +0 -0
  234. package/dist/native/fhe-api.worker.js +164 -0
  235. package/dist/native/kms/node/kms_lib.d.ts +38 -0
  236. package/dist/native/kms/node/kms_lib.js +356 -0
  237. package/dist/native/kms/node/kms_lib_bg.wasm +0 -0
  238. package/dist/native/kms/node/kms_lib_bg.wasm.d.ts +21 -0
  239. package/dist/native/kms/node/package.json +11 -0
  240. package/dist/native/kms/web/kms_lib.d.ts +84 -0
  241. package/dist/native/kms/web/kms_lib.js +443 -0
  242. package/dist/native/kms/web/kms_lib_bg.wasm +0 -0
  243. package/dist/native/kms/web/kms_lib_bg.wasm.d.ts +21 -0
  244. package/dist/native/kms/web/package.json +15 -0
  245. package/dist/runtime/browser.d.ts +36 -0
  246. package/dist/runtime/browser.js +115 -0
  247. package/dist/runtime/browser.js.map +1 -0
  248. package/dist/runtime/node.d.ts +30 -0
  249. package/dist/runtime/node.js +95 -0
  250. package/dist/runtime/node.js.map +1 -0
  251. package/dist/sdk/fhetransform-sdk-b.d.ts +102 -0
  252. package/dist/sdk/fhetransform-sdk-b.js +294 -0
  253. package/dist/sdk/fhetransform-sdk-b.js.map +1 -0
  254. package/dist/sdk/fhetransform-sdk.d.ts +87 -0
  255. package/dist/sdk/fhetransform-sdk.js +135 -0
  256. package/dist/sdk/fhetransform-sdk.js.map +1 -0
  257. package/dist/sdk/jazz-service.d.ts +13 -0
  258. package/dist/sdk/jazz-service.js +58 -0
  259. package/dist/sdk/jazz-service.js.map +1 -0
  260. package/dist/sdk/permit-service.d.ts +45 -0
  261. package/dist/sdk/permit-service.js +144 -0
  262. package/dist/sdk/permit-service.js.map +1 -0
  263. package/dist/wasm/fhe-wasm-client.d.ts +19 -0
  264. package/dist/wasm/fhe-wasm-client.js +23 -0
  265. package/dist/wasm/fhe-wasm-client.js.map +1 -0
  266. package/dist/wasm/fhe-wasm-module.d.ts +24 -0
  267. package/dist/wasm/fhe-wasm-module.js +141 -0
  268. package/dist/wasm/fhe-wasm-module.js.map +1 -0
  269. package/dist/wasm/fhe-wasm-type.d.ts +59 -0
  270. package/dist/wasm/fhe-wasm-type.js +244 -0
  271. package/dist/wasm/fhe-wasm-type.js.map +1 -0
  272. package/dist/wasm/wasm-loader.browser.d.ts +21 -0
  273. package/dist/wasm/wasm-loader.browser.js +143 -0
  274. package/dist/wasm/wasm-loader.browser.js.map +1 -0
  275. package/dist/wasm/wasm-loader.node.d.ts +24 -0
  276. package/dist/wasm/wasm-loader.node.js +114 -0
  277. package/dist/wasm/wasm-loader.node.js.map +1 -0
  278. package/dist/wasm/worker-client.browser.d.ts +6 -0
  279. package/dist/wasm/worker-client.browser.js +21 -0
  280. package/dist/wasm/worker-client.browser.js.map +1 -0
  281. package/dist/wasm/worker-client.d.ts +34 -0
  282. package/dist/wasm/worker-client.js +160 -0
  283. package/dist/wasm/worker-client.js.map +1 -0
  284. package/dist/wasm/worker-client.node.d.ts +6 -0
  285. package/dist/wasm/worker-client.node.js +20 -0
  286. package/dist/wasm/worker-client.node.js.map +1 -0
  287. package/dist/wasm/worker-message.d.ts +61 -0
  288. package/dist/wasm/worker-message.js +2 -0
  289. package/dist/wasm/worker-message.js.map +1 -0
  290. package/dist/wasm/worker-transport.browser.d.ts +15 -0
  291. package/dist/wasm/worker-transport.browser.js +35 -0
  292. package/dist/wasm/worker-transport.browser.js.map +1 -0
  293. package/dist/wasm/worker-transport.d.ts +6 -0
  294. package/dist/wasm/worker-transport.js +2 -0
  295. package/dist/wasm/worker-transport.js.map +1 -0
  296. package/dist/wasm/worker-transport.node.d.ts +17 -0
  297. package/dist/wasm/worker-transport.node.js +39 -0
  298. package/dist/wasm/worker-transport.node.js.map +1 -0
  299. package/dist/wasm/worker.d.ts +1 -0
  300. package/dist/wasm/worker.js +69 -0
  301. package/dist/wasm/worker.js.map +1 -0
  302. package/package.json +81 -0
@@ -0,0 +1,174 @@
1
+ import { concat, ethers, getBytes, keccak256 } from "ethers";
2
+ import { remove0x } from "../../core/string.js";
3
+ import { Wallet } from "ethers";
4
+ import { kms_combine_secret, kms_signcrypt_ex, kms_split_secret, kms_unsigncrypt } from "../../core/kms.js";
5
+ import { bytesToHex, fromHexString } from "../../core/bytes.js";
6
+ import { fakeAbiEncodeClearValues } from "./fake.js";
7
+ import { logger } from "../../core/logger.js";
8
+ import { formatValue } from "../../core/pretty-print.js";
9
+ const userDecryptAbi = [
10
+ {
11
+ "inputs": [
12
+ {
13
+ "internalType": "address[]",
14
+ "name": "contractAddresses",
15
+ "type": "address[]"
16
+ },
17
+ {
18
+ "internalType": "uint256",
19
+ "name": "startTimestamp",
20
+ "type": "uint256"
21
+ },
22
+ {
23
+ "internalType": "uint256",
24
+ "name": "durationDays",
25
+ "type": "uint256"
26
+ },
27
+ {
28
+ "internalType": "address",
29
+ "name": "userAddress",
30
+ "type": "address"
31
+ },
32
+ {
33
+ "internalType": "bytes",
34
+ "name": "userSignature",
35
+ "type": "bytes"
36
+ },
37
+ {
38
+ "internalType": "bytes32[]",
39
+ "name": "ctHandles",
40
+ "type": "bytes32[]"
41
+ },
42
+ {
43
+ "internalType": "bytes",
44
+ "name": "publicKey",
45
+ "type": "bytes"
46
+ },
47
+ {
48
+ "internalType": "bytes",
49
+ "name": "userDecryptedData",
50
+ "type": "bytes"
51
+ }
52
+ ],
53
+ "name": "userDecryptMock",
54
+ "outputs": [
55
+ {
56
+ "internalType": "bytes32",
57
+ "name": "digest",
58
+ "type": "bytes32"
59
+ },
60
+ {
61
+ "internalType": "address[]",
62
+ "name": "signers",
63
+ "type": "address[]"
64
+ },
65
+ {
66
+ "internalType": "uint256",
67
+ "name": "threshold",
68
+ "type": "uint256"
69
+ },
70
+ {
71
+ "internalType": "bytes",
72
+ "name": "extraData",
73
+ "type": "bytes"
74
+ }
75
+ ],
76
+ "stateMutability": "view",
77
+ "type": "function"
78
+ },
79
+ ];
80
+ async function getShares(value) {
81
+ const message = fromHexString(value);
82
+ const shares = kms_split_secret(message, 3, 2);
83
+ logger.trace('[getShares] Secret shares created', { shareCount: shares.length });
84
+ const recovered = kms_combine_secret([
85
+ shares[0],
86
+ shares[1]
87
+ ]);
88
+ logger.trace('[getShares] Shares combined', { recoveredSize: recovered.length });
89
+ return shares;
90
+ }
91
+ async function getEncryptedShare(keypair, message) {
92
+ const encoder = new TextEncoder();
93
+ const decoder = new TextDecoder();
94
+ // Generate ML-KEM key pair
95
+ const sk = fromHexString(keypair.privateKey);
96
+ const pk = fromHexString(keypair.publicKey);
97
+ logger.debug("key generated:", "sk length:", sk.length, "pk length:", pk.length);
98
+ // 2. Ethereum signer
99
+ const wallet = new Wallet("0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80");
100
+ const address = getBytes(wallet.address);
101
+ logger.debug("address:", wallet.address);
102
+ // 4. Build signed data
103
+ // keccak256(message || address || encryption_public_key)
104
+ const digest = keccak256(concat([message, address, pk]));
105
+ // 5. Sign digest
106
+ // Returns: r + s + v
107
+ const signature = await wallet.signingKey.sign(digest);
108
+ // ethers returns: {r,s,yParity}
109
+ const sigBytes = getBytes(signature.serialized);
110
+ logger.debug("signature length:", sigBytes.length);
111
+ // 65
112
+ // 6. Signcrypt
113
+ const ciphertext = kms_signcrypt_ex(message, address, sigBytes, pk);
114
+ logger.debug("ciphertext:", ciphertext.length);
115
+ // 7. Unsigncrypt
116
+ const plaintext = kms_unsigncrypt(ciphertext, address, sk, pk);
117
+ const result = decoder.decode(plaintext);
118
+ logger.trace('[getEncryptedShare] result', result);
119
+ logger.trace('[getEncryptedShare] plaintext', plaintext);
120
+ logger.debug("✅ ML-KEM signcrypt test passed");
121
+ return ciphertext;
122
+ }
123
+ async function getEncryptedShares(keypair, value) {
124
+ const shares = await getShares(value);
125
+ const encryptDatas = [];
126
+ for (const share of shares) {
127
+ const encryptData = await getEncryptedShare(keypair, share);
128
+ encryptDatas.push(bytesToHex(encryptData));
129
+ }
130
+ return encryptDatas;
131
+ }
132
+ export async function fetchUserDecrypt(client, parameters, keypair) {
133
+ logger.debug(() => ['[fetchUserDecrypt] Enter', formatValue({ parameters })]);
134
+ const { options, payload } = parameters;
135
+ const pairs = payload.handleContractPairs;
136
+ const contractAddresses = payload.kmsDecryptEip712Message.contractAddresses;
137
+ const pairs2 = pairs.map((p) => ({
138
+ ctHandle: p.handle,
139
+ contractAddress: p.contractAddress,
140
+ }));
141
+ const ctHandles = pairs.map((p) => p.handle);
142
+ logger.debug("[fetchUserDecrypt] Mock user decrypt flow started");
143
+ const { kmsDecryptEip712Message, kmsDecryptEip712Signer, kmsDecryptEip712Signature } = payload;
144
+ const sysContractInfo = await client.sdk.getSystemContractInfo();
145
+ const provider = await client.sdk.requireProvider();
146
+ const contract = new ethers.Contract(sysContractInfo.decryptionContractAddress, userDecryptAbi, provider);
147
+ const abiEncodeClearValues = fakeAbiEncodeClearValues([...ctHandles]);
148
+ const userDecryptedDatas = await getEncryptedShares(keypair, abiEncodeClearValues);
149
+ const result = [];
150
+ for (const userDecryptedData of userDecryptedDatas) {
151
+ const res = await contract.userDecryptMock(kmsDecryptEip712Message.contractAddresses, kmsDecryptEip712Message.startTimestamp, kmsDecryptEip712Message.durationDays, kmsDecryptEip712Signer, kmsDecryptEip712Signature, ctHandles, kmsDecryptEip712Message.publicKey, userDecryptedData);
152
+ logger.debug('[fetchUserDecrypt] userDecryptMock result', res);
153
+ const digest = res[0];
154
+ const signersAddress = res[1];
155
+ const threshold = res[2];
156
+ const extraData = res[3];
157
+ {
158
+ const privateKey = "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80";
159
+ const signingKey = new ethers.SigningKey(privateKey);
160
+ const signature = signingKey.sign(digest);
161
+ logger.debug('[fetchUserDecrypt] Signature generated', signature);
162
+ const compact = ethers.Signature.from(signature).serialized;
163
+ logger.debug('[fetchUserDecrypt] Compact signature generated', compact);
164
+ result.push({
165
+ signature: remove0x(compact),
166
+ payload: remove0x(userDecryptedData),
167
+ extraData: remove0x(extraData)
168
+ });
169
+ }
170
+ }
171
+ logger.debug("[fetchUserDecrypt] Mock user decrypt shares built", { result });
172
+ return result;
173
+ }
174
+ //# sourceMappingURL=fetch-user-decrypt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-user-decrypt.js","sourceRoot":"","sources":["../../../src/jazz/mock/fetch-user-decrypt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAKhD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC5G,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAGzD,MAAM,cAAc,GAAG;IACrB;QACE,QAAQ,EAAE;YACR;gBACE,cAAc,EAAE,WAAW;gBAC3B,MAAM,EAAE,mBAAmB;gBAC3B,MAAM,EAAE,WAAW;aACpB;YACD;gBACE,cAAc,EAAE,SAAS;gBACzB,MAAM,EAAE,gBAAgB;gBACxB,MAAM,EAAE,SAAS;aAClB;YACD;gBACE,cAAc,EAAE,SAAS;gBACzB,MAAM,EAAE,cAAc;gBACtB,MAAM,EAAE,SAAS;aAClB;YACD;gBACE,cAAc,EAAE,SAAS;gBACzB,MAAM,EAAE,aAAa;gBACrB,MAAM,EAAE,SAAS;aAClB;YACD;gBACE,cAAc,EAAE,OAAO;gBACvB,MAAM,EAAE,eAAe;gBAC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CAAC,CAAa,CAAC;QAClC,MAAM,cAAc,GAAG,GAAG,CAAC,CAAC,CAAuB,CAAC;QACpD,MAAM,SAAS,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;QACzB,MAAM,SAAS,GAAG,GAAG,CAAC,CAAC,CAAa,CAAC;QAErC,CAAC;YACC,MAAM,UAAU,GAAG,oEAAoE,CAAC;YACxF,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;YACrD,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC1C,MAAM,CAAC,KAAK,CAAC,wCAAwC,EAAE,SAAS,CAAC,CAAC;YAClE,MAAM,OAAO,GAAG,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,UAAU,CAAC;YAC5D,MAAM,CAAC,KAAK,CAAC,gDAAgD,EAAE,OAAO,CAAC,CAAC;YAExE,MAAM,CAAC,IAAI,CAAC;gBACV,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAmB;gBAC9C,OAAO,EAAE,QAAQ,CAAC,iBAAiB,CAAC;gBACpC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC;aAC/B,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,mDAAmD,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAE9E,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { IJazzClient } from "../jazz-client-i.js";
2
+ import { FetchInputProofParameters, FetchInputProofResult } from "../types/input-proof.js";
3
+ /**
4
+ * Fetches an input proof from the Jazz service.
5
+ *
6
+ * This function constructs the request payload from the provided parameters,
7
+ * submits an asynchronous job to the Jazz API, and returns the resulting
8
+ * handles and signatures.
9
+ *
10
+ * @param client - The Jazz client instance
11
+ * @param parameters - Input proof request parameters
12
+ * @param parameters.options - Additional options for the request
13
+ * @param parameters.payload - ZK proof payload containing chain ID, contract address,
14
+ * user address, and ciphertext with ZK proof
15
+ * @returns Promise resolving to FetchInputProofResult containing handles,
16
+ * alphatrion EIP-712 signatures, and extra data
17
+ * @throws Error if the Jazz URL is not configured or the request fails
18
+ */
19
+ export declare function fetchInputProof(client: IJazzClient, parameters: FetchInputProofParameters): Promise<FetchInputProofResult>;
@@ -0,0 +1,72 @@
1
+ import { removeSuffix } from "../../core/string.js";
2
+ import { JazzAsyncRequest } from "./jazz-async-request.js";
3
+ import { bytesToHexNo0x } from "../../core/bytes.js";
4
+ import { logger } from "../../core/logger.js";
5
+ import { formatValue } from "../../core/pretty-print.js";
6
+ /**
7
+ * Fetches an input proof from the Jazz service.
8
+ *
9
+ * This function constructs the request payload from the provided parameters,
10
+ * submits an asynchronous job to the Jazz API, and returns the resulting
11
+ * handles and signatures.
12
+ *
13
+ * @param client - The Jazz client instance
14
+ * @param parameters - Input proof request parameters
15
+ * @param parameters.options - Additional options for the request
16
+ * @param parameters.payload - ZK proof payload containing chain ID, contract address,
17
+ * user address, and ciphertext with ZK proof
18
+ * @returns Promise resolving to FetchInputProofResult containing handles,
19
+ * alphatrion EIP-712 signatures, and extra data
20
+ * @throws Error if the Jazz URL is not configured or the request fails
21
+ */
22
+ export async function fetchInputProof(client, parameters) {
23
+ logger.debug(() => ['[fetchInputProof] Enter', formatValue({ parameters })]);
24
+ // Enter method
25
+ const { options, payload } = parameters;
26
+ // ============================================================================
27
+ // Step 1: Build Request Payload
28
+ // ============================================================================
29
+ // Construct the input proof payload for the Jazz API
30
+ const inputProofPayload = {
31
+ // Convert chain ID to hex with 0x prefix (e.g., 1 -> "0x1")
32
+ contractChainId: `0x${payload.zkProof.chainId.toString(16)}`,
33
+ contractAddress: payload.zkProof.contractAddress,
34
+ userAddress: payload.zkProof.userAddress,
35
+ // Convert ciphertext to hex without 0x prefix (API expects no prefix)
36
+ ciphertextWithInputVerification: bytesToHexNo0x(payload.zkProof.ciphertextWithZkProof),
37
+ extraData: "0x00",
38
+ };
39
+ logger.debug(() => ['[fetchInputProof] Request payload constructed', formatValue({ inputProofPayload })]);
40
+ // ============================================================================
41
+ // Step 2: Create and Execute Async Request
42
+ // ============================================================================
43
+ // Retrieve Jazz service URL from client
44
+ const jazzUrl = client.sdk.requireJazzUrl();
45
+ logger.debug('[fetchInputProof] Jazz URL retrieved', {
46
+ jazzUrl: jazzUrl,
47
+ });
48
+ // Create async request with INPUT_PROOF operation
49
+ const request = new JazzAsyncRequest({
50
+ operation: 'INPUT_PROOF',
51
+ baseUrl: removeSuffix(jazzUrl, '/'), // Remove trailing slash if present
52
+ path: `/v2/input-proof`,
53
+ payload: inputProofPayload,
54
+ options,
55
+ });
56
+ logger.trace('[fetchInputProof] Submitting JazzAsyncRequest');
57
+ const result = (await request.run());
58
+ // ============================================================================
59
+ // Step 3: Transform Result
60
+ // ============================================================================
61
+ // Log the raw result for debugging
62
+ logger.debug(() => ['[fetchInputProof] Result received', formatValue({ result })]);
63
+ // Transform to the expected return format
64
+ const fetchResult = {
65
+ handles: result.handles,
66
+ alphatrionEip712Signatures: result.signatures,
67
+ extraData: result.extraData,
68
+ };
69
+ logger.info(() => ['[fetchInputProof] Input proof fetched successfully', formatValue({ fetchResult })]);
70
+ return fetchResult;
71
+ }
72
+ //# sourceMappingURL=fetch-input-proof.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-input-proof.js","sourceRoot":"","sources":["../../../src/jazz/module/fetch-input-proof.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEzD;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,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CAAC,KAAK,CAAC,+CAA+C,CAAC,CAAC;IAC9D,MAAM,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,EAAE,CAAyB,CAAC;IAE7D,+EAA+E;IAC/E,2BAA2B;IAC3B,+EAA+E;IAE/E,mCAAmC;IACnC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,mCAAmC,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IAEnF,0CAA0C;IAC1C,MAAM,WAAW,GAA0B;QACzC,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,0BAA0B,EAAE,MAAM,CAAC,UAAU;QAC7C,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,oDAAoD,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;IAExG,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { IJazzClient } from "../jazz-client-i.js";
2
+ import { FetchKeyUrlParameters, FetchKeyUrlResult } from "../types/key-url.js";
3
+ /**
4
+ * Fetches the FHE key URL and CRS URL from the Jazz service.
5
+ *
6
+ * This function retrieves the public key and CRS (Common Reference String)
7
+ * URLs needed for encryption operations. The key URL operation is a simple
8
+ * GET request that does not require async polling.
9
+ *
10
+ * @param client - The Jazz client instance
11
+ * @param parameters - Key URL request parameters
12
+ * @param parameters.options - Additional options for the request
13
+ * @returns Promise resolving to FetchKeyUrlResult containing public key
14
+ * and CRS source information (ID, URL, and capacity)
15
+ * @throws Error if the Jazz URL is not configured or the request fails
16
+ */
17
+ export declare function fetchKeyUrl(client: IJazzClient, parameters: FetchKeyUrlParameters): Promise<FetchKeyUrlResult>;
@@ -0,0 +1,46 @@
1
+ import { logger } from "../../core/logger.js";
2
+ import { formatValue } from "../../core/pretty-print.js";
3
+ import { removeSuffix } from "../../core/string.js";
4
+ import { JazzAsyncRequest } from "./jazz-async-request.js";
5
+ /**
6
+ * Fetches the FHE key URL and CRS URL from the Jazz service.
7
+ *
8
+ * This function retrieves the public key and CRS (Common Reference String)
9
+ * URLs needed for encryption operations. The key URL operation is a simple
10
+ * GET request that does not require async polling.
11
+ *
12
+ * @param client - The Jazz client instance
13
+ * @param parameters - Key URL request parameters
14
+ * @param parameters.options - Additional options for the request
15
+ * @returns Promise resolving to FetchKeyUrlResult containing public key
16
+ * and CRS source information (ID, URL, and capacity)
17
+ * @throws Error if the Jazz URL is not configured or the request fails
18
+ */
19
+ export async function fetchKeyUrl(client, parameters) {
20
+ // Enter method
21
+ logger.debug(() => ['[fetchKeyUrl] Enter', formatValue({ parameters })]);
22
+ const { options } = parameters;
23
+ // ============================================================================
24
+ // Step 1: Validate and Retrieve Jazz URL
25
+ // ============================================================================
26
+ // Retrieve Jazz service URL from client
27
+ const jazzUrl = client.sdk.requireJazzUrl();
28
+ logger.debug('[fetchKeyUrl] Jazz URL retrieved', { jazzUrl: jazzUrl, });
29
+ // ============================================================================
30
+ // Step 2: Create and Execute Async Request
31
+ // ============================================================================
32
+ // Create async request with KEY_URL operation
33
+ // Note: KEY_URL is a simple GET request, no polling needed
34
+ const request = new JazzAsyncRequest({
35
+ operation: 'KEY_URL',
36
+ baseUrl: removeSuffix(jazzUrl, '/'), // Remove trailing slash if present
37
+ path: `/v2/keyurl`,
38
+ payload: {}, // Empty payload for GET request
39
+ options,
40
+ });
41
+ logger.trace('[fetchKeyUrl] Submitting JazzAsyncRequest for KEY_URL');
42
+ const result = (await request.run());
43
+ logger.info(() => ['[fetchKeyUrl] Key URL fetched successfully', formatValue({ result })]);
44
+ return result;
45
+ }
46
+ //# sourceMappingURL=fetch-key-url.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-key-url.js","sourceRoot":"","sources":["../../../src/jazz/module/fetch-key-url.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sB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CAAC;AAChB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { IJazzClient } from "../jazz-client-i.js";
2
+ import { FetchPublicDecryptParameters, FetchPublicDecryptResult } from "../types/public-decrypt.js";
3
+ /**
4
+ * Fetches public decryption results from the Jazz service.
5
+ *
6
+ * This function submits ciphertext handles for public decryption,
7
+ * processes the async job, and returns the decrypted values with
8
+ * their corresponding signatures.
9
+ *
10
+ * @param client - The Jazz client instance
11
+ * @param parameters - Public decryption request parameters
12
+ * @param parameters.options - Additional options for the request
13
+ * @param parameters.payload - Payload containing ordered ciphertext handles and extra data
14
+ * @returns Promise resolving to FetchPublicDecryptResult containing ordered
15
+ * ABI-encoded clear values, KMS public decrypt EIP-712 signatures,
16
+ * and extra data
17
+ * @throws Error if the Jazz URL is not configured or the request fails
18
+ */
19
+ export declare function fetchPublicDecrypt(client: IJazzClient, parameters: FetchPublicDecryptParameters): Promise<FetchPublicDecryptResult>;
@@ -0,0 +1,65 @@
1
+ import { logger } from "../../core/logger.js";
2
+ import { formatValue } from "../../core/pretty-print.js";
3
+ import { ensure0x, removeSuffix } from "../../core/string.js";
4
+ import { JazzAsyncRequest } from "./jazz-async-request.js";
5
+ /**
6
+ * Fetches public decryption results from the Jazz service.
7
+ *
8
+ * This function submits ciphertext handles for public decryption,
9
+ * processes the async job, and returns the decrypted values with
10
+ * their corresponding signatures.
11
+ *
12
+ * @param client - The Jazz client instance
13
+ * @param parameters - Public decryption request parameters
14
+ * @param parameters.options - Additional options for the request
15
+ * @param parameters.payload - Payload containing ordered ciphertext handles and extra data
16
+ * @returns Promise resolving to FetchPublicDecryptResult containing ordered
17
+ * ABI-encoded clear values, KMS public decrypt EIP-712 signatures,
18
+ * and extra data
19
+ * @throws Error if the Jazz URL is not configured or the request fails
20
+ */
21
+ export async function fetchPublicDecrypt(client, parameters) {
22
+ // Enter method
23
+ logger.debug(() => ['[fetchPublicDecrypt] Enter', formatValue({ parameters })]);
24
+ const { options, payload } = parameters;
25
+ // ============================================================================
26
+ // Step 1: Build Request Payload
27
+ // ============================================================================
28
+ // Convert payload argument to jazz payload
29
+ const publicDecryptPayload = {
30
+ ciphertextHandles: payload.orderedHandles,
31
+ extraData: payload.extraData,
32
+ };
33
+ logger.debug(() => ['[fetchPublicDecrypt] Request payload constructed', formatValue({ publicDecryptPayload })]);
34
+ // ============================================================================
35
+ // Step 2: Create and Execute Async Request
36
+ // ============================================================================
37
+ // Retrieve Jazz service URL from client
38
+ const jazzUrl = client.sdk.requireJazzUrl();
39
+ logger.debug('[fetchPublicDecrypt] Jazz URL retrieved', { jazzUrl: jazzUrl });
40
+ // Create async request with PUBLIC_DECRYPT operation
41
+ const request = new JazzAsyncRequest({
42
+ operation: 'PUBLIC_DECRYPT',
43
+ baseUrl: removeSuffix(jazzUrl, '/'), // Remove trailing slash if present
44
+ path: `/v2/public-decrypt`,
45
+ payload: publicDecryptPayload,
46
+ options,
47
+ });
48
+ logger.trace('[fetchPublicDecrypt] Submitting JazzAsyncRequest for PUBLIC_DECRYPT');
49
+ const result = (await request.run());
50
+ logger.debug(() => ['[fetchPublicDecrypt] Result received', formatValue({ result })]);
51
+ // ============================================================================
52
+ // Step 3: Transform Result
53
+ // ============================================================================
54
+ // Transform to the expected return format
55
+ // - Ensure decrypted value has 0x prefix
56
+ // - Ensure all signatures have 0x prefix
57
+ const fetchResult = {
58
+ orderedAbiEncodedClearValues: ensure0x(result.decryptedValue),
59
+ kmsPublicDecryptEIP712Signatures: result.signatures.map(ensure0x),
60
+ extraData: result.extraData,
61
+ };
62
+ logger.info(() => ['[fetchPublicDecrypt] Public decrypt fetched successfully', formatValue({ fetchResult })]);
63
+ return fetchResult;
64
+ }
65
+ //# sourceMappingURL=fetch-public-decrypt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-public-decrypt.js","sourceRoot":"","sources":["../../../src/jazz/module/fetch-public-decrypt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC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,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACpF,MAAM,MAAM,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,EAAE,CAA4B,CAAC;IAChE,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,sCAAsC,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;IAEtF,+EAA+E;IAC/E,2BAA2B;IAC3B,+EAA+E;IAE/E,0CAA0C;IAC1C,yCAAyC;IACzC,yCAAyC;IACzC,MAAM,WAAW,GAA6B;QAC5C,4BAA4B,EAAE,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC;QAC7D,gCAAgC,EAAE,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAiB;QACjF,SAAS,EAAE,MAAM,CAAC,SAAS;KAC5B,CAAC;IAEF,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,0DAA0D,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;IAE9G,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { IJazzClient } from "../jazz-client-i.js";
2
+ import { FetchUserDecryptParameters, FetchUserDecryptResult } from "../types/user-decrypt.js";
3
+ /**
4
+ * Fetches user decryption results from the Jazz service.
5
+ *
6
+ * This function submits handle-contract pairs for user decryption,
7
+ * processes the async job, and returns the decrypted shares with
8
+ * their corresponding signatures.
9
+ *
10
+ * @param client - The Jazz client instance
11
+ * @param parameters - User decryption request parameters
12
+ * @param parameters.options - Additional options for the request
13
+ * @param parameters.payload - Payload containing handle-contract pairs,
14
+ * EIP-712 message, signer address, and signature
15
+ * @returns Promise resolving to an array of KmsSigncryptedShare objects
16
+ * containing payload, signature, and extra data
17
+ * @throws Error if handle-contract pairs are empty or the Jazz URL is not configured
18
+ */
19
+ export declare function fetchUserDecrypt(client: IJazzClient, parameters: FetchUserDecryptParameters): Promise<FetchUserDecryptResult>;
@@ -0,0 +1,109 @@
1
+ import { extractChainIdFromHandle } from "../../core/handle.js";
2
+ import { logger } from "../../core/logger.js";
3
+ import { formatValue } from "../../core/pretty-print.js";
4
+ import { remove0x, removeSuffix } from "../../core/string.js";
5
+ import { JazzAsyncRequest } from "./jazz-async-request.js";
6
+ import { FheErrorCode } from "../../core/errors/error-codes.js";
7
+ import { FheError } from "../../core/errors/fhe-error.js";
8
+ /**
9
+ * Fetches user decryption results from the Jazz service.
10
+ *
11
+ * This function submits handle-contract pairs for user decryption,
12
+ * processes the async job, and returns the decrypted shares with
13
+ * their corresponding signatures.
14
+ *
15
+ * @param client - The Jazz client instance
16
+ * @param parameters - User decryption request parameters
17
+ * @param parameters.options - Additional options for the request
18
+ * @param parameters.payload - Payload containing handle-contract pairs,
19
+ * EIP-712 message, signer address, and signature
20
+ * @returns Promise resolving to an array of KmsSigncryptedShare objects
21
+ * containing payload, signature, and extra data
22
+ * @throws Error if handle-contract pairs are empty or the Jazz URL is not configured
23
+ */
24
+ export async function fetchUserDecrypt(client, parameters) {
25
+ logger.debug(() => ['[fetchUserDecrypt] Enter', formatValue({ parameters })]);
26
+ // Enter method
27
+ const { options, payload } = parameters;
28
+ // ============================================================================
29
+ // Step 1: Validate Input
30
+ // ============================================================================
31
+ // Extract first handle-contract pair to determine chain ID
32
+ const firstHandleContractPair = payload.handleContractPairs[0];
33
+ if (firstHandleContractPair === undefined) {
34
+ logger.error('[fetchUserDecrypt] Empty handle contract pairs');
35
+ throw new FheError({ code: FheErrorCode.EmptyInput, message: 'Empty handle contract pairs' });
36
+ }
37
+ // Extract chain ID from the handle
38
+ const chainId = extractChainIdFromHandle(firstHandleContractPair.handle);
39
+ logger.trace('[fetchUserDecrypt] Chain ID extracted', {
40
+ chainId,
41
+ handle: firstHandleContractPair.handle,
42
+ contract: firstHandleContractPair.contractAddress,
43
+ });
44
+ // ============================================================================
45
+ // Step 2: Build Request Payload
46
+ // ============================================================================
47
+ // Construct the user decrypt payload for the Jazz API
48
+ const userDecryptPayload = {
49
+ handleContractPairs: [...payload.handleContractPairs],
50
+ requestValidity: {
51
+ startTimestamp: payload.kmsDecryptEip712Message.startTimestamp,
52
+ durationDays: payload.kmsDecryptEip712Message.durationDays,
53
+ },
54
+ contractsChainId: chainId.toString(),
55
+ contractAddresses: payload.kmsDecryptEip712Message.contractAddresses,
56
+ userAddress: payload.kmsDecryptEip712Signer,
57
+ // Remove 0x prefix from signature (API expects no prefix)
58
+ signature: remove0x(payload.kmsDecryptEip712Signature),
59
+ extraData: payload.kmsDecryptEip712Message.extraData,
60
+ // Remove 0x prefix from public key (API expects no prefix)
61
+ publicKey: remove0x(payload.kmsDecryptEip712Message.publicKey),
62
+ };
63
+ logger.debug(() => ['[fetchUserDecrypt] Request payload constructed', formatValue({ userDecryptPayload })]);
64
+ // ============================================================================
65
+ // Step 3: Create and Execute Async Request
66
+ // ============================================================================
67
+ // Retrieve Jazz service URL from client
68
+ const jazzUrl = client.sdk.requireJazzUrl();
69
+ logger.debug('[fetchUserDecrypt] Jazz URL retrieved', {
70
+ jazzUrl: jazzUrl,
71
+ });
72
+ // Create async request with USER_DECRYPT operation
73
+ const request = new JazzAsyncRequest({
74
+ operation: 'USER_DECRYPT',
75
+ baseUrl: removeSuffix(jazzUrl, '/'), // Remove trailing slash if present
76
+ path: `/v2/user-decrypt`,
77
+ payload: userDecryptPayload,
78
+ options,
79
+ });
80
+ logger.trace('[fetchUserDecrypt] Submitting JazzAsyncRequest for USER_DECRYPT');
81
+ const result = (await request.run());
82
+ // ============================================================================
83
+ // Step 4: Transform Result
84
+ // ============================================================================
85
+ // Log the raw result for debugging
86
+ logger.debug(() => ['[fetchUserDecrypt] Result received', formatValue({ result })]);
87
+ // Transform to the expected return format
88
+ // - Remove 0x prefix from extraData for each share
89
+ const shares = result.map((r, index) => {
90
+ const share = {
91
+ signature: r.signature,
92
+ payload: r.payload,
93
+ extraData: remove0x(r.extraData),
94
+ };
95
+ // Log first few shares for debugging (avoid log bloat)
96
+ if (index < 3) {
97
+ logger.trace('[fetchUserDecrypt] Share transformed', {
98
+ index,
99
+ signatureLength: share.signature.length,
100
+ payloadLength: share.payload.length,
101
+ extraDataLength: share.extraData.length,
102
+ });
103
+ }
104
+ return share;
105
+ });
106
+ logger.info(() => ['[fetchUserDecrypt] User decrypt fetched successfully', formatValue({ shares })]);
107
+ return shares;
108
+ }
109
+ //# sourceMappingURL=fetch-user-decrypt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch-user-decrypt.js","sourceRoot":"","sources":["../../../src/jazz/module/fetch-user-decrypt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAG9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAmB,EACnB,UAAsC;IAEtC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,0BAA0B,EAAE,WAAW,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;IAE9E,eAAe;IACf,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,UAAU,CAAC;IAExC,+EAA+E;IAC/E,yBAAyB;IACzB,+EAA+E;IAE/E,2DAA2D;IAC3D,MAAM,uBAAuB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC;IAC/D,IAAI,uBAAuB,KAAK,SAAS,EAAE,CAAC;QA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