@aztec/noir-acvm_js 3.0.0-nightly.20251007 → 3.0.0-nightly.20251009
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 +49 -49
- package/nodejs/acvm_js.js +143 -143
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +10 -10
- package/package.json +1 -1
- package/web/acvm_js.d.ts +59 -59
- package/web/acvm_js.js +142 -142
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +10 -10
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
4
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
7
5
|
*/
|
|
8
|
-
export function
|
|
6
|
+
export function and(lhs: string, rhs: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
9
|
+
*/
|
|
10
|
+
export function xor(lhs: string, rhs: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Sha256 compression function
|
|
13
|
+
*/
|
|
14
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
15
|
+
/**
|
|
16
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
17
|
+
*/
|
|
18
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
19
|
+
/**
|
|
20
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
21
|
+
*/
|
|
22
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
25
|
+
*/
|
|
26
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
9
27
|
/**
|
|
10
28
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
11
29
|
*
|
|
@@ -93,38 +111,11 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
93
111
|
*/
|
|
94
112
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
95
113
|
/**
|
|
96
|
-
*
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
101
|
-
*/
|
|
102
|
-
export function xor(lhs: string, rhs: string): string;
|
|
103
|
-
/**
|
|
104
|
-
* Sha256 compression function
|
|
105
|
-
*/
|
|
106
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
107
|
-
/**
|
|
108
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
109
|
-
*/
|
|
110
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
111
|
-
/**
|
|
112
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
113
|
-
*/
|
|
114
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
114
|
+
* Sets the package's logging level.
|
|
115
|
+
*
|
|
116
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
117
117
|
*/
|
|
118
|
-
export function
|
|
119
|
-
|
|
120
|
-
export type StackItem = {
|
|
121
|
-
index: number;
|
|
122
|
-
witness: WitnessMap;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export type WitnessStack = Array<StackItem>;
|
|
126
|
-
|
|
127
|
-
|
|
118
|
+
export function initLogLevel(filter: string): void;
|
|
128
119
|
|
|
129
120
|
/**
|
|
130
121
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -140,20 +131,6 @@ export type BuildInfo = {
|
|
|
140
131
|
|
|
141
132
|
|
|
142
133
|
|
|
143
|
-
export type ForeignCallInput = string[]
|
|
144
|
-
export type ForeignCallOutput = string | string[]
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* A callback which performs an foreign call and returns the response.
|
|
148
|
-
* @callback ForeignCallHandler
|
|
149
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
150
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
151
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
152
|
-
*/
|
|
153
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
134
|
export type RawAssertionPayload = {
|
|
158
135
|
selector: string;
|
|
159
136
|
data: string[];
|
|
@@ -182,3 +159,26 @@ export type SolvedAndReturnWitness = {
|
|
|
182
159
|
}
|
|
183
160
|
|
|
184
161
|
|
|
162
|
+
|
|
163
|
+
export type StackItem = {
|
|
164
|
+
index: number;
|
|
165
|
+
witness: WitnessMap;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export type WitnessStack = Array<StackItem>;
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
export type ForeignCallInput = string[]
|
|
173
|
+
export type ForeignCallOutput = string | string[]
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* A callback which performs an foreign call and returns the response.
|
|
177
|
+
* @callback ForeignCallHandler
|
|
178
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
179
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
180
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
181
|
+
*/
|
|
182
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
183
|
+
|
|
184
|
+
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -201,30 +201,137 @@ 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
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
206
|
+
* @param {string} lhs
|
|
207
|
+
* @param {string} rhs
|
|
208
|
+
* @returns {string}
|
|
209
|
+
*/
|
|
210
|
+
module.exports.and = function(lhs, rhs) {
|
|
211
|
+
const ret = wasm.and(lhs, rhs);
|
|
212
|
+
return ret;
|
|
213
|
+
};
|
|
204
214
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
215
|
+
/**
|
|
216
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
217
|
+
* @param {string} lhs
|
|
218
|
+
* @param {string} rhs
|
|
219
|
+
* @returns {string}
|
|
220
|
+
*/
|
|
221
|
+
module.exports.xor = function(lhs, rhs) {
|
|
222
|
+
const ret = wasm.xor(lhs, rhs);
|
|
223
|
+
return ret;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
let cachedUint32ArrayMemory0 = null;
|
|
227
|
+
|
|
228
|
+
function getUint32ArrayMemory0() {
|
|
229
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
230
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
231
|
+
}
|
|
232
|
+
return cachedUint32ArrayMemory0;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
236
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
237
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
238
|
+
WASM_VECTOR_LEN = arg.length;
|
|
239
|
+
return ptr;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
243
|
+
ptr = ptr >>> 0;
|
|
244
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
209
245
|
}
|
|
210
246
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* @param {
|
|
247
|
+
* Sha256 compression function
|
|
248
|
+
* @param {Uint32Array} inputs
|
|
249
|
+
* @param {Uint32Array} state
|
|
250
|
+
* @returns {Uint32Array}
|
|
214
251
|
*/
|
|
215
|
-
module.exports.
|
|
216
|
-
const ptr0 =
|
|
252
|
+
module.exports.sha256_compression = function(inputs, state) {
|
|
253
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
217
254
|
const len0 = WASM_VECTOR_LEN;
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
255
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
256
|
+
const len1 = WASM_VECTOR_LEN;
|
|
257
|
+
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
258
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
259
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
260
|
+
return v3;
|
|
222
261
|
};
|
|
223
262
|
|
|
263
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
264
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
265
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
266
|
+
WASM_VECTOR_LEN = arg.length;
|
|
267
|
+
return ptr;
|
|
268
|
+
}
|
|
269
|
+
|
|
224
270
|
function getArrayU8FromWasm0(ptr, len) {
|
|
225
271
|
ptr = ptr >>> 0;
|
|
226
272
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
227
273
|
}
|
|
274
|
+
/**
|
|
275
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
276
|
+
* @param {Uint8Array} inputs
|
|
277
|
+
* @returns {Uint8Array}
|
|
278
|
+
*/
|
|
279
|
+
module.exports.blake2s256 = function(inputs) {
|
|
280
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
281
|
+
const len0 = WASM_VECTOR_LEN;
|
|
282
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
283
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
284
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
285
|
+
return v2;
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
290
|
+
* @param {Uint8Array} hashed_msg
|
|
291
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
292
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
293
|
+
* @param {Uint8Array} signature
|
|
294
|
+
* @returns {boolean}
|
|
295
|
+
*/
|
|
296
|
+
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
297
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
298
|
+
const len0 = WASM_VECTOR_LEN;
|
|
299
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
300
|
+
const len1 = WASM_VECTOR_LEN;
|
|
301
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
302
|
+
const len2 = WASM_VECTOR_LEN;
|
|
303
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
304
|
+
const len3 = WASM_VECTOR_LEN;
|
|
305
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
306
|
+
return ret !== 0;
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
311
|
+
* @param {Uint8Array} hashed_msg
|
|
312
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
313
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
314
|
+
* @param {Uint8Array} signature
|
|
315
|
+
* @returns {boolean}
|
|
316
|
+
*/
|
|
317
|
+
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
318
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
319
|
+
const len0 = WASM_VECTOR_LEN;
|
|
320
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
321
|
+
const len1 = WASM_VECTOR_LEN;
|
|
322
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
323
|
+
const len2 = WASM_VECTOR_LEN;
|
|
324
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
325
|
+
const len3 = WASM_VECTOR_LEN;
|
|
326
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
327
|
+
return ret !== 0;
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
function takeFromExternrefTable0(idx) {
|
|
331
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
332
|
+
wasm.__externref_table_dealloc(idx);
|
|
333
|
+
return value;
|
|
334
|
+
}
|
|
228
335
|
/**
|
|
229
336
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
230
337
|
*
|
|
@@ -241,12 +348,6 @@ module.exports.compressWitness = function(witness_map) {
|
|
|
241
348
|
return v1;
|
|
242
349
|
};
|
|
243
350
|
|
|
244
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
245
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
246
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
247
|
-
WASM_VECTOR_LEN = arg.length;
|
|
248
|
-
return ptr;
|
|
249
|
-
}
|
|
250
351
|
/**
|
|
251
352
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
252
353
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -412,130 +513,29 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
412
513
|
};
|
|
413
514
|
|
|
414
515
|
/**
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
* @param {
|
|
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}
|
|
516
|
+
* Sets the package's logging level.
|
|
517
|
+
*
|
|
518
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
515
519
|
*/
|
|
516
|
-
module.exports.
|
|
517
|
-
const ptr0 =
|
|
520
|
+
module.exports.initLogLevel = function(filter) {
|
|
521
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
518
522
|
const len0 = WASM_VECTOR_LEN;
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
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;
|
|
523
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
524
|
+
if (ret[1]) {
|
|
525
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
526
|
+
}
|
|
527
527
|
};
|
|
528
528
|
|
|
529
529
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
530
|
-
wasm.
|
|
530
|
+
wasm.closure581_externref_shim(arg0, arg1, arg2);
|
|
531
531
|
}
|
|
532
532
|
|
|
533
533
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
534
|
-
wasm.
|
|
534
|
+
wasm.closure1176_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.closure1180_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_590e27d4519f5f72 = 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_6f86ae2adbcd1779 = function(arg0) {
|
|
562
562
|
const ret = new Error(arg0);
|
|
563
563
|
return ret;
|
|
564
564
|
};
|
|
@@ -674,11 +674,6 @@ module.exports.__wbg_new_23a2665fac83c611 = function(arg0, arg1) {
|
|
|
674
674
|
}
|
|
675
675
|
};
|
|
676
676
|
|
|
677
|
-
module.exports.__wbg_new_5bbc7db92320b11c = function() {
|
|
678
|
-
const ret = new Array();
|
|
679
|
-
return ret;
|
|
680
|
-
};
|
|
681
|
-
|
|
682
677
|
module.exports.__wbg_new_5e0be73521bc8c17 = function() {
|
|
683
678
|
const ret = new Map();
|
|
684
679
|
return ret;
|
|
@@ -694,8 +689,8 @@ module.exports.__wbg_new_8a6f238a6ece86ea = function() {
|
|
|
694
689
|
return ret;
|
|
695
690
|
};
|
|
696
691
|
|
|
697
|
-
module.exports.
|
|
698
|
-
const ret = new
|
|
692
|
+
module.exports.__wbg_new_af7b60fde1e58f1b = function() {
|
|
693
|
+
const ret = new Array();
|
|
699
694
|
return ret;
|
|
700
695
|
};
|
|
701
696
|
|
|
@@ -704,6 +699,11 @@ module.exports.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
|
|
|
704
699
|
return ret;
|
|
705
700
|
};
|
|
706
701
|
|
|
702
|
+
module.exports.__wbg_new_e2884e6fab20df40 = function() {
|
|
703
|
+
const ret = new Map();
|
|
704
|
+
return ret;
|
|
705
|
+
};
|
|
706
|
+
|
|
707
707
|
module.exports.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
708
708
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
709
709
|
return ret;
|
|
@@ -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_wrapper1972 = function(arg0, arg1, arg2) {
|
|
817
|
+
const ret = makeMutClosure(arg0, arg1, 582, __wbg_adapter_30);
|
|
818
818
|
return ret;
|
|
819
819
|
};
|
|
820
820
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const
|
|
4
|
+
export const and: (a: any, b: any) => any;
|
|
5
|
+
export const xor: (a: any, b: any) => any;
|
|
6
|
+
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
7
|
+
export const blake2s256: (a: number, b: number) => [number, number];
|
|
8
|
+
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
9
|
+
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
5
10
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
6
11
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
7
12
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -13,12 +18,7 @@ export const buildInfo: () => any;
|
|
|
13
18
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
14
19
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
15
20
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
16
|
-
export const
|
|
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;
|
|
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;
|
|
@@ -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 closure581_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure1176_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure1180_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,11 +1,29 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
4
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
7
5
|
*/
|
|
8
|
-
export function
|
|
6
|
+
export function and(lhs: string, rhs: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
9
|
+
*/
|
|
10
|
+
export function xor(lhs: string, rhs: string): string;
|
|
11
|
+
/**
|
|
12
|
+
* Sha256 compression function
|
|
13
|
+
*/
|
|
14
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
15
|
+
/**
|
|
16
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
17
|
+
*/
|
|
18
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
19
|
+
/**
|
|
20
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
21
|
+
*/
|
|
22
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
25
|
+
*/
|
|
26
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
9
27
|
/**
|
|
10
28
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
11
29
|
*
|
|
@@ -93,38 +111,11 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
93
111
|
*/
|
|
94
112
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
95
113
|
/**
|
|
96
|
-
*
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
101
|
-
*/
|
|
102
|
-
export function xor(lhs: string, rhs: string): string;
|
|
103
|
-
/**
|
|
104
|
-
* Sha256 compression function
|
|
105
|
-
*/
|
|
106
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
107
|
-
/**
|
|
108
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
109
|
-
*/
|
|
110
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
111
|
-
/**
|
|
112
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
113
|
-
*/
|
|
114
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
114
|
+
* Sets the package's logging level.
|
|
115
|
+
*
|
|
116
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
117
117
|
*/
|
|
118
|
-
export function
|
|
119
|
-
|
|
120
|
-
export type StackItem = {
|
|
121
|
-
index: number;
|
|
122
|
-
witness: WitnessMap;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export type WitnessStack = Array<StackItem>;
|
|
126
|
-
|
|
127
|
-
|
|
118
|
+
export function initLogLevel(filter: string): void;
|
|
128
119
|
|
|
129
120
|
/**
|
|
130
121
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -140,20 +131,6 @@ export type BuildInfo = {
|
|
|
140
131
|
|
|
141
132
|
|
|
142
133
|
|
|
143
|
-
export type ForeignCallInput = string[]
|
|
144
|
-
export type ForeignCallOutput = string | string[]
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* A callback which performs an foreign call and returns the response.
|
|
148
|
-
* @callback ForeignCallHandler
|
|
149
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
150
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
151
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
152
|
-
*/
|
|
153
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
134
|
export type RawAssertionPayload = {
|
|
158
135
|
selector: string;
|
|
159
136
|
data: string[];
|
|
@@ -183,11 +160,39 @@ export type SolvedAndReturnWitness = {
|
|
|
183
160
|
|
|
184
161
|
|
|
185
162
|
|
|
163
|
+
export type StackItem = {
|
|
164
|
+
index: number;
|
|
165
|
+
witness: WitnessMap;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export type WitnessStack = Array<StackItem>;
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
export type ForeignCallInput = string[]
|
|
173
|
+
export type ForeignCallOutput = string | string[]
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* A callback which performs an foreign call and returns the response.
|
|
177
|
+
* @callback ForeignCallHandler
|
|
178
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
179
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
180
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
181
|
+
*/
|
|
182
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
186
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
187
187
|
|
|
188
188
|
export interface InitOutput {
|
|
189
189
|
readonly memory: WebAssembly.Memory;
|
|
190
|
-
readonly
|
|
190
|
+
readonly and: (a: any, b: any) => any;
|
|
191
|
+
readonly xor: (a: any, b: any) => any;
|
|
192
|
+
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
193
|
+
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
194
|
+
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
195
|
+
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
191
196
|
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
192
197
|
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
193
198
|
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -199,12 +204,7 @@ export interface InitOutput {
|
|
|
199
204
|
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
200
205
|
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
201
206
|
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
202
|
-
readonly
|
|
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;
|
|
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;
|
|
@@ -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 closure581_externref_shim: (a: number, b: number, c: any) => void;
|
|
217
|
+
readonly closure1176_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
218
|
+
readonly closure1180_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
219
219
|
readonly __wbindgen_start: () => void;
|
|
220
220
|
}
|
|
221
221
|
|
package/web/acvm_js.js
CHANGED
|
@@ -197,30 +197,137 @@ 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
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
202
|
+
* @param {string} lhs
|
|
203
|
+
* @param {string} rhs
|
|
204
|
+
* @returns {string}
|
|
205
|
+
*/
|
|
206
|
+
export function and(lhs, rhs) {
|
|
207
|
+
const ret = wasm.and(lhs, rhs);
|
|
208
|
+
return ret;
|
|
209
|
+
}
|
|
200
210
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
211
|
+
/**
|
|
212
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
213
|
+
* @param {string} lhs
|
|
214
|
+
* @param {string} rhs
|
|
215
|
+
* @returns {string}
|
|
216
|
+
*/
|
|
217
|
+
export function xor(lhs, rhs) {
|
|
218
|
+
const ret = wasm.xor(lhs, rhs);
|
|
219
|
+
return ret;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
let cachedUint32ArrayMemory0 = null;
|
|
223
|
+
|
|
224
|
+
function getUint32ArrayMemory0() {
|
|
225
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
226
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
227
|
+
}
|
|
228
|
+
return cachedUint32ArrayMemory0;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
232
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
233
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
234
|
+
WASM_VECTOR_LEN = arg.length;
|
|
235
|
+
return ptr;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
239
|
+
ptr = ptr >>> 0;
|
|
240
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
205
241
|
}
|
|
206
242
|
/**
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
* @param {
|
|
243
|
+
* Sha256 compression function
|
|
244
|
+
* @param {Uint32Array} inputs
|
|
245
|
+
* @param {Uint32Array} state
|
|
246
|
+
* @returns {Uint32Array}
|
|
210
247
|
*/
|
|
211
|
-
export function
|
|
212
|
-
const ptr0 =
|
|
248
|
+
export function sha256_compression(inputs, state) {
|
|
249
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
213
250
|
const len0 = WASM_VECTOR_LEN;
|
|
214
|
-
const
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
251
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
252
|
+
const len1 = WASM_VECTOR_LEN;
|
|
253
|
+
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
254
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
255
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
256
|
+
return v3;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
260
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
261
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
262
|
+
WASM_VECTOR_LEN = arg.length;
|
|
263
|
+
return ptr;
|
|
218
264
|
}
|
|
219
265
|
|
|
220
266
|
function getArrayU8FromWasm0(ptr, len) {
|
|
221
267
|
ptr = ptr >>> 0;
|
|
222
268
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
223
269
|
}
|
|
270
|
+
/**
|
|
271
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
272
|
+
* @param {Uint8Array} inputs
|
|
273
|
+
* @returns {Uint8Array}
|
|
274
|
+
*/
|
|
275
|
+
export function blake2s256(inputs) {
|
|
276
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
277
|
+
const len0 = WASM_VECTOR_LEN;
|
|
278
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
279
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
280
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
281
|
+
return v2;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
286
|
+
* @param {Uint8Array} hashed_msg
|
|
287
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
288
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
289
|
+
* @param {Uint8Array} signature
|
|
290
|
+
* @returns {boolean}
|
|
291
|
+
*/
|
|
292
|
+
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
293
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
294
|
+
const len0 = WASM_VECTOR_LEN;
|
|
295
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
296
|
+
const len1 = WASM_VECTOR_LEN;
|
|
297
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
298
|
+
const len2 = WASM_VECTOR_LEN;
|
|
299
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
300
|
+
const len3 = WASM_VECTOR_LEN;
|
|
301
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
302
|
+
return ret !== 0;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
307
|
+
* @param {Uint8Array} hashed_msg
|
|
308
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
309
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
310
|
+
* @param {Uint8Array} signature
|
|
311
|
+
* @returns {boolean}
|
|
312
|
+
*/
|
|
313
|
+
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
314
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
315
|
+
const len0 = WASM_VECTOR_LEN;
|
|
316
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
317
|
+
const len1 = WASM_VECTOR_LEN;
|
|
318
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
319
|
+
const len2 = WASM_VECTOR_LEN;
|
|
320
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
321
|
+
const len3 = WASM_VECTOR_LEN;
|
|
322
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
323
|
+
return ret !== 0;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function takeFromExternrefTable0(idx) {
|
|
327
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
328
|
+
wasm.__externref_table_dealloc(idx);
|
|
329
|
+
return value;
|
|
330
|
+
}
|
|
224
331
|
/**
|
|
225
332
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
226
333
|
*
|
|
@@ -237,12 +344,6 @@ export function compressWitness(witness_map) {
|
|
|
237
344
|
return v1;
|
|
238
345
|
}
|
|
239
346
|
|
|
240
|
-
function passArray8ToWasm0(arg, malloc) {
|
|
241
|
-
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
242
|
-
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
243
|
-
WASM_VECTOR_LEN = arg.length;
|
|
244
|
-
return ptr;
|
|
245
|
-
}
|
|
246
347
|
/**
|
|
247
348
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
248
349
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -408,130 +509,29 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
408
509
|
}
|
|
409
510
|
|
|
410
511
|
/**
|
|
411
|
-
*
|
|
412
|
-
*
|
|
413
|
-
* @param {
|
|
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}
|
|
512
|
+
* Sets the package's logging level.
|
|
513
|
+
*
|
|
514
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
511
515
|
*/
|
|
512
|
-
export function
|
|
513
|
-
const ptr0 =
|
|
516
|
+
export function initLogLevel(filter) {
|
|
517
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
514
518
|
const len0 = WASM_VECTOR_LEN;
|
|
515
|
-
const
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
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;
|
|
519
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
520
|
+
if (ret[1]) {
|
|
521
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
522
|
+
}
|
|
523
523
|
}
|
|
524
524
|
|
|
525
525
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
526
|
-
wasm.
|
|
526
|
+
wasm.closure581_externref_shim(arg0, arg1, arg2);
|
|
527
527
|
}
|
|
528
528
|
|
|
529
529
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
530
|
-
wasm.
|
|
530
|
+
wasm.closure1176_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.closure1180_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_590e27d4519f5f72 = function(arg0) {
|
|
584
584
|
const ret = new Error(arg0);
|
|
585
585
|
return ret;
|
|
586
586
|
};
|
|
587
|
-
imports.wbg.
|
|
587
|
+
imports.wbg.__wbg_constructor_6f86ae2adbcd1779 = function(arg0) {
|
|
588
588
|
const ret = new Error(arg0);
|
|
589
589
|
return ret;
|
|
590
590
|
};
|
|
@@ -685,10 +685,6 @@ function __wbg_get_imports() {
|
|
|
685
685
|
state0.a = state0.b = 0;
|
|
686
686
|
}
|
|
687
687
|
};
|
|
688
|
-
imports.wbg.__wbg_new_5bbc7db92320b11c = function() {
|
|
689
|
-
const ret = new Array();
|
|
690
|
-
return ret;
|
|
691
|
-
};
|
|
692
688
|
imports.wbg.__wbg_new_5e0be73521bc8c17 = function() {
|
|
693
689
|
const ret = new Map();
|
|
694
690
|
return ret;
|
|
@@ -701,14 +697,18 @@ function __wbg_get_imports() {
|
|
|
701
697
|
const ret = new Error();
|
|
702
698
|
return ret;
|
|
703
699
|
};
|
|
704
|
-
imports.wbg.
|
|
705
|
-
const ret = new
|
|
700
|
+
imports.wbg.__wbg_new_af7b60fde1e58f1b = function() {
|
|
701
|
+
const ret = new Array();
|
|
706
702
|
return ret;
|
|
707
703
|
};
|
|
708
704
|
imports.wbg.__wbg_new_c68d7209be747379 = function(arg0, arg1) {
|
|
709
705
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
710
706
|
return ret;
|
|
711
707
|
};
|
|
708
|
+
imports.wbg.__wbg_new_e2884e6fab20df40 = function() {
|
|
709
|
+
const ret = new Map();
|
|
710
|
+
return ret;
|
|
711
|
+
};
|
|
712
712
|
imports.wbg.__wbg_newnoargs_105ed471475aaf50 = function(arg0, arg1) {
|
|
713
713
|
const ret = new Function(getStringFromWasm0(arg0, arg1));
|
|
714
714
|
return ret;
|
|
@@ -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_wrapper1972 = function(arg0, arg1, arg2) {
|
|
801
|
+
const ret = makeMutClosure(arg0, arg1, 582, __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
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export const
|
|
4
|
+
export const and: (a: any, b: any) => any;
|
|
5
|
+
export const xor: (a: any, b: any) => any;
|
|
6
|
+
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
7
|
+
export const blake2s256: (a: number, b: number) => [number, number];
|
|
8
|
+
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
9
|
+
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
5
10
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
6
11
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
7
12
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -13,12 +18,7 @@ export const buildInfo: () => any;
|
|
|
13
18
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
14
19
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
15
20
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
16
|
-
export const
|
|
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;
|
|
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;
|
|
@@ -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 closure581_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure1176_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure1180_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|