@noir-lang/acvm_js 1.0.0-beta.17-32f513f.nightly → 1.0.0-beta.18
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.
- package/nodejs/acvm_js.d.ts +77 -77
- package/nodejs/acvm_js.js +202 -203
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +13 -13
- package/package.json +1 -1
- package/web/acvm_js.d.ts +90 -90
- package/web/acvm_js.js +200 -201
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +13 -13
package/nodejs/acvm_js.js
CHANGED
|
@@ -210,130 +210,56 @@ module.exports.buildInfo = function() {
|
|
|
210
210
|
return ret;
|
|
211
211
|
};
|
|
212
212
|
|
|
213
|
-
/**
|
|
214
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
215
|
-
* @param {string} lhs
|
|
216
|
-
* @param {string} rhs
|
|
217
|
-
* @returns {string}
|
|
218
|
-
*/
|
|
219
|
-
module.exports.and = function(lhs, rhs) {
|
|
220
|
-
const ret = wasm.and(lhs, rhs);
|
|
221
|
-
return ret;
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
226
|
-
* @param {string} lhs
|
|
227
|
-
* @param {string} rhs
|
|
228
|
-
* @returns {string}
|
|
229
|
-
*/
|
|
230
|
-
module.exports.xor = function(lhs, rhs) {
|
|
231
|
-
const ret = wasm.xor(lhs, rhs);
|
|
232
|
-
return ret;
|
|
233
|
-
};
|
|
234
|
-
|
|
235
|
-
let cachedUint32ArrayMemory0 = null;
|
|
236
|
-
|
|
237
|
-
function getUint32ArrayMemory0() {
|
|
238
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
239
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
240
|
-
}
|
|
241
|
-
return cachedUint32ArrayMemory0;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
function passArray32ToWasm0(arg, malloc) {
|
|
245
|
-
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
246
|
-
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
247
|
-
WASM_VECTOR_LEN = arg.length;
|
|
248
|
-
return ptr;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
252
|
-
ptr = ptr >>> 0;
|
|
253
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Sha256 compression function
|
|
257
|
-
* @param {Uint32Array} inputs
|
|
258
|
-
* @param {Uint32Array} state
|
|
259
|
-
* @returns {Uint32Array}
|
|
260
|
-
*/
|
|
261
|
-
module.exports.sha256_compression = function(inputs, state) {
|
|
262
|
-
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
263
|
-
const len0 = WASM_VECTOR_LEN;
|
|
264
|
-
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
265
|
-
const len1 = WASM_VECTOR_LEN;
|
|
266
|
-
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
267
|
-
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
268
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
269
|
-
return v3;
|
|
270
|
-
};
|
|
271
|
-
|
|
272
213
|
function passArray8ToWasm0(arg, malloc) {
|
|
273
214
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
274
215
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
275
216
|
WASM_VECTOR_LEN = arg.length;
|
|
276
217
|
return ptr;
|
|
277
218
|
}
|
|
278
|
-
|
|
279
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
280
|
-
ptr = ptr >>> 0;
|
|
281
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
282
|
-
}
|
|
283
219
|
/**
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
* @
|
|
220
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
221
|
+
*
|
|
222
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
223
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
224
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
225
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
287
226
|
*/
|
|
288
|
-
module.exports.
|
|
289
|
-
const ptr0 = passArray8ToWasm0(
|
|
227
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
228
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
290
229
|
const len0 = WASM_VECTOR_LEN;
|
|
291
|
-
const ret = wasm.
|
|
292
|
-
|
|
293
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
294
|
-
return v2;
|
|
230
|
+
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
231
|
+
return ret;
|
|
295
232
|
};
|
|
296
233
|
|
|
297
234
|
/**
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* @param {Uint8Array}
|
|
302
|
-
* @param {
|
|
303
|
-
* @
|
|
235
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
236
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
237
|
+
*
|
|
238
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
239
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
240
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
241
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
304
242
|
*/
|
|
305
|
-
module.exports.
|
|
306
|
-
const ptr0 = passArray8ToWasm0(
|
|
243
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
244
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
307
245
|
const len0 = WASM_VECTOR_LEN;
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
311
|
-
const len2 = WASM_VECTOR_LEN;
|
|
312
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
313
|
-
const len3 = WASM_VECTOR_LEN;
|
|
314
|
-
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
315
|
-
return ret !== 0;
|
|
246
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
247
|
+
return ret;
|
|
316
248
|
};
|
|
317
249
|
|
|
318
250
|
/**
|
|
319
|
-
*
|
|
320
|
-
*
|
|
321
|
-
* @param {Uint8Array}
|
|
322
|
-
* @param {
|
|
323
|
-
* @param {
|
|
324
|
-
* @returns {
|
|
251
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
252
|
+
*
|
|
253
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
254
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
255
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
256
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
325
257
|
*/
|
|
326
|
-
module.exports.
|
|
327
|
-
const ptr0 = passArray8ToWasm0(
|
|
258
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
259
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
328
260
|
const len0 = WASM_VECTOR_LEN;
|
|
329
|
-
const
|
|
330
|
-
|
|
331
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
332
|
-
const len2 = WASM_VECTOR_LEN;
|
|
333
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
334
|
-
const len3 = WASM_VECTOR_LEN;
|
|
335
|
-
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
336
|
-
return ret !== 0;
|
|
261
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
262
|
+
return ret;
|
|
337
263
|
};
|
|
338
264
|
|
|
339
265
|
function takeFromExternrefTable0(idx) {
|
|
@@ -342,19 +268,69 @@ function takeFromExternrefTable0(idx) {
|
|
|
342
268
|
return value;
|
|
343
269
|
}
|
|
344
270
|
/**
|
|
345
|
-
*
|
|
271
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
346
272
|
*
|
|
347
|
-
* @param {
|
|
273
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
274
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
275
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
276
|
+
* @param {Uint8Array} program
|
|
277
|
+
* @param {WitnessMap} witness_map
|
|
278
|
+
* @returns {WitnessMap}
|
|
348
279
|
*/
|
|
349
|
-
module.exports.
|
|
350
|
-
const ptr0 =
|
|
280
|
+
module.exports.getReturnWitness = function(program, witness_map) {
|
|
281
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
351
282
|
const len0 = WASM_VECTOR_LEN;
|
|
352
|
-
const ret = wasm.
|
|
353
|
-
if (ret[
|
|
354
|
-
throw takeFromExternrefTable0(ret[
|
|
283
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
284
|
+
if (ret[2]) {
|
|
285
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
286
|
+
}
|
|
287
|
+
return takeFromExternrefTable0(ret[0]);
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
292
|
+
*
|
|
293
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
294
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
295
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
296
|
+
* @param {Uint8Array} program
|
|
297
|
+
* @param {WitnessMap} solved_witness
|
|
298
|
+
* @returns {WitnessMap}
|
|
299
|
+
*/
|
|
300
|
+
module.exports.getPublicParametersWitness = function(program, solved_witness) {
|
|
301
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
302
|
+
const len0 = WASM_VECTOR_LEN;
|
|
303
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
304
|
+
if (ret[2]) {
|
|
305
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
355
306
|
}
|
|
307
|
+
return takeFromExternrefTable0(ret[0]);
|
|
356
308
|
};
|
|
357
309
|
|
|
310
|
+
/**
|
|
311
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
312
|
+
*
|
|
313
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
314
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
315
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
316
|
+
* @param {Uint8Array} program
|
|
317
|
+
* @param {WitnessMap} solved_witness
|
|
318
|
+
* @returns {WitnessMap}
|
|
319
|
+
*/
|
|
320
|
+
module.exports.getPublicWitness = function(program, solved_witness) {
|
|
321
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
322
|
+
const len0 = WASM_VECTOR_LEN;
|
|
323
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
324
|
+
if (ret[2]) {
|
|
325
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
326
|
+
}
|
|
327
|
+
return takeFromExternrefTable0(ret[0]);
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
331
|
+
ptr = ptr >>> 0;
|
|
332
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
333
|
+
}
|
|
358
334
|
/**
|
|
359
335
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
360
336
|
*
|
|
@@ -421,121 +397,144 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
421
397
|
};
|
|
422
398
|
|
|
423
399
|
/**
|
|
424
|
-
*
|
|
425
|
-
*
|
|
426
|
-
* @param {
|
|
427
|
-
* @
|
|
428
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
429
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
400
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
401
|
+
* @param {string} lhs
|
|
402
|
+
* @param {string} rhs
|
|
403
|
+
* @returns {string}
|
|
430
404
|
*/
|
|
431
|
-
module.exports.
|
|
432
|
-
const
|
|
433
|
-
const len0 = WASM_VECTOR_LEN;
|
|
434
|
-
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
405
|
+
module.exports.and = function(lhs, rhs) {
|
|
406
|
+
const ret = wasm.and(lhs, rhs);
|
|
435
407
|
return ret;
|
|
436
408
|
};
|
|
437
409
|
|
|
438
410
|
/**
|
|
439
|
-
*
|
|
440
|
-
*
|
|
441
|
-
*
|
|
442
|
-
* @
|
|
443
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
444
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
445
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
411
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
412
|
+
* @param {string} lhs
|
|
413
|
+
* @param {string} rhs
|
|
414
|
+
* @returns {string}
|
|
446
415
|
*/
|
|
447
|
-
module.exports.
|
|
448
|
-
const
|
|
449
|
-
const len0 = WASM_VECTOR_LEN;
|
|
450
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
416
|
+
module.exports.xor = function(lhs, rhs) {
|
|
417
|
+
const ret = wasm.xor(lhs, rhs);
|
|
451
418
|
return ret;
|
|
452
419
|
};
|
|
453
420
|
|
|
421
|
+
let cachedUint32ArrayMemory0 = null;
|
|
422
|
+
|
|
423
|
+
function getUint32ArrayMemory0() {
|
|
424
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
425
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
426
|
+
}
|
|
427
|
+
return cachedUint32ArrayMemory0;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
431
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
432
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
433
|
+
WASM_VECTOR_LEN = arg.length;
|
|
434
|
+
return ptr;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
438
|
+
ptr = ptr >>> 0;
|
|
439
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
440
|
+
}
|
|
454
441
|
/**
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
* @param {
|
|
458
|
-
* @
|
|
459
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
460
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
442
|
+
* Sha256 compression function
|
|
443
|
+
* @param {Uint32Array} inputs
|
|
444
|
+
* @param {Uint32Array} state
|
|
445
|
+
* @returns {Uint32Array}
|
|
461
446
|
*/
|
|
462
|
-
module.exports.
|
|
463
|
-
const ptr0 =
|
|
447
|
+
module.exports.sha256_compression = function(inputs, state) {
|
|
448
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
464
449
|
const len0 = WASM_VECTOR_LEN;
|
|
465
|
-
const
|
|
466
|
-
|
|
450
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
451
|
+
const len1 = WASM_VECTOR_LEN;
|
|
452
|
+
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
453
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
454
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
455
|
+
return v3;
|
|
467
456
|
};
|
|
468
457
|
|
|
469
458
|
/**
|
|
470
|
-
*
|
|
471
|
-
*
|
|
472
|
-
* @
|
|
473
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
474
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
475
|
-
* @param {Uint8Array} program
|
|
476
|
-
* @param {WitnessMap} witness_map
|
|
477
|
-
* @returns {WitnessMap}
|
|
459
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
460
|
+
* @param {Uint8Array} inputs
|
|
461
|
+
* @returns {Uint8Array}
|
|
478
462
|
*/
|
|
479
|
-
module.exports.
|
|
480
|
-
const ptr0 = passArray8ToWasm0(
|
|
463
|
+
module.exports.blake2s256 = function(inputs) {
|
|
464
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
481
465
|
const len0 = WASM_VECTOR_LEN;
|
|
482
|
-
const ret = wasm.
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
return takeFromExternrefTable0(ret[0]);
|
|
466
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
467
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
468
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
469
|
+
return v2;
|
|
487
470
|
};
|
|
488
471
|
|
|
489
472
|
/**
|
|
490
|
-
*
|
|
491
|
-
*
|
|
492
|
-
* @param {Uint8Array}
|
|
493
|
-
* @param {
|
|
494
|
-
* @
|
|
495
|
-
* @
|
|
496
|
-
* @param {WitnessMap} solved_witness
|
|
497
|
-
* @returns {WitnessMap}
|
|
473
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
474
|
+
* @param {Uint8Array} hashed_msg
|
|
475
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
476
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
477
|
+
* @param {Uint8Array} signature
|
|
478
|
+
* @returns {boolean}
|
|
498
479
|
*/
|
|
499
|
-
module.exports.
|
|
500
|
-
const ptr0 = passArray8ToWasm0(
|
|
480
|
+
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
481
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
501
482
|
const len0 = WASM_VECTOR_LEN;
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
483
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
484
|
+
const len1 = WASM_VECTOR_LEN;
|
|
485
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
486
|
+
const len2 = WASM_VECTOR_LEN;
|
|
487
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
488
|
+
const len3 = WASM_VECTOR_LEN;
|
|
489
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
490
|
+
return ret !== 0;
|
|
507
491
|
};
|
|
508
492
|
|
|
509
493
|
/**
|
|
510
|
-
*
|
|
494
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
495
|
+
* @param {Uint8Array} hashed_msg
|
|
496
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
497
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
498
|
+
* @param {Uint8Array} signature
|
|
499
|
+
* @returns {boolean}
|
|
500
|
+
*/
|
|
501
|
+
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
502
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
503
|
+
const len0 = WASM_VECTOR_LEN;
|
|
504
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
505
|
+
const len1 = WASM_VECTOR_LEN;
|
|
506
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
507
|
+
const len2 = WASM_VECTOR_LEN;
|
|
508
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
509
|
+
const len3 = WASM_VECTOR_LEN;
|
|
510
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
511
|
+
return ret !== 0;
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Sets the package's logging level.
|
|
511
516
|
*
|
|
512
|
-
* @param {
|
|
513
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
514
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
515
|
-
* @param {Uint8Array} program
|
|
516
|
-
* @param {WitnessMap} solved_witness
|
|
517
|
-
* @returns {WitnessMap}
|
|
517
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
518
518
|
*/
|
|
519
|
-
module.exports.
|
|
520
|
-
const ptr0 =
|
|
519
|
+
module.exports.initLogLevel = function(filter) {
|
|
520
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
521
521
|
const len0 = WASM_VECTOR_LEN;
|
|
522
|
-
const ret = wasm.
|
|
523
|
-
if (ret[
|
|
524
|
-
throw takeFromExternrefTable0(ret[
|
|
522
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
523
|
+
if (ret[1]) {
|
|
524
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
525
525
|
}
|
|
526
|
-
return takeFromExternrefTable0(ret[0]);
|
|
527
526
|
};
|
|
528
527
|
|
|
529
528
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
530
|
-
wasm.
|
|
529
|
+
wasm.closure483_externref_shim(arg0, arg1, arg2);
|
|
531
530
|
}
|
|
532
531
|
|
|
533
532
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
534
|
-
wasm.
|
|
533
|
+
wasm.closure989_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
535
534
|
}
|
|
536
535
|
|
|
537
536
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
538
|
-
wasm.
|
|
537
|
+
wasm.closure993_externref_shim(arg0, arg1, arg2, arg3);
|
|
539
538
|
}
|
|
540
539
|
|
|
541
540
|
module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
@@ -553,12 +552,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
|
|
|
553
552
|
return ret;
|
|
554
553
|
}, arguments) };
|
|
555
554
|
|
|
556
|
-
module.exports.
|
|
555
|
+
module.exports.__wbg_constructor_536364f6bcd4616b = function(arg0) {
|
|
557
556
|
const ret = new Error(arg0);
|
|
558
557
|
return ret;
|
|
559
558
|
};
|
|
560
559
|
|
|
561
|
-
module.exports.
|
|
560
|
+
module.exports.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
|
|
562
561
|
const ret = new Error(arg0);
|
|
563
562
|
return ret;
|
|
564
563
|
};
|
|
@@ -655,11 +654,6 @@ module.exports.__wbg_length_e2d2a49132c1b256 = function(arg0) {
|
|
|
655
654
|
return ret;
|
|
656
655
|
};
|
|
657
656
|
|
|
658
|
-
module.exports.__wbg_new_15469fe041a20dc6 = function() {
|
|
659
|
-
const ret = new Array();
|
|
660
|
-
return ret;
|
|
661
|
-
};
|
|
662
|
-
|
|
663
657
|
module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
664
658
|
try {
|
|
665
659
|
var state0 = {a: arg0, b: arg1};
|
|
@@ -679,11 +673,6 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
|
679
673
|
}
|
|
680
674
|
};
|
|
681
675
|
|
|
682
|
-
module.exports.__wbg_new_494426b3386f8e2c = function() {
|
|
683
|
-
const ret = new Map();
|
|
684
|
-
return ret;
|
|
685
|
-
};
|
|
686
|
-
|
|
687
676
|
module.exports.__wbg_new_5e0be73521bc8c17 = function() {
|
|
688
677
|
const ret = new Map();
|
|
689
678
|
return ret;
|
|
@@ -699,11 +688,21 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
|
|
|
699
688
|
return ret;
|
|
700
689
|
};
|
|
701
690
|
|
|
691
|
+
module.exports.__wbg_new_9f501325818b4158 = function() {
|
|
692
|
+
const ret = new Array();
|
|
693
|
+
return ret;
|
|
694
|
+
};
|
|
695
|
+
|
|
702
696
|
module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
|
|
703
697
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
704
698
|
return ret;
|
|
705
699
|
};
|
|
706
700
|
|
|
701
|
+
module.exports.__wbg_new_ec40611a7805f1f0 = function() {
|
|
702
|
+
const ret = new Map();
|
|
703
|
+
return ret;
|
|
704
|
+
};
|
|
705
|
+
|
|
707
706
|
module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
708
707
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
709
708
|
return ret;
|
|
@@ -813,8 +812,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
813
812
|
return ret;
|
|
814
813
|
};
|
|
815
814
|
|
|
816
|
-
module.exports.
|
|
817
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
815
|
+
module.exports.__wbindgen_closure_wrapper1586 = function(arg0, arg1, arg2) {
|
|
816
|
+
const ret = makeMutClosure(arg0, arg1, 484, __wbg_adapter_30);
|
|
818
817
|
return ret;
|
|
819
818
|
};
|
|
820
819
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const buildInfo: () => any;
|
|
5
|
+
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
6
|
+
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
7
|
+
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
8
|
+
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
9
|
+
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
10
|
+
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
11
|
+
export const compressWitness: (a: any) => [number, number, number, number];
|
|
12
|
+
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
13
|
+
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
14
|
+
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
5
15
|
export const and: (a: any, b: any) => any;
|
|
6
16
|
export const xor: (a: any, b: any) => any;
|
|
7
17
|
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
@@ -9,16 +19,6 @@ export const blake2s256: (a: number, b: number) => [number, number];
|
|
|
9
19
|
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
10
20
|
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
11
21
|
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
12
|
-
export const compressWitness: (a: any) => [number, number, number, number];
|
|
13
|
-
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
14
|
-
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
15
|
-
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
16
|
-
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
17
|
-
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
18
|
-
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
19
|
-
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
20
|
-
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
21
|
-
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -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
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure483_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure989_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure993_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|