@aztec/noir-acvm_js 0.0.1-commit.96dac018d → 0.0.1-commit.993d52e
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 +58 -58
- package/nodejs/acvm_js.js +153 -154
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +8 -8
- package/package.json +3 -3
- package/web/acvm_js.d.ts +66 -66
- package/web/acvm_js.js +152 -153
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +8 -8
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
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;
|
|
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;
|
|
3
38
|
/**
|
|
4
39
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
5
40
|
*
|
|
@@ -81,64 +116,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
81
116
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
82
117
|
*/
|
|
83
118
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
84
|
-
/**
|
|
85
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
86
|
-
*/
|
|
87
|
-
export function and(lhs: string, rhs: string): string;
|
|
88
|
-
/**
|
|
89
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
90
|
-
*/
|
|
91
|
-
export function xor(lhs: string, rhs: string): string;
|
|
92
|
-
/**
|
|
93
|
-
* Sha256 compression function
|
|
94
|
-
*/
|
|
95
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
96
|
-
/**
|
|
97
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
98
|
-
*/
|
|
99
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
100
|
-
/**
|
|
101
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
102
|
-
*/
|
|
103
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
104
|
-
/**
|
|
105
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
106
|
-
*/
|
|
107
|
-
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
108
|
-
/**
|
|
109
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
110
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
111
|
-
*/
|
|
112
|
-
export function buildInfo(): BuildInfo;
|
|
113
|
-
/**
|
|
114
|
-
* Sets the package's logging level.
|
|
115
|
-
*
|
|
116
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
117
|
-
*/
|
|
118
|
-
export function initLogLevel(filter: string): void;
|
|
119
|
-
|
|
120
|
-
export type RawAssertionPayload = {
|
|
121
|
-
selector: string;
|
|
122
|
-
data: string[];
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export type ExecutionError = Error & {
|
|
126
|
-
callStack?: string[];
|
|
127
|
-
rawAssertionPayload?: RawAssertionPayload;
|
|
128
|
-
acirFunctionId?: number;
|
|
129
|
-
brilligFunctionId?: number;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
export type StackItem = {
|
|
135
|
-
index: number;
|
|
136
|
-
witness: WitnessMap;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export type WitnessStack = Array<StackItem>;
|
|
140
|
-
|
|
141
|
-
|
|
142
119
|
|
|
143
120
|
/**
|
|
144
121
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -169,6 +146,29 @@ export type SolvedAndReturnWitness = {
|
|
|
169
146
|
|
|
170
147
|
|
|
171
148
|
|
|
149
|
+
export type StackItem = {
|
|
150
|
+
index: number;
|
|
151
|
+
witness: WitnessMap;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export type WitnessStack = Array<StackItem>;
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
export type RawAssertionPayload = {
|
|
159
|
+
selector: string;
|
|
160
|
+
data: string[];
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export type ExecutionError = Error & {
|
|
164
|
+
callStack?: string[];
|
|
165
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
166
|
+
acirFunctionId?: number;
|
|
167
|
+
brilligFunctionId?: number;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
172
|
export type ForeignCallInput = string[]
|
|
173
173
|
export type ForeignCallOutput = string | string[]
|
|
174
174
|
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -201,17 +201,160 @@ 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);
|
|
207
215
|
wasm.__externref_table_dealloc(idx);
|
|
208
216
|
return value;
|
|
209
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
|
+
}
|
|
210
297
|
|
|
211
298
|
function getArrayU8FromWasm0(ptr, len) {
|
|
212
299
|
ptr = ptr >>> 0;
|
|
213
300
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
214
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
|
+
|
|
215
358
|
/**
|
|
216
359
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
217
360
|
*
|
|
@@ -228,12 +371,6 @@ module.exports.compressWitness = function(witness_map) {
|
|
|
228
371
|
return v1;
|
|
229
372
|
};
|
|
230
373
|
|
|
231
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
232
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
233
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
234
|
-
WASM_VECTOR_LEN = arg.length;
|
|
235
|
-
return ptr;
|
|
236
|
-
}
|
|
237
374
|
/**
|
|
238
375
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
239
376
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -389,144 +526,6 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
389
526
|
return takeFromExternrefTable0(ret[0]);
|
|
390
527
|
};
|
|
391
528
|
|
|
392
|
-
/**
|
|
393
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
394
|
-
* @param {string} lhs
|
|
395
|
-
* @param {string} rhs
|
|
396
|
-
* @returns {string}
|
|
397
|
-
*/
|
|
398
|
-
module.exports.and = function(lhs, rhs) {
|
|
399
|
-
const ret = wasm.and(lhs, rhs);
|
|
400
|
-
return ret;
|
|
401
|
-
};
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
405
|
-
* @param {string} lhs
|
|
406
|
-
* @param {string} rhs
|
|
407
|
-
* @returns {string}
|
|
408
|
-
*/
|
|
409
|
-
module.exports.xor = function(lhs, rhs) {
|
|
410
|
-
const ret = wasm.xor(lhs, rhs);
|
|
411
|
-
return ret;
|
|
412
|
-
};
|
|
413
|
-
|
|
414
|
-
let cachedUint32ArrayMemory0 = null;
|
|
415
|
-
|
|
416
|
-
function getUint32ArrayMemory0() {
|
|
417
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
418
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
419
|
-
}
|
|
420
|
-
return cachedUint32ArrayMemory0;
|
|
421
|
-
}
|
|
422
|
-
|
|
423
|
-
function passArray32ToWasm0(arg, malloc) {
|
|
424
|
-
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
425
|
-
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
426
|
-
WASM_VECTOR_LEN = arg.length;
|
|
427
|
-
return ptr;
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
431
|
-
ptr = ptr >>> 0;
|
|
432
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
433
|
-
}
|
|
434
|
-
/**
|
|
435
|
-
* Sha256 compression function
|
|
436
|
-
* @param {Uint32Array} inputs
|
|
437
|
-
* @param {Uint32Array} state
|
|
438
|
-
* @returns {Uint32Array}
|
|
439
|
-
*/
|
|
440
|
-
module.exports.sha256_compression = function(inputs, state) {
|
|
441
|
-
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
442
|
-
const len0 = WASM_VECTOR_LEN;
|
|
443
|
-
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
444
|
-
const len1 = WASM_VECTOR_LEN;
|
|
445
|
-
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
446
|
-
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
447
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
448
|
-
return v3;
|
|
449
|
-
};
|
|
450
|
-
|
|
451
|
-
/**
|
|
452
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
453
|
-
* @param {Uint8Array} inputs
|
|
454
|
-
* @returns {Uint8Array}
|
|
455
|
-
*/
|
|
456
|
-
module.exports.blake2s256 = function(inputs) {
|
|
457
|
-
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
458
|
-
const len0 = WASM_VECTOR_LEN;
|
|
459
|
-
const ret = wasm.blake2s256(ptr0, len0);
|
|
460
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
461
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
462
|
-
return v2;
|
|
463
|
-
};
|
|
464
|
-
|
|
465
|
-
/**
|
|
466
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
467
|
-
* @param {Uint8Array} hashed_msg
|
|
468
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
469
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
470
|
-
* @param {Uint8Array} signature
|
|
471
|
-
* @returns {boolean}
|
|
472
|
-
*/
|
|
473
|
-
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
474
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
475
|
-
const len0 = WASM_VECTOR_LEN;
|
|
476
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
477
|
-
const len1 = WASM_VECTOR_LEN;
|
|
478
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
479
|
-
const len2 = WASM_VECTOR_LEN;
|
|
480
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
481
|
-
const len3 = WASM_VECTOR_LEN;
|
|
482
|
-
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
483
|
-
return ret !== 0;
|
|
484
|
-
};
|
|
485
|
-
|
|
486
|
-
/**
|
|
487
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
488
|
-
* @param {Uint8Array} hashed_msg
|
|
489
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
490
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
491
|
-
* @param {Uint8Array} signature
|
|
492
|
-
* @returns {boolean}
|
|
493
|
-
*/
|
|
494
|
-
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
495
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
496
|
-
const len0 = WASM_VECTOR_LEN;
|
|
497
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
498
|
-
const len1 = WASM_VECTOR_LEN;
|
|
499
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
500
|
-
const len2 = WASM_VECTOR_LEN;
|
|
501
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
502
|
-
const len3 = WASM_VECTOR_LEN;
|
|
503
|
-
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
504
|
-
return ret !== 0;
|
|
505
|
-
};
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
509
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
510
|
-
*/
|
|
511
|
-
module.exports.buildInfo = function() {
|
|
512
|
-
const ret = wasm.buildInfo();
|
|
513
|
-
return ret;
|
|
514
|
-
};
|
|
515
|
-
|
|
516
|
-
/**
|
|
517
|
-
* Sets the package's logging level.
|
|
518
|
-
*
|
|
519
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
520
|
-
*/
|
|
521
|
-
module.exports.initLogLevel = function(filter) {
|
|
522
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
523
|
-
const len0 = WASM_VECTOR_LEN;
|
|
524
|
-
const ret = wasm.initLogLevel(ptr0, len0);
|
|
525
|
-
if (ret[1]) {
|
|
526
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
527
|
-
}
|
|
528
|
-
};
|
|
529
|
-
|
|
530
529
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
531
530
|
wasm.closure445_externref_shim(arg0, arg1, arg2);
|
|
532
531
|
}
|
|
@@ -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
|
};
|
|
@@ -675,11 +674,6 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
|
675
674
|
}
|
|
676
675
|
};
|
|
677
676
|
|
|
678
|
-
module.exports.__wbg_new_2812f5f6a6bd8bcf = function() {
|
|
679
|
-
const ret = new Array();
|
|
680
|
-
return ret;
|
|
681
|
-
};
|
|
682
|
-
|
|
683
677
|
module.exports.__wbg_new_5e0be73521bc8c17 = function() {
|
|
684
678
|
const ret = new Map();
|
|
685
679
|
return ret;
|
|
@@ -695,8 +689,8 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
|
|
|
695
689
|
return ret;
|
|
696
690
|
};
|
|
697
691
|
|
|
698
|
-
module.exports.
|
|
699
|
-
const ret = new
|
|
692
|
+
module.exports.__wbg_new_9f501325818b4158 = function() {
|
|
693
|
+
const ret = new Array();
|
|
700
694
|
return ret;
|
|
701
695
|
};
|
|
702
696
|
|
|
@@ -705,6 +699,11 @@ module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
|
|
|
705
699
|
return ret;
|
|
706
700
|
};
|
|
707
701
|
|
|
702
|
+
module.exports.__wbg_new_ec40611a7805f1f0 = function() {
|
|
703
|
+
const ret = new Map();
|
|
704
|
+
return ret;
|
|
705
|
+
};
|
|
706
|
+
|
|
708
707
|
module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
709
708
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
710
709
|
return ret;
|
|
@@ -814,7 +813,7 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
814
813
|
return ret;
|
|
815
814
|
};
|
|
816
815
|
|
|
817
|
-
module.exports.
|
|
816
|
+
module.exports.__wbindgen_closure_wrapper1364 = function(arg0, arg1, arg2) {
|
|
818
817
|
const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
|
|
819
818
|
return ret;
|
|
820
819
|
};
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
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;
|
|
4
12
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
5
13
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
6
14
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -11,14 +19,6 @@ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
|
11
19
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
12
20
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
13
21
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
14
|
-
export const and: (a: any, b: any) => any;
|
|
15
|
-
export const xor: (a: any, b: any) => any;
|
|
16
|
-
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
17
|
-
export const blake2s256: (a: number, b: number) => [number, number];
|
|
18
|
-
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
19
|
-
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
20
|
-
export const buildInfo: () => any;
|
|
21
|
-
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
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.993d52e",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@esm-bundle/chai": "^4.3.4-fix.0",
|
|
41
|
-
"@web/dev-server-esbuild": "^1.0.
|
|
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
44
|
"chai": "^6.2.2",
|
|
45
|
-
"eslint": "^
|
|
45
|
+
"eslint": "^9.39.2",
|
|
46
46
|
"eslint-plugin-prettier": "^5.5.5",
|
|
47
47
|
"mocha": "^11.7.5",
|
|
48
48
|
"prettier": "3.8.1",
|
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
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;
|
|
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;
|
|
3
38
|
/**
|
|
4
39
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
5
40
|
*
|
|
@@ -81,64 +116,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
81
116
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
82
117
|
*/
|
|
83
118
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
84
|
-
/**
|
|
85
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
86
|
-
*/
|
|
87
|
-
export function and(lhs: string, rhs: string): string;
|
|
88
|
-
/**
|
|
89
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
90
|
-
*/
|
|
91
|
-
export function xor(lhs: string, rhs: string): string;
|
|
92
|
-
/**
|
|
93
|
-
* Sha256 compression function
|
|
94
|
-
*/
|
|
95
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
96
|
-
/**
|
|
97
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
98
|
-
*/
|
|
99
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
100
|
-
/**
|
|
101
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
102
|
-
*/
|
|
103
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
104
|
-
/**
|
|
105
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
106
|
-
*/
|
|
107
|
-
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
108
|
-
/**
|
|
109
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
110
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
111
|
-
*/
|
|
112
|
-
export function buildInfo(): BuildInfo;
|
|
113
|
-
/**
|
|
114
|
-
* Sets the package's logging level.
|
|
115
|
-
*
|
|
116
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
117
|
-
*/
|
|
118
|
-
export function initLogLevel(filter: string): void;
|
|
119
|
-
|
|
120
|
-
export type RawAssertionPayload = {
|
|
121
|
-
selector: string;
|
|
122
|
-
data: string[];
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
export type ExecutionError = Error & {
|
|
126
|
-
callStack?: string[];
|
|
127
|
-
rawAssertionPayload?: RawAssertionPayload;
|
|
128
|
-
acirFunctionId?: number;
|
|
129
|
-
brilligFunctionId?: number;
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
export type StackItem = {
|
|
135
|
-
index: number;
|
|
136
|
-
witness: WitnessMap;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export type WitnessStack = Array<StackItem>;
|
|
140
|
-
|
|
141
|
-
|
|
142
119
|
|
|
143
120
|
/**
|
|
144
121
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -169,6 +146,29 @@ export type SolvedAndReturnWitness = {
|
|
|
169
146
|
|
|
170
147
|
|
|
171
148
|
|
|
149
|
+
export type StackItem = {
|
|
150
|
+
index: number;
|
|
151
|
+
witness: WitnessMap;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export type WitnessStack = Array<StackItem>;
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
export type RawAssertionPayload = {
|
|
159
|
+
selector: string;
|
|
160
|
+
data: string[];
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
export type ExecutionError = Error & {
|
|
164
|
+
callStack?: string[];
|
|
165
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
166
|
+
acirFunctionId?: number;
|
|
167
|
+
brilligFunctionId?: number;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
172
|
export type ForeignCallInput = string[]
|
|
173
173
|
export type ForeignCallOutput = string | string[]
|
|
174
174
|
|
|
@@ -187,6 +187,14 @@ 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;
|
|
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;
|
|
190
198
|
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
191
199
|
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
192
200
|
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -197,14 +205,6 @@ export interface InitOutput {
|
|
|
197
205
|
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
198
206
|
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
199
207
|
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
200
|
-
readonly and: (a: any, b: any) => any;
|
|
201
|
-
readonly xor: (a: any, b: any) => any;
|
|
202
|
-
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
203
|
-
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
204
|
-
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
205
|
-
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
206
|
-
readonly buildInfo: () => any;
|
|
207
|
-
readonly initLogLevel: (a: number, b: number) => [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;
|
package/web/acvm_js.js
CHANGED
|
@@ -197,17 +197,160 @@ 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);
|
|
203
211
|
wasm.__externref_table_dealloc(idx);
|
|
204
212
|
return value;
|
|
205
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
|
+
}
|
|
206
293
|
|
|
207
294
|
function getArrayU8FromWasm0(ptr, len) {
|
|
208
295
|
ptr = ptr >>> 0;
|
|
209
296
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
210
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
|
+
|
|
211
354
|
/**
|
|
212
355
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
213
356
|
*
|
|
@@ -224,12 +367,6 @@ export function compressWitness(witness_map) {
|
|
|
224
367
|
return v1;
|
|
225
368
|
}
|
|
226
369
|
|
|
227
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
228
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
229
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
230
|
-
WASM_VECTOR_LEN = arg.length;
|
|
231
|
-
return ptr;
|
|
232
|
-
}
|
|
233
370
|
/**
|
|
234
371
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
235
372
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -385,144 +522,6 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
385
522
|
return takeFromExternrefTable0(ret[0]);
|
|
386
523
|
}
|
|
387
524
|
|
|
388
|
-
/**
|
|
389
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
390
|
-
* @param {string} lhs
|
|
391
|
-
* @param {string} rhs
|
|
392
|
-
* @returns {string}
|
|
393
|
-
*/
|
|
394
|
-
export function and(lhs, rhs) {
|
|
395
|
-
const ret = wasm.and(lhs, rhs);
|
|
396
|
-
return ret;
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
/**
|
|
400
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
401
|
-
* @param {string} lhs
|
|
402
|
-
* @param {string} rhs
|
|
403
|
-
* @returns {string}
|
|
404
|
-
*/
|
|
405
|
-
export function xor(lhs, rhs) {
|
|
406
|
-
const ret = wasm.xor(lhs, rhs);
|
|
407
|
-
return ret;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
let cachedUint32ArrayMemory0 = null;
|
|
411
|
-
|
|
412
|
-
function getUint32ArrayMemory0() {
|
|
413
|
-
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
414
|
-
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
415
|
-
}
|
|
416
|
-
return cachedUint32ArrayMemory0;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
function passArray32ToWasm0(arg, malloc) {
|
|
420
|
-
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
421
|
-
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
422
|
-
WASM_VECTOR_LEN = arg.length;
|
|
423
|
-
return ptr;
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
function getArrayU32FromWasm0(ptr, len) {
|
|
427
|
-
ptr = ptr >>> 0;
|
|
428
|
-
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
429
|
-
}
|
|
430
|
-
/**
|
|
431
|
-
* Sha256 compression function
|
|
432
|
-
* @param {Uint32Array} inputs
|
|
433
|
-
* @param {Uint32Array} state
|
|
434
|
-
* @returns {Uint32Array}
|
|
435
|
-
*/
|
|
436
|
-
export function sha256_compression(inputs, state) {
|
|
437
|
-
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
438
|
-
const len0 = WASM_VECTOR_LEN;
|
|
439
|
-
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
440
|
-
const len1 = WASM_VECTOR_LEN;
|
|
441
|
-
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
442
|
-
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
443
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
444
|
-
return v3;
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
449
|
-
* @param {Uint8Array} inputs
|
|
450
|
-
* @returns {Uint8Array}
|
|
451
|
-
*/
|
|
452
|
-
export function blake2s256(inputs) {
|
|
453
|
-
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
454
|
-
const len0 = WASM_VECTOR_LEN;
|
|
455
|
-
const ret = wasm.blake2s256(ptr0, len0);
|
|
456
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
457
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
458
|
-
return v2;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
/**
|
|
462
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
463
|
-
* @param {Uint8Array} hashed_msg
|
|
464
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
465
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
466
|
-
* @param {Uint8Array} signature
|
|
467
|
-
* @returns {boolean}
|
|
468
|
-
*/
|
|
469
|
-
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
470
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
471
|
-
const len0 = WASM_VECTOR_LEN;
|
|
472
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
473
|
-
const len1 = WASM_VECTOR_LEN;
|
|
474
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
475
|
-
const len2 = WASM_VECTOR_LEN;
|
|
476
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
477
|
-
const len3 = WASM_VECTOR_LEN;
|
|
478
|
-
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
479
|
-
return ret !== 0;
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
/**
|
|
483
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
484
|
-
* @param {Uint8Array} hashed_msg
|
|
485
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
486
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
487
|
-
* @param {Uint8Array} signature
|
|
488
|
-
* @returns {boolean}
|
|
489
|
-
*/
|
|
490
|
-
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
491
|
-
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
492
|
-
const len0 = WASM_VECTOR_LEN;
|
|
493
|
-
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
494
|
-
const len1 = WASM_VECTOR_LEN;
|
|
495
|
-
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
496
|
-
const len2 = WASM_VECTOR_LEN;
|
|
497
|
-
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
498
|
-
const len3 = WASM_VECTOR_LEN;
|
|
499
|
-
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
500
|
-
return ret !== 0;
|
|
501
|
-
}
|
|
502
|
-
|
|
503
|
-
/**
|
|
504
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
505
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
506
|
-
*/
|
|
507
|
-
export function buildInfo() {
|
|
508
|
-
const ret = wasm.buildInfo();
|
|
509
|
-
return ret;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
/**
|
|
513
|
-
* Sets the package's logging level.
|
|
514
|
-
*
|
|
515
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
516
|
-
*/
|
|
517
|
-
export function initLogLevel(filter) {
|
|
518
|
-
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
519
|
-
const len0 = WASM_VECTOR_LEN;
|
|
520
|
-
const ret = wasm.initLogLevel(ptr0, len0);
|
|
521
|
-
if (ret[1]) {
|
|
522
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
|
|
526
525
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
527
526
|
wasm.closure445_externref_shim(arg0, arg1, arg2);
|
|
528
527
|
}
|
|
@@ -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
|
};
|
|
@@ -686,10 +685,6 @@ function __wbg_get_imports() {
|
|
|
686
685
|
state0.a = state0.b = 0;
|
|
687
686
|
}
|
|
688
687
|
};
|
|
689
|
-
imports.wbg.__wbg_new_2812f5f6a6bd8bcf = function() {
|
|
690
|
-
const ret = new Array();
|
|
691
|
-
return ret;
|
|
692
|
-
};
|
|
693
688
|
imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
|
|
694
689
|
const ret = new Map();
|
|
695
690
|
return ret;
|
|
@@ -702,14 +697,18 @@ function __wbg_get_imports() {
|
|
|
702
697
|
const ret = new Error();
|
|
703
698
|
return ret;
|
|
704
699
|
};
|
|
705
|
-
imports.wbg.
|
|
706
|
-
const ret = new
|
|
700
|
+
imports.wbg.__wbg_new_9f501325818b4158 = function() {
|
|
701
|
+
const ret = new Array();
|
|
707
702
|
return ret;
|
|
708
703
|
};
|
|
709
704
|
imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
|
|
710
705
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
711
706
|
return ret;
|
|
712
707
|
};
|
|
708
|
+
imports.wbg.__wbg_new_ec40611a7805f1f0 = function() {
|
|
709
|
+
const ret = new Map();
|
|
710
|
+
return ret;
|
|
711
|
+
};
|
|
713
712
|
imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
714
713
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
715
714
|
return ret;
|
|
@@ -798,7 +797,7 @@ function __wbg_get_imports() {
|
|
|
798
797
|
const ret = false;
|
|
799
798
|
return ret;
|
|
800
799
|
};
|
|
801
|
-
imports.wbg.
|
|
800
|
+
imports.wbg.__wbindgen_closure_wrapper1364 = function(arg0, arg1, arg2) {
|
|
802
801
|
const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
|
|
803
802
|
return ret;
|
|
804
803
|
};
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
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;
|
|
4
12
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
5
13
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
6
14
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -11,14 +19,6 @@ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
|
11
19
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
12
20
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
13
21
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
14
|
-
export const and: (a: any, b: any) => any;
|
|
15
|
-
export const xor: (a: any, b: any) => any;
|
|
16
|
-
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
17
|
-
export const blake2s256: (a: number, b: number) => [number, number];
|
|
18
|
-
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
19
|
-
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
20
|
-
export const buildInfo: () => any;
|
|
21
|
-
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|