@noir-lang/acvm_js 1.0.0-beta.15-89c2b2d.nightly → 1.0.0-beta.15-c117dfa.nightly

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,29 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Performs a bitwise AND operation between `lhs` and `rhs`
5
- */
6
- export function and(lhs: string, rhs: string): string;
7
- /**
8
- * Performs a bitwise XOR operation between `lhs` and `rhs`
9
- */
10
- export function xor(lhs: string, rhs: string): string;
11
- /**
12
- * Sha256 compression function
13
- */
14
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
15
- /**
16
- * Calculates the Blake2s256 hash of the input bytes
17
- */
18
- export function blake2s256(inputs: Uint8Array): Uint8Array;
19
- /**
20
- * Verifies a ECDSA signature over the secp256k1 curve.
21
- */
22
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
23
- /**
24
- * Verifies a ECDSA signature over the secp256r1 curve.
25
- */
26
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
27
3
  /**
28
4
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
29
5
  *
@@ -81,6 +57,41 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
81
57
  * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
82
58
  */
83
59
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
60
+ /**
61
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
62
+ * @returns {BuildInfo} - Information on how the installed package was built.
63
+ */
64
+ export function buildInfo(): BuildInfo;
65
+ /**
66
+ * Sets the package's logging level.
67
+ *
68
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
69
+ */
70
+ export function initLogLevel(filter: string): void;
71
+ /**
72
+ * Performs a bitwise AND operation between `lhs` and `rhs`
73
+ */
74
+ export function and(lhs: string, rhs: string): string;
75
+ /**
76
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
77
+ */
78
+ export function xor(lhs: string, rhs: string): string;
79
+ /**
80
+ * Sha256 compression function
81
+ */
82
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
83
+ /**
84
+ * Calculates the Blake2s256 hash of the input bytes
85
+ */
86
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
87
+ /**
88
+ * Verifies a ECDSA signature over the secp256k1 curve.
89
+ */
90
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
91
+ /**
92
+ * Verifies a ECDSA signature over the secp256r1 curve.
93
+ */
94
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
84
95
  /**
85
96
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
86
97
  *
@@ -105,17 +116,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
105
116
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
106
117
  */
107
118
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
108
- /**
109
- * Sets the package's logging level.
110
- *
111
- * @param {LogLevel} level - The maximum level of logging to be emitted.
112
- */
113
- export function initLogLevel(filter: string): void;
114
- /**
115
- * Returns the `BuildInfo` object containing information about how the installed package was built.
116
- * @returns {BuildInfo} - Information on how the installed package was built.
117
- */
118
- export function buildInfo(): BuildInfo;
119
119
 
120
120
  // Map from witness index to hex string value of witness.
121
121
  export type WitnessMap = Map<number, string>;
@@ -132,26 +132,17 @@ export type SolvedAndReturnWitness = {
132
132
 
133
133
 
134
134
 
135
- export type StackItem = {
136
- index: number;
137
- witness: WitnessMap;
138
- }
139
-
140
- export type WitnessStack = Array<StackItem>;
141
-
142
-
143
-
144
- export type ForeignCallInput = string[]
145
- export type ForeignCallOutput = string | string[]
146
-
147
135
  /**
148
- * A callback which performs an foreign call and returns the response.
149
- * @callback ForeignCallHandler
150
- * @param {string} name - The identifier for the type of foreign call being performed.
151
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
152
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
153
- */
154
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
136
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
137
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
138
+ * @property {string} version - The version of the package at the built git commit.
139
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
140
+ */
141
+ export type BuildInfo = {
142
+ gitHash: string;
143
+ version: string;
144
+ dirty: string;
145
+ }
155
146
 
156
147
 
157
148
 
@@ -169,16 +160,25 @@ export type ExecutionError = Error & {
169
160
 
170
161
 
171
162
 
163
+ export type ForeignCallInput = string[]
164
+ export type ForeignCallOutput = string | string[]
165
+
172
166
  /**
173
- * @typedef {Object} BuildInfo - Information about how the installed package was built
174
- * @property {string} gitHash - The hash of the git commit from which the package was built.
175
- * @property {string} version - The version of the package at the built git commit.
176
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
- */
178
- export type BuildInfo = {
179
- gitHash: string;
180
- version: string;
181
- dirty: string;
167
+ * A callback which performs an foreign call and returns the response.
168
+ * @callback ForeignCallHandler
169
+ * @param {string} name - The identifier for the type of foreign call being performed.
170
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
171
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
172
+ */
173
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
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,137 +201,17 @@ function debugString(val) {
201
201
  // TODO we could test for more things here, like `Set`s and `Map`s.
202
202
  return className;
203
203
  }
204
- /**
205
- * Performs a bitwise AND operation between `lhs` and `rhs`
206
- * @param {string} lhs
207
- * @param {string} rhs
208
- * @returns {string}
209
- */
210
- module.exports.and = function(lhs, rhs) {
211
- const ret = wasm.and(lhs, rhs);
212
- return ret;
213
- };
214
-
215
- /**
216
- * Performs a bitwise XOR operation between `lhs` and `rhs`
217
- * @param {string} lhs
218
- * @param {string} rhs
219
- * @returns {string}
220
- */
221
- module.exports.xor = function(lhs, rhs) {
222
- const ret = wasm.xor(lhs, rhs);
223
- return ret;
224
- };
225
-
226
- let cachedUint32ArrayMemory0 = null;
227
-
228
- function getUint32ArrayMemory0() {
229
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
230
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
231
- }
232
- return cachedUint32ArrayMemory0;
233
- }
234
-
235
- function passArray32ToWasm0(arg, malloc) {
236
- const ptr = malloc(arg.length * 4, 4) >>> 0;
237
- getUint32ArrayMemory0().set(arg, ptr / 4);
238
- WASM_VECTOR_LEN = arg.length;
239
- return ptr;
240
- }
241
204
 
242
- function getArrayU32FromWasm0(ptr, len) {
243
- ptr = ptr >>> 0;
244
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
245
- }
246
- /**
247
- * Sha256 compression function
248
- * @param {Uint32Array} inputs
249
- * @param {Uint32Array} state
250
- * @returns {Uint32Array}
251
- */
252
- module.exports.sha256_compression = function(inputs, state) {
253
- const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
254
- const len0 = WASM_VECTOR_LEN;
255
- const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
256
- const len1 = WASM_VECTOR_LEN;
257
- const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
258
- var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
259
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
260
- return v3;
261
- };
262
-
263
- function passArray8ToWasm0(arg, malloc) {
264
- const ptr = malloc(arg.length * 1, 1) >>> 0;
265
- getUint8ArrayMemory0().set(arg, ptr / 1);
266
- WASM_VECTOR_LEN = arg.length;
267
- return ptr;
205
+ function takeFromExternrefTable0(idx) {
206
+ const value = wasm.__wbindgen_export_2.get(idx);
207
+ wasm.__externref_table_dealloc(idx);
208
+ return value;
268
209
  }
269
210
 
270
211
  function getArrayU8FromWasm0(ptr, len) {
271
212
  ptr = ptr >>> 0;
272
213
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
273
214
  }
274
- /**
275
- * Calculates the Blake2s256 hash of the input bytes
276
- * @param {Uint8Array} inputs
277
- * @returns {Uint8Array}
278
- */
279
- module.exports.blake2s256 = function(inputs) {
280
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
281
- const len0 = WASM_VECTOR_LEN;
282
- const ret = wasm.blake2s256(ptr0, len0);
283
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
284
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
285
- return v2;
286
- };
287
-
288
- /**
289
- * Verifies a ECDSA signature over the secp256k1 curve.
290
- * @param {Uint8Array} hashed_msg
291
- * @param {Uint8Array} public_key_x_bytes
292
- * @param {Uint8Array} public_key_y_bytes
293
- * @param {Uint8Array} signature
294
- * @returns {boolean}
295
- */
296
- module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
297
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
298
- const len0 = WASM_VECTOR_LEN;
299
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
300
- const len1 = WASM_VECTOR_LEN;
301
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
302
- const len2 = WASM_VECTOR_LEN;
303
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
304
- const len3 = WASM_VECTOR_LEN;
305
- const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
306
- return ret !== 0;
307
- };
308
-
309
- /**
310
- * Verifies a ECDSA signature over the secp256r1 curve.
311
- * @param {Uint8Array} hashed_msg
312
- * @param {Uint8Array} public_key_x_bytes
313
- * @param {Uint8Array} public_key_y_bytes
314
- * @param {Uint8Array} signature
315
- * @returns {boolean}
316
- */
317
- module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
318
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
319
- const len0 = WASM_VECTOR_LEN;
320
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
321
- const len1 = WASM_VECTOR_LEN;
322
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
323
- const len2 = WASM_VECTOR_LEN;
324
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
325
- const len3 = WASM_VECTOR_LEN;
326
- const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
327
- return ret !== 0;
328
- };
329
-
330
- function takeFromExternrefTable0(idx) {
331
- const value = wasm.__wbindgen_export_2.get(idx);
332
- wasm.__externref_table_dealloc(idx);
333
- return value;
334
- }
335
215
  /**
336
216
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
337
217
  *
@@ -348,6 +228,12 @@ module.exports.compressWitness = function(witness_map) {
348
228
  return v1;
349
229
  };
350
230
 
231
+ function passArray8ToWasm0(arg, malloc) {
232
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
233
+ getUint8ArrayMemory0().set(arg, ptr / 1);
234
+ WASM_VECTOR_LEN = arg.length;
235
+ return ptr;
236
+ }
351
237
  /**
352
238
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
353
239
  * This should be used to only fetch the witness map for the main function.
@@ -443,6 +329,144 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
443
329
  return ret;
444
330
  };
445
331
 
332
+ /**
333
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
334
+ * @returns {BuildInfo} - Information on how the installed package was built.
335
+ */
336
+ module.exports.buildInfo = function() {
337
+ const ret = wasm.buildInfo();
338
+ return ret;
339
+ };
340
+
341
+ /**
342
+ * Sets the package's logging level.
343
+ *
344
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
345
+ */
346
+ module.exports.initLogLevel = function(filter) {
347
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
348
+ const len0 = WASM_VECTOR_LEN;
349
+ const ret = wasm.initLogLevel(ptr0, len0);
350
+ if (ret[1]) {
351
+ throw takeFromExternrefTable0(ret[0]);
352
+ }
353
+ };
354
+
355
+ /**
356
+ * Performs a bitwise AND operation between `lhs` and `rhs`
357
+ * @param {string} lhs
358
+ * @param {string} rhs
359
+ * @returns {string}
360
+ */
361
+ module.exports.and = function(lhs, rhs) {
362
+ const ret = wasm.and(lhs, rhs);
363
+ return ret;
364
+ };
365
+
366
+ /**
367
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
368
+ * @param {string} lhs
369
+ * @param {string} rhs
370
+ * @returns {string}
371
+ */
372
+ module.exports.xor = function(lhs, rhs) {
373
+ const ret = wasm.xor(lhs, rhs);
374
+ return ret;
375
+ };
376
+
377
+ let cachedUint32ArrayMemory0 = null;
378
+
379
+ function getUint32ArrayMemory0() {
380
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
381
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
382
+ }
383
+ return cachedUint32ArrayMemory0;
384
+ }
385
+
386
+ function passArray32ToWasm0(arg, malloc) {
387
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
388
+ getUint32ArrayMemory0().set(arg, ptr / 4);
389
+ WASM_VECTOR_LEN = arg.length;
390
+ return ptr;
391
+ }
392
+
393
+ function getArrayU32FromWasm0(ptr, len) {
394
+ ptr = ptr >>> 0;
395
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
396
+ }
397
+ /**
398
+ * Sha256 compression function
399
+ * @param {Uint32Array} inputs
400
+ * @param {Uint32Array} state
401
+ * @returns {Uint32Array}
402
+ */
403
+ module.exports.sha256_compression = function(inputs, state) {
404
+ const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
405
+ const len0 = WASM_VECTOR_LEN;
406
+ const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
407
+ const len1 = WASM_VECTOR_LEN;
408
+ const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
409
+ var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
410
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
411
+ return v3;
412
+ };
413
+
414
+ /**
415
+ * Calculates the Blake2s256 hash of the input bytes
416
+ * @param {Uint8Array} inputs
417
+ * @returns {Uint8Array}
418
+ */
419
+ module.exports.blake2s256 = function(inputs) {
420
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
421
+ const len0 = WASM_VECTOR_LEN;
422
+ const ret = wasm.blake2s256(ptr0, len0);
423
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
424
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
425
+ return v2;
426
+ };
427
+
428
+ /**
429
+ * Verifies a ECDSA signature over the secp256k1 curve.
430
+ * @param {Uint8Array} hashed_msg
431
+ * @param {Uint8Array} public_key_x_bytes
432
+ * @param {Uint8Array} public_key_y_bytes
433
+ * @param {Uint8Array} signature
434
+ * @returns {boolean}
435
+ */
436
+ module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
437
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
438
+ const len0 = WASM_VECTOR_LEN;
439
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
440
+ const len1 = WASM_VECTOR_LEN;
441
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
442
+ const len2 = WASM_VECTOR_LEN;
443
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
444
+ const len3 = WASM_VECTOR_LEN;
445
+ const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
446
+ return ret !== 0;
447
+ };
448
+
449
+ /**
450
+ * Verifies a ECDSA signature over the secp256r1 curve.
451
+ * @param {Uint8Array} hashed_msg
452
+ * @param {Uint8Array} public_key_x_bytes
453
+ * @param {Uint8Array} public_key_y_bytes
454
+ * @param {Uint8Array} signature
455
+ * @returns {boolean}
456
+ */
457
+ module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
458
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
459
+ const len0 = WASM_VECTOR_LEN;
460
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
461
+ const len1 = WASM_VECTOR_LEN;
462
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
463
+ const len2 = WASM_VECTOR_LEN;
464
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
465
+ const len3 = WASM_VECTOR_LEN;
466
+ const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
467
+ return ret !== 0;
468
+ };
469
+
446
470
  /**
447
471
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
448
472
  *
@@ -503,39 +527,16 @@ module.exports.getPublicWitness = function(program, solved_witness) {
503
527
  return takeFromExternrefTable0(ret[0]);
504
528
  };
505
529
 
506
- /**
507
- * Sets the package's logging level.
508
- *
509
- * @param {LogLevel} level - The maximum level of logging to be emitted.
510
- */
511
- module.exports.initLogLevel = function(filter) {
512
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
513
- const len0 = WASM_VECTOR_LEN;
514
- const ret = wasm.initLogLevel(ptr0, len0);
515
- if (ret[1]) {
516
- throw takeFromExternrefTable0(ret[0]);
517
- }
518
- };
519
-
520
- /**
521
- * Returns the `BuildInfo` object containing information about how the installed package was built.
522
- * @returns {BuildInfo} - Information on how the installed package was built.
523
- */
524
- module.exports.buildInfo = function() {
525
- const ret = wasm.buildInfo();
526
- return ret;
527
- };
528
-
529
530
  function __wbg_adapter_30(arg0, arg1, arg2) {
530
- wasm.closure580_externref_shim(arg0, arg1, arg2);
531
+ wasm.closure588_externref_shim(arg0, arg1, arg2);
531
532
  }
532
533
 
533
534
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
534
- wasm.closure1175_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
+ wasm.closure1183_externref_shim(arg0, arg1, arg2, arg3, arg4);
535
536
  }
536
537
 
537
538
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
538
- wasm.closure1179_externref_shim(arg0, arg1, arg2, arg3);
539
+ wasm.closure1187_externref_shim(arg0, arg1, arg2, arg3);
539
540
  }
540
541
 
541
542
  module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
@@ -813,8 +814,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
813
814
  return ret;
814
815
  };
815
816
 
816
- module.exports.__wbindgen_closure_wrapper1960 = function(arg0, arg1, arg2) {
817
- const ret = makeMutClosure(arg0, arg1, 581, __wbg_adapter_30);
817
+ module.exports.__wbindgen_closure_wrapper1982 = function(arg0, arg1, arg2) {
818
+ const ret = makeMutClosure(arg0, arg1, 589, __wbg_adapter_30);
818
819
  return ret;
819
820
  };
820
821
 
Binary file
@@ -1,12 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const and: (a: any, b: any) => any;
5
- export const xor: (a: any, b: any) => any;
6
- export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
7
- export const blake2s256: (a: number, b: number) => [number, number];
8
- export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
9
- export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
10
4
  export const compressWitness: (a: any) => [number, number, number, number];
11
5
  export const decompressWitness: (a: number, b: number) => [number, number, number];
12
6
  export const compressWitnessStack: (a: any) => [number, number, number, number];
@@ -14,11 +8,17 @@ export const decompressWitnessStack: (a: number, b: number) => [number, number,
14
8
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
15
9
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
16
10
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
11
+ export const buildInfo: () => any;
12
+ export const initLogLevel: (a: number, b: number) => [number, number];
13
+ export const and: (a: any, b: any) => any;
14
+ export const xor: (a: any, b: any) => any;
15
+ export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
16
+ export const blake2s256: (a: number, b: number) => [number, number];
17
+ export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
18
+ export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
19
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
18
20
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
19
21
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
20
- export const initLogLevel: (a: number, b: number) => [number, number];
21
- export const buildInfo: () => any;
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 closure580_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure1175_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1179_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure588_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure1183_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure1187_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.15-89c2b2d.nightly",
3
+ "version": "1.0.0-beta.15-c117dfa.nightly",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
package/web/acvm_js.d.ts CHANGED
@@ -1,29 +1,5 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
- /**
4
- * Performs a bitwise AND operation between `lhs` and `rhs`
5
- */
6
- export function and(lhs: string, rhs: string): string;
7
- /**
8
- * Performs a bitwise XOR operation between `lhs` and `rhs`
9
- */
10
- export function xor(lhs: string, rhs: string): string;
11
- /**
12
- * Sha256 compression function
13
- */
14
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
15
- /**
16
- * Calculates the Blake2s256 hash of the input bytes
17
- */
18
- export function blake2s256(inputs: Uint8Array): Uint8Array;
19
- /**
20
- * Verifies a ECDSA signature over the secp256k1 curve.
21
- */
22
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
23
- /**
24
- * Verifies a ECDSA signature over the secp256r1 curve.
25
- */
26
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
27
3
  /**
28
4
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
29
5
  *
@@ -81,6 +57,41 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
81
57
  * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
82
58
  */
83
59
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
60
+ /**
61
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
62
+ * @returns {BuildInfo} - Information on how the installed package was built.
63
+ */
64
+ export function buildInfo(): BuildInfo;
65
+ /**
66
+ * Sets the package's logging level.
67
+ *
68
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
69
+ */
70
+ export function initLogLevel(filter: string): void;
71
+ /**
72
+ * Performs a bitwise AND operation between `lhs` and `rhs`
73
+ */
74
+ export function and(lhs: string, rhs: string): string;
75
+ /**
76
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
77
+ */
78
+ export function xor(lhs: string, rhs: string): string;
79
+ /**
80
+ * Sha256 compression function
81
+ */
82
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
83
+ /**
84
+ * Calculates the Blake2s256 hash of the input bytes
85
+ */
86
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
87
+ /**
88
+ * Verifies a ECDSA signature over the secp256k1 curve.
89
+ */
90
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
91
+ /**
92
+ * Verifies a ECDSA signature over the secp256r1 curve.
93
+ */
94
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
84
95
  /**
85
96
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
86
97
  *
@@ -105,17 +116,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
105
116
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
106
117
  */
107
118
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
108
- /**
109
- * Sets the package's logging level.
110
- *
111
- * @param {LogLevel} level - The maximum level of logging to be emitted.
112
- */
113
- export function initLogLevel(filter: string): void;
114
- /**
115
- * Returns the `BuildInfo` object containing information about how the installed package was built.
116
- * @returns {BuildInfo} - Information on how the installed package was built.
117
- */
118
- export function buildInfo(): BuildInfo;
119
119
 
120
120
  // Map from witness index to hex string value of witness.
121
121
  export type WitnessMap = Map<number, string>;
@@ -132,26 +132,17 @@ export type SolvedAndReturnWitness = {
132
132
 
133
133
 
134
134
 
135
- export type StackItem = {
136
- index: number;
137
- witness: WitnessMap;
138
- }
139
-
140
- export type WitnessStack = Array<StackItem>;
141
-
142
-
143
-
144
- export type ForeignCallInput = string[]
145
- export type ForeignCallOutput = string | string[]
146
-
147
135
  /**
148
- * A callback which performs an foreign call and returns the response.
149
- * @callback ForeignCallHandler
150
- * @param {string} name - The identifier for the type of foreign call being performed.
151
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
152
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
153
- */
154
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
136
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
137
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
138
+ * @property {string} version - The version of the package at the built git commit.
139
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
140
+ */
141
+ export type BuildInfo = {
142
+ gitHash: string;
143
+ version: string;
144
+ dirty: string;
145
+ }
155
146
 
156
147
 
157
148
 
@@ -169,30 +160,33 @@ export type ExecutionError = Error & {
169
160
 
170
161
 
171
162
 
163
+ export type ForeignCallInput = string[]
164
+ export type ForeignCallOutput = string | string[]
165
+
172
166
  /**
173
- * @typedef {Object} BuildInfo - Information about how the installed package was built
174
- * @property {string} gitHash - The hash of the git commit from which the package was built.
175
- * @property {string} version - The version of the package at the built git commit.
176
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
- */
178
- export type BuildInfo = {
179
- gitHash: string;
180
- version: string;
181
- dirty: string;
167
+ * A callback which performs an foreign call and returns the response.
168
+ * @callback ForeignCallHandler
169
+ * @param {string} name - The identifier for the type of foreign call being performed.
170
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
171
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
172
+ */
173
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
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 and: (a: any, b: any) => any;
191
- readonly xor: (a: any, b: any) => any;
192
- readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
193
- readonly blake2s256: (a: number, b: number) => [number, number];
194
- readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
195
- readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
196
190
  readonly compressWitness: (a: any) => [number, number, number, number];
197
191
  readonly decompressWitness: (a: number, b: number) => [number, number, number];
198
192
  readonly compressWitnessStack: (a: any) => [number, number, number, number];
@@ -200,11 +194,17 @@ export interface InitOutput {
200
194
  readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
201
195
  readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
202
196
  readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
197
+ readonly buildInfo: () => any;
198
+ readonly initLogLevel: (a: number, b: number) => [number, number];
199
+ readonly and: (a: any, b: any) => any;
200
+ readonly xor: (a: any, b: any) => any;
201
+ readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
202
+ readonly blake2s256: (a: number, b: number) => [number, number];
203
+ readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
204
+ readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
203
205
  readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
204
206
  readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
205
207
  readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
206
- readonly initLogLevel: (a: number, b: number) => [number, number];
207
- readonly buildInfo: () => any;
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 closure580_externref_shim: (a: number, b: number, c: any) => void;
217
- readonly closure1175_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
- readonly closure1179_externref_shim: (a: number, b: number, c: any, d: any) => void;
216
+ readonly closure588_externref_shim: (a: number, b: number, c: any) => void;
217
+ readonly closure1183_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
218
+ readonly closure1187_externref_shim: (a: number, b: number, c: any, d: any) => void;
219
219
  readonly __wbindgen_start: () => void;
220
220
  }
221
221
 
package/web/acvm_js.js CHANGED
@@ -197,137 +197,17 @@ function debugString(val) {
197
197
  // TODO we could test for more things here, like `Set`s and `Map`s.
198
198
  return className;
199
199
  }
200
- /**
201
- * Performs a bitwise AND operation between `lhs` and `rhs`
202
- * @param {string} lhs
203
- * @param {string} rhs
204
- * @returns {string}
205
- */
206
- export function and(lhs, rhs) {
207
- const ret = wasm.and(lhs, rhs);
208
- return ret;
209
- }
210
-
211
- /**
212
- * Performs a bitwise XOR operation between `lhs` and `rhs`
213
- * @param {string} lhs
214
- * @param {string} rhs
215
- * @returns {string}
216
- */
217
- export function xor(lhs, rhs) {
218
- const ret = wasm.xor(lhs, rhs);
219
- return ret;
220
- }
221
-
222
- let cachedUint32ArrayMemory0 = null;
223
-
224
- function getUint32ArrayMemory0() {
225
- if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
226
- cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
227
- }
228
- return cachedUint32ArrayMemory0;
229
- }
230
-
231
- function passArray32ToWasm0(arg, malloc) {
232
- const ptr = malloc(arg.length * 4, 4) >>> 0;
233
- getUint32ArrayMemory0().set(arg, ptr / 4);
234
- WASM_VECTOR_LEN = arg.length;
235
- return ptr;
236
- }
237
200
 
238
- function getArrayU32FromWasm0(ptr, len) {
239
- ptr = ptr >>> 0;
240
- return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
241
- }
242
- /**
243
- * Sha256 compression function
244
- * @param {Uint32Array} inputs
245
- * @param {Uint32Array} state
246
- * @returns {Uint32Array}
247
- */
248
- export function sha256_compression(inputs, state) {
249
- const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
250
- const len0 = WASM_VECTOR_LEN;
251
- const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
252
- const len1 = WASM_VECTOR_LEN;
253
- const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
254
- var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
255
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
256
- return v3;
257
- }
258
-
259
- function passArray8ToWasm0(arg, malloc) {
260
- const ptr = malloc(arg.length * 1, 1) >>> 0;
261
- getUint8ArrayMemory0().set(arg, ptr / 1);
262
- WASM_VECTOR_LEN = arg.length;
263
- return ptr;
201
+ function takeFromExternrefTable0(idx) {
202
+ const value = wasm.__wbindgen_export_2.get(idx);
203
+ wasm.__externref_table_dealloc(idx);
204
+ return value;
264
205
  }
265
206
 
266
207
  function getArrayU8FromWasm0(ptr, len) {
267
208
  ptr = ptr >>> 0;
268
209
  return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
269
210
  }
270
- /**
271
- * Calculates the Blake2s256 hash of the input bytes
272
- * @param {Uint8Array} inputs
273
- * @returns {Uint8Array}
274
- */
275
- export function blake2s256(inputs) {
276
- const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
277
- const len0 = WASM_VECTOR_LEN;
278
- const ret = wasm.blake2s256(ptr0, len0);
279
- var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
280
- wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
281
- return v2;
282
- }
283
-
284
- /**
285
- * Verifies a ECDSA signature over the secp256k1 curve.
286
- * @param {Uint8Array} hashed_msg
287
- * @param {Uint8Array} public_key_x_bytes
288
- * @param {Uint8Array} public_key_y_bytes
289
- * @param {Uint8Array} signature
290
- * @returns {boolean}
291
- */
292
- export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
293
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
294
- const len0 = WASM_VECTOR_LEN;
295
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
296
- const len1 = WASM_VECTOR_LEN;
297
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
298
- const len2 = WASM_VECTOR_LEN;
299
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
300
- const len3 = WASM_VECTOR_LEN;
301
- const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
302
- return ret !== 0;
303
- }
304
-
305
- /**
306
- * Verifies a ECDSA signature over the secp256r1 curve.
307
- * @param {Uint8Array} hashed_msg
308
- * @param {Uint8Array} public_key_x_bytes
309
- * @param {Uint8Array} public_key_y_bytes
310
- * @param {Uint8Array} signature
311
- * @returns {boolean}
312
- */
313
- export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
314
- const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
315
- const len0 = WASM_VECTOR_LEN;
316
- const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
317
- const len1 = WASM_VECTOR_LEN;
318
- const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
319
- const len2 = WASM_VECTOR_LEN;
320
- const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
321
- const len3 = WASM_VECTOR_LEN;
322
- const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
323
- return ret !== 0;
324
- }
325
-
326
- function takeFromExternrefTable0(idx) {
327
- const value = wasm.__wbindgen_export_2.get(idx);
328
- wasm.__externref_table_dealloc(idx);
329
- return value;
330
- }
331
211
  /**
332
212
  * Compresses a `WitnessMap` into the binary format outputted by Nargo.
333
213
  *
@@ -344,6 +224,12 @@ export function compressWitness(witness_map) {
344
224
  return v1;
345
225
  }
346
226
 
227
+ function passArray8ToWasm0(arg, malloc) {
228
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
229
+ getUint8ArrayMemory0().set(arg, ptr / 1);
230
+ WASM_VECTOR_LEN = arg.length;
231
+ return ptr;
232
+ }
347
233
  /**
348
234
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
349
235
  * This should be used to only fetch the witness map for the main function.
@@ -439,6 +325,144 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
439
325
  return ret;
440
326
  }
441
327
 
328
+ /**
329
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
330
+ * @returns {BuildInfo} - Information on how the installed package was built.
331
+ */
332
+ export function buildInfo() {
333
+ const ret = wasm.buildInfo();
334
+ return ret;
335
+ }
336
+
337
+ /**
338
+ * Sets the package's logging level.
339
+ *
340
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
341
+ */
342
+ export function initLogLevel(filter) {
343
+ const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
344
+ const len0 = WASM_VECTOR_LEN;
345
+ const ret = wasm.initLogLevel(ptr0, len0);
346
+ if (ret[1]) {
347
+ throw takeFromExternrefTable0(ret[0]);
348
+ }
349
+ }
350
+
351
+ /**
352
+ * Performs a bitwise AND operation between `lhs` and `rhs`
353
+ * @param {string} lhs
354
+ * @param {string} rhs
355
+ * @returns {string}
356
+ */
357
+ export function and(lhs, rhs) {
358
+ const ret = wasm.and(lhs, rhs);
359
+ return ret;
360
+ }
361
+
362
+ /**
363
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
364
+ * @param {string} lhs
365
+ * @param {string} rhs
366
+ * @returns {string}
367
+ */
368
+ export function xor(lhs, rhs) {
369
+ const ret = wasm.xor(lhs, rhs);
370
+ return ret;
371
+ }
372
+
373
+ let cachedUint32ArrayMemory0 = null;
374
+
375
+ function getUint32ArrayMemory0() {
376
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
377
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
378
+ }
379
+ return cachedUint32ArrayMemory0;
380
+ }
381
+
382
+ function passArray32ToWasm0(arg, malloc) {
383
+ const ptr = malloc(arg.length * 4, 4) >>> 0;
384
+ getUint32ArrayMemory0().set(arg, ptr / 4);
385
+ WASM_VECTOR_LEN = arg.length;
386
+ return ptr;
387
+ }
388
+
389
+ function getArrayU32FromWasm0(ptr, len) {
390
+ ptr = ptr >>> 0;
391
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
392
+ }
393
+ /**
394
+ * Sha256 compression function
395
+ * @param {Uint32Array} inputs
396
+ * @param {Uint32Array} state
397
+ * @returns {Uint32Array}
398
+ */
399
+ export function sha256_compression(inputs, state) {
400
+ const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
401
+ const len0 = WASM_VECTOR_LEN;
402
+ const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
403
+ const len1 = WASM_VECTOR_LEN;
404
+ const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
405
+ var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
406
+ wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
407
+ return v3;
408
+ }
409
+
410
+ /**
411
+ * Calculates the Blake2s256 hash of the input bytes
412
+ * @param {Uint8Array} inputs
413
+ * @returns {Uint8Array}
414
+ */
415
+ export function blake2s256(inputs) {
416
+ const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
417
+ const len0 = WASM_VECTOR_LEN;
418
+ const ret = wasm.blake2s256(ptr0, len0);
419
+ var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
420
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
421
+ return v2;
422
+ }
423
+
424
+ /**
425
+ * Verifies a ECDSA signature over the secp256k1 curve.
426
+ * @param {Uint8Array} hashed_msg
427
+ * @param {Uint8Array} public_key_x_bytes
428
+ * @param {Uint8Array} public_key_y_bytes
429
+ * @param {Uint8Array} signature
430
+ * @returns {boolean}
431
+ */
432
+ export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
433
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
434
+ const len0 = WASM_VECTOR_LEN;
435
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
436
+ const len1 = WASM_VECTOR_LEN;
437
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
438
+ const len2 = WASM_VECTOR_LEN;
439
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
440
+ const len3 = WASM_VECTOR_LEN;
441
+ const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
442
+ return ret !== 0;
443
+ }
444
+
445
+ /**
446
+ * Verifies a ECDSA signature over the secp256r1 curve.
447
+ * @param {Uint8Array} hashed_msg
448
+ * @param {Uint8Array} public_key_x_bytes
449
+ * @param {Uint8Array} public_key_y_bytes
450
+ * @param {Uint8Array} signature
451
+ * @returns {boolean}
452
+ */
453
+ export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
454
+ const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
455
+ const len0 = WASM_VECTOR_LEN;
456
+ const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
457
+ const len1 = WASM_VECTOR_LEN;
458
+ const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
459
+ const len2 = WASM_VECTOR_LEN;
460
+ const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
461
+ const len3 = WASM_VECTOR_LEN;
462
+ const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
463
+ return ret !== 0;
464
+ }
465
+
442
466
  /**
443
467
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
444
468
  *
@@ -499,39 +523,16 @@ export function getPublicWitness(program, solved_witness) {
499
523
  return takeFromExternrefTable0(ret[0]);
500
524
  }
501
525
 
502
- /**
503
- * Sets the package's logging level.
504
- *
505
- * @param {LogLevel} level - The maximum level of logging to be emitted.
506
- */
507
- export function initLogLevel(filter) {
508
- const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
509
- const len0 = WASM_VECTOR_LEN;
510
- const ret = wasm.initLogLevel(ptr0, len0);
511
- if (ret[1]) {
512
- throw takeFromExternrefTable0(ret[0]);
513
- }
514
- }
515
-
516
- /**
517
- * Returns the `BuildInfo` object containing information about how the installed package was built.
518
- * @returns {BuildInfo} - Information on how the installed package was built.
519
- */
520
- export function buildInfo() {
521
- const ret = wasm.buildInfo();
522
- return ret;
523
- }
524
-
525
526
  function __wbg_adapter_30(arg0, arg1, arg2) {
526
- wasm.closure580_externref_shim(arg0, arg1, arg2);
527
+ wasm.closure588_externref_shim(arg0, arg1, arg2);
527
528
  }
528
529
 
529
530
  function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
530
- wasm.closure1175_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
+ wasm.closure1183_externref_shim(arg0, arg1, arg2, arg3, arg4);
531
532
  }
532
533
 
533
534
  function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
534
- wasm.closure1179_externref_shim(arg0, arg1, arg2, arg3);
535
+ wasm.closure1187_externref_shim(arg0, arg1, arg2, arg3);
535
536
  }
536
537
 
537
538
  async function __wbg_load(module, imports) {
@@ -797,8 +798,8 @@ function __wbg_get_imports() {
797
798
  const ret = false;
798
799
  return ret;
799
800
  };
800
- imports.wbg.__wbindgen_closure_wrapper1960 = function(arg0, arg1, arg2) {
801
- const ret = makeMutClosure(arg0, arg1, 581, __wbg_adapter_30);
801
+ imports.wbg.__wbindgen_closure_wrapper1982 = function(arg0, arg1, arg2) {
802
+ const ret = makeMutClosure(arg0, arg1, 589, __wbg_adapter_30);
802
803
  return ret;
803
804
  };
804
805
  imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
Binary file
@@ -1,12 +1,6 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
- export const and: (a: any, b: any) => any;
5
- export const xor: (a: any, b: any) => any;
6
- export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
7
- export const blake2s256: (a: number, b: number) => [number, number];
8
- export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
9
- export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
10
4
  export const compressWitness: (a: any) => [number, number, number, number];
11
5
  export const decompressWitness: (a: number, b: number) => [number, number, number];
12
6
  export const compressWitnessStack: (a: any) => [number, number, number, number];
@@ -14,11 +8,17 @@ export const decompressWitnessStack: (a: number, b: number) => [number, number,
14
8
  export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
15
9
  export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
16
10
  export const executeProgram: (a: number, b: number, c: any, d: any) => any;
11
+ export const buildInfo: () => any;
12
+ export const initLogLevel: (a: number, b: number) => [number, number];
13
+ export const and: (a: any, b: any) => any;
14
+ export const xor: (a: any, b: any) => any;
15
+ export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
16
+ export const blake2s256: (a: number, b: number) => [number, number];
17
+ export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
18
+ export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
17
19
  export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
18
20
  export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
19
21
  export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
20
- export const initLogLevel: (a: number, b: number) => [number, number];
21
- export const buildInfo: () => any;
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 closure580_externref_shim: (a: number, b: number, c: any) => void;
31
- export const closure1175_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
- export const closure1179_externref_shim: (a: number, b: number, c: any, d: any) => void;
30
+ export const closure588_externref_shim: (a: number, b: number, c: any) => void;
31
+ export const closure1183_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
32
+ export const closure1187_externref_shim: (a: number, b: number, c: any, d: any) => void;
33
33
  export const __wbindgen_start: () => void;