@aztec/noir-acvm_js 0.0.1-commit.d6f2b3f94 → 0.0.1-commit.dbf9cec

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,40 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Returns the `BuildInfo` object containing information about how the installed package was built.
5
- * @returns {BuildInfo} - Information on how the installed package was built.
6
- */
7
- export function buildInfo(): BuildInfo;
8
- /**
9
- * Sets the package's logging level.
10
- *
11
- * @param {LogLevel} level - The maximum level of logging to be emitted.
12
- */
13
- export function initLogLevel(filter: string): void;
14
- /**
15
- * Performs a bitwise AND operation between `lhs` and `rhs`
16
- */
17
- export function and(lhs: string, rhs: string): string;
18
- /**
19
- * Performs a bitwise XOR operation between `lhs` and `rhs`
20
- */
21
- export function xor(lhs: string, rhs: string): string;
22
- /**
23
- * Sha256 compression function
24
- */
25
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
26
- /**
27
- * Calculates the Blake2s256 hash of the input bytes
28
- */
29
- export function blake2s256(inputs: Uint8Array): Uint8Array;
30
- /**
31
- * Verifies a ECDSA signature over the secp256k1 curve.
32
- */
33
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
34
- /**
35
- * Verifies a ECDSA signature over the secp256r1 curve.
36
- */
37
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
38
3
  /**
39
4
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
40
5
  *
@@ -116,18 +81,62 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
116
81
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
82
  */
118
83
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
84
+ /**
85
+ * Performs a bitwise AND operation between `lhs` and `rhs`
86
+ */
87
+ export function and(lhs: string, rhs: string): string;
88
+ /**
89
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
90
+ */
91
+ export function xor(lhs: string, rhs: string): string;
92
+ /**
93
+ * Sha256 compression function
94
+ */
95
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
96
+ /**
97
+ * Calculates the Blake2s256 hash of the input bytes
98
+ */
99
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
100
+ /**
101
+ * Verifies a ECDSA signature over the secp256k1 curve.
102
+ */
103
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
104
+ /**
105
+ * Verifies a ECDSA signature over the secp256r1 curve.
106
+ */
107
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
108
+ /**
109
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
110
+ * @returns {BuildInfo} - Information on how the installed package was built.
111
+ */
112
+ export function buildInfo(): BuildInfo;
113
+ /**
114
+ * Sets the package's logging level.
115
+ *
116
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
117
+ */
118
+ export function initLogLevel(filter: string): void;
119
119
 
120
- export type ForeignCallInput = string[]
121
- export type ForeignCallOutput = string | string[]
120
+ export type RawAssertionPayload = {
121
+ selector: string;
122
+ data: string[];
123
+ };
122
124
 
123
- /**
124
- * A callback which performs an foreign call and returns the response.
125
- * @callback ForeignCallHandler
126
- * @param {string} name - The identifier for the type of foreign call being performed.
127
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
128
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
129
- */
130
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
125
+ export type ExecutionError = Error & {
126
+ callStack?: string[];
127
+ rawAssertionPayload?: RawAssertionPayload;
128
+ acirFunctionId?: number;
129
+ brilligFunctionId?: number;
130
+ };
131
+
132
+
133
+
134
+ export type StackItem = {
135
+ index: number;
136
+ witness: WitnessMap;
137
+ }
138
+
139
+ export type WitnessStack = Array<StackItem>;
131
140
 
132
141
 
133
142
 
@@ -160,25 +169,16 @@ export type SolvedAndReturnWitness = {
160
169
 
161
170
 
162
171
 
163
- export type StackItem = {
164
- index: number;
165
- witness: WitnessMap;
166
- }
167
-
168
- export type WitnessStack = Array<StackItem>;
169
-
170
-
171
-
172
- export type RawAssertionPayload = {
173
- selector: string;
174
- data: string[];
175
- };
172
+ export type ForeignCallInput = string[]
173
+ export type ForeignCallOutput = string | string[]
176
174
 
177
- export type ExecutionError = Error & {
178
- callStack?: string[];
179
- rawAssertionPayload?: RawAssertionPayload;
180
- acirFunctionId?: number;
181
- brilligFunctionId?: number;
182
- };
175
+ /**
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[]>;
183
183
 
184
184
 
package/nodejs/acvm_js.js CHANGED
@@ -201,160 +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
- * Returns the `BuildInfo` object containing information about how the installed package was built.
206
- * @returns {BuildInfo} - Information on how the installed package was built.
207
- */
208
- module.exports.buildInfo = function() {
209
- const ret = wasm.buildInfo();
210
- return ret;
211
- };
212
204
 
213
205
  function takeFromExternrefTable0(idx) {
214
206
  const value = wasm.__wbindgen_export_2.get(idx);
215
207
  wasm.__externref_table_dealloc(idx);
216
208
  return value;
217
209
  }
218
- /**
219
- * Sets the package's logging level.
220
- *
221
- * @param {LogLevel} level - The maximum level of logging to be emitted.
222
- */
223
- module.exports.initLogLevel = function(filter) {
224
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
225
- const len0 = WASM_VECTOR_LEN;
226
- const ret = wasm.initLogLevel(ptr0, len0);
227
- if (ret[1]) {
228
- throw takeFromExternrefTable0(ret[0]);
229
- }
230
- };
231
-
232
- /**
233
- * Performs a bitwise AND operation between `lhs` and `rhs`
234
- * @param {string} lhs
235
- * @param {string} rhs
236
- * @returns {string}
237
- */
238
- module.exports.and = function(lhs, rhs) {
239
- const ret = wasm.and(lhs, rhs);
240
- return ret;
241
- };
242
-
243
- /**
244
- * Performs a bitwise XOR operation between `lhs` and `rhs`
245
- * @param {string} lhs
246
- * @param {string} rhs
247
- * @returns {string}
248
- */
249
- module.exports.xor = function(lhs, rhs) {
250
- const ret = wasm.xor(lhs, rhs);
251
- return ret;
252
- };
253
-
254
- let cachedUint32ArrayMemory0 = null;
255
-
256
- function getUint32ArrayMemory0() {
257
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
258
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
259
- }
260
- return cachedUint32ArrayMemory0;
261
- }
262
-
263
- function passArray32ToWasm0(arg, malloc) {
264
- const ptr = malloc(arg.length * 4, 4) >>> 0;
265
- getUint32ArrayMemory0().set(arg, ptr / 4);
266
- WASM_VECTOR_LEN = arg.length;
267
- return ptr;
268
- }
269
-
270
- function getArrayU32FromWasm0(ptr, len) {
271
- ptr = ptr >>> 0;
272
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
273
- }
274
- /**
275
- * Sha256 compression function
276
- * @param {Uint32Array} inputs
277
- * @param {Uint32Array} state
278
- * @returns {Uint32Array}
279
- */
280
- module.exports.sha256_compression = function(inputs, state) {
281
- const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
282
- const len0 = WASM_VECTOR_LEN;
283
- const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
284
- const len1 = WASM_VECTOR_LEN;
285
- const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
286
- var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
287
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
288
- return v3;
289
- };
290
-
291
- function passArray8ToWasm0(arg, malloc) {
292
- const ptr = malloc(arg.length * 1, 1) >>> 0;
293
- getUint8ArrayMemory0().set(arg, ptr / 1);
294
- WASM_VECTOR_LEN = arg.length;
295
- return ptr;
296
- }
297
210
 
298
211
  function getArrayU8FromWasm0(ptr, len) {
299
212
  ptr = ptr >>> 0;
300
213
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
301
214
  }
302
- /**
303
- * Calculates the Blake2s256 hash of the input bytes
304
- * @param {Uint8Array} inputs
305
- * @returns {Uint8Array}
306
- */
307
- module.exports.blake2s256 = function(inputs) {
308
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
309
- const len0 = WASM_VECTOR_LEN;
310
- const ret = wasm.blake2s256(ptr0, len0);
311
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
312
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
313
- return v2;
314
- };
315
-
316
- /**
317
- * Verifies a ECDSA signature over the secp256k1 curve.
318
- * @param {Uint8Array} hashed_msg
319
- * @param {Uint8Array} public_key_x_bytes
320
- * @param {Uint8Array} public_key_y_bytes
321
- * @param {Uint8Array} signature
322
- * @returns {boolean}
323
- */
324
- module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
325
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
326
- const len0 = WASM_VECTOR_LEN;
327
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
328
- const len1 = WASM_VECTOR_LEN;
329
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
330
- const len2 = WASM_VECTOR_LEN;
331
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
332
- const len3 = WASM_VECTOR_LEN;
333
- const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
334
- return ret !== 0;
335
- };
336
-
337
- /**
338
- * Verifies a ECDSA signature over the secp256r1 curve.
339
- * @param {Uint8Array} hashed_msg
340
- * @param {Uint8Array} public_key_x_bytes
341
- * @param {Uint8Array} public_key_y_bytes
342
- * @param {Uint8Array} signature
343
- * @returns {boolean}
344
- */
345
- module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
346
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
347
- const len0 = WASM_VECTOR_LEN;
348
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
349
- const len1 = WASM_VECTOR_LEN;
350
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
351
- const len2 = WASM_VECTOR_LEN;
352
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
353
- const len3 = WASM_VECTOR_LEN;
354
- const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
355
- return ret !== 0;
356
- };
357
-
358
215
  /**
359
216
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
360
217
  *
@@ -371,6 +228,12 @@ module.exports.compressWitness = function(witness_map) {
371
228
  return v1;
372
229
  };
373
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
+ }
374
237
  /**
375
238
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
376
239
  * This should be used to only fetch the witness map for the main function.
@@ -526,16 +389,154 @@ module.exports.getPublicWitness = function(program, solved_witness) {
526
389
  return takeFromExternrefTable0(ret[0]);
527
390
  };
528
391
 
392
+ /**
393
+ * Performs a bitwise AND operation between `lhs` and `rhs`
394
+ * @param {string} lhs
395
+ * @param {string} rhs
396
+ * @returns {string}
397
+ */
398
+ module.exports.and = function(lhs, rhs) {
399
+ const ret = wasm.and(lhs, rhs);
400
+ return ret;
401
+ };
402
+
403
+ /**
404
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
405
+ * @param {string} lhs
406
+ * @param {string} rhs
407
+ * @returns {string}
408
+ */
409
+ module.exports.xor = function(lhs, rhs) {
410
+ const ret = wasm.xor(lhs, rhs);
411
+ return ret;
412
+ };
413
+
414
+ let cachedUint32ArrayMemory0 = null;
415
+
416
+ function getUint32ArrayMemory0() {
417
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
418
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
419
+ }
420
+ return cachedUint32ArrayMemory0;
421
+ }
422
+
423
+ function passArray32ToWasm0(arg, malloc) {
424
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
425
+ getUint32ArrayMemory0().set(arg, ptr / 4);
426
+ WASM_VECTOR_LEN = arg.length;
427
+ return ptr;
428
+ }
429
+
430
+ function getArrayU32FromWasm0(ptr, len) {
431
+ ptr = ptr >>> 0;
432
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
433
+ }
434
+ /**
435
+ * Sha256 compression function
436
+ * @param {Uint32Array} inputs
437
+ * @param {Uint32Array} state
438
+ * @returns {Uint32Array}
439
+ */
440
+ module.exports.sha256_compression = function(inputs, state) {
441
+ const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
442
+ const len0 = WASM_VECTOR_LEN;
443
+ const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
444
+ const len1 = WASM_VECTOR_LEN;
445
+ const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
446
+ var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
447
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
448
+ return v3;
449
+ };
450
+
451
+ /**
452
+ * Calculates the Blake2s256 hash of the input bytes
453
+ * @param {Uint8Array} inputs
454
+ * @returns {Uint8Array}
455
+ */
456
+ module.exports.blake2s256 = function(inputs) {
457
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
458
+ const len0 = WASM_VECTOR_LEN;
459
+ const ret = wasm.blake2s256(ptr0, len0);
460
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
461
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
462
+ return v2;
463
+ };
464
+
465
+ /**
466
+ * Verifies a ECDSA signature over the secp256k1 curve.
467
+ * @param {Uint8Array} hashed_msg
468
+ * @param {Uint8Array} public_key_x_bytes
469
+ * @param {Uint8Array} public_key_y_bytes
470
+ * @param {Uint8Array} signature
471
+ * @returns {boolean}
472
+ */
473
+ module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
474
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
475
+ const len0 = WASM_VECTOR_LEN;
476
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
477
+ const len1 = WASM_VECTOR_LEN;
478
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
479
+ const len2 = WASM_VECTOR_LEN;
480
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
481
+ const len3 = WASM_VECTOR_LEN;
482
+ const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
483
+ return ret !== 0;
484
+ };
485
+
486
+ /**
487
+ * Verifies a ECDSA signature over the secp256r1 curve.
488
+ * @param {Uint8Array} hashed_msg
489
+ * @param {Uint8Array} public_key_x_bytes
490
+ * @param {Uint8Array} public_key_y_bytes
491
+ * @param {Uint8Array} signature
492
+ * @returns {boolean}
493
+ */
494
+ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
495
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
496
+ const len0 = WASM_VECTOR_LEN;
497
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
498
+ const len1 = WASM_VECTOR_LEN;
499
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
500
+ const len2 = WASM_VECTOR_LEN;
501
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
502
+ const len3 = WASM_VECTOR_LEN;
503
+ const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
504
+ return ret !== 0;
505
+ };
506
+
507
+ /**
508
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
509
+ * @returns {BuildInfo} - Information on how the installed package was built.
510
+ */
511
+ module.exports.buildInfo = function() {
512
+ const ret = wasm.buildInfo();
513
+ return ret;
514
+ };
515
+
516
+ /**
517
+ * Sets the package's logging level.
518
+ *
519
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
520
+ */
521
+ module.exports.initLogLevel = function(filter) {
522
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
523
+ const len0 = WASM_VECTOR_LEN;
524
+ const ret = wasm.initLogLevel(ptr0, len0);
525
+ if (ret[1]) {
526
+ throw takeFromExternrefTable0(ret[0]);
527
+ }
528
+ };
529
+
529
530
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
531
  wasm.closure445_externref_shim(arg0, arg1, arg2);
531
532
  }
532
533
 
533
534
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure921_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
+ wasm.closure924_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
536
  }
536
537
 
537
538
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure925_externref_shim(arg0, arg1, arg2, arg3);
539
+ wasm.closure928_externref_shim(arg0, arg1, arg2, arg3);
539
540
  }
540
541
 
541
542
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -553,12 +554,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
553
554
  return ret;
554
555
  }, arguments) };
555
556
 
556
- module.exports.__wbg_constructor_536364f6bcd4616b = function(arg0) {
557
+ module.exports.__wbg_constructor_2b49e4454d172081 = function(arg0) {
557
558
  const ret = new Error(arg0);
558
559
  return ret;
559
560
  };
560
561
 
561
- module.exports.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
562
+ module.exports.__wbg_constructor_dddf0209b25406fd = function(arg0) {
562
563
  const ret = new Error(arg0);
563
564
  return ret;
564
565
  };
@@ -674,6 +675,11 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
674
675
  }
675
676
  };
676
677
 
678
+ module.exports.__wbg_new_2812f5f6a6bd8bcf = function() {
679
+ const ret = new Array();
680
+ return ret;
681
+ };
682
+
677
683
  module.exports.__wbg_new_5e0be73521bc8c17 = function() {
678
684
  const ret = new Map();
679
685
  return ret;
@@ -689,8 +695,8 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
689
695
  return ret;
690
696
  };
691
697
 
692
- module.exports.__wbg_new_9f501325818b4158 = function() {
693
- const ret = new Array();
698
+ module.exports.__wbg_new_b110592360513189 = function() {
699
+ const ret = new Map();
694
700
  return ret;
695
701
  };
696
702
 
@@ -699,11 +705,6 @@ module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
699
705
  return ret;
700
706
  };
701
707
 
702
- module.exports.__wbg_new_ec40611a7805f1f0 = function() {
703
- const ret = new Map();
704
- return ret;
705
- };
706
-
707
708
  module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
708
709
  const ret = new Function(getStringFromWasm0(arg0, arg1));
709
710
  return ret;
@@ -813,7 +814,7 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
813
814
  return ret;
814
815
  };
815
816
 
816
- module.exports.__wbindgen_closure_wrapper1365 = function(arg0, arg1, arg2) {
817
+ module.exports.__wbindgen_closure_wrapper1366 = function(arg0, arg1, arg2) {
817
818
  const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
818
819
  return ret;
819
820
  };
Binary file
@@ -1,14 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const buildInfo: () => any;
5
- export const initLogLevel: (a: number, b: number) => [number, number];
6
- export const and: (a: any, b: any) => any;
7
- export const xor: (a: any, b: any) => any;
8
- export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
9
- export const blake2s256: (a: number, b: number) => [number, number];
10
- export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
11
- export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
12
4
  export const compressWitness: (a: any) => [number, number, number, number];
13
5
  export const decompressWitness: (a: number, b: number) => [number, number, number];
14
6
  export const compressWitnessStack: (a: any) => [number, number, number, number];
@@ -19,6 +11,14 @@ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
19
11
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
12
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
13
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
14
+ export const and: (a: any, b: any) => any;
15
+ export const xor: (a: any, b: any) => any;
16
+ export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
17
+ export const blake2s256: (a: number, b: number) => [number, number];
18
+ export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
19
+ export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
20
+ export const buildInfo: () => any;
21
+ export const initLogLevel: (a: number, b: number) => [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;
@@ -28,6 +28,6 @@ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) =>
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
30
  export const closure445_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure921_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure925_externref_shim: (a: number, b: number, c: any, d: any) => void;
31
+ export const closure924_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure928_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": "0.0.1-commit.d6f2b3f94",
3
+ "version": "0.0.1-commit.dbf9cec",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -38,11 +38,11 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@esm-bundle/chai": "^4.3.4-fix.0",
41
- "@web/dev-server-esbuild": "^1.0.4",
41
+ "@web/dev-server-esbuild": "^1.0.5",
42
42
  "@web/test-runner": "^0.20.2",
43
43
  "@web/test-runner-playwright": "^0.11.1",
44
44
  "chai": "^6.2.2",
45
- "eslint": "^9.39.2",
45
+ "eslint": "^10.0.0",
46
46
  "eslint-plugin-prettier": "^5.5.5",
47
47
  "mocha": "^11.7.5",
48
48
  "prettier": "3.8.1",
package/web/acvm_js.d.ts CHANGED
@@ -1,40 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Returns the `BuildInfo` object containing information about how the installed package was built.
5
- * @returns {BuildInfo} - Information on how the installed package was built.
6
- */
7
- export function buildInfo(): BuildInfo;
8
- /**
9
- * Sets the package's logging level.
10
- *
11
- * @param {LogLevel} level - The maximum level of logging to be emitted.
12
- */
13
- export function initLogLevel(filter: string): void;
14
- /**
15
- * Performs a bitwise AND operation between `lhs` and `rhs`
16
- */
17
- export function and(lhs: string, rhs: string): string;
18
- /**
19
- * Performs a bitwise XOR operation between `lhs` and `rhs`
20
- */
21
- export function xor(lhs: string, rhs: string): string;
22
- /**
23
- * Sha256 compression function
24
- */
25
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
26
- /**
27
- * Calculates the Blake2s256 hash of the input bytes
28
- */
29
- export function blake2s256(inputs: Uint8Array): Uint8Array;
30
- /**
31
- * Verifies a ECDSA signature over the secp256k1 curve.
32
- */
33
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
34
- /**
35
- * Verifies a ECDSA signature over the secp256r1 curve.
36
- */
37
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
38
3
  /**
39
4
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
40
5
  *
@@ -116,18 +81,62 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
116
81
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
82
  */
118
83
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
84
+ /**
85
+ * Performs a bitwise AND operation between `lhs` and `rhs`
86
+ */
87
+ export function and(lhs: string, rhs: string): string;
88
+ /**
89
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
90
+ */
91
+ export function xor(lhs: string, rhs: string): string;
92
+ /**
93
+ * Sha256 compression function
94
+ */
95
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
96
+ /**
97
+ * Calculates the Blake2s256 hash of the input bytes
98
+ */
99
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
100
+ /**
101
+ * Verifies a ECDSA signature over the secp256k1 curve.
102
+ */
103
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
104
+ /**
105
+ * Verifies a ECDSA signature over the secp256r1 curve.
106
+ */
107
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
108
+ /**
109
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
110
+ * @returns {BuildInfo} - Information on how the installed package was built.
111
+ */
112
+ export function buildInfo(): BuildInfo;
113
+ /**
114
+ * Sets the package's logging level.
115
+ *
116
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
117
+ */
118
+ export function initLogLevel(filter: string): void;
119
119
 
120
- export type ForeignCallInput = string[]
121
- export type ForeignCallOutput = string | string[]
120
+ export type RawAssertionPayload = {
121
+ selector: string;
122
+ data: string[];
123
+ };
122
124
 
123
- /**
124
- * A callback which performs an foreign call and returns the response.
125
- * @callback ForeignCallHandler
126
- * @param {string} name - The identifier for the type of foreign call being performed.
127
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
128
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
129
- */
130
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
125
+ export type ExecutionError = Error & {
126
+ callStack?: string[];
127
+ rawAssertionPayload?: RawAssertionPayload;
128
+ acirFunctionId?: number;
129
+ brilligFunctionId?: number;
130
+ };
131
+
132
+
133
+
134
+ export type StackItem = {
135
+ index: number;
136
+ witness: WitnessMap;
137
+ }
138
+
139
+ export type WitnessStack = Array<StackItem>;
131
140
 
132
141
 
133
142
 
@@ -160,26 +169,17 @@ export type SolvedAndReturnWitness = {
160
169
 
161
170
 
162
171
 
163
- export type StackItem = {
164
- index: number;
165
- witness: WitnessMap;
166
- }
167
-
168
- export type WitnessStack = Array<StackItem>;
169
-
170
-
171
-
172
- export type RawAssertionPayload = {
173
- selector: string;
174
- data: string[];
175
- };
172
+ export type ForeignCallInput = string[]
173
+ export type ForeignCallOutput = string | string[]
176
174
 
177
- export type ExecutionError = Error & {
178
- callStack?: string[];
179
- rawAssertionPayload?: RawAssertionPayload;
180
- acirFunctionId?: number;
181
- brilligFunctionId?: number;
182
- };
175
+ /**
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[]>;
183
183
 
184
184
 
185
185
 
@@ -187,14 +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 buildInfo: () => any;
191
- readonly initLogLevel: (a: number, b: number) => [number, number];
192
- readonly and: (a: any, b: any) => any;
193
- readonly xor: (a: any, b: any) => any;
194
- readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
195
- readonly blake2s256: (a: number, b: number) => [number, number];
196
- readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
197
- readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
198
190
  readonly compressWitness: (a: any) => [number, number, number, number];
199
191
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
200
192
  readonly compressWitnessStack: (a: any) => [number, number, number, number];
@@ -205,6 +197,14 @@ export interface InitOutput {
205
197
  readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
206
198
  readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
207
199
  readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
200
+ readonly and: (a: any, b: any) => any;
201
+ readonly xor: (a: any, b: any) => any;
202
+ readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
203
+ readonly blake2s256: (a: number, b: number) => [number, number];
204
+ readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
205
+ readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
206
+ readonly buildInfo: () => any;
207
+ readonly initLogLevel: (a: number, b: number) => [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;
@@ -214,8 +214,8 @@ export interface InitOutput {
214
214
  readonly __wbindgen_export_6: WebAssembly.Table;
215
215
  readonly __externref_table_dealloc: (a: number) => void;
216
216
  readonly closure445_externref_shim: (a: number, b: number, c: any) => void;
217
- readonly closure921_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
- readonly closure925_externref_shim: (a: number, b: number, c: any, d: any) => void;
217
+ readonly closure924_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure928_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,160 +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
- * Returns the `BuildInfo` object containing information about how the installed package was built.
202
- * @returns {BuildInfo} - Information on how the installed package was built.
203
- */
204
- export function buildInfo() {
205
- const ret = wasm.buildInfo();
206
- return ret;
207
- }
208
200
 
209
201
  function takeFromExternrefTable0(idx) {
210
202
  const value = wasm.__wbindgen_export_2.get(idx);
211
203
  wasm.__externref_table_dealloc(idx);
212
204
  return value;
213
205
  }
214
- /**
215
- * Sets the package's logging level.
216
- *
217
- * @param {LogLevel} level - The maximum level of logging to be emitted.
218
- */
219
- export function initLogLevel(filter) {
220
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
221
- const len0 = WASM_VECTOR_LEN;
222
- const ret = wasm.initLogLevel(ptr0, len0);
223
- if (ret[1]) {
224
- throw takeFromExternrefTable0(ret[0]);
225
- }
226
- }
227
-
228
- /**
229
- * Performs a bitwise AND operation between `lhs` and `rhs`
230
- * @param {string} lhs
231
- * @param {string} rhs
232
- * @returns {string}
233
- */
234
- export function and(lhs, rhs) {
235
- const ret = wasm.and(lhs, rhs);
236
- return ret;
237
- }
238
-
239
- /**
240
- * Performs a bitwise XOR operation between `lhs` and `rhs`
241
- * @param {string} lhs
242
- * @param {string} rhs
243
- * @returns {string}
244
- */
245
- export function xor(lhs, rhs) {
246
- const ret = wasm.xor(lhs, rhs);
247
- return ret;
248
- }
249
-
250
- let cachedUint32ArrayMemory0 = null;
251
-
252
- function getUint32ArrayMemory0() {
253
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
254
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
255
- }
256
- return cachedUint32ArrayMemory0;
257
- }
258
-
259
- function passArray32ToWasm0(arg, malloc) {
260
- const ptr = malloc(arg.length * 4, 4) >>> 0;
261
- getUint32ArrayMemory0().set(arg, ptr / 4);
262
- WASM_VECTOR_LEN = arg.length;
263
- return ptr;
264
- }
265
-
266
- function getArrayU32FromWasm0(ptr, len) {
267
- ptr = ptr >>> 0;
268
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
269
- }
270
- /**
271
- * Sha256 compression function
272
- * @param {Uint32Array} inputs
273
- * @param {Uint32Array} state
274
- * @returns {Uint32Array}
275
- */
276
- export function sha256_compression(inputs, state) {
277
- const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
278
- const len0 = WASM_VECTOR_LEN;
279
- const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
280
- const len1 = WASM_VECTOR_LEN;
281
- const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
282
- var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
283
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
284
- return v3;
285
- }
286
-
287
- function passArray8ToWasm0(arg, malloc) {
288
- const ptr = malloc(arg.length * 1, 1) >>> 0;
289
- getUint8ArrayMemory0().set(arg, ptr / 1);
290
- WASM_VECTOR_LEN = arg.length;
291
- return ptr;
292
- }
293
206
 
294
207
  function getArrayU8FromWasm0(ptr, len) {
295
208
  ptr = ptr >>> 0;
296
209
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
297
210
  }
298
- /**
299
- * Calculates the Blake2s256 hash of the input bytes
300
- * @param {Uint8Array} inputs
301
- * @returns {Uint8Array}
302
- */
303
- export function blake2s256(inputs) {
304
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
305
- const len0 = WASM_VECTOR_LEN;
306
- const ret = wasm.blake2s256(ptr0, len0);
307
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
308
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
309
- return v2;
310
- }
311
-
312
- /**
313
- * Verifies a ECDSA signature over the secp256k1 curve.
314
- * @param {Uint8Array} hashed_msg
315
- * @param {Uint8Array} public_key_x_bytes
316
- * @param {Uint8Array} public_key_y_bytes
317
- * @param {Uint8Array} signature
318
- * @returns {boolean}
319
- */
320
- export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
321
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
322
- const len0 = WASM_VECTOR_LEN;
323
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
324
- const len1 = WASM_VECTOR_LEN;
325
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
326
- const len2 = WASM_VECTOR_LEN;
327
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
328
- const len3 = WASM_VECTOR_LEN;
329
- const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
330
- return ret !== 0;
331
- }
332
-
333
- /**
334
- * Verifies a ECDSA signature over the secp256r1 curve.
335
- * @param {Uint8Array} hashed_msg
336
- * @param {Uint8Array} public_key_x_bytes
337
- * @param {Uint8Array} public_key_y_bytes
338
- * @param {Uint8Array} signature
339
- * @returns {boolean}
340
- */
341
- export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
342
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
343
- const len0 = WASM_VECTOR_LEN;
344
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
345
- const len1 = WASM_VECTOR_LEN;
346
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
347
- const len2 = WASM_VECTOR_LEN;
348
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
349
- const len3 = WASM_VECTOR_LEN;
350
- const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
351
- return ret !== 0;
352
- }
353
-
354
211
  /**
355
212
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
356
213
  *
@@ -367,6 +224,12 @@ export function compressWitness(witness_map) {
367
224
  return v1;
368
225
  }
369
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
+ }
370
233
  /**
371
234
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
372
235
  * This should be used to only fetch the witness map for the main function.
@@ -522,16 +385,154 @@ export function getPublicWitness(program, solved_witness) {
522
385
  return takeFromExternrefTable0(ret[0]);
523
386
  }
524
387
 
388
+ /**
389
+ * Performs a bitwise AND operation between `lhs` and `rhs`
390
+ * @param {string} lhs
391
+ * @param {string} rhs
392
+ * @returns {string}
393
+ */
394
+ export function and(lhs, rhs) {
395
+ const ret = wasm.and(lhs, rhs);
396
+ return ret;
397
+ }
398
+
399
+ /**
400
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
401
+ * @param {string} lhs
402
+ * @param {string} rhs
403
+ * @returns {string}
404
+ */
405
+ export function xor(lhs, rhs) {
406
+ const ret = wasm.xor(lhs, rhs);
407
+ return ret;
408
+ }
409
+
410
+ let cachedUint32ArrayMemory0 = null;
411
+
412
+ function getUint32ArrayMemory0() {
413
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
414
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
415
+ }
416
+ return cachedUint32ArrayMemory0;
417
+ }
418
+
419
+ function passArray32ToWasm0(arg, malloc) {
420
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
421
+ getUint32ArrayMemory0().set(arg, ptr / 4);
422
+ WASM_VECTOR_LEN = arg.length;
423
+ return ptr;
424
+ }
425
+
426
+ function getArrayU32FromWasm0(ptr, len) {
427
+ ptr = ptr >>> 0;
428
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
429
+ }
430
+ /**
431
+ * Sha256 compression function
432
+ * @param {Uint32Array} inputs
433
+ * @param {Uint32Array} state
434
+ * @returns {Uint32Array}
435
+ */
436
+ export function sha256_compression(inputs, state) {
437
+ const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
438
+ const len0 = WASM_VECTOR_LEN;
439
+ const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
440
+ const len1 = WASM_VECTOR_LEN;
441
+ const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
442
+ var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
443
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
444
+ return v3;
445
+ }
446
+
447
+ /**
448
+ * Calculates the Blake2s256 hash of the input bytes
449
+ * @param {Uint8Array} inputs
450
+ * @returns {Uint8Array}
451
+ */
452
+ export function blake2s256(inputs) {
453
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
454
+ const len0 = WASM_VECTOR_LEN;
455
+ const ret = wasm.blake2s256(ptr0, len0);
456
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
457
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
458
+ return v2;
459
+ }
460
+
461
+ /**
462
+ * Verifies a ECDSA signature over the secp256k1 curve.
463
+ * @param {Uint8Array} hashed_msg
464
+ * @param {Uint8Array} public_key_x_bytes
465
+ * @param {Uint8Array} public_key_y_bytes
466
+ * @param {Uint8Array} signature
467
+ * @returns {boolean}
468
+ */
469
+ export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
470
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
471
+ const len0 = WASM_VECTOR_LEN;
472
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
473
+ const len1 = WASM_VECTOR_LEN;
474
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
475
+ const len2 = WASM_VECTOR_LEN;
476
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
477
+ const len3 = WASM_VECTOR_LEN;
478
+ const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
479
+ return ret !== 0;
480
+ }
481
+
482
+ /**
483
+ * Verifies a ECDSA signature over the secp256r1 curve.
484
+ * @param {Uint8Array} hashed_msg
485
+ * @param {Uint8Array} public_key_x_bytes
486
+ * @param {Uint8Array} public_key_y_bytes
487
+ * @param {Uint8Array} signature
488
+ * @returns {boolean}
489
+ */
490
+ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
491
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
492
+ const len0 = WASM_VECTOR_LEN;
493
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
494
+ const len1 = WASM_VECTOR_LEN;
495
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
496
+ const len2 = WASM_VECTOR_LEN;
497
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
498
+ const len3 = WASM_VECTOR_LEN;
499
+ const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
500
+ return ret !== 0;
501
+ }
502
+
503
+ /**
504
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
505
+ * @returns {BuildInfo} - Information on how the installed package was built.
506
+ */
507
+ export function buildInfo() {
508
+ const ret = wasm.buildInfo();
509
+ return ret;
510
+ }
511
+
512
+ /**
513
+ * Sets the package's logging level.
514
+ *
515
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
516
+ */
517
+ export function initLogLevel(filter) {
518
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
519
+ const len0 = WASM_VECTOR_LEN;
520
+ const ret = wasm.initLogLevel(ptr0, len0);
521
+ if (ret[1]) {
522
+ throw takeFromExternrefTable0(ret[0]);
523
+ }
524
+ }
525
+
525
526
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
527
  wasm.closure445_externref_shim(arg0, arg1, arg2);
527
528
  }
528
529
 
529
530
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure921_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
+ wasm.closure924_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
532
  }
532
533
 
533
534
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure925_externref_shim(arg0, arg1, arg2, arg3);
535
+ wasm.closure928_externref_shim(arg0, arg1, arg2, arg3);
535
536
  }
536
537
 
537
538
  async function __wbg_load(module, imports) {
@@ -580,11 +581,11 @@ function __wbg_get_imports() {
580
581
  const ret = arg0.call(arg1, arg2, arg3);
581
582
  return ret;
582
583
  }, arguments) };
583
- imports.wbg.__wbg_constructor_536364f6bcd4616b = function(arg0) {
584
+ imports.wbg.__wbg_constructor_2b49e4454d172081 = function(arg0) {
584
585
  const ret = new Error(arg0);
585
586
  return ret;
586
587
  };
587
- imports.wbg.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
588
+ imports.wbg.__wbg_constructor_dddf0209b25406fd = function(arg0) {
588
589
  const ret = new Error(arg0);
589
590
  return ret;
590
591
  };
@@ -685,6 +686,10 @@ function __wbg_get_imports() {
685
686
  state0.a = state0.b = 0;
686
687
  }
687
688
  };
689
+ imports.wbg.__wbg_new_2812f5f6a6bd8bcf = function() {
690
+ const ret = new Array();
691
+ return ret;
692
+ };
688
693
  imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
689
694
  const ret = new Map();
690
695
  return ret;
@@ -697,18 +702,14 @@ function __wbg_get_imports() {
697
702
  const ret = new Error();
698
703
  return ret;
699
704
  };
700
- imports.wbg.__wbg_new_9f501325818b4158 = function() {
701
- const ret = new Array();
705
+ imports.wbg.__wbg_new_b110592360513189 = function() {
706
+ const ret = new Map();
702
707
  return ret;
703
708
  };
704
709
  imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
705
710
  const ret = new Error(getStringFromWasm0(arg0, arg1));
706
711
  return ret;
707
712
  };
708
- imports.wbg.__wbg_new_ec40611a7805f1f0 = function() {
709
- const ret = new Map();
710
- return ret;
711
- };
712
713
  imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
713
714
  const ret = new Function(getStringFromWasm0(arg0, arg1));
714
715
  return ret;
@@ -797,7 +798,7 @@ function __wbg_get_imports() {
797
798
  const ret = false;
798
799
  return ret;
799
800
  };
800
- imports.wbg.__wbindgen_closure_wrapper1365 = function(arg0, arg1, arg2) {
801
+ imports.wbg.__wbindgen_closure_wrapper1366 = function(arg0, arg1, arg2) {
801
802
  const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
802
803
  return ret;
803
804
  };
Binary file
@@ -1,14 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const buildInfo: () => any;
5
- export const initLogLevel: (a: number, b: number) => [number, number];
6
- export const and: (a: any, b: any) => any;
7
- export const xor: (a: any, b: any) => any;
8
- export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
9
- export const blake2s256: (a: number, b: number) => [number, number];
10
- export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
11
- export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
12
4
  export const compressWitness: (a: any) => [number, number, number, number];
13
5
  export const decompressWitness: (a: number, b: number) => [number, number, number];
14
6
  export const compressWitnessStack: (a: any) => [number, number, number, number];
@@ -19,6 +11,14 @@ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
19
11
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
12
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
13
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
14
+ export const and: (a: any, b: any) => any;
15
+ export const xor: (a: any, b: any) => any;
16
+ export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
17
+ export const blake2s256: (a: number, b: number) => [number, number];
18
+ export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
19
+ export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
20
+ export const buildInfo: () => any;
21
+ export const initLogLevel: (a: number, b: number) => [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;
@@ -28,6 +28,6 @@ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) =>
28
28
  export const __wbindgen_export_6: WebAssembly.Table;
29
29
  export const __externref_table_dealloc: (a: number) => void;
30
30
  export const closure445_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure921_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure925_externref_shim: (a: number, b: number, c: any, d: any) => void;
31
+ export const closure924_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure928_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;