@provablehq/sdk 0.10.2 → 0.10.4

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 (219) hide show
  1. package/dist/dynamic/browser.cjs +12 -0
  2. package/dist/dynamic/browser.d.cts +8 -0
  3. package/dist/dynamic/browser.d.ts +2 -2
  4. package/dist/dynamic/node.cjs +12 -0
  5. package/dist/dynamic/node.d.cts +8 -0
  6. package/dist/dynamic/node.d.ts +2 -2
  7. package/dist/mainnet/account.d.cts +347 -0
  8. package/dist/mainnet/browser.cjs +8530 -0
  9. package/dist/mainnet/browser.cjs.map +1 -0
  10. package/dist/mainnet/browser.d.cts +72 -0
  11. package/dist/mainnet/browser.d.ts +3 -3
  12. package/dist/mainnet/browser.js +78 -32
  13. package/dist/mainnet/browser.js.map +1 -1
  14. package/dist/mainnet/constants.d.cts +40 -0
  15. package/dist/mainnet/external-signing.d.cts +76 -0
  16. package/dist/mainnet/integrations/sealance/merkle-tree.d.cts +192 -0
  17. package/dist/mainnet/keys/keystore/error.d.cts +24 -0
  18. package/dist/mainnet/keys/keystore/file.d.cts +177 -0
  19. package/dist/mainnet/keys/keystore/interface.d.cts +161 -0
  20. package/dist/mainnet/keys/provider/interface.d.cts +170 -0
  21. package/dist/mainnet/keys/provider/memory.d.cts +213 -0
  22. package/dist/mainnet/keys/provider/memory.d.ts +6 -2
  23. package/dist/mainnet/keys/provider/offline.d.cts +365 -0
  24. package/dist/mainnet/keys/verifier/interface.d.cts +70 -0
  25. package/dist/mainnet/keys/verifier/memory.d.cts +37 -0
  26. package/dist/mainnet/keys/verifier/memory.d.ts +1 -1
  27. package/dist/mainnet/models/authorization.d.cts +6 -0
  28. package/dist/mainnet/models/authorization.d.ts +2 -2
  29. package/dist/mainnet/models/blockJSON.d.cts +33 -0
  30. package/dist/mainnet/models/confirmed_transaction.d.cts +9 -0
  31. package/dist/mainnet/models/cryptoBoxPubkey.d.cts +4 -0
  32. package/dist/mainnet/models/deployment/deploymentJSON.d.cts +6 -0
  33. package/dist/mainnet/models/deployment/deploymentObject.d.cts +6 -0
  34. package/dist/mainnet/models/encryptedProvingRequest.d.cts +4 -0
  35. package/dist/mainnet/models/execution/executionJSON.d.cts +11 -0
  36. package/dist/mainnet/models/execution/executionObject.d.cts +11 -0
  37. package/dist/mainnet/models/external-signing.d.cts +123 -0
  38. package/dist/mainnet/models/finalizeJSON.d.cts +6 -0
  39. package/dist/mainnet/models/functionInput.d.cts +7 -0
  40. package/dist/mainnet/models/functionObject.d.cts +8 -0
  41. package/dist/mainnet/models/imports.d.cts +7 -0
  42. package/dist/mainnet/models/input/inputJSON.d.cts +10 -0
  43. package/dist/mainnet/models/input/inputObject.d.cts +15 -0
  44. package/dist/mainnet/models/inputID.d.cts +4 -0
  45. package/dist/mainnet/models/keyPair.d.cts +4 -0
  46. package/dist/mainnet/models/output/outputJSON.d.cts +7 -0
  47. package/dist/mainnet/models/output/outputObject.d.cts +18 -0
  48. package/dist/mainnet/models/owner/ownerJSON.d.cts +4 -0
  49. package/dist/mainnet/models/owner/ownerObject.d.cts +5 -0
  50. package/dist/mainnet/models/plaintext/array.d.cts +3 -0
  51. package/dist/mainnet/models/plaintext/literal.d.cts +1 -0
  52. package/dist/mainnet/models/plaintext/plaintext.d.cts +5 -0
  53. package/dist/mainnet/models/plaintext/struct.d.cts +5 -0
  54. package/dist/mainnet/models/provingRequest.d.cts +6 -0
  55. package/dist/mainnet/models/provingRequest.d.ts +1 -1
  56. package/dist/mainnet/models/provingResponse.d.cts +51 -0
  57. package/dist/mainnet/models/ratification.d.cts +4 -0
  58. package/dist/mainnet/models/record-provider/encryptedRecord.d.cts +58 -0
  59. package/dist/mainnet/models/record-provider/ownedRecord.d.cts +60 -0
  60. package/dist/mainnet/models/record-provider/recordSearchParams.d.cts +19 -0
  61. package/dist/mainnet/models/record-scanner/encryptedRecordsResult.d.cts +7 -0
  62. package/dist/mainnet/models/record-scanner/encryptedRegistrationRequest.d.cts +8 -0
  63. package/dist/mainnet/models/record-scanner/error.d.cts +47 -0
  64. package/dist/mainnet/models/record-scanner/error.d.ts +1 -1
  65. package/dist/mainnet/models/record-scanner/ownedFilter.d.cts +22 -0
  66. package/dist/mainnet/models/record-scanner/ownedFilter.d.ts +3 -3
  67. package/dist/mainnet/models/record-scanner/ownedRecordsResponseFilter.d.cts +42 -0
  68. package/dist/mainnet/models/record-scanner/ownedRecordsResult.d.cts +13 -0
  69. package/dist/mainnet/models/record-scanner/recordsFilter.d.cts +35 -0
  70. package/dist/mainnet/models/record-scanner/recordsFilter.d.ts +2 -2
  71. package/dist/mainnet/models/record-scanner/recordsResponseFilter.d.cts +42 -0
  72. package/dist/mainnet/models/record-scanner/registrationRequest.d.cts +13 -0
  73. package/dist/mainnet/models/record-scanner/registrationResponse.d.cts +13 -0
  74. package/dist/mainnet/models/record-scanner/registrationResult.d.cts +9 -0
  75. package/dist/mainnet/models/record-scanner/revokeResult.d.cts +17 -0
  76. package/dist/mainnet/models/record-scanner/serialNumbersResult.d.cts +15 -0
  77. package/dist/mainnet/models/record-scanner/statusResponse.d.cts +13 -0
  78. package/dist/mainnet/models/record-scanner/statusResult.d.cts +13 -0
  79. package/dist/mainnet/models/record-scanner/tagsResult.d.cts +12 -0
  80. package/dist/mainnet/models/request.d.cts +14 -0
  81. package/dist/mainnet/models/request.d.ts +1 -1
  82. package/dist/mainnet/models/solution.d.cts +14 -0
  83. package/dist/mainnet/models/transaction/transactionJSON.d.cts +11 -0
  84. package/dist/mainnet/models/transaction/transactionObject.d.cts +14 -0
  85. package/dist/mainnet/models/transition/transitionJSON.d.cts +13 -0
  86. package/dist/mainnet/models/transition/transitionObject.d.cts +15 -0
  87. package/dist/mainnet/network-client.d.cts +850 -0
  88. package/dist/mainnet/network-client.d.ts +3 -0
  89. package/dist/mainnet/node-polyfill.cjs +238 -0
  90. package/dist/mainnet/node-polyfill.cjs.map +1 -0
  91. package/dist/mainnet/node-polyfill.d.cts +5 -0
  92. package/dist/mainnet/node-polyfill.js +1 -1
  93. package/dist/mainnet/node-polyfill.js.map +1 -1
  94. package/dist/mainnet/node.cjs +686 -0
  95. package/dist/mainnet/node.cjs.map +1 -0
  96. package/dist/mainnet/node.d.cts +3 -0
  97. package/dist/mainnet/node.js +2 -2
  98. package/dist/mainnet/polyfill/crypto.d.cts +1 -0
  99. package/dist/mainnet/polyfill/fetch.d.cts +1 -0
  100. package/dist/mainnet/polyfill/shared.d.cts +1 -0
  101. package/dist/mainnet/polyfill/worker.d.cts +1 -0
  102. package/dist/mainnet/polyfill/xmlhttprequest.d.cts +1 -0
  103. package/dist/mainnet/program-manager.d.cts +1600 -0
  104. package/dist/mainnet/program-manager.d.ts +13 -1
  105. package/dist/mainnet/record-provider.d.cts +274 -0
  106. package/dist/mainnet/record-scanner.d.cts +371 -0
  107. package/dist/mainnet/record-scanner.d.ts +9 -6
  108. package/dist/mainnet/security.d.cts +62 -0
  109. package/dist/mainnet/security.d.ts +5 -5
  110. package/dist/mainnet/utils.d.cts +23 -0
  111. package/dist/mainnet/utils.d.ts +10 -2
  112. package/dist/mainnet/wasm.d.cts +1 -0
  113. package/dist/testnet/account.d.cts +347 -0
  114. package/dist/testnet/browser.cjs +8530 -0
  115. package/dist/testnet/browser.cjs.map +1 -0
  116. package/dist/testnet/browser.d.cts +72 -0
  117. package/dist/testnet/browser.d.ts +3 -3
  118. package/dist/testnet/browser.js +78 -32
  119. package/dist/testnet/browser.js.map +1 -1
  120. package/dist/testnet/constants.d.cts +40 -0
  121. package/dist/testnet/external-signing.d.cts +76 -0
  122. package/dist/testnet/integrations/sealance/merkle-tree.d.cts +192 -0
  123. package/dist/testnet/keys/keystore/error.d.cts +24 -0
  124. package/dist/testnet/keys/keystore/file.d.cts +177 -0
  125. package/dist/testnet/keys/keystore/interface.d.cts +161 -0
  126. package/dist/testnet/keys/provider/interface.d.cts +170 -0
  127. package/dist/testnet/keys/provider/memory.d.cts +213 -0
  128. package/dist/testnet/keys/provider/memory.d.ts +6 -2
  129. package/dist/testnet/keys/provider/offline.d.cts +365 -0
  130. package/dist/testnet/keys/verifier/interface.d.cts +70 -0
  131. package/dist/testnet/keys/verifier/memory.d.cts +37 -0
  132. package/dist/testnet/keys/verifier/memory.d.ts +1 -1
  133. package/dist/testnet/models/authorization.d.cts +6 -0
  134. package/dist/testnet/models/authorization.d.ts +2 -2
  135. package/dist/testnet/models/blockJSON.d.cts +33 -0
  136. package/dist/testnet/models/confirmed_transaction.d.cts +9 -0
  137. package/dist/testnet/models/cryptoBoxPubkey.d.cts +4 -0
  138. package/dist/testnet/models/deployment/deploymentJSON.d.cts +6 -0
  139. package/dist/testnet/models/deployment/deploymentObject.d.cts +6 -0
  140. package/dist/testnet/models/encryptedProvingRequest.d.cts +4 -0
  141. package/dist/testnet/models/execution/executionJSON.d.cts +11 -0
  142. package/dist/testnet/models/execution/executionObject.d.cts +11 -0
  143. package/dist/testnet/models/external-signing.d.cts +123 -0
  144. package/dist/testnet/models/finalizeJSON.d.cts +6 -0
  145. package/dist/testnet/models/functionInput.d.cts +7 -0
  146. package/dist/testnet/models/functionObject.d.cts +8 -0
  147. package/dist/testnet/models/imports.d.cts +7 -0
  148. package/dist/testnet/models/input/inputJSON.d.cts +10 -0
  149. package/dist/testnet/models/input/inputObject.d.cts +15 -0
  150. package/dist/testnet/models/inputID.d.cts +4 -0
  151. package/dist/testnet/models/keyPair.d.cts +4 -0
  152. package/dist/testnet/models/output/outputJSON.d.cts +7 -0
  153. package/dist/testnet/models/output/outputObject.d.cts +18 -0
  154. package/dist/testnet/models/owner/ownerJSON.d.cts +4 -0
  155. package/dist/testnet/models/owner/ownerObject.d.cts +5 -0
  156. package/dist/testnet/models/plaintext/array.d.cts +3 -0
  157. package/dist/testnet/models/plaintext/literal.d.cts +1 -0
  158. package/dist/testnet/models/plaintext/plaintext.d.cts +5 -0
  159. package/dist/testnet/models/plaintext/struct.d.cts +5 -0
  160. package/dist/testnet/models/provingRequest.d.cts +6 -0
  161. package/dist/testnet/models/provingRequest.d.ts +1 -1
  162. package/dist/testnet/models/provingResponse.d.cts +51 -0
  163. package/dist/testnet/models/ratification.d.cts +4 -0
  164. package/dist/testnet/models/record-provider/encryptedRecord.d.cts +58 -0
  165. package/dist/testnet/models/record-provider/ownedRecord.d.cts +60 -0
  166. package/dist/testnet/models/record-provider/recordSearchParams.d.cts +19 -0
  167. package/dist/testnet/models/record-scanner/encryptedRecordsResult.d.cts +7 -0
  168. package/dist/testnet/models/record-scanner/encryptedRegistrationRequest.d.cts +8 -0
  169. package/dist/testnet/models/record-scanner/error.d.cts +47 -0
  170. package/dist/testnet/models/record-scanner/error.d.ts +1 -1
  171. package/dist/testnet/models/record-scanner/ownedFilter.d.cts +22 -0
  172. package/dist/testnet/models/record-scanner/ownedFilter.d.ts +3 -3
  173. package/dist/testnet/models/record-scanner/ownedRecordsResponseFilter.d.cts +42 -0
  174. package/dist/testnet/models/record-scanner/ownedRecordsResult.d.cts +13 -0
  175. package/dist/testnet/models/record-scanner/recordsFilter.d.cts +35 -0
  176. package/dist/testnet/models/record-scanner/recordsFilter.d.ts +2 -2
  177. package/dist/testnet/models/record-scanner/recordsResponseFilter.d.cts +42 -0
  178. package/dist/testnet/models/record-scanner/registrationRequest.d.cts +13 -0
  179. package/dist/testnet/models/record-scanner/registrationResponse.d.cts +13 -0
  180. package/dist/testnet/models/record-scanner/registrationResult.d.cts +9 -0
  181. package/dist/testnet/models/record-scanner/revokeResult.d.cts +17 -0
  182. package/dist/testnet/models/record-scanner/serialNumbersResult.d.cts +15 -0
  183. package/dist/testnet/models/record-scanner/statusResponse.d.cts +13 -0
  184. package/dist/testnet/models/record-scanner/statusResult.d.cts +13 -0
  185. package/dist/testnet/models/record-scanner/tagsResult.d.cts +12 -0
  186. package/dist/testnet/models/request.d.cts +14 -0
  187. package/dist/testnet/models/request.d.ts +1 -1
  188. package/dist/testnet/models/solution.d.cts +14 -0
  189. package/dist/testnet/models/transaction/transactionJSON.d.cts +11 -0
  190. package/dist/testnet/models/transaction/transactionObject.d.cts +14 -0
  191. package/dist/testnet/models/transition/transitionJSON.d.cts +13 -0
  192. package/dist/testnet/models/transition/transitionObject.d.cts +15 -0
  193. package/dist/testnet/network-client.d.cts +850 -0
  194. package/dist/testnet/network-client.d.ts +3 -0
  195. package/dist/testnet/node-polyfill.cjs +238 -0
  196. package/dist/testnet/node-polyfill.cjs.map +1 -0
  197. package/dist/testnet/node-polyfill.d.cts +5 -0
  198. package/dist/testnet/node-polyfill.js +1 -1
  199. package/dist/testnet/node-polyfill.js.map +1 -1
  200. package/dist/testnet/node.cjs +686 -0
  201. package/dist/testnet/node.cjs.map +1 -0
  202. package/dist/testnet/node.d.cts +3 -0
  203. package/dist/testnet/node.js +2 -2
  204. package/dist/testnet/polyfill/crypto.d.cts +1 -0
  205. package/dist/testnet/polyfill/fetch.d.cts +1 -0
  206. package/dist/testnet/polyfill/shared.d.cts +1 -0
  207. package/dist/testnet/polyfill/worker.d.cts +1 -0
  208. package/dist/testnet/polyfill/xmlhttprequest.d.cts +1 -0
  209. package/dist/testnet/program-manager.d.cts +1600 -0
  210. package/dist/testnet/program-manager.d.ts +13 -1
  211. package/dist/testnet/record-provider.d.cts +274 -0
  212. package/dist/testnet/record-scanner.d.cts +371 -0
  213. package/dist/testnet/record-scanner.d.ts +9 -6
  214. package/dist/testnet/security.d.cts +62 -0
  215. package/dist/testnet/security.d.ts +5 -5
  216. package/dist/testnet/utils.d.cts +23 -0
  217. package/dist/testnet/utils.d.ts +10 -2
  218. package/dist/testnet/wasm.d.cts +1 -0
  219. package/package.json +51 -9
@@ -1,10 +1,11 @@
1
- import { EncryptedRecord } from "./models/record-provider/encryptedRecord";
1
+ import { TransportFunction } from "./utils.js";
2
+ import { EncryptedRecord } from "./models/record-provider/encryptedRecord.js";
2
3
  import { CryptoBoxPubKey } from "./models/cryptoBoxPubkey.js";
3
- import { OwnedFilter } from "./models/record-scanner/ownedFilter";
4
- import { OwnedRecord } from "./models/record-provider/ownedRecord";
5
- import { RecordProvider } from "./record-provider";
6
- import { Field, ViewKey } from "./wasm";
7
- import { RecordsFilter } from "./models/record-scanner/recordsFilter";
4
+ import { OwnedFilter } from "./models/record-scanner/ownedFilter.js";
5
+ import { OwnedRecord } from "./models/record-provider/ownedRecord.js";
6
+ import { RecordProvider } from "./record-provider.js";
7
+ import { Field, ViewKey } from "./wasm.js";
8
+ import { RecordsFilter } from "./models/record-scanner/recordsFilter.js";
8
9
  import { RegisterResult } from "./models/record-scanner/registrationResult.js";
9
10
  import { RevokeResult } from "./models/record-scanner/revokeResult.js";
10
11
  import { TagsResult } from "./models/record-scanner/tagsResult.js";
@@ -49,6 +50,7 @@ export interface RecordScannerOptions {
49
50
  cacheViewKeysOnRegister?: boolean;
50
51
  autoReRegister?: boolean;
51
52
  decryptEnabled?: boolean;
53
+ transport?: TransportFunction;
52
54
  }
53
55
  /**
54
56
  * RecordScanner is a RecordProvider implementation that uses Provable's confidential record scanning service to find
@@ -104,6 +106,7 @@ declare class RecordScanner implements RecordProvider {
104
106
  private viewKeys?;
105
107
  private autoReRegister?;
106
108
  private decryptEnabled?;
109
+ transport: TransportFunction;
107
110
  account?: Account | undefined;
108
111
  /**
109
112
  * @param {RecordScannerOptions} options Configuration for the record scanner.
@@ -0,0 +1,62 @@
1
+ import { ViewKey, Authorization, ProvingRequest } from "./wasm.js";
2
+ /**
3
+ * Encrypt an authorization with a cryptobox X25519 public key (libsodium-compatible wire format).
4
+ *
5
+ * @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
6
+ * @param {Authorization} authorization the authorization to encrypt.
7
+ *
8
+ * @returns {string} the encrypted authorization in RFC 4648 standard Base64.
9
+ */
10
+ export declare function encryptAuthorization(publicKey: string, authorization: Authorization): string;
11
+ /**
12
+ * Encrypt a ProvingRequest with a cryptobox X25519 public key (libsodium-compatible wire format).
13
+ *
14
+ * @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
15
+ * @param {ProvingRequest} provingRequest the ProvingRequest to encrypt.
16
+ *
17
+ * @returns {string} the encrypted ProvingRequest in RFC 4648 standard Base64.
18
+ */
19
+ export declare function encryptProvingRequest(publicKey: string, provingRequest: ProvingRequest): string;
20
+ /**
21
+ * Encrypt a view key with a cryptobox X25519 public key (libsodium-compatible wire format).
22
+ *
23
+ * @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
24
+ * @param {ViewKey} viewKey the view key to encrypt.
25
+ *
26
+ * @returns {string} the encrypted view key in RFC 4648 standard Base64.
27
+ */
28
+ export declare function encryptViewKey(publicKey: string, viewKey: ViewKey): string;
29
+ /**
30
+ * Encrypt a record scanner registration request.
31
+ *
32
+ * @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
33
+ * @param {ViewKey} viewKey the view key to encrypt.
34
+ * @param {number} start the start height of the registration request.
35
+ *
36
+ * @returns {string} the encrypted view key in RFC 4648 standard Base64.
37
+ */
38
+ export declare function encryptRegistrationRequest(publicKey: string, viewKey: ViewKey, start: number): string;
39
+ /**
40
+ * Best-effort zeroization of a byte array by overwriting all bytes with zeros.
41
+ * Use this to clear sensitive data (e.g., key bytes) from memory when working
42
+ * with Uint8Array representations of keys or other secrets.
43
+ *
44
+ * This is best-effort in JavaScript — the JIT compiler could theoretically
45
+ * elide the fill if the array is never read again (though current engines
46
+ * do not). For deterministic zeroization of key material, use
47
+ * `Account.destroy()` or call `.free()` on key objects (PrivateKey, ViewKey,
48
+ * ComputeKey, GraphKey) whose Rust Drop implementations zeroize memory
49
+ * before deallocation.
50
+ *
51
+ * Note: This cannot zeroize JavaScript strings, which are immutable and managed
52
+ * by the garbage collector. Prefer using byte array representations of sensitive
53
+ * data over strings whenever possible.
54
+ *
55
+ * @param {Uint8Array} bytes The byte array to zeroize
56
+ *
57
+ * @example
58
+ * const keyBytes = privateKey.toBytesLe();
59
+ * // ... use keyBytes ...
60
+ * zeroizeBytes(keyBytes); // Overwrite with zeros when done
61
+ */
62
+ export declare function zeroizeBytes(bytes: Uint8Array): void;
@@ -1,6 +1,6 @@
1
- import { ViewKey, Authorization, ProvingRequest } from "@provablehq/wasm";
1
+ import { ViewKey, Authorization, ProvingRequest } from "./wasm.js";
2
2
  /**
3
- * Encrypt an authorization with a libsodium cryptobox public key.
3
+ * Encrypt an authorization with a cryptobox X25519 public key (libsodium-compatible wire format).
4
4
  *
5
5
  * @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
6
6
  * @param {Authorization} authorization the authorization to encrypt.
@@ -9,16 +9,16 @@ import { ViewKey, Authorization, ProvingRequest } from "@provablehq/wasm";
9
9
  */
10
10
  export declare function encryptAuthorization(publicKey: string, authorization: Authorization): string;
11
11
  /**
12
- * Encrypt a ProvingRequest with a libsodium cryptobox public key.
12
+ * Encrypt a ProvingRequest with a cryptobox X25519 public key (libsodium-compatible wire format).
13
13
  *
14
14
  * @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
15
- * @param {Authorization} provingRequest the ProvingRequest to encrypt.
15
+ * @param {ProvingRequest} provingRequest the ProvingRequest to encrypt.
16
16
  *
17
17
  * @returns {string} the encrypted ProvingRequest in RFC 4648 standard Base64.
18
18
  */
19
19
  export declare function encryptProvingRequest(publicKey: string, provingRequest: ProvingRequest): string;
20
20
  /**
21
- * Encrypt a view key with a libsodium cryptobox public key.
21
+ * Encrypt a view key with a cryptobox X25519 public key (libsodium-compatible wire format).
22
22
  *
23
23
  * @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
24
24
  * @param {ViewKey} viewKey the view key to encrypt.
@@ -0,0 +1,23 @@
1
+ export declare function isNode(): boolean;
2
+ export declare function environment(): "chrome" | "firefox" | "safari" | "edge" | "opera" | "browser" | "node" | "unknown";
3
+ export declare function logAndThrow(message: string): never;
4
+ /**
5
+ * A function matching the global `fetch` signature. Consumers can provide
6
+ * their own implementation to inject custom HTTP agents, mTLS certificates,
7
+ * timeouts, or logging.
8
+ */
9
+ export type TransportFunction = typeof fetch;
10
+ /** Default transport — wraps global fetch to avoid illegal-invocation errors in browsers. */
11
+ export declare const defaultTransport: TransportFunction;
12
+ export declare function parseJSON(json: string): any;
13
+ export declare function get(url: URL | string, options?: RequestInit, transport?: TransportFunction): Promise<Response>;
14
+ export declare function post(url: URL | string, options: RequestInit, transport?: TransportFunction): Promise<Response>;
15
+ type RetryOptions = {
16
+ maxAttempts?: number;
17
+ baseDelay?: number;
18
+ jitter?: number;
19
+ retryOnStatus?: number[];
20
+ shouldRetry?: (err: any) => boolean;
21
+ };
22
+ export declare function retryWithBackoff<T>(fn: () => Promise<T>, { maxAttempts, baseDelay, jitter, retryOnStatus, shouldRetry, }?: RetryOptions): Promise<T>;
23
+ export {};
@@ -1,9 +1,17 @@
1
1
  export declare function isNode(): boolean;
2
2
  export declare function environment(): "chrome" | "firefox" | "safari" | "edge" | "opera" | "browser" | "node" | "unknown";
3
3
  export declare function logAndThrow(message: string): never;
4
+ /**
5
+ * A function matching the global `fetch` signature. Consumers can provide
6
+ * their own implementation to inject custom HTTP agents, mTLS certificates,
7
+ * timeouts, or logging.
8
+ */
9
+ export type TransportFunction = typeof fetch;
10
+ /** Default transport — wraps global fetch to avoid illegal-invocation errors in browsers. */
11
+ export declare const defaultTransport: TransportFunction;
4
12
  export declare function parseJSON(json: string): any;
5
- export declare function get(url: URL | string, options?: RequestInit): Promise<Response>;
6
- export declare function post(url: URL | string, options: RequestInit): Promise<Response>;
13
+ export declare function get(url: URL | string, options?: RequestInit, transport?: TransportFunction): Promise<Response>;
14
+ export declare function post(url: URL | string, options: RequestInit, transport?: TransportFunction): Promise<Response>;
7
15
  type RetryOptions = {
8
16
  maxAttempts?: number;
9
17
  baseDelay?: number;
@@ -0,0 +1 @@
1
+ export { Address, Authorization, Boolean, BHP256, BHP512, BHP768, BHP1024, Ciphertext, ComputeKey, DynamicRecord, EncryptionToolkit, ExecutionRequest, Execution, ExecutionResponse, Field, GraphKey, Group, I8, I16, I32, I64, I128, OfflineQuery, Metadata, Pedersen64, Pedersen128, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager, Proof, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, stringToField, Transaction, Transition, U8, U16, U32, U64, U128, Value, VerifyingKey, ViewKey, initThreadPool, getOrInitConsensusVersionTestHeights, snarkVerify, snarkVerifyBatch, verifyFunctionExecution, } from "@provablehq/wasm/testnet.js";
package/package.json CHANGED
@@ -1,29 +1,66 @@
1
1
  {
2
2
  "name": "@provablehq/sdk",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
4
4
  "description": "A Software Development Kit (SDK) for Zero-Knowledge Transactions",
5
5
  "collaborators": [
6
6
  "The Provable Team"
7
7
  ],
8
8
  "license": "GPL-3.0",
9
9
  "type": "module",
10
- "main": "./dist/testnet/node.js",
10
+ "main": "./dist/testnet/node.cjs",
11
+ "module": "./dist/testnet/node.js",
11
12
  "browser": "./dist/testnet/browser.js",
12
13
  "exports": {
13
14
  ".": {
14
- "node": "./dist/testnet/node.js",
15
+ "node": {
16
+ "types": {
17
+ "import": "./dist/testnet/node.d.ts",
18
+ "require": "./dist/testnet/node.d.cts"
19
+ },
20
+ "import": "./dist/testnet/node.js",
21
+ "require": "./dist/testnet/node.cjs",
22
+ "default": "./dist/testnet/node.js"
23
+ },
24
+ "types": "./dist/testnet/browser.d.ts",
15
25
  "default": "./dist/testnet/browser.js"
16
26
  },
17
27
  "./testnet.js": {
18
- "node": "./dist/testnet/node.js",
28
+ "node": {
29
+ "types": {
30
+ "import": "./dist/testnet/node.d.ts",
31
+ "require": "./dist/testnet/node.d.cts"
32
+ },
33
+ "import": "./dist/testnet/node.js",
34
+ "require": "./dist/testnet/node.cjs",
35
+ "default": "./dist/testnet/node.js"
36
+ },
37
+ "types": "./dist/testnet/browser.d.ts",
19
38
  "default": "./dist/testnet/browser.js"
20
39
  },
21
40
  "./mainnet.js": {
22
- "node": "./dist/mainnet/node.js",
41
+ "node": {
42
+ "types": {
43
+ "import": "./dist/mainnet/node.d.ts",
44
+ "require": "./dist/mainnet/node.d.cts"
45
+ },
46
+ "import": "./dist/mainnet/node.js",
47
+ "require": "./dist/mainnet/node.cjs",
48
+ "default": "./dist/mainnet/node.js"
49
+ },
50
+ "types": "./dist/mainnet/browser.d.ts",
23
51
  "default": "./dist/mainnet/browser.js"
24
52
  },
25
53
  "./dynamic.js": {
26
- "node": "./dist/dynamic/node.js",
54
+ "node": {
55
+ "types": {
56
+ "import": "./dist/dynamic/node.d.ts",
57
+ "require": "./dist/dynamic/node.d.cts"
58
+ },
59
+ "import": "./dist/dynamic/node.js",
60
+ "require": "./dist/dynamic/node.cjs",
61
+ "default": "./dist/dynamic/node.js"
62
+ },
63
+ "types": "./dist/dynamic/browser.d.ts",
27
64
  "default": "./dist/dynamic/browser.js"
28
65
  }
29
66
  },
@@ -34,7 +71,10 @@
34
71
  ],
35
72
  "scripts": {
36
73
  "build": "rimraf dist && rollup -c rollup.config.js",
37
- "test": "rimraf tmp && rollup -c rollup.test.js && mocha tmp/**/*.test.js --timeout 60000 && RUN_SKIPPED=true mocha tmp/**/wasm.test.js --timeout 60000 --grep Consensus"
74
+ "test": "rimraf tmp && rollup -c rollup.test.js && mocha tmp/**/*.test.js --timeout 60000 && RUN_SKIPPED=true mocha tmp/**/wasm.test.js --timeout 60000 --grep Consensus",
75
+ "test:attw": "yarn pack --filename /tmp/provablehq-sdk-attw.tgz && attw /tmp/provablehq-sdk-attw.tgz --profile=node16",
76
+ "test:cjs": "node tests/cjs-smoke/smoke.cjs",
77
+ "test:cjs:pack": "node tests/cjs-smoke/pack-install.cjs"
38
78
  },
39
79
  "repository": {
40
80
  "type": "git",
@@ -51,15 +91,16 @@
51
91
  },
52
92
  "homepage": "https://github.com/ProvableHQ/sdk#readme",
53
93
  "dependencies": {
54
- "@provablehq/wasm": "^0.10.2",
94
+ "@provablehq/wasm": "^0.10.4",
55
95
  "@scure/base": "^2.0.0",
96
+ "@serenity-kit/noble-sodium": "0.2.3",
56
97
  "comlink": "^4.4.2",
57
98
  "core-js": "^3.40.0",
58
- "libsodium-wrappers": "^0.8.2",
59
99
  "mime": "^4.0.6",
60
100
  "xmlhttprequest-ssl": "^4.0.0"
61
101
  },
62
102
  "devDependencies": {
103
+ "@arethetypeswrong/cli": "^0.18.2",
63
104
  "@rollup/plugin-replace": "^6.0.2",
64
105
  "@types/chai": "^5.0.1",
65
106
  "@types/mocha": "^10.0.10",
@@ -76,6 +117,7 @@
76
117
  "glob": "^11.0.1",
77
118
  "jsdoc": "^4.0.4",
78
119
  "kis-jsdoc-plugin": "^2.2.1",
120
+ "libsodium-wrappers": "^0.8.2",
79
121
  "mocha": "^11.1.0",
80
122
  "prettier": "3.4.2",
81
123
  "rimraf": "^6.0.1",