@aztec/noir-acvm_js 0.0.1-commit.b655e406 → 0.0.1-commit.bf2612ae
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 +59 -59
- package/nodejs/acvm_js.js +132 -133
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +10 -10
- package/package.json +6 -6
- package/web/acvm_js.d.ts +69 -69
- package/web/acvm_js.js +132 -133
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +10 -10
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
5
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
|
+
*/
|
|
7
|
+
export function buildInfo(): BuildInfo;
|
|
3
8
|
/**
|
|
4
9
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
5
10
|
*
|
|
@@ -29,6 +34,30 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
29
34
|
* @returns {WitnessStack} The decompressed witness stack.
|
|
30
35
|
*/
|
|
31
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;
|
|
32
61
|
/**
|
|
33
62
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
34
63
|
*
|
|
@@ -87,35 +116,29 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
87
116
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
88
117
|
*/
|
|
89
118
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
119
|
+
|
|
120
|
+
export type StackItem = {
|
|
121
|
+
index: number;
|
|
122
|
+
witness: WitnessMap;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type WitnessStack = Array<StackItem>;
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
90
129
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
97
|
-
*/
|
|
98
|
-
export function and(lhs: string, rhs: string): string;
|
|
99
|
-
/**
|
|
100
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
101
|
-
*/
|
|
102
|
-
export function xor(lhs: string, rhs: string): string;
|
|
103
|
-
/**
|
|
104
|
-
* Sha256 compression function
|
|
105
|
-
*/
|
|
106
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
107
|
-
/**
|
|
108
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
109
|
-
*/
|
|
110
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
111
|
-
/**
|
|
112
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
113
|
-
*/
|
|
114
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
130
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
131
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
132
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
133
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
117
134
|
*/
|
|
118
|
-
export
|
|
135
|
+
export type BuildInfo = {
|
|
136
|
+
gitHash: string;
|
|
137
|
+
version: string;
|
|
138
|
+
dirty: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
119
142
|
|
|
120
143
|
export type RawAssertionPayload = {
|
|
121
144
|
selector: string;
|
|
@@ -131,20 +154,6 @@ export type ExecutionError = Error & {
|
|
|
131
154
|
|
|
132
155
|
|
|
133
156
|
|
|
134
|
-
export type ForeignCallInput = string[]
|
|
135
|
-
export type ForeignCallOutput = string | string[]
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* A callback which performs an foreign call and returns the response.
|
|
139
|
-
* @callback ForeignCallHandler
|
|
140
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
141
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
142
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
143
|
-
*/
|
|
144
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
157
|
// Map from witness index to hex string value of witness.
|
|
149
158
|
export type WitnessMap = Map<number, string>;
|
|
150
159
|
|
|
@@ -160,25 +169,16 @@ export type SolvedAndReturnWitness = {
|
|
|
160
169
|
|
|
161
170
|
|
|
162
171
|
|
|
163
|
-
export type
|
|
164
|
-
|
|
165
|
-
witness: WitnessMap;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export type WitnessStack = Array<StackItem>;
|
|
169
|
-
|
|
170
|
-
|
|
172
|
+
export type ForeignCallInput = string[]
|
|
173
|
+
export type ForeignCallOutput = string | string[]
|
|
171
174
|
|
|
172
175
|
/**
|
|
173
|
-
*
|
|
174
|
-
* @
|
|
175
|
-
* @
|
|
176
|
-
* @
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
version: string;
|
|
181
|
-
dirty: string;
|
|
182
|
-
}
|
|
176
|
+
* A callback which performs an foreign call and returns the response.
|
|
177
|
+
* @callback ForeignCallHandler
|
|
178
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
179
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
180
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
181
|
+
*/
|
|
182
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
183
183
|
|
|
184
184
|
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -201,6 +201,14 @@ function debugString(val) {
|
|
|
201
201
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
202
202
|
return className;
|
|
203
203
|
}
|
|
204
|
+
/**
|
|
205
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
206
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
207
|
+
*/
|
|
208
|
+
module.exports.buildInfo = function() {
|
|
209
|
+
const ret = wasm.buildInfo();
|
|
210
|
+
return ret;
|
|
211
|
+
};
|
|
204
212
|
|
|
205
213
|
function takeFromExternrefTable0(idx) {
|
|
206
214
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
@@ -283,6 +291,121 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
283
291
|
return takeFromExternrefTable0(ret[0]);
|
|
284
292
|
};
|
|
285
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
|
+
|
|
286
409
|
/**
|
|
287
410
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
288
411
|
*
|
|
@@ -403,140 +526,16 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
403
526
|
return takeFromExternrefTable0(ret[0]);
|
|
404
527
|
};
|
|
405
528
|
|
|
406
|
-
/**
|
|
407
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
408
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
409
|
-
*/
|
|
410
|
-
module.exports.buildInfo = function() {
|
|
411
|
-
const ret = wasm.buildInfo();
|
|
412
|
-
return ret;
|
|
413
|
-
};
|
|
414
|
-
|
|
415
|
-
/**
|
|
416
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
417
|
-
* @param {string} lhs
|
|
418
|
-
* @param {string} rhs
|
|
419
|
-
* @returns {string}
|
|
420
|
-
*/
|
|
421
|
-
module.exports.and = function(lhs, rhs) {
|
|
422
|
-
const ret = wasm.and(lhs, rhs);
|
|
423
|
-
return ret;
|
|
424
|
-
};
|
|
425
|
-
|
|
426
|
-
/**
|
|
427
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
428
|
-
* @param {string} lhs
|
|
429
|
-
* @param {string} rhs
|
|
430
|
-
* @returns {string}
|
|
431
|
-
*/
|
|
432
|
-
module.exports.xor = function(lhs, rhs) {
|
|
433
|
-
const ret = wasm.xor(lhs, rhs);
|
|
434
|
-
return ret;
|
|
435
|
-
};
|
|
436
|
-
|
|
437
|
-
let cachedUint32ArrayMemory0 = null;
|
|
438
|
-
|
|
439
|
-
function getUint32ArrayMemory0() {
|
|
440
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
441
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
442
|
-
}
|
|
443
|
-
return cachedUint32ArrayMemory0;
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
function passArray32ToWasm0(arg, malloc) {
|
|
447
|
-
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
448
|
-
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
449
|
-
WASM_VECTOR_LEN = arg.length;
|
|
450
|
-
return ptr;
|
|
451
|
-
}
|
|
452
|
-
|
|
453
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
454
|
-
ptr = ptr >>> 0;
|
|
455
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
456
|
-
}
|
|
457
|
-
/**
|
|
458
|
-
* Sha256 compression function
|
|
459
|
-
* @param {Uint32Array} inputs
|
|
460
|
-
* @param {Uint32Array} state
|
|
461
|
-
* @returns {Uint32Array}
|
|
462
|
-
*/
|
|
463
|
-
module.exports.sha256_compression = function(inputs, state) {
|
|
464
|
-
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
465
|
-
const len0 = WASM_VECTOR_LEN;
|
|
466
|
-
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
467
|
-
const len1 = WASM_VECTOR_LEN;
|
|
468
|
-
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
469
|
-
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
470
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
471
|
-
return v3;
|
|
472
|
-
};
|
|
473
|
-
|
|
474
|
-
/**
|
|
475
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
476
|
-
* @param {Uint8Array} inputs
|
|
477
|
-
* @returns {Uint8Array}
|
|
478
|
-
*/
|
|
479
|
-
module.exports.blake2s256 = function(inputs) {
|
|
480
|
-
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
481
|
-
const len0 = WASM_VECTOR_LEN;
|
|
482
|
-
const ret = wasm.blake2s256(ptr0, len0);
|
|
483
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
484
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
485
|
-
return v2;
|
|
486
|
-
};
|
|
487
|
-
|
|
488
|
-
/**
|
|
489
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
490
|
-
* @param {Uint8Array} hashed_msg
|
|
491
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
492
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
493
|
-
* @param {Uint8Array} signature
|
|
494
|
-
* @returns {boolean}
|
|
495
|
-
*/
|
|
496
|
-
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
497
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
498
|
-
const len0 = WASM_VECTOR_LEN;
|
|
499
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
500
|
-
const len1 = WASM_VECTOR_LEN;
|
|
501
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
502
|
-
const len2 = WASM_VECTOR_LEN;
|
|
503
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
504
|
-
const len3 = WASM_VECTOR_LEN;
|
|
505
|
-
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
506
|
-
return ret !== 0;
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
/**
|
|
510
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
511
|
-
* @param {Uint8Array} hashed_msg
|
|
512
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
513
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
514
|
-
* @param {Uint8Array} signature
|
|
515
|
-
* @returns {boolean}
|
|
516
|
-
*/
|
|
517
|
-
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
518
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
519
|
-
const len0 = WASM_VECTOR_LEN;
|
|
520
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
521
|
-
const len1 = WASM_VECTOR_LEN;
|
|
522
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
523
|
-
const len2 = WASM_VECTOR_LEN;
|
|
524
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
525
|
-
const len3 = WASM_VECTOR_LEN;
|
|
526
|
-
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
527
|
-
return ret !== 0;
|
|
528
|
-
};
|
|
529
|
-
|
|
530
529
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
531
|
-
wasm.
|
|
530
|
+
wasm.closure448_externref_shim(arg0, arg1, arg2);
|
|
532
531
|
}
|
|
533
532
|
|
|
534
533
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
535
|
-
wasm.
|
|
534
|
+
wasm.closure933_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
536
535
|
}
|
|
537
536
|
|
|
538
537
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
539
|
-
wasm.
|
|
538
|
+
wasm.closure937_externref_shim(arg0, arg1, arg2, arg3);
|
|
540
539
|
}
|
|
541
540
|
|
|
542
541
|
module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
@@ -554,12 +553,12 @@ module.exports.__wbg_call_833bed5770ea2041 = function() { return handleError(fun
|
|
|
554
553
|
return ret;
|
|
555
554
|
}, arguments) };
|
|
556
555
|
|
|
557
|
-
module.exports.
|
|
556
|
+
module.exports.__wbg_constructor_536364f6bcd4616b = function(arg0) {
|
|
558
557
|
const ret = new Error(arg0);
|
|
559
558
|
return ret;
|
|
560
559
|
};
|
|
561
560
|
|
|
562
|
-
module.exports.
|
|
561
|
+
module.exports.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
|
|
563
562
|
const ret = new Error(arg0);
|
|
564
563
|
return ret;
|
|
565
564
|
};
|
|
@@ -690,7 +689,7 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
|
|
|
690
689
|
return ret;
|
|
691
690
|
};
|
|
692
691
|
|
|
693
|
-
module.exports.
|
|
692
|
+
module.exports.__wbg_new_9f501325818b4158 = function() {
|
|
694
693
|
const ret = new Array();
|
|
695
694
|
return ret;
|
|
696
695
|
};
|
|
@@ -700,7 +699,7 @@ module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
|
|
|
700
699
|
return ret;
|
|
701
700
|
};
|
|
702
701
|
|
|
703
|
-
module.exports.
|
|
702
|
+
module.exports.__wbg_new_ec40611a7805f1f0 = function() {
|
|
704
703
|
const ret = new Map();
|
|
705
704
|
return ret;
|
|
706
705
|
};
|
|
@@ -814,8 +813,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
814
813
|
return ret;
|
|
815
814
|
};
|
|
816
815
|
|
|
817
|
-
module.exports.
|
|
818
|
-
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);
|
|
819
818
|
return ret;
|
|
820
819
|
};
|
|
821
820
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const buildInfo: () => any;
|
|
4
5
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
5
6
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
6
7
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
7
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;
|
|
8
15
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
9
16
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
10
17
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
@@ -12,13 +19,6 @@ export const initLogLevel: (a: number, b: number) => [number, number];
|
|
|
12
19
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
13
20
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
14
21
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
15
|
-
export const buildInfo: () => any;
|
|
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.bf2612ae",
|
|
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.
|
|
46
|
-
"eslint-plugin-prettier": "^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
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
5
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
|
+
*/
|
|
7
|
+
export function buildInfo(): BuildInfo;
|
|
3
8
|
/**
|
|
4
9
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
5
10
|
*
|
|
@@ -29,6 +34,30 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
29
34
|
* @returns {WitnessStack} The decompressed witness stack.
|
|
30
35
|
*/
|
|
31
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;
|
|
32
61
|
/**
|
|
33
62
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
34
63
|
*
|
|
@@ -87,35 +116,29 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
87
116
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
88
117
|
*/
|
|
89
118
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
119
|
+
|
|
120
|
+
export type StackItem = {
|
|
121
|
+
index: number;
|
|
122
|
+
witness: WitnessMap;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type WitnessStack = Array<StackItem>;
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
90
129
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
97
|
-
*/
|
|
98
|
-
export function and(lhs: string, rhs: string): string;
|
|
99
|
-
/**
|
|
100
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
101
|
-
*/
|
|
102
|
-
export function xor(lhs: string, rhs: string): string;
|
|
103
|
-
/**
|
|
104
|
-
* Sha256 compression function
|
|
105
|
-
*/
|
|
106
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
107
|
-
/**
|
|
108
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
109
|
-
*/
|
|
110
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
111
|
-
/**
|
|
112
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
113
|
-
*/
|
|
114
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
130
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
131
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
132
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
133
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
117
134
|
*/
|
|
118
|
-
export
|
|
135
|
+
export type BuildInfo = {
|
|
136
|
+
gitHash: string;
|
|
137
|
+
version: string;
|
|
138
|
+
dirty: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
|
|
119
142
|
|
|
120
143
|
export type RawAssertionPayload = {
|
|
121
144
|
selector: string;
|
|
@@ -131,20 +154,6 @@ export type ExecutionError = Error & {
|
|
|
131
154
|
|
|
132
155
|
|
|
133
156
|
|
|
134
|
-
export type ForeignCallInput = string[]
|
|
135
|
-
export type ForeignCallOutput = string | string[]
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* A callback which performs an foreign call and returns the response.
|
|
139
|
-
* @callback ForeignCallHandler
|
|
140
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
141
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
142
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
143
|
-
*/
|
|
144
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
157
|
// Map from witness index to hex string value of witness.
|
|
149
158
|
export type WitnessMap = Map<number, string>;
|
|
150
159
|
|
|
@@ -160,26 +169,17 @@ export type SolvedAndReturnWitness = {
|
|
|
160
169
|
|
|
161
170
|
|
|
162
171
|
|
|
163
|
-
export type
|
|
164
|
-
|
|
165
|
-
witness: WitnessMap;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
export type WitnessStack = Array<StackItem>;
|
|
169
|
-
|
|
170
|
-
|
|
172
|
+
export type ForeignCallInput = string[]
|
|
173
|
+
export type ForeignCallOutput = string | string[]
|
|
171
174
|
|
|
172
175
|
/**
|
|
173
|
-
*
|
|
174
|
-
* @
|
|
175
|
-
* @
|
|
176
|
-
* @
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
version: string;
|
|
181
|
-
dirty: string;
|
|
182
|
-
}
|
|
176
|
+
* A callback which performs an foreign call and returns the response.
|
|
177
|
+
* @callback ForeignCallHandler
|
|
178
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
179
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
180
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
181
|
+
*/
|
|
182
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
183
183
|
|
|
184
184
|
|
|
185
185
|
|
|
@@ -187,10 +187,17 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
187
187
|
|
|
188
188
|
export interface InitOutput {
|
|
189
189
|
readonly memory: WebAssembly.Memory;
|
|
190
|
+
readonly buildInfo: () => any;
|
|
190
191
|
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
191
192
|
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
192
193
|
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
193
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;
|
|
194
201
|
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
195
202
|
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
196
203
|
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
@@ -198,13 +205,6 @@ export interface InitOutput {
|
|
|
198
205
|
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
199
206
|
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
200
207
|
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
201
|
-
readonly buildInfo: () => any;
|
|
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
|
@@ -197,6 +197,14 @@ function debugString(val) {
|
|
|
197
197
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
198
198
|
return className;
|
|
199
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
202
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
203
|
+
*/
|
|
204
|
+
export function buildInfo() {
|
|
205
|
+
const ret = wasm.buildInfo();
|
|
206
|
+
return ret;
|
|
207
|
+
}
|
|
200
208
|
|
|
201
209
|
function takeFromExternrefTable0(idx) {
|
|
202
210
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
@@ -279,6 +287,121 @@ export function decompressWitnessStack(compressed_witness) {
|
|
|
279
287
|
return takeFromExternrefTable0(ret[0]);
|
|
280
288
|
}
|
|
281
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
|
+
|
|
282
405
|
/**
|
|
283
406
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
284
407
|
*
|
|
@@ -399,140 +522,16 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
399
522
|
return takeFromExternrefTable0(ret[0]);
|
|
400
523
|
}
|
|
401
524
|
|
|
402
|
-
/**
|
|
403
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
404
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
405
|
-
*/
|
|
406
|
-
export function buildInfo() {
|
|
407
|
-
const ret = wasm.buildInfo();
|
|
408
|
-
return ret;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
/**
|
|
412
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
413
|
-
* @param {string} lhs
|
|
414
|
-
* @param {string} rhs
|
|
415
|
-
* @returns {string}
|
|
416
|
-
*/
|
|
417
|
-
export function and(lhs, rhs) {
|
|
418
|
-
const ret = wasm.and(lhs, rhs);
|
|
419
|
-
return ret;
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
424
|
-
* @param {string} lhs
|
|
425
|
-
* @param {string} rhs
|
|
426
|
-
* @returns {string}
|
|
427
|
-
*/
|
|
428
|
-
export function xor(lhs, rhs) {
|
|
429
|
-
const ret = wasm.xor(lhs, rhs);
|
|
430
|
-
return ret;
|
|
431
|
-
}
|
|
432
|
-
|
|
433
|
-
let cachedUint32ArrayMemory0 = null;
|
|
434
|
-
|
|
435
|
-
function getUint32ArrayMemory0() {
|
|
436
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
437
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
438
|
-
}
|
|
439
|
-
return cachedUint32ArrayMemory0;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
function passArray32ToWasm0(arg, malloc) {
|
|
443
|
-
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
444
|
-
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
445
|
-
WASM_VECTOR_LEN = arg.length;
|
|
446
|
-
return ptr;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
450
|
-
ptr = ptr >>> 0;
|
|
451
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* Sha256 compression function
|
|
455
|
-
* @param {Uint32Array} inputs
|
|
456
|
-
* @param {Uint32Array} state
|
|
457
|
-
* @returns {Uint32Array}
|
|
458
|
-
*/
|
|
459
|
-
export function sha256_compression(inputs, state) {
|
|
460
|
-
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
461
|
-
const len0 = WASM_VECTOR_LEN;
|
|
462
|
-
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
463
|
-
const len1 = WASM_VECTOR_LEN;
|
|
464
|
-
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
465
|
-
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
466
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
467
|
-
return v3;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
472
|
-
* @param {Uint8Array} inputs
|
|
473
|
-
* @returns {Uint8Array}
|
|
474
|
-
*/
|
|
475
|
-
export function blake2s256(inputs) {
|
|
476
|
-
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
477
|
-
const len0 = WASM_VECTOR_LEN;
|
|
478
|
-
const ret = wasm.blake2s256(ptr0, len0);
|
|
479
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
480
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
481
|
-
return v2;
|
|
482
|
-
}
|
|
483
|
-
|
|
484
|
-
/**
|
|
485
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
486
|
-
* @param {Uint8Array} hashed_msg
|
|
487
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
488
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
489
|
-
* @param {Uint8Array} signature
|
|
490
|
-
* @returns {boolean}
|
|
491
|
-
*/
|
|
492
|
-
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
493
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
494
|
-
const len0 = WASM_VECTOR_LEN;
|
|
495
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
496
|
-
const len1 = WASM_VECTOR_LEN;
|
|
497
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
498
|
-
const len2 = WASM_VECTOR_LEN;
|
|
499
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
500
|
-
const len3 = WASM_VECTOR_LEN;
|
|
501
|
-
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
502
|
-
return ret !== 0;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
/**
|
|
506
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
507
|
-
* @param {Uint8Array} hashed_msg
|
|
508
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
509
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
510
|
-
* @param {Uint8Array} signature
|
|
511
|
-
* @returns {boolean}
|
|
512
|
-
*/
|
|
513
|
-
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
514
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
515
|
-
const len0 = WASM_VECTOR_LEN;
|
|
516
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
517
|
-
const len1 = WASM_VECTOR_LEN;
|
|
518
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
519
|
-
const len2 = WASM_VECTOR_LEN;
|
|
520
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
521
|
-
const len3 = WASM_VECTOR_LEN;
|
|
522
|
-
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
523
|
-
return ret !== 0;
|
|
524
|
-
}
|
|
525
|
-
|
|
526
525
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
527
|
-
wasm.
|
|
526
|
+
wasm.closure448_externref_shim(arg0, arg1, arg2);
|
|
528
527
|
}
|
|
529
528
|
|
|
530
529
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
531
|
-
wasm.
|
|
530
|
+
wasm.closure933_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
532
531
|
}
|
|
533
532
|
|
|
534
533
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
535
|
-
wasm.
|
|
534
|
+
wasm.closure937_externref_shim(arg0, arg1, arg2, arg3);
|
|
536
535
|
}
|
|
537
536
|
|
|
538
537
|
async function __wbg_load(module, imports) {
|
|
@@ -581,11 +580,11 @@ function __wbg_get_imports() {
|
|
|
581
580
|
const ret = arg0.call(arg1, arg2, arg3);
|
|
582
581
|
return ret;
|
|
583
582
|
}, arguments) };
|
|
584
|
-
imports.wbg.
|
|
583
|
+
imports.wbg.__wbg_constructor_536364f6bcd4616b = function(arg0) {
|
|
585
584
|
const ret = new Error(arg0);
|
|
586
585
|
return ret;
|
|
587
586
|
};
|
|
588
|
-
imports.wbg.
|
|
587
|
+
imports.wbg.__wbg_constructor_66e92e9c3ecae9e8 = function(arg0) {
|
|
589
588
|
const ret = new Error(arg0);
|
|
590
589
|
return ret;
|
|
591
590
|
};
|
|
@@ -698,7 +697,7 @@ function __wbg_get_imports() {
|
|
|
698
697
|
const ret = new Error();
|
|
699
698
|
return ret;
|
|
700
699
|
};
|
|
701
|
-
imports.wbg.
|
|
700
|
+
imports.wbg.__wbg_new_9f501325818b4158 = function() {
|
|
702
701
|
const ret = new Array();
|
|
703
702
|
return ret;
|
|
704
703
|
};
|
|
@@ -706,7 +705,7 @@ function __wbg_get_imports() {
|
|
|
706
705
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
707
706
|
return ret;
|
|
708
707
|
};
|
|
709
|
-
imports.wbg.
|
|
708
|
+
imports.wbg.__wbg_new_ec40611a7805f1f0 = function() {
|
|
710
709
|
const ret = new Map();
|
|
711
710
|
return ret;
|
|
712
711
|
};
|
|
@@ -798,8 +797,8 @@ function __wbg_get_imports() {
|
|
|
798
797
|
const ret = false;
|
|
799
798
|
return ret;
|
|
800
799
|
};
|
|
801
|
-
imports.wbg.
|
|
802
|
-
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);
|
|
803
802
|
return ret;
|
|
804
803
|
};
|
|
805
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
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const buildInfo: () => any;
|
|
4
5
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
5
6
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
6
7
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
7
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;
|
|
8
15
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
9
16
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
10
17
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
@@ -12,13 +19,6 @@ export const initLogLevel: (a: number, b: number) => [number, number];
|
|
|
12
19
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
13
20
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
14
21
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
15
|
-
export const buildInfo: () => any;
|
|
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;
|