@aztec/noir-acvm_js 4.0.0-devnet.2-patch.4 → 4.0.0-devnet.3-patch.1
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 +63 -63
- package/nodejs/acvm_js.js +145 -144
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +8 -8
- package/package.json +1 -1
- package/web/acvm_js.d.ts +71 -71
- package/web/acvm_js.js +145 -144
- 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,40 +1,5 @@
|
|
|
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;
|
|
38
3
|
/**
|
|
39
4
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
40
5
|
*
|
|
@@ -116,6 +81,69 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
116
81
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
117
82
|
*/
|
|
118
83
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
84
|
+
/**
|
|
85
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
86
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
87
|
+
*/
|
|
88
|
+
export function buildInfo(): BuildInfo;
|
|
89
|
+
/**
|
|
90
|
+
* Sets the package's logging level.
|
|
91
|
+
*
|
|
92
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
93
|
+
*/
|
|
94
|
+
export function initLogLevel(filter: string): void;
|
|
95
|
+
/**
|
|
96
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
97
|
+
*/
|
|
98
|
+
export function and(lhs: string, rhs: string): string;
|
|
99
|
+
/**
|
|
100
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
101
|
+
*/
|
|
102
|
+
export function xor(lhs: string, rhs: string): string;
|
|
103
|
+
/**
|
|
104
|
+
* Sha256 compression function
|
|
105
|
+
*/
|
|
106
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
107
|
+
/**
|
|
108
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
109
|
+
*/
|
|
110
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
111
|
+
/**
|
|
112
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
113
|
+
*/
|
|
114
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
117
|
+
*/
|
|
118
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
119
|
+
|
|
120
|
+
export type ForeignCallInput = string[]
|
|
121
|
+
export type ForeignCallOutput = string | string[]
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* A callback which performs an foreign call and returns the response.
|
|
125
|
+
* @callback ForeignCallHandler
|
|
126
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
127
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
128
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
129
|
+
*/
|
|
130
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
export type RawAssertionPayload = {
|
|
135
|
+
selector: string;
|
|
136
|
+
data: string[];
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export type ExecutionError = Error & {
|
|
140
|
+
callStack?: string[];
|
|
141
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
142
|
+
acirFunctionId?: number;
|
|
143
|
+
brilligFunctionId?: number;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
|
|
119
147
|
|
|
120
148
|
/**
|
|
121
149
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -154,31 +182,3 @@ export type StackItem = {
|
|
|
154
182
|
export type WitnessStack = Array<StackItem>;
|
|
155
183
|
|
|
156
184
|
|
|
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
|
-
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,160 +201,17 @@ 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
|
-
};
|
|
212
204
|
|
|
213
205
|
function takeFromExternrefTable0(idx) {
|
|
214
206
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
215
207
|
wasm.__externref_table_dealloc(idx);
|
|
216
208
|
return value;
|
|
217
209
|
}
|
|
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
|
-
}
|
|
297
210
|
|
|
298
211
|
function getArrayU8FromWasm0(ptr, len) {
|
|
299
212
|
ptr = ptr >>> 0;
|
|
300
213
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
301
214
|
}
|
|
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
|
-
|
|
358
215
|
/**
|
|
359
216
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
360
217
|
*
|
|
@@ -371,6 +228,12 @@ module.exports.compressWitness = function(witness_map) {
|
|
|
371
228
|
return v1;
|
|
372
229
|
};
|
|
373
230
|
|
|
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
|
+
}
|
|
374
237
|
/**
|
|
375
238
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
376
239
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -526,6 +389,144 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
526
389
|
return takeFromExternrefTable0(ret[0]);
|
|
527
390
|
};
|
|
528
391
|
|
|
392
|
+
/**
|
|
393
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
394
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
395
|
+
*/
|
|
396
|
+
module.exports.buildInfo = function() {
|
|
397
|
+
const ret = wasm.buildInfo();
|
|
398
|
+
return ret;
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Sets the package's logging level.
|
|
403
|
+
*
|
|
404
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
405
|
+
*/
|
|
406
|
+
module.exports.initLogLevel = function(filter) {
|
|
407
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
408
|
+
const len0 = WASM_VECTOR_LEN;
|
|
409
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
410
|
+
if (ret[1]) {
|
|
411
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
417
|
+
* @param {string} lhs
|
|
418
|
+
* @param {string} rhs
|
|
419
|
+
* @returns {string}
|
|
420
|
+
*/
|
|
421
|
+
module.exports.and = function(lhs, rhs) {
|
|
422
|
+
const ret = wasm.and(lhs, rhs);
|
|
423
|
+
return ret;
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
428
|
+
* @param {string} lhs
|
|
429
|
+
* @param {string} rhs
|
|
430
|
+
* @returns {string}
|
|
431
|
+
*/
|
|
432
|
+
module.exports.xor = function(lhs, rhs) {
|
|
433
|
+
const ret = wasm.xor(lhs, rhs);
|
|
434
|
+
return ret;
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
let cachedUint32ArrayMemory0 = null;
|
|
438
|
+
|
|
439
|
+
function getUint32ArrayMemory0() {
|
|
440
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
441
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
442
|
+
}
|
|
443
|
+
return cachedUint32ArrayMemory0;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
447
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
448
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
449
|
+
WASM_VECTOR_LEN = arg.length;
|
|
450
|
+
return ptr;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
454
|
+
ptr = ptr >>> 0;
|
|
455
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Sha256 compression function
|
|
459
|
+
* @param {Uint32Array} inputs
|
|
460
|
+
* @param {Uint32Array} state
|
|
461
|
+
* @returns {Uint32Array}
|
|
462
|
+
*/
|
|
463
|
+
module.exports.sha256_compression = function(inputs, state) {
|
|
464
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
465
|
+
const len0 = WASM_VECTOR_LEN;
|
|
466
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
467
|
+
const len1 = WASM_VECTOR_LEN;
|
|
468
|
+
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
469
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
470
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
471
|
+
return v3;
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
/**
|
|
475
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
476
|
+
* @param {Uint8Array} inputs
|
|
477
|
+
* @returns {Uint8Array}
|
|
478
|
+
*/
|
|
479
|
+
module.exports.blake2s256 = function(inputs) {
|
|
480
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
481
|
+
const len0 = WASM_VECTOR_LEN;
|
|
482
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
483
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
484
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
485
|
+
return v2;
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
490
|
+
* @param {Uint8Array} hashed_msg
|
|
491
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
492
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
493
|
+
* @param {Uint8Array} signature
|
|
494
|
+
* @returns {boolean}
|
|
495
|
+
*/
|
|
496
|
+
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
497
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
498
|
+
const len0 = WASM_VECTOR_LEN;
|
|
499
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
500
|
+
const len1 = WASM_VECTOR_LEN;
|
|
501
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
502
|
+
const len2 = WASM_VECTOR_LEN;
|
|
503
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
504
|
+
const len3 = WASM_VECTOR_LEN;
|
|
505
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
506
|
+
return ret !== 0;
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
511
|
+
* @param {Uint8Array} hashed_msg
|
|
512
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
513
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
514
|
+
* @param {Uint8Array} signature
|
|
515
|
+
* @returns {boolean}
|
|
516
|
+
*/
|
|
517
|
+
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
518
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
519
|
+
const len0 = WASM_VECTOR_LEN;
|
|
520
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
521
|
+
const len1 = WASM_VECTOR_LEN;
|
|
522
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
523
|
+
const len2 = WASM_VECTOR_LEN;
|
|
524
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
525
|
+
const len3 = WASM_VECTOR_LEN;
|
|
526
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
527
|
+
return ret !== 0;
|
|
528
|
+
};
|
|
529
|
+
|
|
529
530
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
530
531
|
wasm.closure445_externref_shim(arg0, arg1, arg2);
|
|
531
532
|
}
|
|
@@ -813,7 +814,7 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
813
814
|
return ret;
|
|
814
815
|
};
|
|
815
816
|
|
|
816
|
-
module.exports.
|
|
817
|
+
module.exports.__wbindgen_closure_wrapper1367 = function(arg0, arg1, arg2) {
|
|
817
818
|
const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
|
|
818
819
|
return ret;
|
|
819
820
|
};
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,14 +1,6 @@
|
|
|
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;
|
|
12
4
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
13
5
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
14
6
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -19,6 +11,14 @@ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
|
19
11
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
20
12
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
21
13
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
14
|
+
export const buildInfo: () => any;
|
|
15
|
+
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
16
|
+
export const and: (a: any, b: any) => any;
|
|
17
|
+
export const xor: (a: any, b: any) => any;
|
|
18
|
+
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
19
|
+
export const blake2s256: (a: number, b: number) => [number, number];
|
|
20
|
+
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
21
|
+
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,40 +1,5 @@
|
|
|
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;
|
|
38
3
|
/**
|
|
39
4
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
40
5
|
*
|
|
@@ -116,6 +81,69 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
116
81
|
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
117
82
|
*/
|
|
118
83
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
84
|
+
/**
|
|
85
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
86
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
87
|
+
*/
|
|
88
|
+
export function buildInfo(): BuildInfo;
|
|
89
|
+
/**
|
|
90
|
+
* Sets the package's logging level.
|
|
91
|
+
*
|
|
92
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
93
|
+
*/
|
|
94
|
+
export function initLogLevel(filter: string): void;
|
|
95
|
+
/**
|
|
96
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
97
|
+
*/
|
|
98
|
+
export function and(lhs: string, rhs: string): string;
|
|
99
|
+
/**
|
|
100
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
101
|
+
*/
|
|
102
|
+
export function xor(lhs: string, rhs: string): string;
|
|
103
|
+
/**
|
|
104
|
+
* Sha256 compression function
|
|
105
|
+
*/
|
|
106
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
107
|
+
/**
|
|
108
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
109
|
+
*/
|
|
110
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
111
|
+
/**
|
|
112
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
113
|
+
*/
|
|
114
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
117
|
+
*/
|
|
118
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
119
|
+
|
|
120
|
+
export type ForeignCallInput = string[]
|
|
121
|
+
export type ForeignCallOutput = string | string[]
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* A callback which performs an foreign call and returns the response.
|
|
125
|
+
* @callback ForeignCallHandler
|
|
126
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
127
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
128
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
129
|
+
*/
|
|
130
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
export type RawAssertionPayload = {
|
|
135
|
+
selector: string;
|
|
136
|
+
data: string[];
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
export type ExecutionError = Error & {
|
|
140
|
+
callStack?: string[];
|
|
141
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
142
|
+
acirFunctionId?: number;
|
|
143
|
+
brilligFunctionId?: number;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
|
|
119
147
|
|
|
120
148
|
/**
|
|
121
149
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -155,46 +183,10 @@ export type WitnessStack = Array<StackItem>;
|
|
|
155
183
|
|
|
156
184
|
|
|
157
185
|
|
|
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
|
-
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 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;
|
|
198
190
|
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
199
191
|
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
200
192
|
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -205,6 +197,14 @@ export interface InitOutput {
|
|
|
205
197
|
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
206
198
|
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
207
199
|
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
200
|
+
readonly buildInfo: () => any;
|
|
201
|
+
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
202
|
+
readonly and: (a: any, b: any) => any;
|
|
203
|
+
readonly xor: (a: any, b: any) => any;
|
|
204
|
+
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
205
|
+
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
206
|
+
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
207
|
+
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
208
208
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
209
209
|
readonly __externref_table_alloc: () => number;
|
|
210
210
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
package/web/acvm_js.js
CHANGED
|
@@ -197,160 +197,17 @@ 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
|
-
}
|
|
208
200
|
|
|
209
201
|
function takeFromExternrefTable0(idx) {
|
|
210
202
|
const value = wasm.__wbindgen_export_2.get(idx);
|
|
211
203
|
wasm.__externref_table_dealloc(idx);
|
|
212
204
|
return value;
|
|
213
205
|
}
|
|
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
|
-
}
|
|
293
206
|
|
|
294
207
|
function getArrayU8FromWasm0(ptr, len) {
|
|
295
208
|
ptr = ptr >>> 0;
|
|
296
209
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
297
210
|
}
|
|
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
|
-
|
|
354
211
|
/**
|
|
355
212
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
356
213
|
*
|
|
@@ -367,6 +224,12 @@ export function compressWitness(witness_map) {
|
|
|
367
224
|
return v1;
|
|
368
225
|
}
|
|
369
226
|
|
|
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
|
+
}
|
|
370
233
|
/**
|
|
371
234
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
372
235
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -522,6 +385,144 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
522
385
|
return takeFromExternrefTable0(ret[0]);
|
|
523
386
|
}
|
|
524
387
|
|
|
388
|
+
/**
|
|
389
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
390
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
391
|
+
*/
|
|
392
|
+
export function buildInfo() {
|
|
393
|
+
const ret = wasm.buildInfo();
|
|
394
|
+
return ret;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Sets the package's logging level.
|
|
399
|
+
*
|
|
400
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
401
|
+
*/
|
|
402
|
+
export function initLogLevel(filter) {
|
|
403
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
404
|
+
const len0 = WASM_VECTOR_LEN;
|
|
405
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
406
|
+
if (ret[1]) {
|
|
407
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
413
|
+
* @param {string} lhs
|
|
414
|
+
* @param {string} rhs
|
|
415
|
+
* @returns {string}
|
|
416
|
+
*/
|
|
417
|
+
export function and(lhs, rhs) {
|
|
418
|
+
const ret = wasm.and(lhs, rhs);
|
|
419
|
+
return ret;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
424
|
+
* @param {string} lhs
|
|
425
|
+
* @param {string} rhs
|
|
426
|
+
* @returns {string}
|
|
427
|
+
*/
|
|
428
|
+
export function xor(lhs, rhs) {
|
|
429
|
+
const ret = wasm.xor(lhs, rhs);
|
|
430
|
+
return ret;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
let cachedUint32ArrayMemory0 = null;
|
|
434
|
+
|
|
435
|
+
function getUint32ArrayMemory0() {
|
|
436
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
437
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
438
|
+
}
|
|
439
|
+
return cachedUint32ArrayMemory0;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
443
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
444
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
445
|
+
WASM_VECTOR_LEN = arg.length;
|
|
446
|
+
return ptr;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
450
|
+
ptr = ptr >>> 0;
|
|
451
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
452
|
+
}
|
|
453
|
+
/**
|
|
454
|
+
* Sha256 compression function
|
|
455
|
+
* @param {Uint32Array} inputs
|
|
456
|
+
* @param {Uint32Array} state
|
|
457
|
+
* @returns {Uint32Array}
|
|
458
|
+
*/
|
|
459
|
+
export function sha256_compression(inputs, state) {
|
|
460
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
461
|
+
const len0 = WASM_VECTOR_LEN;
|
|
462
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
463
|
+
const len1 = WASM_VECTOR_LEN;
|
|
464
|
+
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
465
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
466
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
467
|
+
return v3;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
472
|
+
* @param {Uint8Array} inputs
|
|
473
|
+
* @returns {Uint8Array}
|
|
474
|
+
*/
|
|
475
|
+
export function blake2s256(inputs) {
|
|
476
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
477
|
+
const len0 = WASM_VECTOR_LEN;
|
|
478
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
479
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
480
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
481
|
+
return v2;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
486
|
+
* @param {Uint8Array} hashed_msg
|
|
487
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
488
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
489
|
+
* @param {Uint8Array} signature
|
|
490
|
+
* @returns {boolean}
|
|
491
|
+
*/
|
|
492
|
+
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
493
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
494
|
+
const len0 = WASM_VECTOR_LEN;
|
|
495
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
496
|
+
const len1 = WASM_VECTOR_LEN;
|
|
497
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
498
|
+
const len2 = WASM_VECTOR_LEN;
|
|
499
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
500
|
+
const len3 = WASM_VECTOR_LEN;
|
|
501
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
502
|
+
return ret !== 0;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
507
|
+
* @param {Uint8Array} hashed_msg
|
|
508
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
509
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
510
|
+
* @param {Uint8Array} signature
|
|
511
|
+
* @returns {boolean}
|
|
512
|
+
*/
|
|
513
|
+
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
514
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
515
|
+
const len0 = WASM_VECTOR_LEN;
|
|
516
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
517
|
+
const len1 = WASM_VECTOR_LEN;
|
|
518
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
519
|
+
const len2 = WASM_VECTOR_LEN;
|
|
520
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
521
|
+
const len3 = WASM_VECTOR_LEN;
|
|
522
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
523
|
+
return ret !== 0;
|
|
524
|
+
}
|
|
525
|
+
|
|
525
526
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
526
527
|
wasm.closure445_externref_shim(arg0, arg1, arg2);
|
|
527
528
|
}
|
|
@@ -797,7 +798,7 @@ function __wbg_get_imports() {
|
|
|
797
798
|
const ret = false;
|
|
798
799
|
return ret;
|
|
799
800
|
};
|
|
800
|
-
imports.wbg.
|
|
801
|
+
imports.wbg.__wbindgen_closure_wrapper1367 = function(arg0, arg1, arg2) {
|
|
801
802
|
const ret = makeMutClosure(arg0, arg1, 446, __wbg_adapter_30);
|
|
802
803
|
return ret;
|
|
803
804
|
};
|
package/web/acvm_js_bg.wasm
CHANGED
|
Binary file
|
package/web/acvm_js_bg.wasm.d.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
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;
|
|
12
4
|
export const compressWitness: (a: any) => [number, number, number, number];
|
|
13
5
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
14
6
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
@@ -19,6 +11,14 @@ export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
|
19
11
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
20
12
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
21
13
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
14
|
+
export const buildInfo: () => any;
|
|
15
|
+
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
16
|
+
export const and: (a: any, b: any) => any;
|
|
17
|
+
export const xor: (a: any, b: any) => any;
|
|
18
|
+
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
19
|
+
export const blake2s256: (a: number, b: number) => [number, number];
|
|
20
|
+
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
21
|
+
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|