@provablehq/wasm 0.11.0 → 0.11.1

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.
@@ -23,18 +23,6 @@ export function initThreadPool(url: URL, num_threads: number): Promise<void>;
23
23
  * @returns {boolean} True if the execution is valid, false otherwise
24
24
  */
25
25
  export function verifyFunctionExecution(execution: Execution, verifying_key: VerifyingKey, program: Program, function_id: string, imports: object | null | undefined, imported_verifying_keys: object | null | undefined, block_height: number, program_imports?: ProgramImports | null): boolean;
26
- /**
27
- * Verify a SNARK proof against a verifying key and public inputs.
28
- *
29
- * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
30
- * It directly invokes the Varuna proof verification from snarkVM.
31
- *
32
- * @param {VerifyingKey} verifying_key The verifying key for the circuit
33
- * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
34
- * @param {Proof} proof The proof to verify
35
- * @returns {boolean} True if the proof is valid, false otherwise
36
- */
37
- export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
38
26
  /**
39
27
  * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
40
28
  *
@@ -47,6 +35,19 @@ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, pro
47
35
  * @returns {boolean} True if the batch proof is valid, false otherwise
48
36
  */
49
37
  export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>, proof: Proof): boolean;
38
+ /**
39
+ * Verify a SNARK proof against a verifying key and public inputs.
40
+ *
41
+ * This function verifies a proof produced by an Aleo program that may not be deployed on chain.
42
+ * It directly invokes the Varuna proof verification from snarkVM.
43
+ *
44
+ * @param {VerifyingKey} verifying_key The verifying key for the circuit
45
+ * @param {Array<string>} inputs Array of field element strings representing public inputs (e.g. ["1field", "2field"])
46
+ * @param {Proof} proof The proof to verify
47
+ * @returns {boolean} True if the proof is valid, false otherwise
48
+ */
49
+ export function snarkVerify(verifying_key: VerifyingKey, inputs: Array<any>, proof: Proof): boolean;
50
+ export function stringToField(string: string): Field;
50
51
  /**
51
52
  * Set test consensus version heights for testing.
52
53
  *
@@ -56,10 +57,9 @@ export function snarkVerifyBatch(verifying_keys: Array<any>, inputs: Array<any>,
56
57
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
57
58
  *
58
59
  * Set the consensus version heights.
59
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13");
60
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
60
61
  */
61
62
  export function getOrInitConsensusVersionTestHeights(heights?: string | null): Array<any>;
62
- export function stringToField(string: string): Field;
63
63
  /**
64
64
  * Public address of an Aleo account
65
65
  */
Binary file
@@ -368,6 +368,38 @@ function verifyFunctionExecution(execution, verifying_key, program, function_id,
368
368
  }
369
369
  }
370
370
 
371
+ /**
372
+ * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
373
+ *
374
+ * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
375
+ * Each verifying key is paired with one or more sets of public inputs (instances).
376
+ *
377
+ * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
378
+ * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
379
+ * @param {Proof} proof The batch proof to verify
380
+ * @returns {boolean} True if the batch proof is valid, false otherwise
381
+ * @param {Array<any>} verifying_keys
382
+ * @param {Array<any>} inputs
383
+ * @param {Proof} proof
384
+ * @returns {boolean}
385
+ */
386
+ function snarkVerifyBatch(verifying_keys, inputs, proof) {
387
+ try {
388
+ const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
389
+ _assertClass(proof, Proof);
390
+ wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
391
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
392
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
393
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
394
+ if (r2) {
395
+ throw takeObject(r1);
396
+ }
397
+ return r0 !== 0;
398
+ } finally {
399
+ wasm$1.__wbindgen_add_to_stack_pointer(16);
400
+ }
401
+ }
402
+
371
403
  /**
372
404
  * Verify a SNARK proof against a verifying key and public inputs.
373
405
  *
@@ -402,32 +434,22 @@ function snarkVerify(verifying_key, inputs, proof) {
402
434
  }
403
435
 
404
436
  /**
405
- * Verify a batch SNARK proof against multiple verifying keys and their corresponding public inputs.
406
- *
407
- * This function verifies a batch proof produced by Aleo programs that may not be deployed on chain.
408
- * Each verifying key is paired with one or more sets of public inputs (instances).
409
- *
410
- * @param {Array<string>} verifying_keys Array of verifying key strings, one per circuit
411
- * @param {Array<Array<Array<string>>>} inputs 3D array of field element strings [circuit_idx][instance_idx][field_idx]
412
- * @param {Proof} proof The batch proof to verify
413
- * @returns {boolean} True if the batch proof is valid, false otherwise
414
- * @param {Array<any>} verifying_keys
415
- * @param {Array<any>} inputs
416
- * @param {Proof} proof
417
- * @returns {boolean}
437
+ * @param {string} string
438
+ * @returns {Field}
418
439
  */
419
- function snarkVerifyBatch(verifying_keys, inputs, proof) {
440
+ function stringToField(string) {
420
441
  try {
421
442
  const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
422
- _assertClass(proof, Proof);
423
- wasm$1.snarkVerifyBatch(retptr, addHeapObject(verifying_keys), addHeapObject(inputs), proof.__wbg_ptr);
443
+ const ptr0 = passStringToWasm0(string, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
444
+ const len0 = WASM_VECTOR_LEN;
445
+ wasm$1.stringToField(retptr, ptr0, len0);
424
446
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
425
447
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
426
448
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
427
449
  if (r2) {
428
450
  throw takeObject(r1);
429
451
  }
430
- return r0 !== 0;
452
+ return Field.__wrap(r0);
431
453
  } finally {
432
454
  wasm$1.__wbindgen_add_to_stack_pointer(16);
433
455
  }
@@ -442,7 +464,7 @@ function snarkVerifyBatch(verifying_keys, inputs, proof) {
442
464
  * import { getOrInitConsensusVersionTestHeights } from '@provablehq/sdk';
443
465
  *
444
466
  * Set the consensus version heights.
445
- * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13");
467
+ * getOrInitConsensusVersionTestHeights("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14");
446
468
  * @param {string | null} [heights]
447
469
  * @returns {Array<any>}
448
470
  */
@@ -453,28 +475,6 @@ function getOrInitConsensusVersionTestHeights(heights) {
453
475
  return takeObject(ret);
454
476
  }
455
477
 
456
- /**
457
- * @param {string} string
458
- * @returns {Field}
459
- */
460
- function stringToField(string) {
461
- try {
462
- const retptr = wasm$1.__wbindgen_add_to_stack_pointer(-16);
463
- const ptr0 = passStringToWasm0(string, wasm$1.__wbindgen_export, wasm$1.__wbindgen_export2);
464
- const len0 = WASM_VECTOR_LEN;
465
- wasm$1.stringToField(retptr, ptr0, len0);
466
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
467
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
468
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
469
- if (r2) {
470
- throw takeObject(r1);
471
- }
472
- return Field.__wrap(r0);
473
- } finally {
474
- wasm$1.__wbindgen_add_to_stack_pointer(16);
475
- }
476
- }
477
-
478
478
  function passArrayJsValueToWasm0(array, malloc) {
479
479
  const ptr = malloc(array.length * 4, 4) >>> 0;
480
480
  const mem = getDataViewMemory0();
@@ -494,16 +494,16 @@ function getArrayJsValueFromWasm0(ptr, len) {
494
494
  }
495
495
  return result;
496
496
  }
497
- function __wasm_bindgen_func_elem_7287(arg0, arg1) {
498
- wasm$1.__wasm_bindgen_func_elem_7287(arg0, arg1);
497
+ function __wasm_bindgen_func_elem_8740(arg0, arg1, arg2) {
498
+ wasm$1.__wasm_bindgen_func_elem_8740(arg0, arg1, addHeapObject(arg2));
499
499
  }
500
500
 
501
- function __wasm_bindgen_func_elem_8655(arg0, arg1, arg2) {
502
- wasm$1.__wasm_bindgen_func_elem_8655(arg0, arg1, addHeapObject(arg2));
501
+ function __wasm_bindgen_func_elem_7369(arg0, arg1) {
502
+ wasm$1.__wasm_bindgen_func_elem_7369(arg0, arg1);
503
503
  }
504
504
 
505
- function __wasm_bindgen_func_elem_7560(arg0, arg1, arg2, arg3) {
506
- wasm$1.__wasm_bindgen_func_elem_7560(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
505
+ function __wasm_bindgen_func_elem_7641(arg0, arg1, arg2, arg3) {
506
+ wasm$1.__wasm_bindgen_func_elem_7641(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
507
507
  }
508
508
 
509
509
  const __wbindgen_enum_RequestCredentials = ["omit", "same-origin", "include"];
@@ -19023,10 +19023,6 @@ function __wbg_get_imports(memory) {
19023
19023
  const ret = typeof(val) === 'object' && val !== null;
19024
19024
  return ret;
19025
19025
  };
19026
- imports.wbg.__wbg___wbindgen_is_string_fbb76cb2940daafd = function(arg0) {
19027
- const ret = typeof(getObject(arg0)) === 'string';
19028
- return ret;
19029
- };
19030
19026
  imports.wbg.__wbg___wbindgen_is_undefined_2d472862bd29a478 = function(arg0) {
19031
19027
  const ret = getObject(arg0) === undefined;
19032
19028
  return ret;
@@ -19108,10 +19104,6 @@ function __wbg_get_imports(memory) {
19108
19104
  const ret = clearTimeout(takeObject(arg0));
19109
19105
  return addHeapObject(ret);
19110
19106
  };
19111
- imports.wbg.__wbg_crypto_574e78ad8b13b65f = function(arg0) {
19112
- const ret = getObject(arg0).crypto;
19113
- return addHeapObject(ret);
19114
- };
19115
19107
  imports.wbg.__wbg_data_ee4306d069f24f2d = function(arg0) {
19116
19108
  const ret = getObject(arg0).data;
19117
19109
  return addHeapObject(ret);
@@ -19155,8 +19147,8 @@ function __wbg_get_imports(memory) {
19155
19147
  const ret = Array.from(getObject(arg0));
19156
19148
  return addHeapObject(ret);
19157
19149
  };
19158
- imports.wbg.__wbg_getRandomValues_b8f5dbd5f3995a9e = function() { return handleError(function (arg0, arg1) {
19159
- getObject(arg0).getRandomValues(getObject(arg1));
19150
+ imports.wbg.__wbg_getRandomValues_90e56bff4f3b89fb = function() { return handleError(function (arg0) {
19151
+ globalThis.crypto.getRandomValues(getObject(arg0));
19160
19152
  }, arguments) };
19161
19153
  imports.wbg.__wbg_get_7bed016f185add81 = function(arg0, arg1) {
19162
19154
  const ret = getObject(arg0)[arg1 >>> 0];
@@ -19246,13 +19238,9 @@ function __wbg_get_imports(memory) {
19246
19238
  const ret = getObject(arg0).length;
19247
19239
  return ret;
19248
19240
  };
19249
- imports.wbg.__wbg_log_b88efcc0ed7757a6 = function(arg0, arg1) {
19241
+ imports.wbg.__wbg_log_e77f2654b14580d9 = function(arg0, arg1) {
19250
19242
  console.log(getStringFromWasm0(arg0, arg1));
19251
19243
  };
19252
- imports.wbg.__wbg_msCrypto_a61aeb35a24c1329 = function(arg0) {
19253
- const ret = getObject(arg0).msCrypto;
19254
- return addHeapObject(ret);
19255
- };
19256
19244
  imports.wbg.__wbg_new_1acc0b6eea89d040 = function() {
19257
19245
  const ret = new Object();
19258
19246
  return addHeapObject(ret);
@@ -19268,7 +19256,7 @@ function __wbg_get_imports(memory) {
19268
19256
  const a = state0.a;
19269
19257
  state0.a = 0;
19270
19258
  try {
19271
- return __wasm_bindgen_func_elem_7560(a, state0.b, arg0, arg1);
19259
+ return __wasm_bindgen_func_elem_7641(a, state0.b, arg0, arg1);
19272
19260
  } finally {
19273
19261
  state0.a = a;
19274
19262
  }
@@ -19335,10 +19323,6 @@ function __wbg_get_imports(memory) {
19335
19323
  const ret = getObject(arg0).next;
19336
19324
  return addHeapObject(ret);
19337
19325
  };
19338
- imports.wbg.__wbg_node_905d3e251edff8a2 = function(arg0) {
19339
- const ret = getObject(arg0).node;
19340
- return addHeapObject(ret);
19341
- };
19342
19326
  imports.wbg.__wbg_of_3192b3b018b8f660 = function(arg0, arg1, arg2) {
19343
19327
  const ret = Array.of(getObject(arg0), getObject(arg1), getObject(arg2));
19344
19328
  return addHeapObject(ret);
@@ -19356,10 +19340,6 @@ function __wbg_get_imports(memory) {
19356
19340
  imports.wbg.__wbg_postMessage_f34857ca078c8536 = function() { return handleError(function (arg0, arg1) {
19357
19341
  getObject(arg0).postMessage(getObject(arg1));
19358
19342
  }, arguments) };
19359
- imports.wbg.__wbg_process_dc0fbacc7c1c06f7 = function(arg0) {
19360
- const ret = getObject(arg0).process;
19361
- return addHeapObject(ret);
19362
- };
19363
19343
  imports.wbg.__wbg_prototypesetcall_2a6620b6922694b2 = function(arg0, arg1, arg2) {
19364
19344
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
19365
19345
  };
@@ -19378,9 +19358,6 @@ function __wbg_get_imports(memory) {
19378
19358
  imports.wbg.__wbg_queueMicrotask_9d76cacb20c84d58 = function(arg0) {
19379
19359
  queueMicrotask(getObject(arg0));
19380
19360
  };
19381
- imports.wbg.__wbg_randomFillSync_ac0988aba3254290 = function() { return handleError(function (arg0, arg1) {
19382
- getObject(arg0).randomFillSync(takeObject(arg1));
19383
- }, arguments) };
19384
19361
  imports.wbg.__wbg_recordciphertext_new = function(arg0) {
19385
19362
  const ret = RecordCiphertext.__wrap(arg0);
19386
19363
  return addHeapObject(ret);
@@ -19393,10 +19370,6 @@ function __wbg_get_imports(memory) {
19393
19370
  const ret = RecordPlaintext.__wrap(arg0);
19394
19371
  return addHeapObject(ret);
19395
19372
  };
19396
- imports.wbg.__wbg_require_60cc747a6bc5215a = function() { return handleError(function () {
19397
- const ret = module.require;
19398
- return addHeapObject(ret);
19399
- }, arguments) };
19400
19373
  imports.wbg.__wbg_resolve_caf97c30b83f7053 = function(arg0) {
19401
19374
  const ret = Promise.resolve(getObject(arg0));
19402
19375
  return addHeapObject(ret);
@@ -19455,7 +19428,7 @@ function __wbg_get_imports(memory) {
19455
19428
  const ret = Signature.__wrap(arg0);
19456
19429
  return addHeapObject(ret);
19457
19430
  };
19458
- imports.wbg.__wbg_spawnWorker_6ede797d507e374c = function(arg0, arg1, arg2, arg3) {
19431
+ imports.wbg.__wbg_spawnWorker_77887968658d2179 = function(arg0, arg1, arg2, arg3) {
19459
19432
  const ret = spawnWorker(getObject(arg0), getObject(arg1), getObject(arg2), arg3 >>> 0);
19460
19433
  return addHeapObject(ret);
19461
19434
  };
@@ -19494,10 +19467,6 @@ function __wbg_get_imports(memory) {
19494
19467
  const ret = JSON.stringify(getObject(arg0));
19495
19468
  return addHeapObject(ret);
19496
19469
  }, arguments) };
19497
- imports.wbg.__wbg_subarray_480600f3d6a9f26c = function(arg0, arg1, arg2) {
19498
- const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
19499
- return addHeapObject(ret);
19500
- };
19501
19470
  imports.wbg.__wbg_then_4f46f6544e6b4a28 = function(arg0, arg1) {
19502
19471
  const ret = getObject(arg0).then(getObject(arg1));
19503
19472
  return addHeapObject(ret);
@@ -19533,10 +19502,6 @@ function __wbg_get_imports(memory) {
19533
19502
  const ret = VerifyingKey.__wrap(arg0);
19534
19503
  return addHeapObject(ret);
19535
19504
  };
19536
- imports.wbg.__wbg_versions_c01dfd4722a88165 = function(arg0) {
19537
- const ret = getObject(arg0).versions;
19538
- return addHeapObject(ret);
19539
- };
19540
19505
  imports.wbg.__wbg_waitAsync_2c4b633ebb554615 = function() {
19541
19506
  const ret = Atomics.waitAsync;
19542
19507
  return addHeapObject(ret);
@@ -19555,24 +19520,19 @@ function __wbg_get_imports(memory) {
19555
19520
  const ret = (BigInt.asUintN(64, arg0) | (arg1 << BigInt(64)));
19556
19521
  return addHeapObject(ret);
19557
19522
  };
19558
- imports.wbg.__wbindgen_cast_3ebebf8ee554379e = function(arg0, arg1) {
19559
- // Cast intrinsic for `Closure(Closure { dtor_idx: 354, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 355, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19560
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_8655);
19561
- return addHeapObject(ret);
19562
- };
19563
19523
  imports.wbg.__wbindgen_cast_4625c577ab2ec9ee = function(arg0) {
19564
19524
  // Cast intrinsic for `U64 -> Externref`.
19565
19525
  const ret = BigInt.asUintN(64, arg0);
19566
19526
  return addHeapObject(ret);
19567
19527
  };
19568
- imports.wbg.__wbindgen_cast_5e9bcb6388942484 = function(arg0, arg1) {
19569
- // Cast intrinsic for `Closure(Closure { dtor_idx: 354, function: Function { arguments: [], shim_idx: 462, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19570
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_7287);
19528
+ imports.wbg.__wbindgen_cast_4a64cbb5b17898c9 = function(arg0, arg1) {
19529
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [Externref], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19530
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7368, __wasm_bindgen_func_elem_8740);
19571
19531
  return addHeapObject(ret);
19572
19532
  };
19573
- imports.wbg.__wbindgen_cast_74f3a90a349943d1 = function(arg0, arg1) {
19574
- // Cast intrinsic for `Closure(Closure { dtor_idx: 354, function: Function { arguments: [Externref], shim_idx: 355, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19575
- const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7286, __wasm_bindgen_func_elem_8655);
19533
+ imports.wbg.__wbindgen_cast_65bbaf572cb463ed = function(arg0, arg1) {
19534
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 359, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19535
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7368, __wasm_bindgen_func_elem_8740);
19576
19536
  return addHeapObject(ret);
19577
19537
  };
19578
19538
  imports.wbg.__wbindgen_cast_9ae0607507abb057 = function(arg0) {
@@ -19580,9 +19540,9 @@ function __wbg_get_imports(memory) {
19580
19540
  const ret = arg0;
19581
19541
  return addHeapObject(ret);
19582
19542
  };
19583
- imports.wbg.__wbindgen_cast_cb9088102bce6b30 = function(arg0, arg1) {
19584
- // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
19585
- const ret = getArrayU8FromWasm0(arg0, arg1);
19543
+ imports.wbg.__wbindgen_cast_aca65e91b5ef2a91 = function(arg0, arg1) {
19544
+ // Cast intrinsic for `Closure(Closure { dtor_idx: 358, function: Function { arguments: [], shim_idx: 467, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
19545
+ const ret = makeMutClosure(arg0, arg1, wasm$1.__wasm_bindgen_func_elem_7368, __wasm_bindgen_func_elem_7369);
19586
19546
  return addHeapObject(ret);
19587
19547
  };
19588
19548
  imports.wbg.__wbindgen_cast_d6cd19b81560fd6e = function(arg0) {