@noir-lang/acvm_js 1.0.0-beta.16-5a65dae.nightly → 1.0.0-beta.16-e0fba02.nightly

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.
@@ -5,6 +5,36 @@
5
5
  * @returns {BuildInfo} - Information on how the installed package was built.
6
6
  */
7
7
  export function buildInfo(): BuildInfo;
8
+ /**
9
+ * Performs a bitwise AND operation between `lhs` and `rhs`
10
+ */
11
+ export function and(lhs: string, rhs: string): string;
12
+ /**
13
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
14
+ */
15
+ export function xor(lhs: string, rhs: string): string;
16
+ /**
17
+ * Sha256 compression function
18
+ */
19
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
20
+ /**
21
+ * Calculates the Blake2s256 hash of the input bytes
22
+ */
23
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
24
+ /**
25
+ * Verifies a ECDSA signature over the secp256k1 curve.
26
+ */
27
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
28
+ /**
29
+ * Verifies a ECDSA signature over the secp256r1 curve.
30
+ */
31
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
32
+ /**
33
+ * Sets the package's logging level.
34
+ *
35
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
36
+ */
37
+ export function initLogLevel(filter: string): void;
8
38
  /**
9
39
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
10
40
  *
@@ -62,12 +92,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
62
92
  * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
63
93
  */
64
94
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
65
- /**
66
- * Sets the package's logging level.
67
- *
68
- * @param {LogLevel} level - The maximum level of logging to be emitted.
69
- */
70
- export function initLogLevel(filter: string): void;
71
95
  /**
72
96
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
73
97
  *
@@ -92,30 +116,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
92
116
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
93
117
  */
94
118
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
95
- /**
96
- * Performs a bitwise AND operation between `lhs` and `rhs`
97
- */
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;
119
119
 
120
120
  /**
121
121
  * @typedef {Object} BuildInfo - Information about how the installed package was built
@@ -131,21 +131,6 @@ export type BuildInfo = {
131
131
 
132
132
 
133
133
 
134
- // Map from witness index to hex string value of witness.
135
- export type WitnessMap = Map<number, string>;
136
-
137
- /**
138
- * An execution result containing two witnesses.
139
- * 1. The full solved witness of the execution.
140
- * 2. The return witness which contains the given public return values within the full witness.
141
- */
142
- export type SolvedAndReturnWitness = {
143
- solvedWitness: WitnessMap;
144
- returnWitness: WitnessMap;
145
- }
146
-
147
-
148
-
149
134
  export type StackItem = {
150
135
  index: number;
151
136
  witness: WitnessMap;
@@ -155,6 +140,20 @@ export type WitnessStack = Array<StackItem>;
155
140
 
156
141
 
157
142
 
143
+ export type RawAssertionPayload = {
144
+ selector: string;
145
+ data: string[];
146
+ };
147
+
148
+ export type ExecutionError = Error & {
149
+ callStack?: string[];
150
+ rawAssertionPayload?: RawAssertionPayload;
151
+ acirFunctionId?: number;
152
+ brilligFunctionId?: number;
153
+ };
154
+
155
+
156
+
158
157
  export type ForeignCallInput = string[]
159
158
  export type ForeignCallOutput = string | string[]
160
159
 
@@ -169,16 +168,17 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
169
168
 
170
169
 
171
170
 
172
- export type RawAssertionPayload = {
173
- selector: string;
174
- data: string[];
175
- };
171
+ // Map from witness index to hex string value of witness.
172
+ export type WitnessMap = Map<number, string>;
176
173
 
177
- export type ExecutionError = Error & {
178
- callStack?: string[];
179
- rawAssertionPayload?: RawAssertionPayload;
180
- acirFunctionId?: number;
181
- brilligFunctionId?: number;
182
- };
174
+ /**
175
+ * An execution result containing two witnesses.
176
+ * 1. The full solved witness of the execution.
177
+ * 2. The return witness which contains the given public return values within the full witness.
178
+ */
179
+ export type SolvedAndReturnWitness = {
180
+ solvedWitness: WitnessMap;
181
+ returnWitness: WitnessMap;
182
+ }
183
183
 
184
184
 
package/nodejs/acvm_js.js CHANGED
@@ -210,16 +210,151 @@ module.exports.buildInfo = function() {
210
210
  return ret;
211
211
  };
212
212
 
213
- function takeFromExternrefTable0(idx) {
214
- const value = wasm.__wbindgen_export_2.get(idx);
215
- wasm.__externref_table_dealloc(idx);
216
- return value;
213
+ /**
214
+ * Performs a bitwise AND operation between `lhs` and `rhs`
215
+ * @param {string} lhs
216
+ * @param {string} rhs
217
+ * @returns {string}
218
+ */
219
+ module.exports.and = function(lhs, rhs) {
220
+ const ret = wasm.and(lhs, rhs);
221
+ return ret;
222
+ };
223
+
224
+ /**
225
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
226
+ * @param {string} lhs
227
+ * @param {string} rhs
228
+ * @returns {string}
229
+ */
230
+ module.exports.xor = function(lhs, rhs) {
231
+ const ret = wasm.xor(lhs, rhs);
232
+ return ret;
233
+ };
234
+
235
+ let cachedUint32ArrayMemory0 = null;
236
+
237
+ function getUint32ArrayMemory0() {
238
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
239
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
240
+ }
241
+ return cachedUint32ArrayMemory0;
242
+ }
243
+
244
+ function passArray32ToWasm0(arg, malloc) {
245
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
246
+ getUint32ArrayMemory0().set(arg, ptr / 4);
247
+ WASM_VECTOR_LEN = arg.length;
248
+ return ptr;
249
+ }
250
+
251
+ function getArrayU32FromWasm0(ptr, len) {
252
+ ptr = ptr >>> 0;
253
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
254
+ }
255
+ /**
256
+ * Sha256 compression function
257
+ * @param {Uint32Array} inputs
258
+ * @param {Uint32Array} state
259
+ * @returns {Uint32Array}
260
+ */
261
+ module.exports.sha256_compression = function(inputs, state) {
262
+ const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
263
+ const len0 = WASM_VECTOR_LEN;
264
+ const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
265
+ const len1 = WASM_VECTOR_LEN;
266
+ const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
267
+ var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
268
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
269
+ return v3;
270
+ };
271
+
272
+ function passArray8ToWasm0(arg, malloc) {
273
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
274
+ getUint8ArrayMemory0().set(arg, ptr / 1);
275
+ WASM_VECTOR_LEN = arg.length;
276
+ return ptr;
217
277
  }
218
278
 
219
279
  function getArrayU8FromWasm0(ptr, len) {
220
280
  ptr = ptr >>> 0;
221
281
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
222
282
  }
283
+ /**
284
+ * Calculates the Blake2s256 hash of the input bytes
285
+ * @param {Uint8Array} inputs
286
+ * @returns {Uint8Array}
287
+ */
288
+ module.exports.blake2s256 = function(inputs) {
289
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
290
+ const len0 = WASM_VECTOR_LEN;
291
+ const ret = wasm.blake2s256(ptr0, len0);
292
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
293
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
294
+ return v2;
295
+ };
296
+
297
+ /**
298
+ * Verifies a ECDSA signature over the secp256k1 curve.
299
+ * @param {Uint8Array} hashed_msg
300
+ * @param {Uint8Array} public_key_x_bytes
301
+ * @param {Uint8Array} public_key_y_bytes
302
+ * @param {Uint8Array} signature
303
+ * @returns {boolean}
304
+ */
305
+ module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
306
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
307
+ const len0 = WASM_VECTOR_LEN;
308
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
309
+ const len1 = WASM_VECTOR_LEN;
310
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
311
+ const len2 = WASM_VECTOR_LEN;
312
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
313
+ const len3 = WASM_VECTOR_LEN;
314
+ const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
315
+ return ret !== 0;
316
+ };
317
+
318
+ /**
319
+ * Verifies a ECDSA signature over the secp256r1 curve.
320
+ * @param {Uint8Array} hashed_msg
321
+ * @param {Uint8Array} public_key_x_bytes
322
+ * @param {Uint8Array} public_key_y_bytes
323
+ * @param {Uint8Array} signature
324
+ * @returns {boolean}
325
+ */
326
+ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
327
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
328
+ const len0 = WASM_VECTOR_LEN;
329
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
330
+ const len1 = WASM_VECTOR_LEN;
331
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
332
+ const len2 = WASM_VECTOR_LEN;
333
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
334
+ const len3 = WASM_VECTOR_LEN;
335
+ const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
336
+ return ret !== 0;
337
+ };
338
+
339
+ function takeFromExternrefTable0(idx) {
340
+ const value = wasm.__wbindgen_export_2.get(idx);
341
+ wasm.__externref_table_dealloc(idx);
342
+ return value;
343
+ }
344
+ /**
345
+ * Sets the package's logging level.
346
+ *
347
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
348
+ */
349
+ module.exports.initLogLevel = function(filter) {
350
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
351
+ const len0 = WASM_VECTOR_LEN;
352
+ const ret = wasm.initLogLevel(ptr0, len0);
353
+ if (ret[1]) {
354
+ throw takeFromExternrefTable0(ret[0]);
355
+ }
356
+ };
357
+
223
358
  /**
224
359
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
225
360
  *
@@ -236,12 +371,6 @@ module.exports.compressWitness = function(witness_map) {
236
371
  return v1;
237
372
  };
238
373
 
239
- function passArray8ToWasm0(arg, malloc) {
240
- const ptr = malloc(arg.length * 1, 1) >>> 0;
241
- getUint8ArrayMemory0().set(arg, ptr / 1);
242
- WASM_VECTOR_LEN = arg.length;
243
- return ptr;
244
- }
245
374
  /**
246
375
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
247
376
  * This should be used to only fetch the witness map for the main function.
@@ -337,20 +466,6 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
337
466
  return ret;
338
467
  };
339
468
 
340
- /**
341
- * Sets the package's logging level.
342
- *
343
- * @param {LogLevel} level - The maximum level of logging to be emitted.
344
- */
345
- module.exports.initLogLevel = function(filter) {
346
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
347
- const len0 = WASM_VECTOR_LEN;
348
- const ret = wasm.initLogLevel(ptr0, len0);
349
- if (ret[1]) {
350
- throw takeFromExternrefTable0(ret[0]);
351
- }
352
- };
353
-
354
469
  /**
355
470
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
356
471
  *
@@ -411,131 +526,16 @@ module.exports.getPublicWitness = function(program, solved_witness) {
411
526
  return takeFromExternrefTable0(ret[0]);
412
527
  };
413
528
 
414
- /**
415
- * Performs a bitwise AND operation between `lhs` and `rhs`
416
- * @param {string} lhs
417
- * @param {string} rhs
418
- * @returns {string}
419
- */
420
- module.exports.and = function(lhs, rhs) {
421
- const ret = wasm.and(lhs, rhs);
422
- return ret;
423
- };
424
-
425
- /**
426
- * Performs a bitwise XOR operation between `lhs` and `rhs`
427
- * @param {string} lhs
428
- * @param {string} rhs
429
- * @returns {string}
430
- */
431
- module.exports.xor = function(lhs, rhs) {
432
- const ret = wasm.xor(lhs, rhs);
433
- return ret;
434
- };
435
-
436
- let cachedUint32ArrayMemory0 = null;
437
-
438
- function getUint32ArrayMemory0() {
439
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
440
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
441
- }
442
- return cachedUint32ArrayMemory0;
443
- }
444
-
445
- function passArray32ToWasm0(arg, malloc) {
446
- const ptr = malloc(arg.length * 4, 4) >>> 0;
447
- getUint32ArrayMemory0().set(arg, ptr / 4);
448
- WASM_VECTOR_LEN = arg.length;
449
- return ptr;
450
- }
451
-
452
- function getArrayU32FromWasm0(ptr, len) {
453
- ptr = ptr >>> 0;
454
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
455
- }
456
- /**
457
- * Sha256 compression function
458
- * @param {Uint32Array} inputs
459
- * @param {Uint32Array} state
460
- * @returns {Uint32Array}
461
- */
462
- module.exports.sha256_compression = function(inputs, state) {
463
- const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
464
- const len0 = WASM_VECTOR_LEN;
465
- const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
466
- const len1 = WASM_VECTOR_LEN;
467
- const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
468
- var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
469
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
470
- return v3;
471
- };
472
-
473
- /**
474
- * Calculates the Blake2s256 hash of the input bytes
475
- * @param {Uint8Array} inputs
476
- * @returns {Uint8Array}
477
- */
478
- module.exports.blake2s256 = function(inputs) {
479
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
480
- const len0 = WASM_VECTOR_LEN;
481
- const ret = wasm.blake2s256(ptr0, len0);
482
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
483
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
484
- return v2;
485
- };
486
-
487
- /**
488
- * Verifies a ECDSA signature over the secp256k1 curve.
489
- * @param {Uint8Array} hashed_msg
490
- * @param {Uint8Array} public_key_x_bytes
491
- * @param {Uint8Array} public_key_y_bytes
492
- * @param {Uint8Array} signature
493
- * @returns {boolean}
494
- */
495
- module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
496
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
497
- const len0 = WASM_VECTOR_LEN;
498
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
499
- const len1 = WASM_VECTOR_LEN;
500
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
501
- const len2 = WASM_VECTOR_LEN;
502
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
503
- const len3 = WASM_VECTOR_LEN;
504
- const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
505
- return ret !== 0;
506
- };
507
-
508
- /**
509
- * Verifies a ECDSA signature over the secp256r1 curve.
510
- * @param {Uint8Array} hashed_msg
511
- * @param {Uint8Array} public_key_x_bytes
512
- * @param {Uint8Array} public_key_y_bytes
513
- * @param {Uint8Array} signature
514
- * @returns {boolean}
515
- */
516
- module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
517
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
518
- const len0 = WASM_VECTOR_LEN;
519
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
520
- const len1 = WASM_VECTOR_LEN;
521
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
522
- const len2 = WASM_VECTOR_LEN;
523
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
524
- const len3 = WASM_VECTOR_LEN;
525
- const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
526
- return ret !== 0;
527
- };
528
-
529
529
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
- wasm.closure576_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure482_externref_shim(arg0, arg1, arg2);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure1171_externref_shim(arg0, arg1, arg2, arg3, arg4);
534
+ wasm.closure990_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
535
  }
536
536
 
537
537
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure1175_externref_shim(arg0, arg1, arg2, arg3);
538
+ wasm.closure994_externref_shim(arg0, arg1, arg2, arg3);
539
539
  }
540
540
 
541
541
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -813,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
813
813
  return ret;
814
814
  };
815
815
 
816
- module.exports.__wbindgen_closure_wrapper1971 = function(arg0, arg1, arg2) {
817
- const ret = makeMutClosure(arg0, arg1, 577, __wbg_adapter_30);
816
+ module.exports.__wbindgen_closure_wrapper1583 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 483, __wbg_adapter_30);
818
818
  return ret;
819
819
  };
820
820
 
Binary file
@@ -2,6 +2,13 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const buildInfo: () => any;
5
+ export const and: (a: any, b: any) => any;
6
+ export const xor: (a: any, b: any) => any;
7
+ export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
8
+ export const blake2s256: (a: number, b: number) => [number, number];
9
+ export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
10
+ export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
11
+ export const initLogLevel: (a: number, b: number) => [number, number];
5
12
  export const compressWitness: (a: any) => [number, number, number, number];
6
13
  export const decompressWitness: (a: number, b: number) => [number, number, number];
7
14
  export const compressWitnessStack: (a: any) => [number, number, number, number];
@@ -9,16 +16,9 @@ export const decompressWitnessStack: (a: number, b: number) => [number, number,
9
16
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
10
17
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
11
18
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
12
- export const initLogLevel: (a: number, b: number) => [number, number];
13
19
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
14
20
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
15
21
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
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 closure576_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure1171_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1175_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure482_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure990_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure994_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": "@noir-lang/acvm_js",
3
- "version": "1.0.0-beta.16-5a65dae.nightly",
3
+ "version": "1.0.0-beta.16-e0fba02.nightly",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -5,6 +5,36 @@
5
5
  * @returns {BuildInfo} - Information on how the installed package was built.
6
6
  */
7
7
  export function buildInfo(): BuildInfo;
8
+ /**
9
+ * Performs a bitwise AND operation between `lhs` and `rhs`
10
+ */
11
+ export function and(lhs: string, rhs: string): string;
12
+ /**
13
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
14
+ */
15
+ export function xor(lhs: string, rhs: string): string;
16
+ /**
17
+ * Sha256 compression function
18
+ */
19
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
20
+ /**
21
+ * Calculates the Blake2s256 hash of the input bytes
22
+ */
23
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
24
+ /**
25
+ * Verifies a ECDSA signature over the secp256k1 curve.
26
+ */
27
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
28
+ /**
29
+ * Verifies a ECDSA signature over the secp256r1 curve.
30
+ */
31
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
32
+ /**
33
+ * Sets the package's logging level.
34
+ *
35
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
36
+ */
37
+ export function initLogLevel(filter: string): void;
8
38
  /**
9
39
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
10
40
  *
@@ -62,12 +92,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
62
92
  * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
63
93
  */
64
94
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
65
- /**
66
- * Sets the package's logging level.
67
- *
68
- * @param {LogLevel} level - The maximum level of logging to be emitted.
69
- */
70
- export function initLogLevel(filter: string): void;
71
95
  /**
72
96
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
73
97
  *
@@ -92,30 +116,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
92
116
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
93
117
  */
94
118
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
95
- /**
96
- * Performs a bitwise AND operation between `lhs` and `rhs`
97
- */
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;
119
119
 
120
120
  /**
121
121
  * @typedef {Object} BuildInfo - Information about how the installed package was built
@@ -131,21 +131,6 @@ export type BuildInfo = {
131
131
 
132
132
 
133
133
 
134
- // Map from witness index to hex string value of witness.
135
- export type WitnessMap = Map<number, string>;
136
-
137
- /**
138
- * An execution result containing two witnesses.
139
- * 1. The full solved witness of the execution.
140
- * 2. The return witness which contains the given public return values within the full witness.
141
- */
142
- export type SolvedAndReturnWitness = {
143
- solvedWitness: WitnessMap;
144
- returnWitness: WitnessMap;
145
- }
146
-
147
-
148
-
149
134
  export type StackItem = {
150
135
  index: number;
151
136
  witness: WitnessMap;
@@ -155,6 +140,20 @@ export type WitnessStack = Array<StackItem>;
155
140
 
156
141
 
157
142
 
143
+ export type RawAssertionPayload = {
144
+ selector: string;
145
+ data: string[];
146
+ };
147
+
148
+ export type ExecutionError = Error & {
149
+ callStack?: string[];
150
+ rawAssertionPayload?: RawAssertionPayload;
151
+ acirFunctionId?: number;
152
+ brilligFunctionId?: number;
153
+ };
154
+
155
+
156
+
158
157
  export type ForeignCallInput = string[]
159
158
  export type ForeignCallOutput = string | string[]
160
159
 
@@ -169,17 +168,18 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
169
168
 
170
169
 
171
170
 
172
- export type RawAssertionPayload = {
173
- selector: string;
174
- data: string[];
175
- };
171
+ // Map from witness index to hex string value of witness.
172
+ export type WitnessMap = Map<number, string>;
176
173
 
177
- export type ExecutionError = Error & {
178
- callStack?: string[];
179
- rawAssertionPayload?: RawAssertionPayload;
180
- acirFunctionId?: number;
181
- brilligFunctionId?: number;
182
- };
174
+ /**
175
+ * An execution result containing two witnesses.
176
+ * 1. The full solved witness of the execution.
177
+ * 2. The return witness which contains the given public return values within the full witness.
178
+ */
179
+ export type SolvedAndReturnWitness = {
180
+ solvedWitness: WitnessMap;
181
+ returnWitness: WitnessMap;
182
+ }
183
183
 
184
184
 
185
185
 
@@ -188,6 +188,13 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
188
188
  export interface InitOutput {
189
189
  readonly memory: WebAssembly.Memory;
190
190
  readonly buildInfo: () => any;
191
+ readonly and: (a: any, b: any) => any;
192
+ readonly xor: (a: any, b: any) => any;
193
+ readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
194
+ readonly blake2s256: (a: number, b: number) => [number, number];
195
+ readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
196
+ readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
197
+ readonly initLogLevel: (a: number, b: number) => [number, number];
191
198
  readonly compressWitness: (a: any) => [number, number, number, number];
192
199
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
193
200
  readonly compressWitnessStack: (a: any) => [number, number, number, number];
@@ -195,16 +202,9 @@ export interface InitOutput {
195
202
  readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
196
203
  readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
197
204
  readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
198
- readonly initLogLevel: (a: number, b: number) => [number, number];
199
205
  readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
200
206
  readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
201
207
  readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
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 closure576_externref_shim: (a: number, b: number, c: any) => void;
217
- readonly closure1171_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
- readonly closure1175_externref_shim: (a: number, b: number, c: any, d: any) => void;
216
+ readonly closure482_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure990_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure994_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
@@ -206,16 +206,151 @@ export function buildInfo() {
206
206
  return ret;
207
207
  }
208
208
 
209
- function takeFromExternrefTable0(idx) {
210
- const value = wasm.__wbindgen_export_2.get(idx);
211
- wasm.__externref_table_dealloc(idx);
212
- return value;
209
+ /**
210
+ * Performs a bitwise AND operation between `lhs` and `rhs`
211
+ * @param {string} lhs
212
+ * @param {string} rhs
213
+ * @returns {string}
214
+ */
215
+ export function and(lhs, rhs) {
216
+ const ret = wasm.and(lhs, rhs);
217
+ return ret;
218
+ }
219
+
220
+ /**
221
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
222
+ * @param {string} lhs
223
+ * @param {string} rhs
224
+ * @returns {string}
225
+ */
226
+ export function xor(lhs, rhs) {
227
+ const ret = wasm.xor(lhs, rhs);
228
+ return ret;
229
+ }
230
+
231
+ let cachedUint32ArrayMemory0 = null;
232
+
233
+ function getUint32ArrayMemory0() {
234
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
235
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
236
+ }
237
+ return cachedUint32ArrayMemory0;
238
+ }
239
+
240
+ function passArray32ToWasm0(arg, malloc) {
241
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
242
+ getUint32ArrayMemory0().set(arg, ptr / 4);
243
+ WASM_VECTOR_LEN = arg.length;
244
+ return ptr;
245
+ }
246
+
247
+ function getArrayU32FromWasm0(ptr, len) {
248
+ ptr = ptr >>> 0;
249
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
250
+ }
251
+ /**
252
+ * Sha256 compression function
253
+ * @param {Uint32Array} inputs
254
+ * @param {Uint32Array} state
255
+ * @returns {Uint32Array}
256
+ */
257
+ export function sha256_compression(inputs, state) {
258
+ const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
259
+ const len0 = WASM_VECTOR_LEN;
260
+ const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
261
+ const len1 = WASM_VECTOR_LEN;
262
+ const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
263
+ var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
264
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
265
+ return v3;
266
+ }
267
+
268
+ function passArray8ToWasm0(arg, malloc) {
269
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
270
+ getUint8ArrayMemory0().set(arg, ptr / 1);
271
+ WASM_VECTOR_LEN = arg.length;
272
+ return ptr;
213
273
  }
214
274
 
215
275
  function getArrayU8FromWasm0(ptr, len) {
216
276
  ptr = ptr >>> 0;
217
277
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
218
278
  }
279
+ /**
280
+ * Calculates the Blake2s256 hash of the input bytes
281
+ * @param {Uint8Array} inputs
282
+ * @returns {Uint8Array}
283
+ */
284
+ export function blake2s256(inputs) {
285
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
286
+ const len0 = WASM_VECTOR_LEN;
287
+ const ret = wasm.blake2s256(ptr0, len0);
288
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
289
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
290
+ return v2;
291
+ }
292
+
293
+ /**
294
+ * Verifies a ECDSA signature over the secp256k1 curve.
295
+ * @param {Uint8Array} hashed_msg
296
+ * @param {Uint8Array} public_key_x_bytes
297
+ * @param {Uint8Array} public_key_y_bytes
298
+ * @param {Uint8Array} signature
299
+ * @returns {boolean}
300
+ */
301
+ export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
302
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
303
+ const len0 = WASM_VECTOR_LEN;
304
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
305
+ const len1 = WASM_VECTOR_LEN;
306
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
307
+ const len2 = WASM_VECTOR_LEN;
308
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
309
+ const len3 = WASM_VECTOR_LEN;
310
+ const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
311
+ return ret !== 0;
312
+ }
313
+
314
+ /**
315
+ * Verifies a ECDSA signature over the secp256r1 curve.
316
+ * @param {Uint8Array} hashed_msg
317
+ * @param {Uint8Array} public_key_x_bytes
318
+ * @param {Uint8Array} public_key_y_bytes
319
+ * @param {Uint8Array} signature
320
+ * @returns {boolean}
321
+ */
322
+ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
323
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
324
+ const len0 = WASM_VECTOR_LEN;
325
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
326
+ const len1 = WASM_VECTOR_LEN;
327
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
328
+ const len2 = WASM_VECTOR_LEN;
329
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
330
+ const len3 = WASM_VECTOR_LEN;
331
+ const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
332
+ return ret !== 0;
333
+ }
334
+
335
+ function takeFromExternrefTable0(idx) {
336
+ const value = wasm.__wbindgen_export_2.get(idx);
337
+ wasm.__externref_table_dealloc(idx);
338
+ return value;
339
+ }
340
+ /**
341
+ * Sets the package's logging level.
342
+ *
343
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
344
+ */
345
+ export function initLogLevel(filter) {
346
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
347
+ const len0 = WASM_VECTOR_LEN;
348
+ const ret = wasm.initLogLevel(ptr0, len0);
349
+ if (ret[1]) {
350
+ throw takeFromExternrefTable0(ret[0]);
351
+ }
352
+ }
353
+
219
354
  /**
220
355
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
221
356
  *
@@ -232,12 +367,6 @@ export function compressWitness(witness_map) {
232
367
  return v1;
233
368
  }
234
369
 
235
- function passArray8ToWasm0(arg, malloc) {
236
- const ptr = malloc(arg.length * 1, 1) >>> 0;
237
- getUint8ArrayMemory0().set(arg, ptr / 1);
238
- WASM_VECTOR_LEN = arg.length;
239
- return ptr;
240
- }
241
370
  /**
242
371
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
243
372
  * This should be used to only fetch the witness map for the main function.
@@ -333,20 +462,6 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
333
462
  return ret;
334
463
  }
335
464
 
336
- /**
337
- * Sets the package's logging level.
338
- *
339
- * @param {LogLevel} level - The maximum level of logging to be emitted.
340
- */
341
- export function initLogLevel(filter) {
342
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
343
- const len0 = WASM_VECTOR_LEN;
344
- const ret = wasm.initLogLevel(ptr0, len0);
345
- if (ret[1]) {
346
- throw takeFromExternrefTable0(ret[0]);
347
- }
348
- }
349
-
350
465
  /**
351
466
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
352
467
  *
@@ -407,131 +522,16 @@ export function getPublicWitness(program, solved_witness) {
407
522
  return takeFromExternrefTable0(ret[0]);
408
523
  }
409
524
 
410
- /**
411
- * Performs a bitwise AND operation between `lhs` and `rhs`
412
- * @param {string} lhs
413
- * @param {string} rhs
414
- * @returns {string}
415
- */
416
- export function and(lhs, rhs) {
417
- const ret = wasm.and(lhs, rhs);
418
- return ret;
419
- }
420
-
421
- /**
422
- * Performs a bitwise XOR operation between `lhs` and `rhs`
423
- * @param {string} lhs
424
- * @param {string} rhs
425
- * @returns {string}
426
- */
427
- export function xor(lhs, rhs) {
428
- const ret = wasm.xor(lhs, rhs);
429
- return ret;
430
- }
431
-
432
- let cachedUint32ArrayMemory0 = null;
433
-
434
- function getUint32ArrayMemory0() {
435
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
436
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
437
- }
438
- return cachedUint32ArrayMemory0;
439
- }
440
-
441
- function passArray32ToWasm0(arg, malloc) {
442
- const ptr = malloc(arg.length * 4, 4) >>> 0;
443
- getUint32ArrayMemory0().set(arg, ptr / 4);
444
- WASM_VECTOR_LEN = arg.length;
445
- return ptr;
446
- }
447
-
448
- function getArrayU32FromWasm0(ptr, len) {
449
- ptr = ptr >>> 0;
450
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
451
- }
452
- /**
453
- * Sha256 compression function
454
- * @param {Uint32Array} inputs
455
- * @param {Uint32Array} state
456
- * @returns {Uint32Array}
457
- */
458
- export function sha256_compression(inputs, state) {
459
- const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
460
- const len0 = WASM_VECTOR_LEN;
461
- const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
462
- const len1 = WASM_VECTOR_LEN;
463
- const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
464
- var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
465
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
466
- return v3;
467
- }
468
-
469
- /**
470
- * Calculates the Blake2s256 hash of the input bytes
471
- * @param {Uint8Array} inputs
472
- * @returns {Uint8Array}
473
- */
474
- export function blake2s256(inputs) {
475
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
476
- const len0 = WASM_VECTOR_LEN;
477
- const ret = wasm.blake2s256(ptr0, len0);
478
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
479
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
480
- return v2;
481
- }
482
-
483
- /**
484
- * Verifies a ECDSA signature over the secp256k1 curve.
485
- * @param {Uint8Array} hashed_msg
486
- * @param {Uint8Array} public_key_x_bytes
487
- * @param {Uint8Array} public_key_y_bytes
488
- * @param {Uint8Array} signature
489
- * @returns {boolean}
490
- */
491
- export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
492
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
493
- const len0 = WASM_VECTOR_LEN;
494
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
495
- const len1 = WASM_VECTOR_LEN;
496
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
497
- const len2 = WASM_VECTOR_LEN;
498
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
499
- const len3 = WASM_VECTOR_LEN;
500
- const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
501
- return ret !== 0;
502
- }
503
-
504
- /**
505
- * Verifies a ECDSA signature over the secp256r1 curve.
506
- * @param {Uint8Array} hashed_msg
507
- * @param {Uint8Array} public_key_x_bytes
508
- * @param {Uint8Array} public_key_y_bytes
509
- * @param {Uint8Array} signature
510
- * @returns {boolean}
511
- */
512
- export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
513
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
514
- const len0 = WASM_VECTOR_LEN;
515
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
516
- const len1 = WASM_VECTOR_LEN;
517
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
518
- const len2 = WASM_VECTOR_LEN;
519
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
520
- const len3 = WASM_VECTOR_LEN;
521
- const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
522
- return ret !== 0;
523
- }
524
-
525
525
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
- wasm.closure576_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure482_externref_shim(arg0, arg1, arg2);
527
527
  }
528
528
 
529
529
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure1171_externref_shim(arg0, arg1, arg2, arg3, arg4);
530
+ wasm.closure990_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
531
  }
532
532
 
533
533
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure1175_externref_shim(arg0, arg1, arg2, arg3);
534
+ wasm.closure994_externref_shim(arg0, arg1, arg2, arg3);
535
535
  }
536
536
 
537
537
  async function __wbg_load(module, imports) {
@@ -797,8 +797,8 @@ function __wbg_get_imports() {
797
797
  const ret = false;
798
798
  return ret;
799
799
  };
800
- imports.wbg.__wbindgen_closure_wrapper1971 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 577, __wbg_adapter_30);
800
+ imports.wbg.__wbindgen_closure_wrapper1583 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 483, __wbg_adapter_30);
802
802
  return ret;
803
803
  };
804
804
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -2,6 +2,13 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const buildInfo: () => any;
5
+ export const and: (a: any, b: any) => any;
6
+ export const xor: (a: any, b: any) => any;
7
+ export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
8
+ export const blake2s256: (a: number, b: number) => [number, number];
9
+ export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
10
+ export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
11
+ export const initLogLevel: (a: number, b: number) => [number, number];
5
12
  export const compressWitness: (a: any) => [number, number, number, number];
6
13
  export const decompressWitness: (a: number, b: number) => [number, number, number];
7
14
  export const compressWitnessStack: (a: any) => [number, number, number, number];
@@ -9,16 +16,9 @@ export const decompressWitnessStack: (a: number, b: number) => [number, number,
9
16
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
10
17
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
11
18
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
12
- export const initLogLevel: (a: number, b: number) => [number, number];
13
19
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
14
20
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
15
21
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
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 closure576_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure1171_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1175_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure482_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure990_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure994_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;