@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,443 @@
1
+ /* @ts-self-types="./kms_lib.d.ts" */
2
+
3
+ /**
4
+ * @param {Array<any>} shares
5
+ * @returns {Uint8Array}
6
+ */
7
+ export function wasm_combine_secret(shares) {
8
+ const ret = wasm.wasm_combine_secret(shares);
9
+ if (ret[3]) {
10
+ throw takeFromExternrefTable0(ret[2]);
11
+ }
12
+ var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
13
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
14
+ return v1;
15
+ }
16
+
17
+ /**
18
+ * @param {Uint8Array} ciphertext
19
+ * @param {Uint8Array} sk_bytes
20
+ * @returns {Uint8Array}
21
+ */
22
+ export function wasm_decrypt(ciphertext, sk_bytes) {
23
+ const ptr0 = passArray8ToWasm0(ciphertext, wasm.__wbindgen_malloc);
24
+ const len0 = WASM_VECTOR_LEN;
25
+ const ptr1 = passArray8ToWasm0(sk_bytes, wasm.__wbindgen_malloc);
26
+ const len1 = WASM_VECTOR_LEN;
27
+ const ret = wasm.wasm_decrypt(ptr0, len0, ptr1, len1);
28
+ if (ret[3]) {
29
+ throw takeFromExternrefTable0(ret[2]);
30
+ }
31
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
32
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
33
+ return v3;
34
+ }
35
+
36
+ /**
37
+ * @returns {any}
38
+ */
39
+ export function wasm_enc_keygen() {
40
+ const ret = wasm.wasm_enc_keygen();
41
+ if (ret[2]) {
42
+ throw takeFromExternrefTable0(ret[1]);
43
+ }
44
+ return takeFromExternrefTable0(ret[0]);
45
+ }
46
+
47
+ /**
48
+ * @param {Uint8Array} plaintext
49
+ * @param {Uint8Array} pk_bytes
50
+ * @returns {Uint8Array}
51
+ */
52
+ export function wasm_encrypt(plaintext, pk_bytes) {
53
+ const ptr0 = passArray8ToWasm0(plaintext, wasm.__wbindgen_malloc);
54
+ const len0 = WASM_VECTOR_LEN;
55
+ const ptr1 = passArray8ToWasm0(pk_bytes, wasm.__wbindgen_malloc);
56
+ const len1 = WASM_VECTOR_LEN;
57
+ const ret = wasm.wasm_encrypt(ptr0, len0, ptr1, len1);
58
+ if (ret[3]) {
59
+ throw takeFromExternrefTable0(ret[2]);
60
+ }
61
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
62
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
63
+ return v3;
64
+ }
65
+
66
+ /**
67
+ * Signcrypt with an externally generated signature.
68
+ *
69
+ * The signature should be generated externally (e.g. wallet/HSM)
70
+ * over:
71
+ *
72
+ * keccak256(
73
+ * message || signer_address || encryption_public_key
74
+ * )
75
+ *
76
+ * The output format is:
77
+ *
78
+ * encrypted_message || signature
79
+ * @param {Uint8Array} msg
80
+ * @param {Uint8Array} address
81
+ * @param {Uint8Array} signature
82
+ * @param {Uint8Array} enc_key
83
+ * @returns {Uint8Array}
84
+ */
85
+ export function wasm_signcrypt_ex(msg, address, signature, enc_key) {
86
+ const ptr0 = passArray8ToWasm0(msg, wasm.__wbindgen_malloc);
87
+ const len0 = WASM_VECTOR_LEN;
88
+ const ptr1 = passArray8ToWasm0(address, wasm.__wbindgen_malloc);
89
+ const len1 = WASM_VECTOR_LEN;
90
+ const ptr2 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
91
+ const len2 = WASM_VECTOR_LEN;
92
+ const ptr3 = passArray8ToWasm0(enc_key, wasm.__wbindgen_malloc);
93
+ const len3 = WASM_VECTOR_LEN;
94
+ const ret = wasm.wasm_signcrypt_ex(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
95
+ if (ret[3]) {
96
+ throw takeFromExternrefTable0(ret[2]);
97
+ }
98
+ var v5 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
99
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
100
+ return v5;
101
+ }
102
+
103
+ /**
104
+ * @param {Uint8Array} secret
105
+ * @param {number} n
106
+ * @param {number} threshold
107
+ * @returns {any}
108
+ */
109
+ export function wasm_split_secret(secret, n, threshold) {
110
+ const ptr0 = passArray8ToWasm0(secret, wasm.__wbindgen_malloc);
111
+ const len0 = WASM_VECTOR_LEN;
112
+ const ret = wasm.wasm_split_secret(ptr0, len0, n, threshold);
113
+ if (ret[2]) {
114
+ throw takeFromExternrefTable0(ret[1]);
115
+ }
116
+ return takeFromExternrefTable0(ret[0]);
117
+ }
118
+
119
+ /**
120
+ * Decrypt and verify a signcrypted message.
121
+ *
122
+ * The signature is recovered from the ciphertext and
123
+ * the signer address is checked internally.
124
+ *
125
+ * Returns the original plaintext.
126
+ * @param {Uint8Array} ct
127
+ * @param {Uint8Array} signer_address
128
+ * @param {Uint8Array} dec_key
129
+ * @param {Uint8Array} enc_key
130
+ * @returns {Uint8Array}
131
+ */
132
+ export function wasm_unsigncrypt(ct, signer_address, dec_key, enc_key) {
133
+ const ptr0 = passArray8ToWasm0(ct, wasm.__wbindgen_malloc);
134
+ const len0 = WASM_VECTOR_LEN;
135
+ const ptr1 = passArray8ToWasm0(signer_address, wasm.__wbindgen_malloc);
136
+ const len1 = WASM_VECTOR_LEN;
137
+ const ptr2 = passArray8ToWasm0(dec_key, wasm.__wbindgen_malloc);
138
+ const len2 = WASM_VECTOR_LEN;
139
+ const ptr3 = passArray8ToWasm0(enc_key, wasm.__wbindgen_malloc);
140
+ const len3 = WASM_VECTOR_LEN;
141
+ const ret = wasm.wasm_unsigncrypt(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
142
+ if (ret[3]) {
143
+ throw takeFromExternrefTable0(ret[2]);
144
+ }
145
+ var v5 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
146
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
147
+ return v5;
148
+ }
149
+ function __wbg_get_imports() {
150
+ const import0 = {
151
+ __proto__: null,
152
+ __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
153
+ const ret = typeof(arg0) === 'function';
154
+ return ret;
155
+ },
156
+ __wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
157
+ const val = arg0;
158
+ const ret = typeof(val) === 'object' && val !== null;
159
+ return ret;
160
+ },
161
+ __wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
162
+ const ret = typeof(arg0) === 'string';
163
+ return ret;
164
+ },
165
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
166
+ const ret = arg0 === undefined;
167
+ return ret;
168
+ },
169
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
170
+ throw new Error(getStringFromWasm0(arg0, arg1));
171
+ },
172
+ __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
173
+ const ret = arg0.call(arg1, arg2);
174
+ return ret;
175
+ }, arguments); },
176
+ __wbg_crypto_38df2bab126b63dc: function(arg0) {
177
+ const ret = arg0.crypto;
178
+ return ret;
179
+ },
180
+ __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
181
+ arg0.getRandomValues(arg1);
182
+ }, arguments); },
183
+ __wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
184
+ const ret = arg0[arg1 >>> 0];
185
+ return ret;
186
+ },
187
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
188
+ const ret = arg0.length;
189
+ return ret;
190
+ },
191
+ __wbg_length_370319915dc99107: function(arg0) {
192
+ const ret = arg0.length;
193
+ return ret;
194
+ },
195
+ __wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
196
+ const ret = arg0.msCrypto;
197
+ return ret;
198
+ },
199
+ __wbg_new_32b398fb48b6d94a: function() {
200
+ const ret = new Array();
201
+ return ret;
202
+ },
203
+ __wbg_new_cd45aabdf6073e84: function(arg0) {
204
+ const ret = new Uint8Array(arg0);
205
+ return ret;
206
+ },
207
+ __wbg_new_from_slice_77cdfb7977362f3c: function(arg0, arg1) {
208
+ const ret = new Uint8Array(getArrayU8FromWasm0(arg0, arg1));
209
+ return ret;
210
+ },
211
+ __wbg_new_with_length_e6785c33c8e4cce8: function(arg0) {
212
+ const ret = new Uint8Array(arg0 >>> 0);
213
+ return ret;
214
+ },
215
+ __wbg_node_84ea875411254db1: function(arg0) {
216
+ const ret = arg0.node;
217
+ return ret;
218
+ },
219
+ __wbg_process_44c7a14e11e9f69e: function(arg0) {
220
+ const ret = arg0.process;
221
+ return ret;
222
+ },
223
+ __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
224
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
225
+ },
226
+ __wbg_push_d2ae3af0c1217ae6: function(arg0, arg1) {
227
+ const ret = arg0.push(arg1);
228
+ return ret;
229
+ },
230
+ __wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
231
+ arg0.randomFillSync(arg1);
232
+ }, arguments); },
233
+ __wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
234
+ const ret = module.require;
235
+ return ret;
236
+ }, arguments); },
237
+ __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
238
+ const ret = typeof global === 'undefined' ? null : global;
239
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
240
+ },
241
+ __wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() {
242
+ const ret = typeof globalThis === 'undefined' ? null : globalThis;
243
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
244
+ },
245
+ __wbg_static_accessor_SELF_146583524fe1469b: function() {
246
+ const ret = typeof self === 'undefined' ? null : self;
247
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
248
+ },
249
+ __wbg_static_accessor_WINDOW_f2829a2234d7819e: function() {
250
+ const ret = typeof window === 'undefined' ? null : window;
251
+ return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
252
+ },
253
+ __wbg_subarray_3ed232c8a6baee09: function(arg0, arg1, arg2) {
254
+ const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
255
+ return ret;
256
+ },
257
+ __wbg_versions_276b2795b1c6a219: function(arg0) {
258
+ const ret = arg0.versions;
259
+ return ret;
260
+ },
261
+ __wbindgen_cast_0000000000000001: function(arg0, arg1) {
262
+ // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
263
+ const ret = getArrayU8FromWasm0(arg0, arg1);
264
+ return ret;
265
+ },
266
+ __wbindgen_cast_0000000000000002: function(arg0, arg1) {
267
+ // Cast intrinsic for `Ref(String) -> Externref`.
268
+ const ret = getStringFromWasm0(arg0, arg1);
269
+ return ret;
270
+ },
271
+ __wbindgen_init_externref_table: function() {
272
+ const table = wasm.__wbindgen_externrefs;
273
+ const offset = table.grow(4);
274
+ table.set(0, undefined);
275
+ table.set(offset + 0, undefined);
276
+ table.set(offset + 1, null);
277
+ table.set(offset + 2, true);
278
+ table.set(offset + 3, false);
279
+ },
280
+ };
281
+ return {
282
+ __proto__: null,
283
+ "./kms_lib_bg.js": import0,
284
+ };
285
+ }
286
+
287
+ function addToExternrefTable0(obj) {
288
+ const idx = wasm.__externref_table_alloc();
289
+ wasm.__wbindgen_externrefs.set(idx, obj);
290
+ return idx;
291
+ }
292
+
293
+ function getArrayU8FromWasm0(ptr, len) {
294
+ ptr = ptr >>> 0;
295
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
296
+ }
297
+
298
+ function getStringFromWasm0(ptr, len) {
299
+ return decodeText(ptr >>> 0, len);
300
+ }
301
+
302
+ let cachedUint8ArrayMemory0 = null;
303
+ function getUint8ArrayMemory0() {
304
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
305
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
306
+ }
307
+ return cachedUint8ArrayMemory0;
308
+ }
309
+
310
+ function handleError(f, args) {
311
+ try {
312
+ return f.apply(this, args);
313
+ } catch (e) {
314
+ const idx = addToExternrefTable0(e);
315
+ wasm.__wbindgen_exn_store(idx);
316
+ }
317
+ }
318
+
319
+ function isLikeNone(x) {
320
+ return x === undefined || x === null;
321
+ }
322
+
323
+ function passArray8ToWasm0(arg, malloc) {
324
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
325
+ getUint8ArrayMemory0().set(arg, ptr / 1);
326
+ WASM_VECTOR_LEN = arg.length;
327
+ return ptr;
328
+ }
329
+
330
+ function takeFromExternrefTable0(idx) {
331
+ const value = wasm.__wbindgen_externrefs.get(idx);
332
+ wasm.__externref_table_dealloc(idx);
333
+ return value;
334
+ }
335
+
336
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
337
+ cachedTextDecoder.decode();
338
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
339
+ let numBytesDecoded = 0;
340
+ function decodeText(ptr, len) {
341
+ numBytesDecoded += len;
342
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
343
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
344
+ cachedTextDecoder.decode();
345
+ numBytesDecoded = len;
346
+ }
347
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
348
+ }
349
+
350
+ let WASM_VECTOR_LEN = 0;
351
+
352
+ let wasmModule, wasmInstance, wasm;
353
+ function __wbg_finalize_init(instance, module) {
354
+ wasmInstance = instance;
355
+ wasm = instance.exports;
356
+ wasmModule = module;
357
+ cachedUint8ArrayMemory0 = null;
358
+ wasm.__wbindgen_start();
359
+ return wasm;
360
+ }
361
+
362
+ async function __wbg_load(module, imports) {
363
+ if (typeof Response === 'function' && module instanceof Response) {
364
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
365
+ try {
366
+ return await WebAssembly.instantiateStreaming(module, imports);
367
+ } catch (e) {
368
+ const validResponse = module.ok && expectedResponseType(module.type);
369
+
370
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
371
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
372
+
373
+ } else { throw e; }
374
+ }
375
+ }
376
+
377
+ const bytes = await module.arrayBuffer();
378
+ return await WebAssembly.instantiate(bytes, imports);
379
+ } else {
380
+ const instance = await WebAssembly.instantiate(module, imports);
381
+
382
+ if (instance instanceof WebAssembly.Instance) {
383
+ return { instance, module };
384
+ } else {
385
+ return instance;
386
+ }
387
+ }
388
+
389
+ function expectedResponseType(type) {
390
+ switch (type) {
391
+ case 'basic': case 'cors': case 'default': return true;
392
+ }
393
+ return false;
394
+ }
395
+ }
396
+
397
+ function initSync(module) {
398
+ if (wasm !== undefined) return wasm;
399
+
400
+
401
+ if (module !== undefined) {
402
+ if (Object.getPrototypeOf(module) === Object.prototype) {
403
+ ({module} = module)
404
+ } else {
405
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
406
+ }
407
+ }
408
+
409
+ const imports = __wbg_get_imports();
410
+ if (!(module instanceof WebAssembly.Module)) {
411
+ module = new WebAssembly.Module(module);
412
+ }
413
+ const instance = new WebAssembly.Instance(module, imports);
414
+ return __wbg_finalize_init(instance, module);
415
+ }
416
+
417
+ async function __wbg_init(module_or_path) {
418
+ if (wasm !== undefined) return wasm;
419
+
420
+
421
+ if (module_or_path !== undefined) {
422
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
423
+ ({module_or_path} = module_or_path)
424
+ } else {
425
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
426
+ }
427
+ }
428
+
429
+ if (module_or_path === undefined) {
430
+ module_or_path = new URL('kms_lib_bg.wasm', import.meta.url);
431
+ }
432
+ const imports = __wbg_get_imports();
433
+
434
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
435
+ module_or_path = fetch(module_or_path);
436
+ }
437
+
438
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
439
+
440
+ return __wbg_finalize_init(instance, module);
441
+ }
442
+
443
+ export { initSync, __wbg_init as default };
@@ -0,0 +1,21 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const wasm_combine_secret: (a: any) => [number, number, number, number];
5
+ export const wasm_decrypt: (a: number, b: number, c: number, d: number) => [number, number, number, number];
6
+ export const wasm_enc_keygen: () => [number, number, number];
7
+ export const wasm_encrypt: (a: number, b: number, c: number, d: number) => [number, number, number, number];
8
+ export const wasm_signcrypt_ex: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
9
+ export const wasm_split_secret: (a: number, b: number, c: number, d: number) => [number, number, number];
10
+ export const wasm_unsigncrypt: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
11
+ export const rustsecp256k1_v0_10_0_context_create: (a: number) => number;
12
+ export const rustsecp256k1_v0_10_0_context_destroy: (a: number) => void;
13
+ export const rustsecp256k1_v0_10_0_default_error_callback_fn: (a: number, b: number) => void;
14
+ export const rustsecp256k1_v0_10_0_default_illegal_callback_fn: (a: number, b: number) => void;
15
+ export const __wbindgen_exn_store: (a: number) => void;
16
+ export const __externref_table_alloc: () => number;
17
+ export const __wbindgen_externrefs: WebAssembly.Table;
18
+ export const __externref_table_dealloc: (a: number) => void;
19
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
20
+ export const __wbindgen_malloc: (a: number, b: number) => number;
21
+ export const __wbindgen_start: () => void;
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "kms_lib",
3
+ "type": "module",
4
+ "version": "0.1.0",
5
+ "files": [
6
+ "kms_lib_bg.wasm",
7
+ "kms_lib.js",
8
+ "kms_lib.d.ts"
9
+ ],
10
+ "main": "kms_lib.js",
11
+ "types": "kms_lib.d.ts",
12
+ "sideEffects": [
13
+ "./snippets/*"
14
+ ]
15
+ }
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Configuration options for the browser IndexedDB cache driver.
3
+ */
4
+ export interface CacheDriverOptions {
5
+ /** IndexedDB database name (default: "db") */
6
+ dbName?: string;
7
+ /** IndexedDB store name (default: "store") */
8
+ storeName?: string;
9
+ /** Base name for IndexedDB storage (default: "base") */
10
+ baseName?: string;
11
+ }
12
+ /**
13
+ * Creates an IndexedDB driver for browser cache storage using unstorage.
14
+ *
15
+ * @param options - Cache configuration options
16
+ * @param options.dbName - IndexedDB database name (default: "db")
17
+ * @param options.storeName - IndexedDB store name (default: "store")
18
+ * @param options.baseName - Base name for IndexedDB storage (default: "base")
19
+ * @returns An IndexedDB storage driver instance
20
+ * @throws Error if the unstorage driver module fails to load
21
+ */
22
+ export declare function createCacheDriver(options?: CacheDriverOptions): Promise<any>;
23
+ /**
24
+ * Get the database base name with a colon suffix for key scoping
25
+ * @returns The base name scope string, e.g., "fhe-transform:"
26
+ */
27
+ export declare function getDbBaseNameScope(): string;
28
+ /**
29
+ * Reads a local file using the browser's Fetch API.
30
+ * Intended for testing/mocking purposes in browser environments.
31
+ *
32
+ * @param url - The URL or path to the local file (relative or absolute)
33
+ * @returns Promise resolving to Uint8Array containing the file data
34
+ * @throws Error if the fetch fails or the response is not OK
35
+ */
36
+ export declare function readLocalFile(url: string): Promise<Uint8Array>;
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Browser-specific implementations for KMS, cache, and file operations.
3
+ * These functions are designed to run exclusively in browser environments.
4
+ */
5
+ import { DB_BASE_NAME } from "../core/constants.js";
6
+ import { logger } from "../core/logger.js";
7
+ import { FheErrorCode } from "../core/errors/error-codes.js";
8
+ import { FheError } from "../core/errors/fhe-error.js";
9
+ /**
10
+ * Creates an IndexedDB driver for browser cache storage using unstorage.
11
+ *
12
+ * @param options - Cache configuration options
13
+ * @param options.dbName - IndexedDB database name (default: "db")
14
+ * @param options.storeName - IndexedDB store name (default: "store")
15
+ * @param options.baseName - Base name for IndexedDB storage (default: "base")
16
+ * @returns An IndexedDB storage driver instance
17
+ * @throws Error if the unstorage driver module fails to load
18
+ */
19
+ export async function createCacheDriver(options = {}) {
20
+ // Enter method
21
+ const dbName = options.dbName || "db";
22
+ const storeName = options.storeName || "store";
23
+ const baseName = options.baseName || "base";
24
+ logger.debug('[createCacheDriver] Creating IndexedDB cache driver (Browser)', {
25
+ dbName,
26
+ storeName,
27
+ baseName,
28
+ });
29
+ try {
30
+ // Dynamically import the unstorage IndexedDB driver
31
+ logger.trace('[createCacheDriver] Importing unstorage/drivers/indexedb');
32
+ const { default: idbDriver } = await import("unstorage/drivers/indexedb");
33
+ // Create and return the driver instance
34
+ const driver = idbDriver({
35
+ dbName: dbName,
36
+ storeName: storeName,
37
+ base: baseName,
38
+ });
39
+ logger.debug('[createCacheDriver] IndexedDB cache driver created successfully', {
40
+ dbName,
41
+ storeName,
42
+ baseName,
43
+ driverType: 'indexedb',
44
+ });
45
+ return driver;
46
+ }
47
+ catch (error) {
48
+ // Log error with context
49
+ logger.error('[createCacheDriver] Failed to create IndexedDB cache driver (Browser)', {
50
+ dbName,
51
+ storeName,
52
+ baseName,
53
+ error: error.message,
54
+ stack: error.stack,
55
+ });
56
+ throw error;
57
+ }
58
+ }
59
+ /**
60
+ * Get the database base name with a colon suffix for key scoping
61
+ * @returns The base name scope string, e.g., "fhe-transform:"
62
+ */
63
+ export function getDbBaseNameScope() {
64
+ return `${DB_BASE_NAME}:`;
65
+ }
66
+ // ============================================================================
67
+ // Local File Operations
68
+ // ============================================================================
69
+ /**
70
+ * Reads a local file using the browser's Fetch API.
71
+ * Intended for testing/mocking purposes in browser environments.
72
+ *
73
+ * @param url - The URL or path to the local file (relative or absolute)
74
+ * @returns Promise resolving to Uint8Array containing the file data
75
+ * @throws Error if the fetch fails or the response is not OK
76
+ */
77
+ export async function readLocalFile(url) {
78
+ // Enter method
79
+ logger.debug('[readLocalFile] Reading local file (Browser)', {
80
+ url,
81
+ });
82
+ try {
83
+ // Perform fetch request
84
+ logger.trace('[readLocalFile] Fetching file', { url });
85
+ const response = await fetch(url);
86
+ // Check response status
87
+ if (!response.ok) {
88
+ logger.error('[readLocalFile] HTTP error', {
89
+ url,
90
+ status: response.status,
91
+ statusText: response.statusText,
92
+ });
93
+ throw new FheError({ code: FheErrorCode.HttpError, message: `HTTP error! status: ${response.status} ${response.statusText}` });
94
+ }
95
+ // Read response as ArrayBuffer and convert to Uint8Array
96
+ logger.trace('[readLocalFile] Reading response as array buffer', { url });
97
+ const buffer = await response.arrayBuffer();
98
+ const data = new Uint8Array(buffer);
99
+ logger.debug('[readLocalFile] File read successfully (Browser)', {
100
+ url,
101
+ size: data.length,
102
+ });
103
+ return data;
104
+ }
105
+ catch (error) {
106
+ // Log error with context
107
+ logger.error('[readLocalFile] Failed to read file (Browser)', {
108
+ url,
109
+ error: error.message,
110
+ stack: error.stack,
111
+ });
112
+ throw error;
113
+ }
114
+ }
115
+ //# sourceMappingURL=browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser.js","sourceRoot":"","sources":["../../src/runtime/browser.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAkBvD;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,UAA8B,EAAE;IACtE,eAAe;IACf,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,IAAI,CAAC;IACtC,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC;IAC/C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC;IAE5C,MAAM,CAAC,KAAK,CAAC,+DAA+D,EAAE;QAC5E,MAAM;QACN,SAAS;QACT,QAAQ;KACT,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,oDAAoD;QACpD,MAAM,CAAC,KAAK,CAAC,0DAA0D,CAAC,CAAC;QACzE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC;QAE1E,wCAAwC;QACxC,MAAM,MAAM,GAAG,SAAS,CAAC;YACvB,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,SAAS;YACpB,IAAI,EAAE,QAAQ;SACf,CAAC,CAAC;QAEH,MAAM,CAAC,KAAK,CAAC,iEAAiE,EAAE;YAC9E,MAAM;YACN,SAAS;YACT,QAAQ;YACR,UAAU,EAAE,UAAU;SACvB,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,yBAAyB;QACzB,MAAM,CAAC,KAAK,CAAC,uEAAuE,EAAE;YACpF,MAAM;YACN,SAAS;YACT,QAAQ;YACR,KAAK,EAAE,KAAK,CAAC,OAAO;YACpB,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAC,CAAC;QACH,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO,GAAG,YAAY,GAAG,CAAC;AAC5B,CAAC;AAED,+EAA+E;AAC/E,wBAAwB;AACxB,+EAA+E;AAE/E;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAW;IAC7C,eAAe;IACf,MAAM,CAAC,KAAK,CAAC,8CAA8C,EAAE;QAC3D,GAAG;KACJ,CAAC,CAAC;IAEH,IAAI,CAAC;QACH,wBAAwB;QACxB,MAAM,CAAC,KAAK,CAAC,+BAA+B,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QACvD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QAElC,wBAAwB;QACxB,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,CAAC,KAAK,CAAC,4BAA4B,EAAE;gBACzC,GAAG;gBACH,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,UAAU,EAAE,QAAQ,CAAC,UAAU;aAChC,CAAC,CAAC;YACH,MAAM,IAAI,QAAQ,CAAC,EAAE,IAAI,EAAE,YAAY,CAAC,SAAS,EAAE,OAAO,EAAE,uBAAuB,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;QACjI,CAAC;QAED,yDAAyD;QACzD,MAAM,CAAC,KAAK,CAAC,kDAAkD,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAC1E,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,WAAW,EAAE,CAAC;QAC5C,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;QAEpC,MAAM,CAAC,KAAK,CAAC,kDAAkD,EAAE;YAC/D,GAAG;YACH,IAAI,EAAE,IAAI,CAAC,MAAM;SAClB,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,yBAAyB;QACzB,MAAM,CAAC,KAAK,CAAC,+CAA+C,EAAE;YAC5D,GAAG;YACH,KAAK,EAAE,KAAK,CAAC,OAAO;YACpB,KAAK,EAAE,KAAK,CAAC,KAAK;SACnB,CAAC,CAAC;QACH,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Configuration options for the Node.js filesystem cache driver.
3
+ */
4
+ export interface CacheDriverOptions {
5
+ /** Base directory for cache files (default: "./.cache") */
6
+ baseDir?: string;
7
+ }
8
+ /**
9
+ * Creates a filesystem driver for Node.js cache storage using unstorage.
10
+ *
11
+ * @param options - Cache configuration options
12
+ * @param options.baseDir - Base directory for cache files (default: "./.cache")
13
+ * @returns A filesystem storage driver instance
14
+ * @throws Error if the unstorage driver module fails to load
15
+ */
16
+ export declare function createCacheDriver(options?: CacheDriverOptions): Promise<any>;
17
+ /**
18
+ * Get the database base name with a colon suffix for key scoping
19
+ * @returns The empty string
20
+ */
21
+ export declare function getDbBaseNameScope(): string;
22
+ /**
23
+ * Reads a local file from the filesystem in Node.js environments.
24
+ * Uses the built-in `fs/promises` module for async file reading.
25
+ *
26
+ * @param path - The file system path to the local file
27
+ * @returns Promise resolving to Uint8Array containing the file data
28
+ * @throws Error if the file cannot be read or fs module fails to load
29
+ */
30
+ export declare function readLocalFile(path: string): Promise<Uint8Array>;