@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/web/acvm_js.js
CHANGED
|
@@ -206,130 +206,56 @@ export function buildInfo() {
|
|
|
206
206
|
return ret;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
/**
|
|
210
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
211
|
-
* @param {string} lhs
|
|
212
|
-
* @param {string} rhs
|
|
213
|
-
* @returns {string}
|
|
214
|
-
*/
|
|
215
|
-
export function and(lhs, rhs) {
|
|
216
|
-
const ret = wasm.and(lhs, rhs);
|
|
217
|
-
return ret;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**
|
|
221
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
222
|
-
* @param {string} lhs
|
|
223
|
-
* @param {string} rhs
|
|
224
|
-
* @returns {string}
|
|
225
|
-
*/
|
|
226
|
-
export function xor(lhs, rhs) {
|
|
227
|
-
const ret = wasm.xor(lhs, rhs);
|
|
228
|
-
return ret;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
let cachedUint32ArrayMemory0 = null;
|
|
232
|
-
|
|
233
|
-
function getUint32ArrayMemory0() {
|
|
234
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
235
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
236
|
-
}
|
|
237
|
-
return cachedUint32ArrayMemory0;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
function passArray32ToWasm0(arg, malloc) {
|
|
241
|
-
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
242
|
-
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
243
|
-
WASM_VECTOR_LEN = arg.length;
|
|
244
|
-
return ptr;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
248
|
-
ptr = ptr >>> 0;
|
|
249
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Sha256 compression function
|
|
253
|
-
* @param {Uint32Array} inputs
|
|
254
|
-
* @param {Uint32Array} state
|
|
255
|
-
* @returns {Uint32Array}
|
|
256
|
-
*/
|
|
257
|
-
export function sha256_compression(inputs, state) {
|
|
258
|
-
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
259
|
-
const len0 = WASM_VECTOR_LEN;
|
|
260
|
-
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
261
|
-
const len1 = WASM_VECTOR_LEN;
|
|
262
|
-
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
263
|
-
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
264
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
265
|
-
return v3;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
209
|
function passArray8ToWasm0(arg, malloc) {
|
|
269
210
|
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
270
211
|
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
271
212
|
WASM_VECTOR_LEN = arg.length;
|
|
272
213
|
return ptr;
|
|
273
214
|
}
|
|
274
|
-
|
|
275
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
276
|
-
ptr = ptr >>> 0;
|
|
277
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
278
|
-
}
|
|
279
215
|
/**
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
* @
|
|
216
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
217
|
+
*
|
|
218
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
219
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
220
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
221
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
283
222
|
*/
|
|
284
|
-
export function
|
|
285
|
-
const ptr0 = passArray8ToWasm0(
|
|
223
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
224
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
286
225
|
const len0 = WASM_VECTOR_LEN;
|
|
287
|
-
const ret = wasm.
|
|
288
|
-
|
|
289
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
290
|
-
return v2;
|
|
226
|
+
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
227
|
+
return ret;
|
|
291
228
|
}
|
|
292
229
|
|
|
293
230
|
/**
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
* @param {Uint8Array}
|
|
298
|
-
* @param {
|
|
299
|
-
* @
|
|
231
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
232
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
233
|
+
*
|
|
234
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
235
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
236
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
237
|
+
* @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.
|
|
300
238
|
*/
|
|
301
|
-
export function
|
|
302
|
-
const ptr0 = passArray8ToWasm0(
|
|
239
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
240
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
303
241
|
const len0 = WASM_VECTOR_LEN;
|
|
304
|
-
const
|
|
305
|
-
|
|
306
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
307
|
-
const len2 = WASM_VECTOR_LEN;
|
|
308
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
309
|
-
const len3 = WASM_VECTOR_LEN;
|
|
310
|
-
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
311
|
-
return ret !== 0;
|
|
242
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
243
|
+
return ret;
|
|
312
244
|
}
|
|
313
245
|
|
|
314
246
|
/**
|
|
315
|
-
*
|
|
316
|
-
*
|
|
317
|
-
* @param {Uint8Array}
|
|
318
|
-
* @param {
|
|
319
|
-
* @param {
|
|
320
|
-
* @returns {
|
|
247
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
248
|
+
*
|
|
249
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
250
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
251
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
252
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
321
253
|
*/
|
|
322
|
-
export function
|
|
323
|
-
const ptr0 = passArray8ToWasm0(
|
|
254
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
255
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
324
256
|
const len0 = WASM_VECTOR_LEN;
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
328
|
-
const len2 = WASM_VECTOR_LEN;
|
|
329
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
330
|
-
const len3 = WASM_VECTOR_LEN;
|
|
331
|
-
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
332
|
-
return ret !== 0;
|
|
257
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
258
|
+
return ret;
|
|
333
259
|
}
|
|
334
260
|
|
|
335
261
|
function takeFromExternrefTable0(idx) {
|
|
@@ -338,19 +264,69 @@ function takeFromExternrefTable0(idx) {
|
|
|
338
264
|
return value;
|
|
339
265
|
}
|
|
340
266
|
/**
|
|
341
|
-
*
|
|
267
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
342
268
|
*
|
|
343
|
-
* @param {
|
|
269
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
270
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
271
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
272
|
+
* @param {Uint8Array} program
|
|
273
|
+
* @param {WitnessMap} witness_map
|
|
274
|
+
* @returns {WitnessMap}
|
|
344
275
|
*/
|
|
345
|
-
export function
|
|
346
|
-
const ptr0 =
|
|
276
|
+
export function getReturnWitness(program, witness_map) {
|
|
277
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
347
278
|
const len0 = WASM_VECTOR_LEN;
|
|
348
|
-
const ret = wasm.
|
|
349
|
-
if (ret[
|
|
350
|
-
throw takeFromExternrefTable0(ret[
|
|
279
|
+
const ret = wasm.getReturnWitness(ptr0, len0, witness_map);
|
|
280
|
+
if (ret[2]) {
|
|
281
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
282
|
+
}
|
|
283
|
+
return takeFromExternrefTable0(ret[0]);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
288
|
+
*
|
|
289
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
290
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
291
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
292
|
+
* @param {Uint8Array} program
|
|
293
|
+
* @param {WitnessMap} solved_witness
|
|
294
|
+
* @returns {WitnessMap}
|
|
295
|
+
*/
|
|
296
|
+
export function getPublicParametersWitness(program, solved_witness) {
|
|
297
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
298
|
+
const len0 = WASM_VECTOR_LEN;
|
|
299
|
+
const ret = wasm.getPublicParametersWitness(ptr0, len0, solved_witness);
|
|
300
|
+
if (ret[2]) {
|
|
301
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
351
302
|
}
|
|
303
|
+
return takeFromExternrefTable0(ret[0]);
|
|
352
304
|
}
|
|
353
305
|
|
|
306
|
+
/**
|
|
307
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
308
|
+
*
|
|
309
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
310
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
311
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
312
|
+
* @param {Uint8Array} program
|
|
313
|
+
* @param {WitnessMap} solved_witness
|
|
314
|
+
* @returns {WitnessMap}
|
|
315
|
+
*/
|
|
316
|
+
export function getPublicWitness(program, solved_witness) {
|
|
317
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
318
|
+
const len0 = WASM_VECTOR_LEN;
|
|
319
|
+
const ret = wasm.getPublicWitness(ptr0, len0, solved_witness);
|
|
320
|
+
if (ret[2]) {
|
|
321
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
322
|
+
}
|
|
323
|
+
return takeFromExternrefTable0(ret[0]);
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
327
|
+
ptr = ptr >>> 0;
|
|
328
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
329
|
+
}
|
|
354
330
|
/**
|
|
355
331
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
356
332
|
*
|
|
@@ -417,121 +393,144 @@ export function decompressWitnessStack(compressed_witness) {
|
|
|
417
393
|
}
|
|
418
394
|
|
|
419
395
|
/**
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
* @param {
|
|
423
|
-
* @
|
|
424
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
425
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
396
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
397
|
+
* @param {string} lhs
|
|
398
|
+
* @param {string} rhs
|
|
399
|
+
* @returns {string}
|
|
426
400
|
*/
|
|
427
|
-
export function
|
|
428
|
-
const
|
|
429
|
-
const len0 = WASM_VECTOR_LEN;
|
|
430
|
-
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
401
|
+
export function and(lhs, rhs) {
|
|
402
|
+
const ret = wasm.and(lhs, rhs);
|
|
431
403
|
return ret;
|
|
432
404
|
}
|
|
433
405
|
|
|
434
406
|
/**
|
|
435
|
-
*
|
|
436
|
-
*
|
|
437
|
-
*
|
|
438
|
-
* @
|
|
439
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
440
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
441
|
-
* @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.
|
|
407
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
408
|
+
* @param {string} lhs
|
|
409
|
+
* @param {string} rhs
|
|
410
|
+
* @returns {string}
|
|
442
411
|
*/
|
|
443
|
-
export function
|
|
444
|
-
const
|
|
445
|
-
const len0 = WASM_VECTOR_LEN;
|
|
446
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
412
|
+
export function xor(lhs, rhs) {
|
|
413
|
+
const ret = wasm.xor(lhs, rhs);
|
|
447
414
|
return ret;
|
|
448
415
|
}
|
|
449
416
|
|
|
417
|
+
let cachedUint32ArrayMemory0 = null;
|
|
418
|
+
|
|
419
|
+
function getUint32ArrayMemory0() {
|
|
420
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
421
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
422
|
+
}
|
|
423
|
+
return cachedUint32ArrayMemory0;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
427
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
428
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
429
|
+
WASM_VECTOR_LEN = arg.length;
|
|
430
|
+
return ptr;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
434
|
+
ptr = ptr >>> 0;
|
|
435
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
436
|
+
}
|
|
450
437
|
/**
|
|
451
|
-
*
|
|
452
|
-
*
|
|
453
|
-
* @param {
|
|
454
|
-
* @
|
|
455
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
456
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
438
|
+
* Sha256 compression function
|
|
439
|
+
* @param {Uint32Array} inputs
|
|
440
|
+
* @param {Uint32Array} state
|
|
441
|
+
* @returns {Uint32Array}
|
|
457
442
|
*/
|
|
458
|
-
export function
|
|
459
|
-
const ptr0 =
|
|
443
|
+
export function sha256_compression(inputs, state) {
|
|
444
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
460
445
|
const len0 = WASM_VECTOR_LEN;
|
|
461
|
-
const
|
|
462
|
-
|
|
446
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
447
|
+
const len1 = WASM_VECTOR_LEN;
|
|
448
|
+
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
449
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
450
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
451
|
+
return v3;
|
|
463
452
|
}
|
|
464
453
|
|
|
465
454
|
/**
|
|
466
|
-
*
|
|
467
|
-
*
|
|
468
|
-
* @
|
|
469
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
470
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
471
|
-
* @param {Uint8Array} program
|
|
472
|
-
* @param {WitnessMap} witness_map
|
|
473
|
-
* @returns {WitnessMap}
|
|
455
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
456
|
+
* @param {Uint8Array} inputs
|
|
457
|
+
* @returns {Uint8Array}
|
|
474
458
|
*/
|
|
475
|
-
export function
|
|
476
|
-
const ptr0 = passArray8ToWasm0(
|
|
459
|
+
export function blake2s256(inputs) {
|
|
460
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
477
461
|
const len0 = WASM_VECTOR_LEN;
|
|
478
|
-
const ret = wasm.
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
return takeFromExternrefTable0(ret[0]);
|
|
462
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
463
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
464
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
465
|
+
return v2;
|
|
483
466
|
}
|
|
484
467
|
|
|
485
468
|
/**
|
|
486
|
-
*
|
|
487
|
-
*
|
|
488
|
-
* @param {Uint8Array}
|
|
489
|
-
* @param {
|
|
490
|
-
* @
|
|
491
|
-
* @
|
|
492
|
-
* @param {WitnessMap} solved_witness
|
|
493
|
-
* @returns {WitnessMap}
|
|
469
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
470
|
+
* @param {Uint8Array} hashed_msg
|
|
471
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
472
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
473
|
+
* @param {Uint8Array} signature
|
|
474
|
+
* @returns {boolean}
|
|
494
475
|
*/
|
|
495
|
-
export function
|
|
496
|
-
const ptr0 = passArray8ToWasm0(
|
|
476
|
+
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
477
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
497
478
|
const len0 = WASM_VECTOR_LEN;
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
479
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
480
|
+
const len1 = WASM_VECTOR_LEN;
|
|
481
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
482
|
+
const len2 = WASM_VECTOR_LEN;
|
|
483
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
484
|
+
const len3 = WASM_VECTOR_LEN;
|
|
485
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
486
|
+
return ret !== 0;
|
|
503
487
|
}
|
|
504
488
|
|
|
505
489
|
/**
|
|
506
|
-
*
|
|
490
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
491
|
+
* @param {Uint8Array} hashed_msg
|
|
492
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
493
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
494
|
+
* @param {Uint8Array} signature
|
|
495
|
+
* @returns {boolean}
|
|
496
|
+
*/
|
|
497
|
+
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
498
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
499
|
+
const len0 = WASM_VECTOR_LEN;
|
|
500
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
501
|
+
const len1 = WASM_VECTOR_LEN;
|
|
502
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
503
|
+
const len2 = WASM_VECTOR_LEN;
|
|
504
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
505
|
+
const len3 = WASM_VECTOR_LEN;
|
|
506
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
507
|
+
return ret !== 0;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Sets the package's logging level.
|
|
507
512
|
*
|
|
508
|
-
* @param {
|
|
509
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
510
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
511
|
-
* @param {Uint8Array} program
|
|
512
|
-
* @param {WitnessMap} solved_witness
|
|
513
|
-
* @returns {WitnessMap}
|
|
513
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
514
514
|
*/
|
|
515
|
-
export function
|
|
516
|
-
const ptr0 =
|
|
515
|
+
export function initLogLevel(filter) {
|
|
516
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
517
517
|
const len0 = WASM_VECTOR_LEN;
|
|
518
|
-
const ret = wasm.
|
|
519
|
-
if (ret[
|
|
520
|
-
throw takeFromExternrefTable0(ret[
|
|
518
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
519
|
+
if (ret[1]) {
|
|
520
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
521
521
|
}
|
|
522
|
-
return takeFromExternrefTable0(ret[0]);
|
|
523
522
|
}
|
|
524
523
|
|
|
525
524
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
526
|
-
wasm.
|
|
525
|
+
wasm.closure483_externref_shim(arg0, arg1, arg2);
|
|
527
526
|
}
|
|
528
527
|
|
|
529
528
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
530
|
-
wasm.
|
|
529
|
+
wasm.closure989_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
531
530
|
}
|
|
532
531
|
|
|
533
532
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
534
|
-
wasm.
|
|
533
|
+
wasm.closure993_externref_shim(arg0, arg1, arg2, arg3);
|
|
535
534
|
}
|
|
536
535
|
|
|
537
536
|
async function __wbg_load(module, imports) {
|
|
@@ -580,11 +579,11 @@ function __wbg_get_imports() {
|
|
|
580
579
|
const ret = arg0.call(arg1, arg2, arg3);
|
|
581
580
|
return ret;
|
|
582
581
|
}, arguments) };
|
|
583
|
-
imports.wbg.
|
|
582
|
+
imports.wbg.__wbg_constructor_536364f6bcd4616b = function(arg0) {
|
|
584
583
|
const ret = new Error(arg0);
|
|
585
584
|
return ret;
|
|
586
585
|
};
|
|
587
|
-
imports.wbg.
|
|
586
|
+
imports.wbg.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
|
|
588
587
|
const ret = new Error(arg0);
|
|
589
588
|
return ret;
|
|
590
589
|
};
|
|
@@ -667,10 +666,6 @@ function __wbg_get_imports() {
|
|
|
667
666
|
const ret = arg0.length;
|
|
668
667
|
return ret;
|
|
669
668
|
};
|
|
670
|
-
imports.wbg.__wbg_new_15469fe041a20dc6 = function() {
|
|
671
|
-
const ret = new Array();
|
|
672
|
-
return ret;
|
|
673
|
-
};
|
|
674
669
|
imports.wbg.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
675
670
|
try {
|
|
676
671
|
var state0 = {a: arg0, b: arg1};
|
|
@@ -689,10 +684,6 @@ function __wbg_get_imports() {
|
|
|
689
684
|
state0.a = state0.b = 0;
|
|
690
685
|
}
|
|
691
686
|
};
|
|
692
|
-
imports.wbg.__wbg_new_494426b3386f8e2c = function() {
|
|
693
|
-
const ret = new Map();
|
|
694
|
-
return ret;
|
|
695
|
-
};
|
|
696
687
|
imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
|
|
697
688
|
const ret = new Map();
|
|
698
689
|
return ret;
|
|
@@ -705,10 +696,18 @@ function __wbg_get_imports() {
|
|
|
705
696
|
const ret = new Error();
|
|
706
697
|
return ret;
|
|
707
698
|
};
|
|
699
|
+
imports.wbg.__wbg_new_9f501325818b4158 = function() {
|
|
700
|
+
const ret = new Array();
|
|
701
|
+
return ret;
|
|
702
|
+
};
|
|
708
703
|
imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
|
|
709
704
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
710
705
|
return ret;
|
|
711
706
|
};
|
|
707
|
+
imports.wbg.__wbg_new_ec40611a7805f1f0 = function() {
|
|
708
|
+
const ret = new Map();
|
|
709
|
+
return ret;
|
|
710
|
+
};
|
|
712
711
|
imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
713
712
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
714
713
|
return ret;
|
|
@@ -797,8 +796,8 @@ function __wbg_get_imports() {
|
|
|
797
796
|
const ret = false;
|
|
798
797
|
return ret;
|
|
799
798
|
};
|
|
800
|
-
imports.wbg.
|
|
801
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
799
|
+
imports.wbg.__wbindgen_closure_wrapper1586 = function(arg0, arg1, arg2) {
|
|
800
|
+
const ret = makeMutClosure(arg0, arg1, 484, __wbg_adapter_30);
|
|
802
801
|
return ret;
|
|
803
802
|
};
|
|
804
803
|
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -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;
|