@aztec/noir-acvm_js 0.0.1-commit.c7c42ec → 0.0.1-commit.c80b6263
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 +47 -47
- package/nodejs/acvm_js.js +124 -124
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +9 -9
- package/package.json +6 -6
- package/web/acvm_js.d.ts +56 -56
- package/web/acvm_js.js +124 -124
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +9 -9
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -34,6 +34,30 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
34
34
|
* @returns {WitnessStack} The decompressed witness stack.
|
|
35
35
|
*/
|
|
36
36
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
37
|
+
/**
|
|
38
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
39
|
+
*/
|
|
40
|
+
export function and(lhs: string, rhs: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
43
|
+
*/
|
|
44
|
+
export function xor(lhs: string, rhs: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Sha256 compression function
|
|
47
|
+
*/
|
|
48
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
49
|
+
/**
|
|
50
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
51
|
+
*/
|
|
52
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
53
|
+
/**
|
|
54
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
55
|
+
*/
|
|
56
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
59
|
+
*/
|
|
60
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
37
61
|
/**
|
|
38
62
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
39
63
|
*
|
|
@@ -92,30 +116,15 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
92
116
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
93
117
|
*/
|
|
94
118
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
* Sha256 compression function
|
|
105
|
-
*/
|
|
106
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
107
|
-
/**
|
|
108
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
109
|
-
*/
|
|
110
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
111
|
-
/**
|
|
112
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
113
|
-
*/
|
|
114
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
117
|
-
*/
|
|
118
|
-
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
119
|
+
|
|
120
|
+
export type StackItem = {
|
|
121
|
+
index: number;
|
|
122
|
+
witness: WitnessMap;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type WitnessStack = Array<StackItem>;
|
|
126
|
+
|
|
127
|
+
|
|
119
128
|
|
|
120
129
|
/**
|
|
121
130
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -131,6 +140,20 @@ export type BuildInfo = {
|
|
|
131
140
|
|
|
132
141
|
|
|
133
142
|
|
|
143
|
+
export type RawAssertionPayload = {
|
|
144
|
+
selector: string;
|
|
145
|
+
data: string[];
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export type ExecutionError = Error & {
|
|
149
|
+
callStack?: string[];
|
|
150
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
151
|
+
acirFunctionId?: number;
|
|
152
|
+
brilligFunctionId?: number;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
134
157
|
// Map from witness index to hex string value of witness.
|
|
135
158
|
export type WitnessMap = Map<number, string>;
|
|
136
159
|
|
|
@@ -146,15 +169,6 @@ export type SolvedAndReturnWitness = {
|
|
|
146
169
|
|
|
147
170
|
|
|
148
171
|
|
|
149
|
-
export type StackItem = {
|
|
150
|
-
index: number;
|
|
151
|
-
witness: WitnessMap;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export type WitnessStack = Array<StackItem>;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
172
|
export type ForeignCallInput = string[]
|
|
159
173
|
export type ForeignCallOutput = string | string[]
|
|
160
174
|
|
|
@@ -168,17 +182,3 @@ export type ForeignCallOutput = string | string[]
|
|
|
168
182
|
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
169
183
|
|
|
170
184
|
|
|
171
|
-
|
|
172
|
-
export type RawAssertionPayload = {
|
|
173
|
-
selector: string;
|
|
174
|
-
data: string[];
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
export type ExecutionError = Error & {
|
|
178
|
-
callStack?: string[];
|
|
179
|
-
rawAssertionPayload?: RawAssertionPayload;
|
|
180
|
-
acirFunctionId?: number;
|
|
181
|
-
brilligFunctionId?: number;
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -291,6 +291,121 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
291
291
|
return takeFromExternrefTable0(ret[0]);
|
|
292
292
|
};
|
|
293
293
|
|
|
294
|
+
/**
|
|
295
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
296
|
+
* @param {string} lhs
|
|
297
|
+
* @param {string} rhs
|
|
298
|
+
* @returns {string}
|
|
299
|
+
*/
|
|
300
|
+
module.exports.and = function(lhs, rhs) {
|
|
301
|
+
const ret = wasm.and(lhs, rhs);
|
|
302
|
+
return ret;
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
307
|
+
* @param {string} lhs
|
|
308
|
+
* @param {string} rhs
|
|
309
|
+
* @returns {string}
|
|
310
|
+
*/
|
|
311
|
+
module.exports.xor = function(lhs, rhs) {
|
|
312
|
+
const ret = wasm.xor(lhs, rhs);
|
|
313
|
+
return ret;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
let cachedUint32ArrayMemory0 = null;
|
|
317
|
+
|
|
318
|
+
function getUint32ArrayMemory0() {
|
|
319
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
320
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
321
|
+
}
|
|
322
|
+
return cachedUint32ArrayMemory0;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
326
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
327
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
328
|
+
WASM_VECTOR_LEN = arg.length;
|
|
329
|
+
return ptr;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
333
|
+
ptr = ptr >>> 0;
|
|
334
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Sha256 compression function
|
|
338
|
+
* @param {Uint32Array} inputs
|
|
339
|
+
* @param {Uint32Array} state
|
|
340
|
+
* @returns {Uint32Array}
|
|
341
|
+
*/
|
|
342
|
+
module.exports.sha256_compression = function(inputs, state) {
|
|
343
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
344
|
+
const len0 = WASM_VECTOR_LEN;
|
|
345
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
346
|
+
const len1 = WASM_VECTOR_LEN;
|
|
347
|
+
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
348
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
349
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
350
|
+
return v3;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
355
|
+
* @param {Uint8Array} inputs
|
|
356
|
+
* @returns {Uint8Array}
|
|
357
|
+
*/
|
|
358
|
+
module.exports.blake2s256 = function(inputs) {
|
|
359
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
360
|
+
const len0 = WASM_VECTOR_LEN;
|
|
361
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
362
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
363
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
364
|
+
return v2;
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
369
|
+
* @param {Uint8Array} hashed_msg
|
|
370
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
371
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
372
|
+
* @param {Uint8Array} signature
|
|
373
|
+
* @returns {boolean}
|
|
374
|
+
*/
|
|
375
|
+
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
376
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
377
|
+
const len0 = WASM_VECTOR_LEN;
|
|
378
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
379
|
+
const len1 = WASM_VECTOR_LEN;
|
|
380
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
381
|
+
const len2 = WASM_VECTOR_LEN;
|
|
382
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
383
|
+
const len3 = WASM_VECTOR_LEN;
|
|
384
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
385
|
+
return ret !== 0;
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
390
|
+
* @param {Uint8Array} hashed_msg
|
|
391
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
392
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
393
|
+
* @param {Uint8Array} signature
|
|
394
|
+
* @returns {boolean}
|
|
395
|
+
*/
|
|
396
|
+
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
397
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
398
|
+
const len0 = WASM_VECTOR_LEN;
|
|
399
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
400
|
+
const len1 = WASM_VECTOR_LEN;
|
|
401
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
402
|
+
const len2 = WASM_VECTOR_LEN;
|
|
403
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
404
|
+
const len3 = WASM_VECTOR_LEN;
|
|
405
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
406
|
+
return ret !== 0;
|
|
407
|
+
};
|
|
408
|
+
|
|
294
409
|
/**
|
|
295
410
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
296
411
|
*
|
|
@@ -411,131 +526,16 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
411
526
|
return takeFromExternrefTable0(ret[0]);
|
|
412
527
|
};
|
|
413
528
|
|
|
414
|
-
/**
|
|
415
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
416
|
-
* @param {string} lhs
|
|
417
|
-
* @param {string} rhs
|
|
418
|
-
* @returns {string}
|
|
419
|
-
*/
|
|
420
|
-
module.exports.and = function(lhs, rhs) {
|
|
421
|
-
const ret = wasm.and(lhs, rhs);
|
|
422
|
-
return ret;
|
|
423
|
-
};
|
|
424
|
-
|
|
425
|
-
/**
|
|
426
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
427
|
-
* @param {string} lhs
|
|
428
|
-
* @param {string} rhs
|
|
429
|
-
* @returns {string}
|
|
430
|
-
*/
|
|
431
|
-
module.exports.xor = function(lhs, rhs) {
|
|
432
|
-
const ret = wasm.xor(lhs, rhs);
|
|
433
|
-
return ret;
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
let cachedUint32ArrayMemory0 = null;
|
|
437
|
-
|
|
438
|
-
function getUint32ArrayMemory0() {
|
|
439
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
440
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
441
|
-
}
|
|
442
|
-
return cachedUint32ArrayMemory0;
|
|
443
|
-
}
|
|
444
|
-
|
|
445
|
-
function passArray32ToWasm0(arg, malloc) {
|
|
446
|
-
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
447
|
-
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
448
|
-
WASM_VECTOR_LEN = arg.length;
|
|
449
|
-
return ptr;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
453
|
-
ptr = ptr >>> 0;
|
|
454
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Sha256 compression function
|
|
458
|
-
* @param {Uint32Array} inputs
|
|
459
|
-
* @param {Uint32Array} state
|
|
460
|
-
* @returns {Uint32Array}
|
|
461
|
-
*/
|
|
462
|
-
module.exports.sha256_compression = function(inputs, state) {
|
|
463
|
-
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
464
|
-
const len0 = WASM_VECTOR_LEN;
|
|
465
|
-
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
466
|
-
const len1 = WASM_VECTOR_LEN;
|
|
467
|
-
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
468
|
-
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
469
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
470
|
-
return v3;
|
|
471
|
-
};
|
|
472
|
-
|
|
473
|
-
/**
|
|
474
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
475
|
-
* @param {Uint8Array} inputs
|
|
476
|
-
* @returns {Uint8Array}
|
|
477
|
-
*/
|
|
478
|
-
module.exports.blake2s256 = function(inputs) {
|
|
479
|
-
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
480
|
-
const len0 = WASM_VECTOR_LEN;
|
|
481
|
-
const ret = wasm.blake2s256(ptr0, len0);
|
|
482
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
483
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
484
|
-
return v2;
|
|
485
|
-
};
|
|
486
|
-
|
|
487
|
-
/**
|
|
488
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
489
|
-
* @param {Uint8Array} hashed_msg
|
|
490
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
491
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
492
|
-
* @param {Uint8Array} signature
|
|
493
|
-
* @returns {boolean}
|
|
494
|
-
*/
|
|
495
|
-
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
496
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
497
|
-
const len0 = WASM_VECTOR_LEN;
|
|
498
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
499
|
-
const len1 = WASM_VECTOR_LEN;
|
|
500
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
501
|
-
const len2 = WASM_VECTOR_LEN;
|
|
502
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
503
|
-
const len3 = WASM_VECTOR_LEN;
|
|
504
|
-
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
505
|
-
return ret !== 0;
|
|
506
|
-
};
|
|
507
|
-
|
|
508
|
-
/**
|
|
509
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
510
|
-
* @param {Uint8Array} hashed_msg
|
|
511
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
512
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
513
|
-
* @param {Uint8Array} signature
|
|
514
|
-
* @returns {boolean}
|
|
515
|
-
*/
|
|
516
|
-
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
517
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
518
|
-
const len0 = WASM_VECTOR_LEN;
|
|
519
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
520
|
-
const len1 = WASM_VECTOR_LEN;
|
|
521
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
522
|
-
const len2 = WASM_VECTOR_LEN;
|
|
523
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
524
|
-
const len3 = WASM_VECTOR_LEN;
|
|
525
|
-
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
526
|
-
return ret !== 0;
|
|
527
|
-
};
|
|
528
|
-
|
|
529
529
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
530
|
-
wasm.
|
|
530
|
+
wasm.closure448_externref_shim(arg0, arg1, arg2);
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
534
|
-
wasm.
|
|
534
|
+
wasm.closure933_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
535
535
|
}
|
|
536
536
|
|
|
537
537
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
538
|
-
wasm.
|
|
538
|
+
wasm.closure937_externref_shim(arg0, arg1, arg2, arg3);
|
|
539
539
|
}
|
|
540
540
|
|
|
541
541
|
module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
@@ -553,12 +553,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
|
|
|
553
553
|
return ret;
|
|
554
554
|
}, arguments) };
|
|
555
555
|
|
|
556
|
-
module.exports.
|
|
556
|
+
module.exports.__wbg_constructor_536364f6bcd4616b = function(arg0) {
|
|
557
557
|
const ret = new Error(arg0);
|
|
558
558
|
return ret;
|
|
559
559
|
};
|
|
560
560
|
|
|
561
|
-
module.exports.
|
|
561
|
+
module.exports.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
|
|
562
562
|
const ret = new Error(arg0);
|
|
563
563
|
return ret;
|
|
564
564
|
};
|
|
@@ -689,7 +689,7 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
|
|
|
689
689
|
return ret;
|
|
690
690
|
};
|
|
691
691
|
|
|
692
|
-
module.exports.
|
|
692
|
+
module.exports.__wbg_new_9f501325818b4158 = function() {
|
|
693
693
|
const ret = new Array();
|
|
694
694
|
return ret;
|
|
695
695
|
};
|
|
@@ -699,7 +699,7 @@ module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
|
|
|
699
699
|
return ret;
|
|
700
700
|
};
|
|
701
701
|
|
|
702
|
-
module.exports.
|
|
702
|
+
module.exports.__wbg_new_ec40611a7805f1f0 = function() {
|
|
703
703
|
const ret = new Map();
|
|
704
704
|
return ret;
|
|
705
705
|
};
|
|
@@ -813,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
813
813
|
return ret;
|
|
814
814
|
};
|
|
815
815
|
|
|
816
|
-
module.exports.
|
|
817
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
816
|
+
module.exports.__wbindgen_closure_wrapper1445 = function(arg0, arg1, arg2) {
|
|
817
|
+
const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_30);
|
|
818
818
|
return ret;
|
|
819
819
|
};
|
|
820
820
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -6,6 +6,12 @@ export const compressWitness: (a: any) => [number, number, number, number];
|
|
|
6
6
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
7
7
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
8
8
|
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
9
|
+
export const and: (a: any, b: any) => any;
|
|
10
|
+
export const xor: (a: any, b: any) => any;
|
|
11
|
+
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
12
|
+
export const blake2s256: (a: number, b: number) => [number, number];
|
|
13
|
+
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
14
|
+
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
9
15
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
10
16
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
11
17
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
@@ -13,12 +19,6 @@ export const initLogLevel: (a: number, b: number) => [number, number];
|
|
|
13
19
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
14
20
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
15
21
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
16
|
-
export const and: (a: any, b: any) => any;
|
|
17
|
-
export const xor: (a: any, b: any) => any;
|
|
18
|
-
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
19
|
-
export const blake2s256: (a: number, b: number) => [number, number];
|
|
20
|
-
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
21
|
-
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
|
27
27
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
28
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
29
29
|
export const __externref_table_dealloc: (a: number) => void;
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure448_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure933_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure937_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/noir-acvm_js",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.c80b6263",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"@web/dev-server-esbuild": "^1.0.4",
|
|
42
42
|
"@web/test-runner": "^0.20.2",
|
|
43
43
|
"@web/test-runner-playwright": "^0.11.1",
|
|
44
|
-
"chai": "^
|
|
45
|
-
"eslint": "^9.39.
|
|
46
|
-
"eslint-plugin-prettier": "^5.5.
|
|
47
|
-
"mocha": "^11.5
|
|
48
|
-
"prettier": "3.
|
|
44
|
+
"chai": "^6.2.2",
|
|
45
|
+
"eslint": "^9.39.2",
|
|
46
|
+
"eslint-plugin-prettier": "^5.5.5",
|
|
47
|
+
"mocha": "^11.7.5",
|
|
48
|
+
"prettier": "3.8.0",
|
|
49
49
|
"ts-node": "^10.9.2",
|
|
50
50
|
"typescript": "^5.8.3"
|
|
51
51
|
}
|
package/web/acvm_js.d.ts
CHANGED
|
@@ -34,6 +34,30 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
34
34
|
* @returns {WitnessStack} The decompressed witness stack.
|
|
35
35
|
*/
|
|
36
36
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
37
|
+
/**
|
|
38
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
39
|
+
*/
|
|
40
|
+
export function and(lhs: string, rhs: string): string;
|
|
41
|
+
/**
|
|
42
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
43
|
+
*/
|
|
44
|
+
export function xor(lhs: string, rhs: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Sha256 compression function
|
|
47
|
+
*/
|
|
48
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
49
|
+
/**
|
|
50
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
51
|
+
*/
|
|
52
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
53
|
+
/**
|
|
54
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
55
|
+
*/
|
|
56
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
59
|
+
*/
|
|
60
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
37
61
|
/**
|
|
38
62
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
39
63
|
*
|
|
@@ -92,30 +116,15 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
92
116
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
93
117
|
*/
|
|
94
118
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
* Sha256 compression function
|
|
105
|
-
*/
|
|
106
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
107
|
-
/**
|
|
108
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
109
|
-
*/
|
|
110
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
111
|
-
/**
|
|
112
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
113
|
-
*/
|
|
114
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
117
|
-
*/
|
|
118
|
-
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
119
|
+
|
|
120
|
+
export type StackItem = {
|
|
121
|
+
index: number;
|
|
122
|
+
witness: WitnessMap;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type WitnessStack = Array<StackItem>;
|
|
126
|
+
|
|
127
|
+
|
|
119
128
|
|
|
120
129
|
/**
|
|
121
130
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -131,6 +140,20 @@ export type BuildInfo = {
|
|
|
131
140
|
|
|
132
141
|
|
|
133
142
|
|
|
143
|
+
export type RawAssertionPayload = {
|
|
144
|
+
selector: string;
|
|
145
|
+
data: string[];
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export type ExecutionError = Error & {
|
|
149
|
+
callStack?: string[];
|
|
150
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
151
|
+
acirFunctionId?: number;
|
|
152
|
+
brilligFunctionId?: number;
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
134
157
|
// Map from witness index to hex string value of witness.
|
|
135
158
|
export type WitnessMap = Map<number, string>;
|
|
136
159
|
|
|
@@ -146,15 +169,6 @@ export type SolvedAndReturnWitness = {
|
|
|
146
169
|
|
|
147
170
|
|
|
148
171
|
|
|
149
|
-
export type StackItem = {
|
|
150
|
-
index: number;
|
|
151
|
-
witness: WitnessMap;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
export type WitnessStack = Array<StackItem>;
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
172
|
export type ForeignCallInput = string[]
|
|
159
173
|
export type ForeignCallOutput = string | string[]
|
|
160
174
|
|
|
@@ -169,20 +183,6 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
169
183
|
|
|
170
184
|
|
|
171
185
|
|
|
172
|
-
export type RawAssertionPayload = {
|
|
173
|
-
selector: string;
|
|
174
|
-
data: string[];
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
export type ExecutionError = Error & {
|
|
178
|
-
callStack?: string[];
|
|
179
|
-
rawAssertionPayload?: RawAssertionPayload;
|
|
180
|
-
acirFunctionId?: number;
|
|
181
|
-
brilligFunctionId?: number;
|
|
182
|
-
};
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
186
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
187
187
|
|
|
188
188
|
export interface InitOutput {
|
|
@@ -192,6 +192,12 @@ export interface InitOutput {
|
|
|
192
192
|
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
193
193
|
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
194
194
|
readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
195
|
+
readonly and: (a: any, b: any) => any;
|
|
196
|
+
readonly xor: (a: any, b: any) => any;
|
|
197
|
+
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
198
|
+
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
199
|
+
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
200
|
+
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
195
201
|
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
196
202
|
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
197
203
|
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
@@ -199,12 +205,6 @@ export interface InitOutput {
|
|
|
199
205
|
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
200
206
|
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
201
207
|
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
202
|
-
readonly and: (a: any, b: any) => any;
|
|
203
|
-
readonly xor: (a: any, b: any) => any;
|
|
204
|
-
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
205
|
-
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
206
|
-
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
207
|
-
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
208
208
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
209
209
|
readonly __externref_table_alloc: () => number;
|
|
210
210
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -213,9 +213,9 @@ export interface InitOutput {
|
|
|
213
213
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
214
214
|
readonly __wbindgen_export_6: WebAssembly.Table;
|
|
215
215
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
216
|
-
readonly
|
|
217
|
-
readonly
|
|
218
|
-
readonly
|
|
216
|
+
readonly closure448_externref_shim: (a: number, b: number, c: any) => void;
|
|
217
|
+
readonly closure933_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
218
|
+
readonly closure937_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
|
@@ -287,6 +287,121 @@ export function decompressWitnessStack(compressed_witness) {
|
|
|
287
287
|
return takeFromExternrefTable0(ret[0]);
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
+
/**
|
|
291
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
292
|
+
* @param {string} lhs
|
|
293
|
+
* @param {string} rhs
|
|
294
|
+
* @returns {string}
|
|
295
|
+
*/
|
|
296
|
+
export function and(lhs, rhs) {
|
|
297
|
+
const ret = wasm.and(lhs, rhs);
|
|
298
|
+
return ret;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
303
|
+
* @param {string} lhs
|
|
304
|
+
* @param {string} rhs
|
|
305
|
+
* @returns {string}
|
|
306
|
+
*/
|
|
307
|
+
export function xor(lhs, rhs) {
|
|
308
|
+
const ret = wasm.xor(lhs, rhs);
|
|
309
|
+
return ret;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
let cachedUint32ArrayMemory0 = null;
|
|
313
|
+
|
|
314
|
+
function getUint32ArrayMemory0() {
|
|
315
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
316
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
317
|
+
}
|
|
318
|
+
return cachedUint32ArrayMemory0;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
322
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
323
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
324
|
+
WASM_VECTOR_LEN = arg.length;
|
|
325
|
+
return ptr;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
329
|
+
ptr = ptr >>> 0;
|
|
330
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
331
|
+
}
|
|
332
|
+
/**
|
|
333
|
+
* Sha256 compression function
|
|
334
|
+
* @param {Uint32Array} inputs
|
|
335
|
+
* @param {Uint32Array} state
|
|
336
|
+
* @returns {Uint32Array}
|
|
337
|
+
*/
|
|
338
|
+
export function sha256_compression(inputs, state) {
|
|
339
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
340
|
+
const len0 = WASM_VECTOR_LEN;
|
|
341
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
342
|
+
const len1 = WASM_VECTOR_LEN;
|
|
343
|
+
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
344
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
345
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
346
|
+
return v3;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
351
|
+
* @param {Uint8Array} inputs
|
|
352
|
+
* @returns {Uint8Array}
|
|
353
|
+
*/
|
|
354
|
+
export function blake2s256(inputs) {
|
|
355
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
356
|
+
const len0 = WASM_VECTOR_LEN;
|
|
357
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
358
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
359
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
360
|
+
return v2;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
365
|
+
* @param {Uint8Array} hashed_msg
|
|
366
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
367
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
368
|
+
* @param {Uint8Array} signature
|
|
369
|
+
* @returns {boolean}
|
|
370
|
+
*/
|
|
371
|
+
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
372
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
373
|
+
const len0 = WASM_VECTOR_LEN;
|
|
374
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
375
|
+
const len1 = WASM_VECTOR_LEN;
|
|
376
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
377
|
+
const len2 = WASM_VECTOR_LEN;
|
|
378
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
379
|
+
const len3 = WASM_VECTOR_LEN;
|
|
380
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
381
|
+
return ret !== 0;
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/**
|
|
385
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
386
|
+
* @param {Uint8Array} hashed_msg
|
|
387
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
388
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
389
|
+
* @param {Uint8Array} signature
|
|
390
|
+
* @returns {boolean}
|
|
391
|
+
*/
|
|
392
|
+
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
393
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
394
|
+
const len0 = WASM_VECTOR_LEN;
|
|
395
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
396
|
+
const len1 = WASM_VECTOR_LEN;
|
|
397
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
398
|
+
const len2 = WASM_VECTOR_LEN;
|
|
399
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
400
|
+
const len3 = WASM_VECTOR_LEN;
|
|
401
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
402
|
+
return ret !== 0;
|
|
403
|
+
}
|
|
404
|
+
|
|
290
405
|
/**
|
|
291
406
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
292
407
|
*
|
|
@@ -407,131 +522,16 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
407
522
|
return takeFromExternrefTable0(ret[0]);
|
|
408
523
|
}
|
|
409
524
|
|
|
410
|
-
/**
|
|
411
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
412
|
-
* @param {string} lhs
|
|
413
|
-
* @param {string} rhs
|
|
414
|
-
* @returns {string}
|
|
415
|
-
*/
|
|
416
|
-
export function and(lhs, rhs) {
|
|
417
|
-
const ret = wasm.and(lhs, rhs);
|
|
418
|
-
return ret;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
/**
|
|
422
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
423
|
-
* @param {string} lhs
|
|
424
|
-
* @param {string} rhs
|
|
425
|
-
* @returns {string}
|
|
426
|
-
*/
|
|
427
|
-
export function xor(lhs, rhs) {
|
|
428
|
-
const ret = wasm.xor(lhs, rhs);
|
|
429
|
-
return ret;
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
let cachedUint32ArrayMemory0 = null;
|
|
433
|
-
|
|
434
|
-
function getUint32ArrayMemory0() {
|
|
435
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
436
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
437
|
-
}
|
|
438
|
-
return cachedUint32ArrayMemory0;
|
|
439
|
-
}
|
|
440
|
-
|
|
441
|
-
function passArray32ToWasm0(arg, malloc) {
|
|
442
|
-
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
443
|
-
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
444
|
-
WASM_VECTOR_LEN = arg.length;
|
|
445
|
-
return ptr;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
449
|
-
ptr = ptr >>> 0;
|
|
450
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* Sha256 compression function
|
|
454
|
-
* @param {Uint32Array} inputs
|
|
455
|
-
* @param {Uint32Array} state
|
|
456
|
-
* @returns {Uint32Array}
|
|
457
|
-
*/
|
|
458
|
-
export function sha256_compression(inputs, state) {
|
|
459
|
-
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
460
|
-
const len0 = WASM_VECTOR_LEN;
|
|
461
|
-
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
462
|
-
const len1 = WASM_VECTOR_LEN;
|
|
463
|
-
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
464
|
-
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
465
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
466
|
-
return v3;
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
/**
|
|
470
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
471
|
-
* @param {Uint8Array} inputs
|
|
472
|
-
* @returns {Uint8Array}
|
|
473
|
-
*/
|
|
474
|
-
export function blake2s256(inputs) {
|
|
475
|
-
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
476
|
-
const len0 = WASM_VECTOR_LEN;
|
|
477
|
-
const ret = wasm.blake2s256(ptr0, len0);
|
|
478
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
479
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
480
|
-
return v2;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
/**
|
|
484
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
485
|
-
* @param {Uint8Array} hashed_msg
|
|
486
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
487
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
488
|
-
* @param {Uint8Array} signature
|
|
489
|
-
* @returns {boolean}
|
|
490
|
-
*/
|
|
491
|
-
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
492
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
493
|
-
const len0 = WASM_VECTOR_LEN;
|
|
494
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
495
|
-
const len1 = WASM_VECTOR_LEN;
|
|
496
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
497
|
-
const len2 = WASM_VECTOR_LEN;
|
|
498
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
499
|
-
const len3 = WASM_VECTOR_LEN;
|
|
500
|
-
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
501
|
-
return ret !== 0;
|
|
502
|
-
}
|
|
503
|
-
|
|
504
|
-
/**
|
|
505
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
506
|
-
* @param {Uint8Array} hashed_msg
|
|
507
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
508
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
509
|
-
* @param {Uint8Array} signature
|
|
510
|
-
* @returns {boolean}
|
|
511
|
-
*/
|
|
512
|
-
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
513
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
514
|
-
const len0 = WASM_VECTOR_LEN;
|
|
515
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
516
|
-
const len1 = WASM_VECTOR_LEN;
|
|
517
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
518
|
-
const len2 = WASM_VECTOR_LEN;
|
|
519
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
520
|
-
const len3 = WASM_VECTOR_LEN;
|
|
521
|
-
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
522
|
-
return ret !== 0;
|
|
523
|
-
}
|
|
524
|
-
|
|
525
525
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
526
|
-
wasm.
|
|
526
|
+
wasm.closure448_externref_shim(arg0, arg1, arg2);
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
530
|
-
wasm.
|
|
530
|
+
wasm.closure933_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
534
|
-
wasm.
|
|
534
|
+
wasm.closure937_externref_shim(arg0, arg1, arg2, arg3);
|
|
535
535
|
}
|
|
536
536
|
|
|
537
537
|
async function __wbg_load(module, imports) {
|
|
@@ -580,11 +580,11 @@ function __wbg_get_imports() {
|
|
|
580
580
|
const ret = arg0.call(arg1, arg2, arg3);
|
|
581
581
|
return ret;
|
|
582
582
|
}, arguments) };
|
|
583
|
-
imports.wbg.
|
|
583
|
+
imports.wbg.__wbg_constructor_536364f6bcd4616b = function(arg0) {
|
|
584
584
|
const ret = new Error(arg0);
|
|
585
585
|
return ret;
|
|
586
586
|
};
|
|
587
|
-
imports.wbg.
|
|
587
|
+
imports.wbg.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
|
|
588
588
|
const ret = new Error(arg0);
|
|
589
589
|
return ret;
|
|
590
590
|
};
|
|
@@ -697,7 +697,7 @@ function __wbg_get_imports() {
|
|
|
697
697
|
const ret = new Error();
|
|
698
698
|
return ret;
|
|
699
699
|
};
|
|
700
|
-
imports.wbg.
|
|
700
|
+
imports.wbg.__wbg_new_9f501325818b4158 = function() {
|
|
701
701
|
const ret = new Array();
|
|
702
702
|
return ret;
|
|
703
703
|
};
|
|
@@ -705,7 +705,7 @@ function __wbg_get_imports() {
|
|
|
705
705
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
706
706
|
return ret;
|
|
707
707
|
};
|
|
708
|
-
imports.wbg.
|
|
708
|
+
imports.wbg.__wbg_new_ec40611a7805f1f0 = function() {
|
|
709
709
|
const ret = new Map();
|
|
710
710
|
return ret;
|
|
711
711
|
};
|
|
@@ -797,8 +797,8 @@ function __wbg_get_imports() {
|
|
|
797
797
|
const ret = false;
|
|
798
798
|
return ret;
|
|
799
799
|
};
|
|
800
|
-
imports.wbg.
|
|
801
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
800
|
+
imports.wbg.__wbindgen_closure_wrapper1445 = function(arg0, arg1, arg2) {
|
|
801
|
+
const ret = makeMutClosure(arg0, arg1, 449, __wbg_adapter_30);
|
|
802
802
|
return ret;
|
|
803
803
|
};
|
|
804
804
|
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
|
@@ -6,6 +6,12 @@ export const compressWitness: (a: any) => [number, number, number, number];
|
|
|
6
6
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
7
7
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
8
8
|
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
9
|
+
export const and: (a: any, b: any) => any;
|
|
10
|
+
export const xor: (a: any, b: any) => any;
|
|
11
|
+
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
12
|
+
export const blake2s256: (a: number, b: number) => [number, number];
|
|
13
|
+
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
14
|
+
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
9
15
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
10
16
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
11
17
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
@@ -13,12 +19,6 @@ export const initLogLevel: (a: number, b: number) => [number, number];
|
|
|
13
19
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
14
20
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
15
21
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
16
|
-
export const and: (a: any, b: any) => any;
|
|
17
|
-
export const xor: (a: any, b: any) => any;
|
|
18
|
-
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
19
|
-
export const blake2s256: (a: number, b: number) => [number, number];
|
|
20
|
-
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
21
|
-
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
|
27
27
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
28
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
29
29
|
export const __externref_table_dealloc: (a: number) => void;
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure448_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure933_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure937_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|