@noir-lang/acvm_js 1.0.0-beta.7-d651576.nightly → 1.0.0-beta.8

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,35 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Sets the package's logging level.
5
- *
6
- * @param {LogLevel} level - The maximum level of logging to be emitted.
7
- */
8
- export function initLogLevel(filter: string): void;
9
- /**
10
- * Performs a bitwise AND operation between `lhs` and `rhs`
11
- */
12
- export function and(lhs: string, rhs: string): string;
13
- /**
14
- * Performs a bitwise XOR operation between `lhs` and `rhs`
15
- */
16
- export function xor(lhs: string, rhs: string): string;
17
- /**
18
- * Sha256 compression function
19
- */
20
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
21
- /**
22
- * Calculates the Blake2s256 hash of the input bytes
23
- */
24
- export function blake2s256(inputs: Uint8Array): Uint8Array;
25
- /**
26
- * Verifies a ECDSA signature over the secp256k1 curve.
27
- */
28
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
29
- /**
30
- * Verifies a ECDSA signature over the secp256r1 curve.
31
- */
32
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
33
3
  /**
34
4
  * Returns the `BuildInfo` object containing information about how the installed package was built.
35
5
  * @returns {BuildInfo} - Information on how the installed package was built.
@@ -116,29 +86,36 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
116
86
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
87
  */
118
88
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
-
120
- export type RawAssertionPayload = {
121
- selector: string;
122
- data: string[];
123
- };
124
-
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>;
140
-
141
-
89
+ /**
90
+ * Sets the package's logging level.
91
+ *
92
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
93
+ */
94
+ export function initLogLevel(filter: string): void;
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;
142
119
 
143
120
  /**
144
121
  * @typedef {Object} BuildInfo - Information about how the installed package was built
@@ -154,6 +131,21 @@ export type BuildInfo = {
154
131
 
155
132
 
156
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
+
157
149
  export type ForeignCallInput = string[]
158
150
  export type ForeignCallOutput = string | string[]
159
151
 
@@ -168,17 +160,25 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
168
160
 
169
161
 
170
162
 
171
- // Map from witness index to hex string value of witness.
172
- export type WitnessMap = Map<number, string>;
163
+ export type RawAssertionPayload = {
164
+ selector: string;
165
+ data: string[];
166
+ };
173
167
 
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;
168
+ export type ExecutionError = Error & {
169
+ callStack?: string[];
170
+ rawAssertionPayload?: RawAssertionPayload;
171
+ acirFunctionId?: number;
172
+ brilligFunctionId?: number;
173
+ };
174
+
175
+
176
+
177
+ export type StackItem = {
178
+ index: number;
179
+ witness: WitnessMap;
182
180
  }
183
181
 
182
+ export type WitnessStack = Array<StackItem>;
183
+
184
184
 
package/nodejs/acvm_js.js CHANGED
@@ -201,161 +201,25 @@ 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
- function takeFromExternrefTable0(idx) {
206
- const value = wasm.__wbindgen_export_2.get(idx);
207
- wasm.__externref_table_dealloc(idx);
208
- return value;
209
- }
210
204
  /**
211
- * Sets the package's logging level.
212
- *
213
- * @param {LogLevel} level - The maximum level of logging to be emitted.
214
- */
215
- module.exports.initLogLevel = function(filter) {
216
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
217
- const len0 = WASM_VECTOR_LEN;
218
- const ret = wasm.initLogLevel(ptr0, len0);
219
- if (ret[1]) {
220
- throw takeFromExternrefTable0(ret[0]);
221
- }
222
- };
223
-
224
- /**
225
- * Performs a bitwise AND operation between `lhs` and `rhs`
226
- * @param {string} lhs
227
- * @param {string} rhs
228
- * @returns {string}
229
- */
230
- module.exports.and = function(lhs, rhs) {
231
- const ret = wasm.and(lhs, rhs);
232
- return ret;
233
- };
234
-
235
- /**
236
- * Performs a bitwise XOR operation between `lhs` and `rhs`
237
- * @param {string} lhs
238
- * @param {string} rhs
239
- * @returns {string}
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.
240
207
  */
241
- module.exports.xor = function(lhs, rhs) {
242
- const ret = wasm.xor(lhs, rhs);
208
+ module.exports.buildInfo = function() {
209
+ const ret = wasm.buildInfo();
243
210
  return ret;
244
211
  };
245
212
 
246
- let cachedUint32ArrayMemory0 = null;
247
-
248
- function getUint32ArrayMemory0() {
249
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
250
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
251
- }
252
- return cachedUint32ArrayMemory0;
253
- }
254
-
255
- function passArray32ToWasm0(arg, malloc) {
256
- const ptr = malloc(arg.length * 4, 4) >>> 0;
257
- getUint32ArrayMemory0().set(arg, ptr / 4);
258
- WASM_VECTOR_LEN = arg.length;
259
- return ptr;
260
- }
261
-
262
- function getArrayU32FromWasm0(ptr, len) {
263
- ptr = ptr >>> 0;
264
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
265
- }
266
- /**
267
- * Sha256 compression function
268
- * @param {Uint32Array} inputs
269
- * @param {Uint32Array} state
270
- * @returns {Uint32Array}
271
- */
272
- module.exports.sha256_compression = function(inputs, state) {
273
- const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
274
- const len0 = WASM_VECTOR_LEN;
275
- const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
276
- const len1 = WASM_VECTOR_LEN;
277
- const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
278
- var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
279
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
280
- return v3;
281
- };
282
-
283
- function passArray8ToWasm0(arg, malloc) {
284
- const ptr = malloc(arg.length * 1, 1) >>> 0;
285
- getUint8ArrayMemory0().set(arg, ptr / 1);
286
- WASM_VECTOR_LEN = arg.length;
287
- return ptr;
213
+ function takeFromExternrefTable0(idx) {
214
+ const value = wasm.__wbindgen_export_2.get(idx);
215
+ wasm.__externref_table_dealloc(idx);
216
+ return value;
288
217
  }
289
218
 
290
219
  function getArrayU8FromWasm0(ptr, len) {
291
220
  ptr = ptr >>> 0;
292
221
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
293
222
  }
294
- /**
295
- * Calculates the Blake2s256 hash of the input bytes
296
- * @param {Uint8Array} inputs
297
- * @returns {Uint8Array}
298
- */
299
- module.exports.blake2s256 = function(inputs) {
300
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
301
- const len0 = WASM_VECTOR_LEN;
302
- const ret = wasm.blake2s256(ptr0, len0);
303
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
304
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
305
- return v2;
306
- };
307
-
308
- /**
309
- * Verifies a ECDSA signature over the secp256k1 curve.
310
- * @param {Uint8Array} hashed_msg
311
- * @param {Uint8Array} public_key_x_bytes
312
- * @param {Uint8Array} public_key_y_bytes
313
- * @param {Uint8Array} signature
314
- * @returns {boolean}
315
- */
316
- module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
317
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
318
- const len0 = WASM_VECTOR_LEN;
319
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
320
- const len1 = WASM_VECTOR_LEN;
321
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
322
- const len2 = WASM_VECTOR_LEN;
323
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
324
- const len3 = WASM_VECTOR_LEN;
325
- const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
326
- return ret !== 0;
327
- };
328
-
329
- /**
330
- * Verifies a ECDSA signature over the secp256r1 curve.
331
- * @param {Uint8Array} hashed_msg
332
- * @param {Uint8Array} public_key_x_bytes
333
- * @param {Uint8Array} public_key_y_bytes
334
- * @param {Uint8Array} signature
335
- * @returns {boolean}
336
- */
337
- module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
338
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
339
- const len0 = WASM_VECTOR_LEN;
340
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
341
- const len1 = WASM_VECTOR_LEN;
342
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
343
- const len2 = WASM_VECTOR_LEN;
344
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
345
- const len3 = WASM_VECTOR_LEN;
346
- const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
347
- return ret !== 0;
348
- };
349
-
350
- /**
351
- * Returns the `BuildInfo` object containing information about how the installed package was built.
352
- * @returns {BuildInfo} - Information on how the installed package was built.
353
- */
354
- module.exports.buildInfo = function() {
355
- const ret = wasm.buildInfo();
356
- return ret;
357
- };
358
-
359
223
  /**
360
224
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
361
225
  *
@@ -372,6 +236,12 @@ module.exports.compressWitness = function(witness_map) {
372
236
  return v1;
373
237
  };
374
238
 
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
+ }
375
245
  /**
376
246
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
377
247
  * This should be used to only fetch the witness map for the main function.
@@ -527,16 +397,145 @@ module.exports.getPublicWitness = function(program, solved_witness) {
527
397
  return takeFromExternrefTable0(ret[0]);
528
398
  };
529
399
 
400
+ /**
401
+ * Sets the package's logging level.
402
+ *
403
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
404
+ */
405
+ module.exports.initLogLevel = function(filter) {
406
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
407
+ const len0 = WASM_VECTOR_LEN;
408
+ const ret = wasm.initLogLevel(ptr0, len0);
409
+ if (ret[1]) {
410
+ throw takeFromExternrefTable0(ret[0]);
411
+ }
412
+ };
413
+
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
+
530
529
  function __wbg_adapter_30(arg0, arg1, arg2) {
531
- wasm.closure647_externref_shim(arg0, arg1, arg2);
530
+ wasm.closure646_externref_shim(arg0, arg1, arg2);
532
531
  }
533
532
 
534
533
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
535
- wasm.closure1312_externref_shim(arg0, arg1, arg2, arg3, arg4);
534
+ wasm.closure1311_externref_shim(arg0, arg1, arg2, arg3, arg4);
536
535
  }
537
536
 
538
537
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
539
- wasm.closure1316_externref_shim(arg0, arg1, arg2, arg3);
538
+ wasm.closure1315_externref_shim(arg0, arg1, arg2, arg3);
540
539
  }
541
540
 
542
541
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -554,12 +553,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
554
553
  return ret;
555
554
  }, arguments) };
556
555
 
557
- module.exports.__wbg_constructor_80adc7700dc98be7 = function(arg0) {
556
+ module.exports.__wbg_constructor_0678592859d8ad46 = function(arg0) {
558
557
  const ret = new Error(arg0);
559
558
  return ret;
560
559
  };
561
560
 
562
- module.exports.__wbg_constructor_d4798d01154f4bbf = function(arg0) {
561
+ module.exports.__wbg_constructor_0b67c5fcc545fad7 = function(arg0) {
563
562
  const ret = new Error(arg0);
564
563
  return ret;
565
564
  };
@@ -680,8 +679,8 @@ module.exports.__wbg_new_5e0be73521bc8c17 = function() {
680
679
  return ret;
681
680
  };
682
681
 
683
- module.exports.__wbg_new_63dcb8fa4e4ab11b = function() {
684
- const ret = new Map();
682
+ module.exports.__wbg_new_6a4d0f0a95ea1d41 = function() {
683
+ const ret = new Array();
685
684
  return ret;
686
685
  };
687
686
 
@@ -695,13 +694,13 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
695
694
  return ret;
696
695
  };
697
696
 
698
- module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
699
- const ret = new Error(getStringFromWasm0(arg0, arg1));
697
+ module.exports.__wbg_new_9d8c1790c9f203ab = function() {
698
+ const ret = new Map();
700
699
  return ret;
701
700
  };
702
701
 
703
- module.exports.__wbg_new_dc45136d2de0bc6a = function() {
704
- const ret = new Array();
702
+ module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
703
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
705
704
  return ret;
706
705
  };
707
706
 
@@ -814,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
814
813
  return ret;
815
814
  };
816
815
 
817
- module.exports.__wbindgen_closure_wrapper2146 = function(arg0, arg1, arg2) {
818
- const ret = makeMutClosure(arg0, arg1, 648, __wbg_adapter_30);
816
+ module.exports.__wbindgen_closure_wrapper2143 = function(arg0, arg1, arg2) {
817
+ const ret = makeMutClosure(arg0, arg1, 647, __wbg_adapter_30);
819
818
  return ret;
820
819
  };
821
820
 
Binary file
@@ -1,13 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const initLogLevel: (a: number, b: number) => [number, number];
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
4
  export const buildInfo: () => any;
12
5
  export const compressWitness: (a: any) => [number, number, number, number];
13
6
  export const decompressWitness: (a: number, b: number) => [number, number, number];
@@ -19,6 +12,13 @@ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
19
12
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
13
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
14
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
15
+ export const initLogLevel: (a: number, b: 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 closure647_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure1312_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1316_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure646_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure1311_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure1315_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.7-d651576.nightly",
3
+ "version": "1.0.0-beta.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -1,35 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Sets the package's logging level.
5
- *
6
- * @param {LogLevel} level - The maximum level of logging to be emitted.
7
- */
8
- export function initLogLevel(filter: string): void;
9
- /**
10
- * Performs a bitwise AND operation between `lhs` and `rhs`
11
- */
12
- export function and(lhs: string, rhs: string): string;
13
- /**
14
- * Performs a bitwise XOR operation between `lhs` and `rhs`
15
- */
16
- export function xor(lhs: string, rhs: string): string;
17
- /**
18
- * Sha256 compression function
19
- */
20
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
21
- /**
22
- * Calculates the Blake2s256 hash of the input bytes
23
- */
24
- export function blake2s256(inputs: Uint8Array): Uint8Array;
25
- /**
26
- * Verifies a ECDSA signature over the secp256k1 curve.
27
- */
28
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
29
- /**
30
- * Verifies a ECDSA signature over the secp256r1 curve.
31
- */
32
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
33
3
  /**
34
4
  * Returns the `BuildInfo` object containing information about how the installed package was built.
35
5
  * @returns {BuildInfo} - Information on how the installed package was built.
@@ -116,29 +86,36 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
116
86
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
117
87
  */
118
88
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
119
-
120
- export type RawAssertionPayload = {
121
- selector: string;
122
- data: string[];
123
- };
124
-
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>;
140
-
141
-
89
+ /**
90
+ * Sets the package's logging level.
91
+ *
92
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
93
+ */
94
+ export function initLogLevel(filter: string): void;
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;
142
119
 
143
120
  /**
144
121
  * @typedef {Object} BuildInfo - Information about how the installed package was built
@@ -154,6 +131,21 @@ export type BuildInfo = {
154
131
 
155
132
 
156
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
+
157
149
  export type ForeignCallInput = string[]
158
150
  export type ForeignCallOutput = string | string[]
159
151
 
@@ -168,32 +160,33 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
168
160
 
169
161
 
170
162
 
171
- // Map from witness index to hex string value of witness.
172
- export type WitnessMap = Map<number, string>;
163
+ export type RawAssertionPayload = {
164
+ selector: string;
165
+ data: string[];
166
+ };
173
167
 
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;
168
+ export type ExecutionError = Error & {
169
+ callStack?: string[];
170
+ rawAssertionPayload?: RawAssertionPayload;
171
+ acirFunctionId?: number;
172
+ brilligFunctionId?: number;
173
+ };
174
+
175
+
176
+
177
+ export type StackItem = {
178
+ index: number;
179
+ witness: WitnessMap;
182
180
  }
183
181
 
182
+ export type WitnessStack = Array<StackItem>;
183
+
184
184
 
185
185
 
186
186
  export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
187
187
 
188
188
  export interface InitOutput {
189
189
  readonly memory: WebAssembly.Memory;
190
- readonly initLogLevel: (a: number, b: number) => [number, number];
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
190
  readonly buildInfo: () => any;
198
191
  readonly compressWitness: (a: any) => [number, number, number, number];
199
192
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
@@ -205,6 +198,13 @@ export interface InitOutput {
205
198
  readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
206
199
  readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
207
200
  readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
201
+ readonly initLogLevel: (a: number, b: 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 closure647_externref_shim: (a: number, b: number, c: any) => void;
217
- readonly closure1312_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
- readonly closure1316_externref_shim: (a: number, b: number, c: any, d: any) => void;
216
+ readonly closure646_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure1311_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure1315_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,161 +197,25 @@ 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
- function takeFromExternrefTable0(idx) {
202
- const value = wasm.__wbindgen_export_2.get(idx);
203
- wasm.__externref_table_dealloc(idx);
204
- return value;
205
- }
206
200
  /**
207
- * Sets the package's logging level.
208
- *
209
- * @param {LogLevel} level - The maximum level of logging to be emitted.
210
- */
211
- export function initLogLevel(filter) {
212
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
213
- const len0 = WASM_VECTOR_LEN;
214
- const ret = wasm.initLogLevel(ptr0, len0);
215
- if (ret[1]) {
216
- throw takeFromExternrefTable0(ret[0]);
217
- }
218
- }
219
-
220
- /**
221
- * Performs a bitwise AND operation between `lhs` and `rhs`
222
- * @param {string} lhs
223
- * @param {string} rhs
224
- * @returns {string}
225
- */
226
- export function and(lhs, rhs) {
227
- const ret = wasm.and(lhs, rhs);
228
- return ret;
229
- }
230
-
231
- /**
232
- * Performs a bitwise XOR operation between `lhs` and `rhs`
233
- * @param {string} lhs
234
- * @param {string} rhs
235
- * @returns {string}
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.
236
203
  */
237
- export function xor(lhs, rhs) {
238
- const ret = wasm.xor(lhs, rhs);
204
+ export function buildInfo() {
205
+ const ret = wasm.buildInfo();
239
206
  return ret;
240
207
  }
241
208
 
242
- let cachedUint32ArrayMemory0 = null;
243
-
244
- function getUint32ArrayMemory0() {
245
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
246
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
247
- }
248
- return cachedUint32ArrayMemory0;
249
- }
250
-
251
- function passArray32ToWasm0(arg, malloc) {
252
- const ptr = malloc(arg.length * 4, 4) >>> 0;
253
- getUint32ArrayMemory0().set(arg, ptr / 4);
254
- WASM_VECTOR_LEN = arg.length;
255
- return ptr;
256
- }
257
-
258
- function getArrayU32FromWasm0(ptr, len) {
259
- ptr = ptr >>> 0;
260
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
261
- }
262
- /**
263
- * Sha256 compression function
264
- * @param {Uint32Array} inputs
265
- * @param {Uint32Array} state
266
- * @returns {Uint32Array}
267
- */
268
- export function sha256_compression(inputs, state) {
269
- const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
270
- const len0 = WASM_VECTOR_LEN;
271
- const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
272
- const len1 = WASM_VECTOR_LEN;
273
- const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
274
- var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
275
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
276
- return v3;
277
- }
278
-
279
- function passArray8ToWasm0(arg, malloc) {
280
- const ptr = malloc(arg.length * 1, 1) >>> 0;
281
- getUint8ArrayMemory0().set(arg, ptr / 1);
282
- WASM_VECTOR_LEN = arg.length;
283
- return ptr;
209
+ function takeFromExternrefTable0(idx) {
210
+ const value = wasm.__wbindgen_export_2.get(idx);
211
+ wasm.__externref_table_dealloc(idx);
212
+ return value;
284
213
  }
285
214
 
286
215
  function getArrayU8FromWasm0(ptr, len) {
287
216
  ptr = ptr >>> 0;
288
217
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
289
218
  }
290
- /**
291
- * Calculates the Blake2s256 hash of the input bytes
292
- * @param {Uint8Array} inputs
293
- * @returns {Uint8Array}
294
- */
295
- export function blake2s256(inputs) {
296
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
297
- const len0 = WASM_VECTOR_LEN;
298
- const ret = wasm.blake2s256(ptr0, len0);
299
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
300
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
301
- return v2;
302
- }
303
-
304
- /**
305
- * Verifies a ECDSA signature over the secp256k1 curve.
306
- * @param {Uint8Array} hashed_msg
307
- * @param {Uint8Array} public_key_x_bytes
308
- * @param {Uint8Array} public_key_y_bytes
309
- * @param {Uint8Array} signature
310
- * @returns {boolean}
311
- */
312
- export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
313
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
314
- const len0 = WASM_VECTOR_LEN;
315
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
316
- const len1 = WASM_VECTOR_LEN;
317
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
318
- const len2 = WASM_VECTOR_LEN;
319
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
320
- const len3 = WASM_VECTOR_LEN;
321
- const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
322
- return ret !== 0;
323
- }
324
-
325
- /**
326
- * Verifies a ECDSA signature over the secp256r1 curve.
327
- * @param {Uint8Array} hashed_msg
328
- * @param {Uint8Array} public_key_x_bytes
329
- * @param {Uint8Array} public_key_y_bytes
330
- * @param {Uint8Array} signature
331
- * @returns {boolean}
332
- */
333
- export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
334
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
335
- const len0 = WASM_VECTOR_LEN;
336
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
337
- const len1 = WASM_VECTOR_LEN;
338
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
339
- const len2 = WASM_VECTOR_LEN;
340
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
341
- const len3 = WASM_VECTOR_LEN;
342
- const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
343
- return ret !== 0;
344
- }
345
-
346
- /**
347
- * Returns the `BuildInfo` object containing information about how the installed package was built.
348
- * @returns {BuildInfo} - Information on how the installed package was built.
349
- */
350
- export function buildInfo() {
351
- const ret = wasm.buildInfo();
352
- return ret;
353
- }
354
-
355
219
  /**
356
220
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
357
221
  *
@@ -368,6 +232,12 @@ export function compressWitness(witness_map) {
368
232
  return v1;
369
233
  }
370
234
 
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
+ }
371
241
  /**
372
242
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
373
243
  * This should be used to only fetch the witness map for the main function.
@@ -523,16 +393,145 @@ export function getPublicWitness(program, solved_witness) {
523
393
  return takeFromExternrefTable0(ret[0]);
524
394
  }
525
395
 
396
+ /**
397
+ * Sets the package's logging level.
398
+ *
399
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
400
+ */
401
+ export function initLogLevel(filter) {
402
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
403
+ const len0 = WASM_VECTOR_LEN;
404
+ const ret = wasm.initLogLevel(ptr0, len0);
405
+ if (ret[1]) {
406
+ throw takeFromExternrefTable0(ret[0]);
407
+ }
408
+ }
409
+
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
+
526
525
  function __wbg_adapter_30(arg0, arg1, arg2) {
527
- wasm.closure647_externref_shim(arg0, arg1, arg2);
526
+ wasm.closure646_externref_shim(arg0, arg1, arg2);
528
527
  }
529
528
 
530
529
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
531
- wasm.closure1312_externref_shim(arg0, arg1, arg2, arg3, arg4);
530
+ wasm.closure1311_externref_shim(arg0, arg1, arg2, arg3, arg4);
532
531
  }
533
532
 
534
533
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
535
- wasm.closure1316_externref_shim(arg0, arg1, arg2, arg3);
534
+ wasm.closure1315_externref_shim(arg0, arg1, arg2, arg3);
536
535
  }
537
536
 
538
537
  async function __wbg_load(module, imports) {
@@ -581,11 +580,11 @@ function __wbg_get_imports() {
581
580
  const ret = arg0.call(arg1, arg2, arg3);
582
581
  return ret;
583
582
  }, arguments) };
584
- imports.wbg.__wbg_constructor_80adc7700dc98be7 = function(arg0) {
583
+ imports.wbg.__wbg_constructor_0678592859d8ad46 = function(arg0) {
585
584
  const ret = new Error(arg0);
586
585
  return ret;
587
586
  };
588
- imports.wbg.__wbg_constructor_d4798d01154f4bbf = function(arg0) {
587
+ imports.wbg.__wbg_constructor_0b67c5fcc545fad7 = function(arg0) {
589
588
  const ret = new Error(arg0);
590
589
  return ret;
591
590
  };
@@ -690,8 +689,8 @@ function __wbg_get_imports() {
690
689
  const ret = new Map();
691
690
  return ret;
692
691
  };
693
- imports.wbg.__wbg_new_63dcb8fa4e4ab11b = function() {
694
- const ret = new Map();
692
+ imports.wbg.__wbg_new_6a4d0f0a95ea1d41 = function() {
693
+ const ret = new Array();
695
694
  return ret;
696
695
  };
697
696
  imports.wbg.__wbg_new_78feb108b6472713 = function() {
@@ -702,12 +701,12 @@ function __wbg_get_imports() {
702
701
  const ret = new Error();
703
702
  return ret;
704
703
  };
705
- imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
706
- const ret = new Error(getStringFromWasm0(arg0, arg1));
704
+ imports.wbg.__wbg_new_9d8c1790c9f203ab = function() {
705
+ const ret = new Map();
707
706
  return ret;
708
707
  };
709
- imports.wbg.__wbg_new_dc45136d2de0bc6a = function() {
710
- const ret = new Array();
708
+ imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
709
+ const ret = new Error(getStringFromWasm0(arg0, arg1));
711
710
  return ret;
712
711
  };
713
712
  imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
@@ -798,8 +797,8 @@ function __wbg_get_imports() {
798
797
  const ret = false;
799
798
  return ret;
800
799
  };
801
- imports.wbg.__wbindgen_closure_wrapper2146 = function(arg0, arg1, arg2) {
802
- const ret = makeMutClosure(arg0, arg1, 648, __wbg_adapter_30);
800
+ imports.wbg.__wbindgen_closure_wrapper2143 = function(arg0, arg1, arg2) {
801
+ const ret = makeMutClosure(arg0, arg1, 647, __wbg_adapter_30);
803
802
  return ret;
804
803
  };
805
804
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -1,13 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const initLogLevel: (a: number, b: number) => [number, number];
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
4
  export const buildInfo: () => any;
12
5
  export const compressWitness: (a: any) => [number, number, number, number];
13
6
  export const decompressWitness: (a: number, b: number) => [number, number, number];
@@ -19,6 +12,13 @@ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
19
12
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
20
13
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
21
14
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
15
+ export const initLogLevel: (a: number, b: 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 closure647_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure1312_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1316_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure646_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure1311_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure1315_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;