@aztec/noir-acvm_js 0.0.1-commit.6230efd → 0.0.1-commit.64b6bbb
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 +43 -43
- package/nodejs/acvm_js.js +144 -144
- 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 +53 -53
- package/web/acvm_js.js +144 -144
- 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
|
@@ -5,6 +5,36 @@
|
|
|
5
5
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
6
|
*/
|
|
7
7
|
export function buildInfo(): BuildInfo;
|
|
8
|
+
/**
|
|
9
|
+
* Sets the package's logging level.
|
|
10
|
+
*
|
|
11
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
12
|
+
*/
|
|
13
|
+
export function initLogLevel(filter: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
16
|
+
*/
|
|
17
|
+
export function and(lhs: string, rhs: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
20
|
+
*/
|
|
21
|
+
export function xor(lhs: string, rhs: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Sha256 compression function
|
|
24
|
+
*/
|
|
25
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
26
|
+
/**
|
|
27
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
28
|
+
*/
|
|
29
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
32
|
+
*/
|
|
33
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
36
|
+
*/
|
|
37
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
8
38
|
/**
|
|
9
39
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
10
40
|
*
|
|
@@ -62,12 +92,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
62
92
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
63
93
|
*/
|
|
64
94
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
65
|
-
/**
|
|
66
|
-
* Sets the package's logging level.
|
|
67
|
-
*
|
|
68
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
69
|
-
*/
|
|
70
|
-
export function initLogLevel(filter: string): void;
|
|
71
95
|
/**
|
|
72
96
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
73
97
|
*
|
|
@@ -92,30 +116,20 @@ 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;
|
|
119
|
+
|
|
120
|
+
export type ForeignCallInput = string[]
|
|
121
|
+
export type ForeignCallOutput = string | string[]
|
|
122
|
+
|
|
95
123
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
export
|
|
103
|
-
|
|
104
|
-
|
|
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;
|
|
124
|
+
* A callback which performs an foreign call and returns the response.
|
|
125
|
+
* @callback ForeignCallHandler
|
|
126
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
127
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
128
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
129
|
+
*/
|
|
130
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
131
|
+
|
|
132
|
+
|
|
119
133
|
|
|
120
134
|
/**
|
|
121
135
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -155,20 +169,6 @@ export type WitnessStack = Array<StackItem>;
|
|
|
155
169
|
|
|
156
170
|
|
|
157
171
|
|
|
158
|
-
export type ForeignCallInput = string[]
|
|
159
|
-
export type ForeignCallOutput = string | string[]
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* A callback which performs an foreign call and returns the response.
|
|
163
|
-
* @callback ForeignCallHandler
|
|
164
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
165
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
166
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
167
|
-
*/
|
|
168
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
172
|
export type RawAssertionPayload = {
|
|
173
173
|
selector: string;
|
|
174
174
|
data: string[];
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -215,11 +215,146 @@ function takeFromExternrefTable0(idx) {
|
|
|
215
215
|
wasm.__externref_table_dealloc(idx);
|
|
216
216
|
return value;
|
|
217
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Sets the package's logging level.
|
|
220
|
+
*
|
|
221
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
222
|
+
*/
|
|
223
|
+
module.exports.initLogLevel = function(filter) {
|
|
224
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
225
|
+
const len0 = WASM_VECTOR_LEN;
|
|
226
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
227
|
+
if (ret[1]) {
|
|
228
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
234
|
+
* @param {string} lhs
|
|
235
|
+
* @param {string} rhs
|
|
236
|
+
* @returns {string}
|
|
237
|
+
*/
|
|
238
|
+
module.exports.and = function(lhs, rhs) {
|
|
239
|
+
const ret = wasm.and(lhs, rhs);
|
|
240
|
+
return ret;
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
245
|
+
* @param {string} lhs
|
|
246
|
+
* @param {string} rhs
|
|
247
|
+
* @returns {string}
|
|
248
|
+
*/
|
|
249
|
+
module.exports.xor = function(lhs, rhs) {
|
|
250
|
+
const ret = wasm.xor(lhs, rhs);
|
|
251
|
+
return ret;
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
let cachedUint32ArrayMemory0 = null;
|
|
255
|
+
|
|
256
|
+
function getUint32ArrayMemory0() {
|
|
257
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
258
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
259
|
+
}
|
|
260
|
+
return cachedUint32ArrayMemory0;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
264
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
265
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
266
|
+
WASM_VECTOR_LEN = arg.length;
|
|
267
|
+
return ptr;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
271
|
+
ptr = ptr >>> 0;
|
|
272
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Sha256 compression function
|
|
276
|
+
* @param {Uint32Array} inputs
|
|
277
|
+
* @param {Uint32Array} state
|
|
278
|
+
* @returns {Uint32Array}
|
|
279
|
+
*/
|
|
280
|
+
module.exports.sha256_compression = function(inputs, state) {
|
|
281
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
282
|
+
const len0 = WASM_VECTOR_LEN;
|
|
283
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
284
|
+
const len1 = WASM_VECTOR_LEN;
|
|
285
|
+
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
286
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
287
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
288
|
+
return v3;
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
292
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
293
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
294
|
+
WASM_VECTOR_LEN = arg.length;
|
|
295
|
+
return ptr;
|
|
296
|
+
}
|
|
218
297
|
|
|
219
298
|
function getArrayU8FromWasm0(ptr, len) {
|
|
220
299
|
ptr = ptr >>> 0;
|
|
221
300
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
222
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
304
|
+
* @param {Uint8Array} inputs
|
|
305
|
+
* @returns {Uint8Array}
|
|
306
|
+
*/
|
|
307
|
+
module.exports.blake2s256 = function(inputs) {
|
|
308
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
309
|
+
const len0 = WASM_VECTOR_LEN;
|
|
310
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
311
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
312
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
313
|
+
return v2;
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
318
|
+
* @param {Uint8Array} hashed_msg
|
|
319
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
320
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
321
|
+
* @param {Uint8Array} signature
|
|
322
|
+
* @returns {boolean}
|
|
323
|
+
*/
|
|
324
|
+
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
325
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
326
|
+
const len0 = WASM_VECTOR_LEN;
|
|
327
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
328
|
+
const len1 = WASM_VECTOR_LEN;
|
|
329
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
330
|
+
const len2 = WASM_VECTOR_LEN;
|
|
331
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
332
|
+
const len3 = WASM_VECTOR_LEN;
|
|
333
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
334
|
+
return ret !== 0;
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
339
|
+
* @param {Uint8Array} hashed_msg
|
|
340
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
341
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
342
|
+
* @param {Uint8Array} signature
|
|
343
|
+
* @returns {boolean}
|
|
344
|
+
*/
|
|
345
|
+
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
346
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
347
|
+
const len0 = WASM_VECTOR_LEN;
|
|
348
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
349
|
+
const len1 = WASM_VECTOR_LEN;
|
|
350
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
351
|
+
const len2 = WASM_VECTOR_LEN;
|
|
352
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
353
|
+
const len3 = WASM_VECTOR_LEN;
|
|
354
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
355
|
+
return ret !== 0;
|
|
356
|
+
};
|
|
357
|
+
|
|
223
358
|
/**
|
|
224
359
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
225
360
|
*
|
|
@@ -236,12 +371,6 @@ module.exports.compressWitness = function(witness_map) {
|
|
|
236
371
|
return v1;
|
|
237
372
|
};
|
|
238
373
|
|
|
239
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
240
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
241
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
242
|
-
WASM_VECTOR_LEN = arg.length;
|
|
243
|
-
return ptr;
|
|
244
|
-
}
|
|
245
374
|
/**
|
|
246
375
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
247
376
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -337,20 +466,6 @@ module.exports.executeProgram = function(program, initial_witness, foreign_call_
|
|
|
337
466
|
return ret;
|
|
338
467
|
};
|
|
339
468
|
|
|
340
|
-
/**
|
|
341
|
-
* Sets the package's logging level.
|
|
342
|
-
*
|
|
343
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
344
|
-
*/
|
|
345
|
-
module.exports.initLogLevel = function(filter) {
|
|
346
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
347
|
-
const len0 = WASM_VECTOR_LEN;
|
|
348
|
-
const ret = wasm.initLogLevel(ptr0, len0);
|
|
349
|
-
if (ret[1]) {
|
|
350
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
|
|
354
469
|
/**
|
|
355
470
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
356
471
|
*
|
|
@@ -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.closure445_externref_shim(arg0, arg1, arg2);
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
534
|
-
wasm.
|
|
534
|
+
wasm.closure921_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.closure925_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_wrapper1365 = function(arg0, arg1, arg2) {
|
|
817
|
+
const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
|
|
818
818
|
return ret;
|
|
819
819
|
};
|
|
820
820
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const buildInfo: () => any;
|
|
5
|
+
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
6
|
+
export const and: (a: any, b: any) => any;
|
|
7
|
+
export const xor: (a: any, b: any) => any;
|
|
8
|
+
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
9
|
+
export const blake2s256: (a: number, b: number) => [number, number];
|
|
10
|
+
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
11
|
+
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
5
12
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
6
13
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
7
14
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -9,16 +16,9 @@ export const decompressWitnessStack: (a: number, b: number) => [number, number,
|
|
|
9
16
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
10
17
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
11
18
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
12
|
-
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 closure445_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure921_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure925_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.64b6bbb",
|
|
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.1",
|
|
49
49
|
"ts-node": "^10.9.2",
|
|
50
50
|
"typescript": "^5.8.3"
|
|
51
51
|
}
|
package/web/acvm_js.d.ts
CHANGED
|
@@ -5,6 +5,36 @@
|
|
|
5
5
|
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
6
6
|
*/
|
|
7
7
|
export function buildInfo(): BuildInfo;
|
|
8
|
+
/**
|
|
9
|
+
* Sets the package's logging level.
|
|
10
|
+
*
|
|
11
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
12
|
+
*/
|
|
13
|
+
export function initLogLevel(filter: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
16
|
+
*/
|
|
17
|
+
export function and(lhs: string, rhs: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
20
|
+
*/
|
|
21
|
+
export function xor(lhs: string, rhs: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Sha256 compression function
|
|
24
|
+
*/
|
|
25
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
26
|
+
/**
|
|
27
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
28
|
+
*/
|
|
29
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
30
|
+
/**
|
|
31
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
32
|
+
*/
|
|
33
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
36
|
+
*/
|
|
37
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
8
38
|
/**
|
|
9
39
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
10
40
|
*
|
|
@@ -62,12 +92,6 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
62
92
|
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
63
93
|
*/
|
|
64
94
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
65
|
-
/**
|
|
66
|
-
* Sets the package's logging level.
|
|
67
|
-
*
|
|
68
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
69
|
-
*/
|
|
70
|
-
export function initLogLevel(filter: string): void;
|
|
71
95
|
/**
|
|
72
96
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
73
97
|
*
|
|
@@ -92,30 +116,20 @@ 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;
|
|
119
|
+
|
|
120
|
+
export type ForeignCallInput = string[]
|
|
121
|
+
export type ForeignCallOutput = string | string[]
|
|
122
|
+
|
|
95
123
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
export
|
|
103
|
-
|
|
104
|
-
|
|
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;
|
|
124
|
+
* A callback which performs an foreign call and returns the response.
|
|
125
|
+
* @callback ForeignCallHandler
|
|
126
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
127
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
128
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
129
|
+
*/
|
|
130
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
131
|
+
|
|
132
|
+
|
|
119
133
|
|
|
120
134
|
/**
|
|
121
135
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -155,20 +169,6 @@ export type WitnessStack = Array<StackItem>;
|
|
|
155
169
|
|
|
156
170
|
|
|
157
171
|
|
|
158
|
-
export type ForeignCallInput = string[]
|
|
159
|
-
export type ForeignCallOutput = string | string[]
|
|
160
|
-
|
|
161
|
-
/**
|
|
162
|
-
* A callback which performs an foreign call and returns the response.
|
|
163
|
-
* @callback ForeignCallHandler
|
|
164
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
165
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
166
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
167
|
-
*/
|
|
168
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
172
|
export type RawAssertionPayload = {
|
|
173
173
|
selector: string;
|
|
174
174
|
data: string[];
|
|
@@ -188,6 +188,13 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
188
188
|
export interface InitOutput {
|
|
189
189
|
readonly memory: WebAssembly.Memory;
|
|
190
190
|
readonly buildInfo: () => any;
|
|
191
|
+
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
192
|
+
readonly and: (a: any, b: any) => any;
|
|
193
|
+
readonly xor: (a: any, b: any) => any;
|
|
194
|
+
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
195
|
+
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
196
|
+
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
197
|
+
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
191
198
|
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
192
199
|
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
193
200
|
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -195,16 +202,9 @@ export interface InitOutput {
|
|
|
195
202
|
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
196
203
|
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
197
204
|
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
198
|
-
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
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 closure445_externref_shim: (a: number, b: number, c: any) => void;
|
|
217
|
+
readonly closure921_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
218
|
+
readonly closure925_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
|
@@ -211,11 +211,146 @@ function takeFromExternrefTable0(idx) {
|
|
|
211
211
|
wasm.__externref_table_dealloc(idx);
|
|
212
212
|
return value;
|
|
213
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Sets the package's logging level.
|
|
216
|
+
*
|
|
217
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
218
|
+
*/
|
|
219
|
+
export function initLogLevel(filter) {
|
|
220
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
221
|
+
const len0 = WASM_VECTOR_LEN;
|
|
222
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
223
|
+
if (ret[1]) {
|
|
224
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
230
|
+
* @param {string} lhs
|
|
231
|
+
* @param {string} rhs
|
|
232
|
+
* @returns {string}
|
|
233
|
+
*/
|
|
234
|
+
export function and(lhs, rhs) {
|
|
235
|
+
const ret = wasm.and(lhs, rhs);
|
|
236
|
+
return ret;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
241
|
+
* @param {string} lhs
|
|
242
|
+
* @param {string} rhs
|
|
243
|
+
* @returns {string}
|
|
244
|
+
*/
|
|
245
|
+
export function xor(lhs, rhs) {
|
|
246
|
+
const ret = wasm.xor(lhs, rhs);
|
|
247
|
+
return ret;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
let cachedUint32ArrayMemory0 = null;
|
|
251
|
+
|
|
252
|
+
function getUint32ArrayMemory0() {
|
|
253
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
254
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
255
|
+
}
|
|
256
|
+
return cachedUint32ArrayMemory0;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
260
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
261
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
262
|
+
WASM_VECTOR_LEN = arg.length;
|
|
263
|
+
return ptr;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
267
|
+
ptr = ptr >>> 0;
|
|
268
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Sha256 compression function
|
|
272
|
+
* @param {Uint32Array} inputs
|
|
273
|
+
* @param {Uint32Array} state
|
|
274
|
+
* @returns {Uint32Array}
|
|
275
|
+
*/
|
|
276
|
+
export function sha256_compression(inputs, state) {
|
|
277
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
278
|
+
const len0 = WASM_VECTOR_LEN;
|
|
279
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
280
|
+
const len1 = WASM_VECTOR_LEN;
|
|
281
|
+
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
282
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
283
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
284
|
+
return v3;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
288
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
289
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
290
|
+
WASM_VECTOR_LEN = arg.length;
|
|
291
|
+
return ptr;
|
|
292
|
+
}
|
|
214
293
|
|
|
215
294
|
function getArrayU8FromWasm0(ptr, len) {
|
|
216
295
|
ptr = ptr >>> 0;
|
|
217
296
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
218
297
|
}
|
|
298
|
+
/**
|
|
299
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
300
|
+
* @param {Uint8Array} inputs
|
|
301
|
+
* @returns {Uint8Array}
|
|
302
|
+
*/
|
|
303
|
+
export function blake2s256(inputs) {
|
|
304
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
305
|
+
const len0 = WASM_VECTOR_LEN;
|
|
306
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
307
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
308
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
309
|
+
return v2;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
314
|
+
* @param {Uint8Array} hashed_msg
|
|
315
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
316
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
317
|
+
* @param {Uint8Array} signature
|
|
318
|
+
* @returns {boolean}
|
|
319
|
+
*/
|
|
320
|
+
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
321
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
322
|
+
const len0 = WASM_VECTOR_LEN;
|
|
323
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
324
|
+
const len1 = WASM_VECTOR_LEN;
|
|
325
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
326
|
+
const len2 = WASM_VECTOR_LEN;
|
|
327
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
328
|
+
const len3 = WASM_VECTOR_LEN;
|
|
329
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
330
|
+
return ret !== 0;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
335
|
+
* @param {Uint8Array} hashed_msg
|
|
336
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
337
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
338
|
+
* @param {Uint8Array} signature
|
|
339
|
+
* @returns {boolean}
|
|
340
|
+
*/
|
|
341
|
+
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
342
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
343
|
+
const len0 = WASM_VECTOR_LEN;
|
|
344
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
345
|
+
const len1 = WASM_VECTOR_LEN;
|
|
346
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
347
|
+
const len2 = WASM_VECTOR_LEN;
|
|
348
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
349
|
+
const len3 = WASM_VECTOR_LEN;
|
|
350
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
351
|
+
return ret !== 0;
|
|
352
|
+
}
|
|
353
|
+
|
|
219
354
|
/**
|
|
220
355
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
221
356
|
*
|
|
@@ -232,12 +367,6 @@ export function compressWitness(witness_map) {
|
|
|
232
367
|
return v1;
|
|
233
368
|
}
|
|
234
369
|
|
|
235
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
236
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
237
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
238
|
-
WASM_VECTOR_LEN = arg.length;
|
|
239
|
-
return ptr;
|
|
240
|
-
}
|
|
241
370
|
/**
|
|
242
371
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
243
372
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -333,20 +462,6 @@ export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
|
333
462
|
return ret;
|
|
334
463
|
}
|
|
335
464
|
|
|
336
|
-
/**
|
|
337
|
-
* Sets the package's logging level.
|
|
338
|
-
*
|
|
339
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
340
|
-
*/
|
|
341
|
-
export function initLogLevel(filter) {
|
|
342
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
343
|
-
const len0 = WASM_VECTOR_LEN;
|
|
344
|
-
const ret = wasm.initLogLevel(ptr0, len0);
|
|
345
|
-
if (ret[1]) {
|
|
346
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
347
|
-
}
|
|
348
|
-
}
|
|
349
|
-
|
|
350
465
|
/**
|
|
351
466
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
352
467
|
*
|
|
@@ -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.closure445_externref_shim(arg0, arg1, arg2);
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
530
|
-
wasm.
|
|
530
|
+
wasm.closure921_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.closure925_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_wrapper1365 = function(arg0, arg1, arg2) {
|
|
801
|
+
const ret = makeMutClosure(arg0, arg1, 446, __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
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const buildInfo: () => any;
|
|
5
|
+
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
6
|
+
export const and: (a: any, b: any) => any;
|
|
7
|
+
export const xor: (a: any, b: any) => any;
|
|
8
|
+
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
9
|
+
export const blake2s256: (a: number, b: number) => [number, number];
|
|
10
|
+
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
11
|
+
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
5
12
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
6
13
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
7
14
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -9,16 +16,9 @@ export const decompressWitnessStack: (a: number, b: number) => [number, number,
|
|
|
9
16
|
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
10
17
|
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
11
18
|
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
12
|
-
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 closure445_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure921_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure925_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|