@aztec/noir-acvm_js 3.0.0-nightly.20251013 → 3.0.0-nightly.20251015

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.
@@ -1,29 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Performs a bitwise AND operation between `lhs` and `rhs`
5
- */
6
- export function and(lhs: string, rhs: string): string;
7
- /**
8
- * Performs a bitwise XOR operation between `lhs` and `rhs`
9
- */
10
- export function xor(lhs: string, rhs: string): string;
11
- /**
12
- * Sha256 compression function
13
- */
14
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
15
- /**
16
- * Calculates the Blake2s256 hash of the input bytes
17
- */
18
- export function blake2s256(inputs: Uint8Array): Uint8Array;
19
- /**
20
- * Verifies a ECDSA signature over the secp256k1 curve.
21
- */
22
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
23
- /**
24
- * Verifies a ECDSA signature over the secp256r1 curve.
25
- */
26
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
27
3
  /**
28
4
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
29
5
  *
@@ -82,10 +58,11 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
82
58
  */
83
59
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
84
60
  /**
85
- * Returns the `BuildInfo` object containing information about how the installed package was built.
86
- * @returns {BuildInfo} - Information on how the installed package was built.
61
+ * Sets the package's logging level.
62
+ *
63
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
87
64
  */
88
- export function buildInfo(): BuildInfo;
65
+ export function initLogLevel(filter: string): void;
89
66
  /**
90
67
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
91
68
  *
@@ -111,25 +88,34 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
111
88
  */
112
89
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
113
90
  /**
114
- * Sets the package's logging level.
115
- *
116
- * @param {LogLevel} level - The maximum level of logging to be emitted.
91
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
92
+ * @returns {BuildInfo} - Information on how the installed package was built.
117
93
  */
118
- export function initLogLevel(filter: string): void;
119
-
94
+ export function buildInfo(): BuildInfo;
120
95
  /**
121
- * @typedef {Object} BuildInfo - Information about how the installed package was built
122
- * @property {string} gitHash - The hash of the git commit from which the package was built.
123
- * @property {string} version - The version of the package at the built git commit.
124
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
96
+ * Performs a bitwise AND operation between `lhs` and `rhs`
125
97
  */
126
- export type BuildInfo = {
127
- gitHash: string;
128
- version: string;
129
- dirty: string;
130
- }
131
-
132
-
98
+ export function and(lhs: string, rhs: string): string;
99
+ /**
100
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
101
+ */
102
+ export function xor(lhs: string, rhs: string): string;
103
+ /**
104
+ * Sha256 compression function
105
+ */
106
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
107
+ /**
108
+ * Calculates the Blake2s256 hash of the input bytes
109
+ */
110
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
111
+ /**
112
+ * Verifies a ECDSA signature over the secp256k1 curve.
113
+ */
114
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
115
+ /**
116
+ * Verifies a ECDSA signature over the secp256r1 curve.
117
+ */
118
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
133
119
 
134
120
  export type RawAssertionPayload = {
135
121
  selector: string;
@@ -145,6 +131,20 @@ export type ExecutionError = Error & {
145
131
 
146
132
 
147
133
 
134
+ export type ForeignCallInput = string[]
135
+ export type ForeignCallOutput = string | string[]
136
+
137
+ /**
138
+ * A callback which performs an foreign call and returns the response.
139
+ * @callback ForeignCallHandler
140
+ * @param {string} name - The identifier for the type of foreign call being performed.
141
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
142
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
143
+ */
144
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
145
+
146
+
147
+
148
148
  // Map from witness index to hex string value of witness.
149
149
  export type WitnessMap = Map<number, string>;
150
150
 
@@ -169,16 +169,16 @@ export type WitnessStack = Array<StackItem>;
169
169
 
170
170
 
171
171
 
172
- export type ForeignCallInput = string[]
173
- export type ForeignCallOutput = string | string[]
174
-
175
172
  /**
176
- * A callback which performs an foreign call and returns the response.
177
- * @callback ForeignCallHandler
178
- * @param {string} name - The identifier for the type of foreign call being performed.
179
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
180
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
181
- */
182
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
173
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
174
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
175
+ * @property {string} version - The version of the package at the built git commit.
176
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
+ */
178
+ export type BuildInfo = {
179
+ gitHash: string;
180
+ version: string;
181
+ dirty: string;
182
+ }
183
183
 
184
184
 
package/nodejs/acvm_js.js CHANGED
@@ -201,137 +201,17 @@ function debugString(val) {
201
201
  // TODO we could test for more things here, like `Set`s and `Map`s.
202
202
  return className;
203
203
  }
204
- /**
205
- * Performs a bitwise AND operation between `lhs` and `rhs`
206
- * @param {string} lhs
207
- * @param {string} rhs
208
- * @returns {string}
209
- */
210
- module.exports.and = function(lhs, rhs) {
211
- const ret = wasm.and(lhs, rhs);
212
- return ret;
213
- };
214
-
215
- /**
216
- * Performs a bitwise XOR operation between `lhs` and `rhs`
217
- * @param {string} lhs
218
- * @param {string} rhs
219
- * @returns {string}
220
- */
221
- module.exports.xor = function(lhs, rhs) {
222
- const ret = wasm.xor(lhs, rhs);
223
- return ret;
224
- };
225
-
226
- let cachedUint32ArrayMemory0 = null;
227
-
228
- function getUint32ArrayMemory0() {
229
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
230
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
231
- }
232
- return cachedUint32ArrayMemory0;
233
- }
234
-
235
- function passArray32ToWasm0(arg, malloc) {
236
- const ptr = malloc(arg.length * 4, 4) >>> 0;
237
- getUint32ArrayMemory0().set(arg, ptr / 4);
238
- WASM_VECTOR_LEN = arg.length;
239
- return ptr;
240
- }
241
204
 
242
- function getArrayU32FromWasm0(ptr, len) {
243
- ptr = ptr >>> 0;
244
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
245
- }
246
- /**
247
- * Sha256 compression function
248
- * @param {Uint32Array} inputs
249
- * @param {Uint32Array} state
250
- * @returns {Uint32Array}
251
- */
252
- module.exports.sha256_compression = function(inputs, state) {
253
- const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
254
- const len0 = WASM_VECTOR_LEN;
255
- const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
256
- const len1 = WASM_VECTOR_LEN;
257
- const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
258
- var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
259
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
260
- return v3;
261
- };
262
-
263
- function passArray8ToWasm0(arg, malloc) {
264
- const ptr = malloc(arg.length * 1, 1) >>> 0;
265
- getUint8ArrayMemory0().set(arg, ptr / 1);
266
- WASM_VECTOR_LEN = arg.length;
267
- return ptr;
205
+ function takeFromExternrefTable0(idx) {
206
+ const value = wasm.__wbindgen_export_2.get(idx);
207
+ wasm.__externref_table_dealloc(idx);
208
+ return value;
268
209
  }
269
210
 
270
211
  function getArrayU8FromWasm0(ptr, len) {
271
212
  ptr = ptr >>> 0;
272
213
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
273
214
  }
274
- /**
275
- * Calculates the Blake2s256 hash of the input bytes
276
- * @param {Uint8Array} inputs
277
- * @returns {Uint8Array}
278
- */
279
- module.exports.blake2s256 = function(inputs) {
280
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
281
- const len0 = WASM_VECTOR_LEN;
282
- const ret = wasm.blake2s256(ptr0, len0);
283
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
284
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
285
- return v2;
286
- };
287
-
288
- /**
289
- * Verifies a ECDSA signature over the secp256k1 curve.
290
- * @param {Uint8Array} hashed_msg
291
- * @param {Uint8Array} public_key_x_bytes
292
- * @param {Uint8Array} public_key_y_bytes
293
- * @param {Uint8Array} signature
294
- * @returns {boolean}
295
- */
296
- module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
297
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
298
- const len0 = WASM_VECTOR_LEN;
299
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
300
- const len1 = WASM_VECTOR_LEN;
301
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
302
- const len2 = WASM_VECTOR_LEN;
303
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
304
- const len3 = WASM_VECTOR_LEN;
305
- const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
306
- return ret !== 0;
307
- };
308
-
309
- /**
310
- * Verifies a ECDSA signature over the secp256r1 curve.
311
- * @param {Uint8Array} hashed_msg
312
- * @param {Uint8Array} public_key_x_bytes
313
- * @param {Uint8Array} public_key_y_bytes
314
- * @param {Uint8Array} signature
315
- * @returns {boolean}
316
- */
317
- module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
318
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
319
- const len0 = WASM_VECTOR_LEN;
320
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
321
- const len1 = WASM_VECTOR_LEN;
322
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
323
- const len2 = WASM_VECTOR_LEN;
324
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
325
- const len3 = WASM_VECTOR_LEN;
326
- const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
327
- return ret !== 0;
328
- };
329
-
330
- function takeFromExternrefTable0(idx) {
331
- const value = wasm.__wbindgen_export_2.get(idx);
332
- wasm.__externref_table_dealloc(idx);
333
- return value;
334
- }
335
215
  /**
336
216
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
337
217
  *
@@ -348,6 +228,12 @@ module.exports.compressWitness = function(witness_map) {
348
228
  return v1;
349
229
  };
350
230
 
231
+ function passArray8ToWasm0(arg, malloc) {
232
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
233
+ getUint8ArrayMemory0().set(arg, ptr / 1);
234
+ WASM_VECTOR_LEN = arg.length;
235
+ return ptr;
236
+ }
351
237
  /**
352
238
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
353
239
  * This should be used to only fetch the witness map for the main function.
@@ -444,12 +330,17 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
444
330
  };
445
331
 
446
332
  /**
447
- * Returns the `BuildInfo` object containing information about how the installed package was built.
448
- * @returns {BuildInfo} - Information on how the installed package was built.
333
+ * Sets the package's logging level.
334
+ *
335
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
449
336
  */
450
- module.exports.buildInfo = function() {
451
- const ret = wasm.buildInfo();
452
- return ret;
337
+ module.exports.initLogLevel = function(filter) {
338
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
339
+ const len0 = WASM_VECTOR_LEN;
340
+ const ret = wasm.initLogLevel(ptr0, len0);
341
+ if (ret[1]) {
342
+ throw takeFromExternrefTable0(ret[0]);
343
+ }
453
344
  };
454
345
 
455
346
  /**
@@ -513,29 +404,139 @@ module.exports.getPublicWitness = function(program, solved_witness) {
513
404
  };
514
405
 
515
406
  /**
516
- * Sets the package's logging level.
517
- *
518
- * @param {LogLevel} level - The maximum level of logging to be emitted.
407
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
408
+ * @returns {BuildInfo} - Information on how the installed package was built.
519
409
  */
520
- module.exports.initLogLevel = function(filter) {
521
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
522
- const len0 = WASM_VECTOR_LEN;
523
- const ret = wasm.initLogLevel(ptr0, len0);
524
- if (ret[1]) {
525
- throw takeFromExternrefTable0(ret[0]);
410
+ module.exports.buildInfo = function() {
411
+ const ret = wasm.buildInfo();
412
+ return ret;
413
+ };
414
+
415
+ /**
416
+ * Performs a bitwise AND operation between `lhs` and `rhs`
417
+ * @param {string} lhs
418
+ * @param {string} rhs
419
+ * @returns {string}
420
+ */
421
+ module.exports.and = function(lhs, rhs) {
422
+ const ret = wasm.and(lhs, rhs);
423
+ return ret;
424
+ };
425
+
426
+ /**
427
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
428
+ * @param {string} lhs
429
+ * @param {string} rhs
430
+ * @returns {string}
431
+ */
432
+ module.exports.xor = function(lhs, rhs) {
433
+ const ret = wasm.xor(lhs, rhs);
434
+ return ret;
435
+ };
436
+
437
+ let cachedUint32ArrayMemory0 = null;
438
+
439
+ function getUint32ArrayMemory0() {
440
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
441
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
526
442
  }
443
+ return cachedUint32ArrayMemory0;
444
+ }
445
+
446
+ function passArray32ToWasm0(arg, malloc) {
447
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
448
+ getUint32ArrayMemory0().set(arg, ptr / 4);
449
+ WASM_VECTOR_LEN = arg.length;
450
+ return ptr;
451
+ }
452
+
453
+ function getArrayU32FromWasm0(ptr, len) {
454
+ ptr = ptr >>> 0;
455
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
456
+ }
457
+ /**
458
+ * Sha256 compression function
459
+ * @param {Uint32Array} inputs
460
+ * @param {Uint32Array} state
461
+ * @returns {Uint32Array}
462
+ */
463
+ module.exports.sha256_compression = function(inputs, state) {
464
+ const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
465
+ const len0 = WASM_VECTOR_LEN;
466
+ const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
467
+ const len1 = WASM_VECTOR_LEN;
468
+ const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
469
+ var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
470
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
471
+ return v3;
472
+ };
473
+
474
+ /**
475
+ * Calculates the Blake2s256 hash of the input bytes
476
+ * @param {Uint8Array} inputs
477
+ * @returns {Uint8Array}
478
+ */
479
+ module.exports.blake2s256 = function(inputs) {
480
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
481
+ const len0 = WASM_VECTOR_LEN;
482
+ const ret = wasm.blake2s256(ptr0, len0);
483
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
484
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
485
+ return v2;
486
+ };
487
+
488
+ /**
489
+ * Verifies a ECDSA signature over the secp256k1 curve.
490
+ * @param {Uint8Array} hashed_msg
491
+ * @param {Uint8Array} public_key_x_bytes
492
+ * @param {Uint8Array} public_key_y_bytes
493
+ * @param {Uint8Array} signature
494
+ * @returns {boolean}
495
+ */
496
+ module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
497
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
498
+ const len0 = WASM_VECTOR_LEN;
499
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
500
+ const len1 = WASM_VECTOR_LEN;
501
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
502
+ const len2 = WASM_VECTOR_LEN;
503
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
504
+ const len3 = WASM_VECTOR_LEN;
505
+ const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
506
+ return ret !== 0;
507
+ };
508
+
509
+ /**
510
+ * Verifies a ECDSA signature over the secp256r1 curve.
511
+ * @param {Uint8Array} hashed_msg
512
+ * @param {Uint8Array} public_key_x_bytes
513
+ * @param {Uint8Array} public_key_y_bytes
514
+ * @param {Uint8Array} signature
515
+ * @returns {boolean}
516
+ */
517
+ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
518
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
519
+ const len0 = WASM_VECTOR_LEN;
520
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
521
+ const len1 = WASM_VECTOR_LEN;
522
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
523
+ const len2 = WASM_VECTOR_LEN;
524
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
525
+ const len3 = WASM_VECTOR_LEN;
526
+ const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
527
+ return ret !== 0;
527
528
  };
528
529
 
529
530
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
- wasm.closure581_externref_shim(arg0, arg1, arg2);
531
+ wasm.closure584_externref_shim(arg0, arg1, arg2);
531
532
  }
532
533
 
533
534
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure1176_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
+ wasm.closure1179_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
536
  }
536
537
 
537
538
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure1180_externref_shim(arg0, arg1, arg2, arg3);
539
+ wasm.closure1183_externref_shim(arg0, arg1, arg2, arg3);
539
540
  }
540
541
 
541
542
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -813,8 +814,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
813
814
  return ret;
814
815
  };
815
816
 
816
- module.exports.__wbindgen_closure_wrapper1972 = function(arg0, arg1, arg2) {
817
- const ret = makeMutClosure(arg0, arg1, 582, __wbg_adapter_30);
817
+ module.exports.__wbindgen_closure_wrapper1979 = function(arg0, arg1, arg2) {
818
+ const ret = makeMutClosure(arg0, arg1, 585, __wbg_adapter_30);
818
819
  return ret;
819
820
  };
820
821
 
Binary file
@@ -1,12 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const and: (a: any, b: any) => any;
5
- export const xor: (a: any, b: any) => any;
6
- export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
7
- export const blake2s256: (a: number, b: number) => [number, number];
8
- export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
9
- export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
10
4
  export const compressWitness: (a: any) => [number, number, number, number];
11
5
  export const decompressWitness: (a: number, b: number) => [number, number, number];
12
6
  export const compressWitnessStack: (a: any) => [number, number, number, number];
@@ -14,11 +8,17 @@ export const decompressWitnessStack: (a: number, b: number) => [number, number,
14
8
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
15
9
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
16
10
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
17
- export const buildInfo: () => any;
11
+ export const initLogLevel: (a: number, b: number) => [number, number];
18
12
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
19
13
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
20
14
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
21
- export const initLogLevel: (a: number, b: number) => [number, number];
15
+ export const buildInfo: () => any;
16
+ export const and: (a: any, b: any) => any;
17
+ export const xor: (a: any, b: any) => any;
18
+ export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
19
+ export const blake2s256: (a: number, b: number) => [number, number];
20
+ export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
21
+ export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const closure581_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure1176_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1180_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure584_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure1179_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure1183_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/noir-acvm_js",
3
- "version": "3.0.0-nightly.20251013",
3
+ "version": "3.0.0-nightly.20251015",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -1,29 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Performs a bitwise AND operation between `lhs` and `rhs`
5
- */
6
- export function and(lhs: string, rhs: string): string;
7
- /**
8
- * Performs a bitwise XOR operation between `lhs` and `rhs`
9
- */
10
- export function xor(lhs: string, rhs: string): string;
11
- /**
12
- * Sha256 compression function
13
- */
14
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
15
- /**
16
- * Calculates the Blake2s256 hash of the input bytes
17
- */
18
- export function blake2s256(inputs: Uint8Array): Uint8Array;
19
- /**
20
- * Verifies a ECDSA signature over the secp256k1 curve.
21
- */
22
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
23
- /**
24
- * Verifies a ECDSA signature over the secp256r1 curve.
25
- */
26
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
27
3
  /**
28
4
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
29
5
  *
@@ -82,10 +58,11 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
82
58
  */
83
59
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
84
60
  /**
85
- * Returns the `BuildInfo` object containing information about how the installed package was built.
86
- * @returns {BuildInfo} - Information on how the installed package was built.
61
+ * Sets the package's logging level.
62
+ *
63
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
87
64
  */
88
- export function buildInfo(): BuildInfo;
65
+ export function initLogLevel(filter: string): void;
89
66
  /**
90
67
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
91
68
  *
@@ -111,25 +88,34 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
111
88
  */
112
89
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
113
90
  /**
114
- * Sets the package's logging level.
115
- *
116
- * @param {LogLevel} level - The maximum level of logging to be emitted.
91
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
92
+ * @returns {BuildInfo} - Information on how the installed package was built.
117
93
  */
118
- export function initLogLevel(filter: string): void;
119
-
94
+ export function buildInfo(): BuildInfo;
120
95
  /**
121
- * @typedef {Object} BuildInfo - Information about how the installed package was built
122
- * @property {string} gitHash - The hash of the git commit from which the package was built.
123
- * @property {string} version - The version of the package at the built git commit.
124
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
96
+ * Performs a bitwise AND operation between `lhs` and `rhs`
125
97
  */
126
- export type BuildInfo = {
127
- gitHash: string;
128
- version: string;
129
- dirty: string;
130
- }
131
-
132
-
98
+ export function and(lhs: string, rhs: string): string;
99
+ /**
100
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
101
+ */
102
+ export function xor(lhs: string, rhs: string): string;
103
+ /**
104
+ * Sha256 compression function
105
+ */
106
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
107
+ /**
108
+ * Calculates the Blake2s256 hash of the input bytes
109
+ */
110
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
111
+ /**
112
+ * Verifies a ECDSA signature over the secp256k1 curve.
113
+ */
114
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
115
+ /**
116
+ * Verifies a ECDSA signature over the secp256r1 curve.
117
+ */
118
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
133
119
 
134
120
  export type RawAssertionPayload = {
135
121
  selector: string;
@@ -145,6 +131,20 @@ export type ExecutionError = Error & {
145
131
 
146
132
 
147
133
 
134
+ export type ForeignCallInput = string[]
135
+ export type ForeignCallOutput = string | string[]
136
+
137
+ /**
138
+ * A callback which performs an foreign call and returns the response.
139
+ * @callback ForeignCallHandler
140
+ * @param {string} name - The identifier for the type of foreign call being performed.
141
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
142
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
143
+ */
144
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
145
+
146
+
147
+
148
148
  // Map from witness index to hex string value of witness.
149
149
  export type WitnessMap = Map<number, string>;
150
150
 
@@ -169,17 +169,17 @@ export type WitnessStack = Array<StackItem>;
169
169
 
170
170
 
171
171
 
172
- export type ForeignCallInput = string[]
173
- export type ForeignCallOutput = string | string[]
174
-
175
172
  /**
176
- * A callback which performs an foreign call and returns the response.
177
- * @callback ForeignCallHandler
178
- * @param {string} name - The identifier for the type of foreign call being performed.
179
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
180
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
181
- */
182
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
173
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
174
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
175
+ * @property {string} version - The version of the package at the built git commit.
176
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
+ */
178
+ export type BuildInfo = {
179
+ gitHash: string;
180
+ version: string;
181
+ dirty: string;
182
+ }
183
183
 
184
184
 
185
185
 
@@ -187,12 +187,6 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
187
187
 
188
188
  export interface InitOutput {
189
189
  readonly memory: WebAssembly.Memory;
190
- readonly and: (a: any, b: any) => any;
191
- readonly xor: (a: any, b: any) => any;
192
- readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
193
- readonly blake2s256: (a: number, b: number) => [number, number];
194
- readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
195
- readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
196
190
  readonly compressWitness: (a: any) => [number, number, number, number];
197
191
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
198
192
  readonly compressWitnessStack: (a: any) => [number, number, number, number];
@@ -200,11 +194,17 @@ export interface InitOutput {
200
194
  readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
201
195
  readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
202
196
  readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
203
- readonly buildInfo: () => any;
197
+ readonly initLogLevel: (a: number, b: number) => [number, number];
204
198
  readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
205
199
  readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
206
200
  readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
207
- readonly initLogLevel: (a: number, b: number) => [number, number];
201
+ readonly buildInfo: () => any;
202
+ readonly and: (a: any, b: any) => any;
203
+ readonly xor: (a: any, b: any) => any;
204
+ readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
205
+ readonly blake2s256: (a: number, b: number) => [number, number];
206
+ readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
207
+ readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
208
208
  readonly __wbindgen_exn_store: (a: number) => void;
209
209
  readonly __externref_table_alloc: () => number;
210
210
  readonly __wbindgen_export_2: WebAssembly.Table;
@@ -213,9 +213,9 @@ export interface InitOutput {
213
213
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
214
214
  readonly __wbindgen_export_6: WebAssembly.Table;
215
215
  readonly __externref_table_dealloc: (a: number) => void;
216
- readonly closure581_externref_shim: (a: number, b: number, c: any) => void;
217
- readonly closure1176_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
- readonly closure1180_externref_shim: (a: number, b: number, c: any, d: any) => void;
216
+ readonly closure584_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure1179_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure1183_externref_shim: (a: number, b: number, c: any, d: any) => void;
219
219
  readonly __wbindgen_start: () => void;
220
220
  }
221
221
 
package/web/acvm_js.js CHANGED
@@ -197,137 +197,17 @@ function debugString(val) {
197
197
  // TODO we could test for more things here, like `Set`s and `Map`s.
198
198
  return className;
199
199
  }
200
- /**
201
- * Performs a bitwise AND operation between `lhs` and `rhs`
202
- * @param {string} lhs
203
- * @param {string} rhs
204
- * @returns {string}
205
- */
206
- export function and(lhs, rhs) {
207
- const ret = wasm.and(lhs, rhs);
208
- return ret;
209
- }
210
-
211
- /**
212
- * Performs a bitwise XOR operation between `lhs` and `rhs`
213
- * @param {string} lhs
214
- * @param {string} rhs
215
- * @returns {string}
216
- */
217
- export function xor(lhs, rhs) {
218
- const ret = wasm.xor(lhs, rhs);
219
- return ret;
220
- }
221
-
222
- let cachedUint32ArrayMemory0 = null;
223
-
224
- function getUint32ArrayMemory0() {
225
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
226
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
227
- }
228
- return cachedUint32ArrayMemory0;
229
- }
230
-
231
- function passArray32ToWasm0(arg, malloc) {
232
- const ptr = malloc(arg.length * 4, 4) >>> 0;
233
- getUint32ArrayMemory0().set(arg, ptr / 4);
234
- WASM_VECTOR_LEN = arg.length;
235
- return ptr;
236
- }
237
200
 
238
- function getArrayU32FromWasm0(ptr, len) {
239
- ptr = ptr >>> 0;
240
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
241
- }
242
- /**
243
- * Sha256 compression function
244
- * @param {Uint32Array} inputs
245
- * @param {Uint32Array} state
246
- * @returns {Uint32Array}
247
- */
248
- export function sha256_compression(inputs, state) {
249
- const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
250
- const len0 = WASM_VECTOR_LEN;
251
- const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
252
- const len1 = WASM_VECTOR_LEN;
253
- const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
254
- var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
255
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
256
- return v3;
257
- }
258
-
259
- function passArray8ToWasm0(arg, malloc) {
260
- const ptr = malloc(arg.length * 1, 1) >>> 0;
261
- getUint8ArrayMemory0().set(arg, ptr / 1);
262
- WASM_VECTOR_LEN = arg.length;
263
- return ptr;
201
+ function takeFromExternrefTable0(idx) {
202
+ const value = wasm.__wbindgen_export_2.get(idx);
203
+ wasm.__externref_table_dealloc(idx);
204
+ return value;
264
205
  }
265
206
 
266
207
  function getArrayU8FromWasm0(ptr, len) {
267
208
  ptr = ptr >>> 0;
268
209
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
269
210
  }
270
- /**
271
- * Calculates the Blake2s256 hash of the input bytes
272
- * @param {Uint8Array} inputs
273
- * @returns {Uint8Array}
274
- */
275
- export function blake2s256(inputs) {
276
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
277
- const len0 = WASM_VECTOR_LEN;
278
- const ret = wasm.blake2s256(ptr0, len0);
279
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
280
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
281
- return v2;
282
- }
283
-
284
- /**
285
- * Verifies a ECDSA signature over the secp256k1 curve.
286
- * @param {Uint8Array} hashed_msg
287
- * @param {Uint8Array} public_key_x_bytes
288
- * @param {Uint8Array} public_key_y_bytes
289
- * @param {Uint8Array} signature
290
- * @returns {boolean}
291
- */
292
- export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
293
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
294
- const len0 = WASM_VECTOR_LEN;
295
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
296
- const len1 = WASM_VECTOR_LEN;
297
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
298
- const len2 = WASM_VECTOR_LEN;
299
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
300
- const len3 = WASM_VECTOR_LEN;
301
- const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
302
- return ret !== 0;
303
- }
304
-
305
- /**
306
- * Verifies a ECDSA signature over the secp256r1 curve.
307
- * @param {Uint8Array} hashed_msg
308
- * @param {Uint8Array} public_key_x_bytes
309
- * @param {Uint8Array} public_key_y_bytes
310
- * @param {Uint8Array} signature
311
- * @returns {boolean}
312
- */
313
- export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
314
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
315
- const len0 = WASM_VECTOR_LEN;
316
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
317
- const len1 = WASM_VECTOR_LEN;
318
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
319
- const len2 = WASM_VECTOR_LEN;
320
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
321
- const len3 = WASM_VECTOR_LEN;
322
- const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
323
- return ret !== 0;
324
- }
325
-
326
- function takeFromExternrefTable0(idx) {
327
- const value = wasm.__wbindgen_export_2.get(idx);
328
- wasm.__externref_table_dealloc(idx);
329
- return value;
330
- }
331
211
  /**
332
212
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
333
213
  *
@@ -344,6 +224,12 @@ export function compressWitness(witness_map) {
344
224
  return v1;
345
225
  }
346
226
 
227
+ function passArray8ToWasm0(arg, malloc) {
228
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
229
+ getUint8ArrayMemory0().set(arg, ptr / 1);
230
+ WASM_VECTOR_LEN = arg.length;
231
+ return ptr;
232
+ }
347
233
  /**
348
234
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
349
235
  * This should be used to only fetch the witness map for the main function.
@@ -440,12 +326,17 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
440
326
  }
441
327
 
442
328
  /**
443
- * Returns the `BuildInfo` object containing information about how the installed package was built.
444
- * @returns {BuildInfo} - Information on how the installed package was built.
329
+ * Sets the package's logging level.
330
+ *
331
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
445
332
  */
446
- export function buildInfo() {
447
- const ret = wasm.buildInfo();
448
- return ret;
333
+ export function initLogLevel(filter) {
334
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
335
+ const len0 = WASM_VECTOR_LEN;
336
+ const ret = wasm.initLogLevel(ptr0, len0);
337
+ if (ret[1]) {
338
+ throw takeFromExternrefTable0(ret[0]);
339
+ }
449
340
  }
450
341
 
451
342
  /**
@@ -509,29 +400,139 @@ export function getPublicWitness(program, solved_witness) {
509
400
  }
510
401
 
511
402
  /**
512
- * Sets the package's logging level.
513
- *
514
- * @param {LogLevel} level - The maximum level of logging to be emitted.
403
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
404
+ * @returns {BuildInfo} - Information on how the installed package was built.
515
405
  */
516
- export function initLogLevel(filter) {
517
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
518
- const len0 = WASM_VECTOR_LEN;
519
- const ret = wasm.initLogLevel(ptr0, len0);
520
- if (ret[1]) {
521
- throw takeFromExternrefTable0(ret[0]);
406
+ export function buildInfo() {
407
+ const ret = wasm.buildInfo();
408
+ return ret;
409
+ }
410
+
411
+ /**
412
+ * Performs a bitwise AND operation between `lhs` and `rhs`
413
+ * @param {string} lhs
414
+ * @param {string} rhs
415
+ * @returns {string}
416
+ */
417
+ export function and(lhs, rhs) {
418
+ const ret = wasm.and(lhs, rhs);
419
+ return ret;
420
+ }
421
+
422
+ /**
423
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
424
+ * @param {string} lhs
425
+ * @param {string} rhs
426
+ * @returns {string}
427
+ */
428
+ export function xor(lhs, rhs) {
429
+ const ret = wasm.xor(lhs, rhs);
430
+ return ret;
431
+ }
432
+
433
+ let cachedUint32ArrayMemory0 = null;
434
+
435
+ function getUint32ArrayMemory0() {
436
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
437
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
522
438
  }
439
+ return cachedUint32ArrayMemory0;
440
+ }
441
+
442
+ function passArray32ToWasm0(arg, malloc) {
443
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
444
+ getUint32ArrayMemory0().set(arg, ptr / 4);
445
+ WASM_VECTOR_LEN = arg.length;
446
+ return ptr;
447
+ }
448
+
449
+ function getArrayU32FromWasm0(ptr, len) {
450
+ ptr = ptr >>> 0;
451
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
452
+ }
453
+ /**
454
+ * Sha256 compression function
455
+ * @param {Uint32Array} inputs
456
+ * @param {Uint32Array} state
457
+ * @returns {Uint32Array}
458
+ */
459
+ export function sha256_compression(inputs, state) {
460
+ const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
461
+ const len0 = WASM_VECTOR_LEN;
462
+ const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
463
+ const len1 = WASM_VECTOR_LEN;
464
+ const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
465
+ var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
466
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
467
+ return v3;
468
+ }
469
+
470
+ /**
471
+ * Calculates the Blake2s256 hash of the input bytes
472
+ * @param {Uint8Array} inputs
473
+ * @returns {Uint8Array}
474
+ */
475
+ export function blake2s256(inputs) {
476
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
477
+ const len0 = WASM_VECTOR_LEN;
478
+ const ret = wasm.blake2s256(ptr0, len0);
479
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
480
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
481
+ return v2;
482
+ }
483
+
484
+ /**
485
+ * Verifies a ECDSA signature over the secp256k1 curve.
486
+ * @param {Uint8Array} hashed_msg
487
+ * @param {Uint8Array} public_key_x_bytes
488
+ * @param {Uint8Array} public_key_y_bytes
489
+ * @param {Uint8Array} signature
490
+ * @returns {boolean}
491
+ */
492
+ export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
493
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
494
+ const len0 = WASM_VECTOR_LEN;
495
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
496
+ const len1 = WASM_VECTOR_LEN;
497
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
498
+ const len2 = WASM_VECTOR_LEN;
499
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
500
+ const len3 = WASM_VECTOR_LEN;
501
+ const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
502
+ return ret !== 0;
503
+ }
504
+
505
+ /**
506
+ * Verifies a ECDSA signature over the secp256r1 curve.
507
+ * @param {Uint8Array} hashed_msg
508
+ * @param {Uint8Array} public_key_x_bytes
509
+ * @param {Uint8Array} public_key_y_bytes
510
+ * @param {Uint8Array} signature
511
+ * @returns {boolean}
512
+ */
513
+ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
514
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
515
+ const len0 = WASM_VECTOR_LEN;
516
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
517
+ const len1 = WASM_VECTOR_LEN;
518
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
519
+ const len2 = WASM_VECTOR_LEN;
520
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
521
+ const len3 = WASM_VECTOR_LEN;
522
+ const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
523
+ return ret !== 0;
523
524
  }
524
525
 
525
526
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
- wasm.closure581_externref_shim(arg0, arg1, arg2);
527
+ wasm.closure584_externref_shim(arg0, arg1, arg2);
527
528
  }
528
529
 
529
530
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure1176_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
+ wasm.closure1179_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
532
  }
532
533
 
533
534
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure1180_externref_shim(arg0, arg1, arg2, arg3);
535
+ wasm.closure1183_externref_shim(arg0, arg1, arg2, arg3);
535
536
  }
536
537
 
537
538
  async function __wbg_load(module, imports) {
@@ -797,8 +798,8 @@ function __wbg_get_imports() {
797
798
  const ret = false;
798
799
  return ret;
799
800
  };
800
- imports.wbg.__wbindgen_closure_wrapper1972 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 582, __wbg_adapter_30);
801
+ imports.wbg.__wbindgen_closure_wrapper1979 = function(arg0, arg1, arg2) {
802
+ const ret = makeMutClosure(arg0, arg1, 585, __wbg_adapter_30);
802
803
  return ret;
803
804
  };
804
805
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -1,12 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const and: (a: any, b: any) => any;
5
- export const xor: (a: any, b: any) => any;
6
- export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
7
- export const blake2s256: (a: number, b: number) => [number, number];
8
- export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
9
- export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
10
4
  export const compressWitness: (a: any) => [number, number, number, number];
11
5
  export const decompressWitness: (a: number, b: number) => [number, number, number];
12
6
  export const compressWitnessStack: (a: any) => [number, number, number, number];
@@ -14,11 +8,17 @@ export const decompressWitnessStack: (a: number, b: number) => [number, number,
14
8
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
15
9
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
16
10
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
17
- export const buildInfo: () => any;
11
+ export const initLogLevel: (a: number, b: number) => [number, number];
18
12
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
19
13
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
20
14
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
21
- export const initLogLevel: (a: number, b: number) => [number, number];
15
+ export const buildInfo: () => any;
16
+ export const and: (a: any, b: any) => any;
17
+ export const xor: (a: any, b: any) => any;
18
+ export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
19
+ export const blake2s256: (a: number, b: number) => [number, number];
20
+ export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
21
+ export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
22
22
  export const __wbindgen_exn_store: (a: number) => void;
23
23
  export const __externref_table_alloc: () => number;
24
24
  export const __wbindgen_export_2: WebAssembly.Table;
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
27
27
  export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
- export const closure581_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure1176_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1180_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure584_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure1179_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure1183_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;