@aztec/noir-acvm_js 4.0.0-nightly.20260118 → 4.0.0-nightly.20260120
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 +69 -69
- package/nodejs/acvm_js.js +155 -156
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +13 -13
- package/package.json +1 -1
- package/web/acvm_js.d.ts +82 -82
- package/web/acvm_js.js +155 -156
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +13 -13
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,40 +1,44 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
|
|
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
|
|
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.
|
|
17
6
|
*/
|
|
18
|
-
export function
|
|
7
|
+
export function buildInfo(): BuildInfo;
|
|
19
8
|
/**
|
|
20
|
-
*
|
|
9
|
+
* Sets the package's logging level.
|
|
10
|
+
*
|
|
11
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
21
12
|
*/
|
|
22
|
-
export function
|
|
13
|
+
export function initLogLevel(filter: string): void;
|
|
23
14
|
/**
|
|
24
|
-
*
|
|
15
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
16
|
+
*
|
|
17
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
18
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
19
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
20
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
25
21
|
*/
|
|
26
|
-
export function
|
|
22
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
27
23
|
/**
|
|
28
|
-
*
|
|
24
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
25
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
29
26
|
*
|
|
30
|
-
* @param {
|
|
27
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
28
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
29
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
30
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
31
31
|
*/
|
|
32
|
-
export function
|
|
32
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
34
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
35
|
+
*
|
|
36
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
37
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
38
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
39
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
36
40
|
*/
|
|
37
|
-
export function
|
|
41
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
38
42
|
/**
|
|
39
43
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
40
44
|
*
|
|
@@ -89,33 +93,43 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
89
93
|
*/
|
|
90
94
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
91
95
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
95
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
96
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
97
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
96
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
98
97
|
*/
|
|
99
|
-
export function
|
|
98
|
+
export function and(lhs: string, rhs: string): string;
|
|
100
99
|
/**
|
|
101
|
-
*
|
|
102
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
103
|
-
*
|
|
104
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
105
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
106
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
107
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
100
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
108
101
|
*/
|
|
109
|
-
export function
|
|
102
|
+
export function xor(lhs: string, rhs: string): string;
|
|
110
103
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
114
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
115
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
116
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
104
|
+
* Sha256 compression function
|
|
117
105
|
*/
|
|
118
|
-
export function
|
|
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
|
+
/**
|
|
121
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
122
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
123
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
124
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
125
|
+
*/
|
|
126
|
+
export type BuildInfo = {
|
|
127
|
+
gitHash: string;
|
|
128
|
+
version: string;
|
|
129
|
+
dirty: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
119
133
|
|
|
120
134
|
export type RawAssertionPayload = {
|
|
121
135
|
selector: string;
|
|
@@ -131,15 +145,6 @@ export type ExecutionError = Error & {
|
|
|
131
145
|
|
|
132
146
|
|
|
133
147
|
|
|
134
|
-
export type StackItem = {
|
|
135
|
-
index: number;
|
|
136
|
-
witness: WitnessMap;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export type WitnessStack = Array<StackItem>;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
148
|
// Map from witness index to hex string value of witness.
|
|
144
149
|
export type WitnessMap = Map<number, string>;
|
|
145
150
|
|
|
@@ -155,20 +160,6 @@ export type SolvedAndReturnWitness = {
|
|
|
155
160
|
|
|
156
161
|
|
|
157
162
|
|
|
158
|
-
/**
|
|
159
|
-
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
160
|
-
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
161
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
162
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
163
|
-
*/
|
|
164
|
-
export type BuildInfo = {
|
|
165
|
-
gitHash: string;
|
|
166
|
-
version: string;
|
|
167
|
-
dirty: string;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
163
|
export type ForeignCallInput = string[]
|
|
173
164
|
export type ForeignCallOutput = string | string[]
|
|
174
165
|
|
|
@@ -182,3 +173,12 @@ export type ForeignCallOutput = string | string[]
|
|
|
182
173
|
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
183
174
|
|
|
184
175
|
|
|
176
|
+
|
|
177
|
+
export type StackItem = {
|
|
178
|
+
index: number;
|
|
179
|
+
witness: WitnessMap;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export type WitnessStack = Array<StackItem>;
|
|
183
|
+
|
|
184
|
+
|
package/nodejs/acvm_js.js
CHANGED
|
@@ -202,62 +202,31 @@ function debugString(val) {
|
|
|
202
202
|
return className;
|
|
203
203
|
}
|
|
204
204
|
/**
|
|
205
|
-
*
|
|
206
|
-
* @
|
|
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
|
-
};
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
217
|
-
* @param {string} lhs
|
|
218
|
-
* @param {string} rhs
|
|
219
|
-
* @returns {string}
|
|
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.
|
|
220
207
|
*/
|
|
221
|
-
module.exports.
|
|
222
|
-
const ret = wasm.
|
|
208
|
+
module.exports.buildInfo = function() {
|
|
209
|
+
const ret = wasm.buildInfo();
|
|
223
210
|
return ret;
|
|
224
211
|
};
|
|
225
212
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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);
|
|
213
|
+
function takeFromExternrefTable0(idx) {
|
|
214
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
215
|
+
wasm.__externref_table_dealloc(idx);
|
|
216
|
+
return value;
|
|
245
217
|
}
|
|
246
218
|
/**
|
|
247
|
-
*
|
|
248
|
-
*
|
|
249
|
-
* @param {
|
|
250
|
-
* @returns {Uint32Array}
|
|
219
|
+
* Sets the package's logging level.
|
|
220
|
+
*
|
|
221
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
251
222
|
*/
|
|
252
|
-
module.exports.
|
|
253
|
-
const ptr0 =
|
|
223
|
+
module.exports.initLogLevel = function(filter) {
|
|
224
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
254
225
|
const len0 = WASM_VECTOR_LEN;
|
|
255
|
-
const
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
260
|
-
return v3;
|
|
226
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
227
|
+
if (ret[1]) {
|
|
228
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
229
|
+
}
|
|
261
230
|
};
|
|
262
231
|
|
|
263
232
|
function passArray8ToWasm0(arg, malloc) {
|
|
@@ -266,92 +235,49 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
266
235
|
WASM_VECTOR_LEN = arg.length;
|
|
267
236
|
return ptr;
|
|
268
237
|
}
|
|
269
|
-
|
|
270
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
271
|
-
ptr = ptr >>> 0;
|
|
272
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
273
|
-
}
|
|
274
238
|
/**
|
|
275
|
-
*
|
|
276
|
-
*
|
|
277
|
-
* @
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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}
|
|
239
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
240
|
+
*
|
|
241
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
242
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
243
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
244
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
295
245
|
*/
|
|
296
|
-
module.exports.
|
|
297
|
-
const ptr0 = passArray8ToWasm0(
|
|
246
|
+
module.exports.executeCircuit = function(program, initial_witness, foreign_call_handler) {
|
|
247
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
298
248
|
const len0 = WASM_VECTOR_LEN;
|
|
299
|
-
const
|
|
300
|
-
|
|
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;
|
|
249
|
+
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
250
|
+
return ret;
|
|
307
251
|
};
|
|
308
252
|
|
|
309
253
|
/**
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
*
|
|
313
|
-
* @param {Uint8Array}
|
|
314
|
-
* @param {
|
|
315
|
-
* @
|
|
254
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
255
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
256
|
+
*
|
|
257
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
258
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
259
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
260
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
316
261
|
*/
|
|
317
|
-
module.exports.
|
|
318
|
-
const ptr0 = passArray8ToWasm0(
|
|
262
|
+
module.exports.executeCircuitWithReturnWitness = function(program, initial_witness, foreign_call_handler) {
|
|
263
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
319
264
|
const len0 = WASM_VECTOR_LEN;
|
|
320
|
-
const
|
|
321
|
-
|
|
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;
|
|
265
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
266
|
+
return ret;
|
|
328
267
|
};
|
|
329
268
|
|
|
330
|
-
function takeFromExternrefTable0(idx) {
|
|
331
|
-
const value = wasm.__wbindgen_export_2.get(idx);
|
|
332
|
-
wasm.__externref_table_dealloc(idx);
|
|
333
|
-
return value;
|
|
334
|
-
}
|
|
335
269
|
/**
|
|
336
|
-
*
|
|
270
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
337
271
|
*
|
|
338
|
-
* @param {
|
|
272
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
273
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
274
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
275
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
339
276
|
*/
|
|
340
|
-
module.exports.
|
|
341
|
-
const ptr0 =
|
|
277
|
+
module.exports.executeProgram = function(program, initial_witness, foreign_call_handler) {
|
|
278
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
342
279
|
const len0 = WASM_VECTOR_LEN;
|
|
343
|
-
const ret = wasm.
|
|
344
|
-
if (ret[1]) {
|
|
345
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
346
|
-
}
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
351
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
352
|
-
*/
|
|
353
|
-
module.exports.buildInfo = function() {
|
|
354
|
-
const ret = wasm.buildInfo();
|
|
280
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
355
281
|
return ret;
|
|
356
282
|
};
|
|
357
283
|
|
|
@@ -415,6 +341,10 @@ module.exports.getPublicWitness = function(program, solved_witness) {
|
|
|
415
341
|
return takeFromExternrefTable0(ret[0]);
|
|
416
342
|
};
|
|
417
343
|
|
|
344
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
345
|
+
ptr = ptr >>> 0;
|
|
346
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
347
|
+
}
|
|
418
348
|
/**
|
|
419
349
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
420
350
|
*
|
|
@@ -481,61 +411,130 @@ module.exports.decompressWitnessStack = function(compressed_witness) {
|
|
|
481
411
|
};
|
|
482
412
|
|
|
483
413
|
/**
|
|
484
|
-
*
|
|
485
|
-
*
|
|
486
|
-
* @param {
|
|
487
|
-
* @
|
|
488
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
489
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
414
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
415
|
+
* @param {string} lhs
|
|
416
|
+
* @param {string} rhs
|
|
417
|
+
* @returns {string}
|
|
490
418
|
*/
|
|
491
|
-
module.exports.
|
|
492
|
-
const
|
|
493
|
-
const len0 = WASM_VECTOR_LEN;
|
|
494
|
-
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
419
|
+
module.exports.and = function(lhs, rhs) {
|
|
420
|
+
const ret = wasm.and(lhs, rhs);
|
|
495
421
|
return ret;
|
|
496
422
|
};
|
|
497
423
|
|
|
498
424
|
/**
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
* @
|
|
503
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
504
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
505
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
425
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
426
|
+
* @param {string} lhs
|
|
427
|
+
* @param {string} rhs
|
|
428
|
+
* @returns {string}
|
|
506
429
|
*/
|
|
507
|
-
module.exports.
|
|
508
|
-
const
|
|
509
|
-
const len0 = WASM_VECTOR_LEN;
|
|
510
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
430
|
+
module.exports.xor = function(lhs, rhs) {
|
|
431
|
+
const ret = wasm.xor(lhs, rhs);
|
|
511
432
|
return ret;
|
|
512
433
|
};
|
|
513
434
|
|
|
435
|
+
let cachedUint32ArrayMemory0 = null;
|
|
436
|
+
|
|
437
|
+
function getUint32ArrayMemory0() {
|
|
438
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
439
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
440
|
+
}
|
|
441
|
+
return cachedUint32ArrayMemory0;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
445
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
446
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
447
|
+
WASM_VECTOR_LEN = arg.length;
|
|
448
|
+
return ptr;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
452
|
+
ptr = ptr >>> 0;
|
|
453
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
454
|
+
}
|
|
514
455
|
/**
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
* @param {
|
|
518
|
-
* @
|
|
519
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
520
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
456
|
+
* Sha256 compression function
|
|
457
|
+
* @param {Uint32Array} inputs
|
|
458
|
+
* @param {Uint32Array} state
|
|
459
|
+
* @returns {Uint32Array}
|
|
521
460
|
*/
|
|
522
|
-
module.exports.
|
|
523
|
-
const ptr0 =
|
|
461
|
+
module.exports.sha256_compression = function(inputs, state) {
|
|
462
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
524
463
|
const len0 = WASM_VECTOR_LEN;
|
|
525
|
-
const
|
|
526
|
-
|
|
464
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
465
|
+
const len1 = WASM_VECTOR_LEN;
|
|
466
|
+
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
467
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
468
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
469
|
+
return v3;
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
474
|
+
* @param {Uint8Array} inputs
|
|
475
|
+
* @returns {Uint8Array}
|
|
476
|
+
*/
|
|
477
|
+
module.exports.blake2s256 = function(inputs) {
|
|
478
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
479
|
+
const len0 = WASM_VECTOR_LEN;
|
|
480
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
481
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
482
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
483
|
+
return v2;
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
/**
|
|
487
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
488
|
+
* @param {Uint8Array} hashed_msg
|
|
489
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
490
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
491
|
+
* @param {Uint8Array} signature
|
|
492
|
+
* @returns {boolean}
|
|
493
|
+
*/
|
|
494
|
+
module.exports.ecdsa_secp256k1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
495
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
496
|
+
const len0 = WASM_VECTOR_LEN;
|
|
497
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
498
|
+
const len1 = WASM_VECTOR_LEN;
|
|
499
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
500
|
+
const len2 = WASM_VECTOR_LEN;
|
|
501
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
502
|
+
const len3 = WASM_VECTOR_LEN;
|
|
503
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
504
|
+
return ret !== 0;
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
509
|
+
* @param {Uint8Array} hashed_msg
|
|
510
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
511
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
512
|
+
* @param {Uint8Array} signature
|
|
513
|
+
* @returns {boolean}
|
|
514
|
+
*/
|
|
515
|
+
module.exports.ecdsa_secp256r1_verify = function(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
516
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
517
|
+
const len0 = WASM_VECTOR_LEN;
|
|
518
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
519
|
+
const len1 = WASM_VECTOR_LEN;
|
|
520
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
521
|
+
const len2 = WASM_VECTOR_LEN;
|
|
522
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
523
|
+
const len3 = WASM_VECTOR_LEN;
|
|
524
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
525
|
+
return ret !== 0;
|
|
527
526
|
};
|
|
528
527
|
|
|
529
528
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
530
|
-
wasm.
|
|
529
|
+
wasm.closure447_externref_shim(arg0, arg1, arg2);
|
|
531
530
|
}
|
|
532
531
|
|
|
533
532
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
534
|
-
wasm.
|
|
533
|
+
wasm.closure932_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
535
534
|
}
|
|
536
535
|
|
|
537
536
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
538
|
-
wasm.
|
|
537
|
+
wasm.closure936_externref_shim(arg0, arg1, arg2, arg3);
|
|
539
538
|
}
|
|
540
539
|
|
|
541
540
|
module.exports.__wbg_call_672a4d21634d4a24 = function() { return handleError(function (arg0, arg1) {
|
|
@@ -813,8 +812,8 @@ module.exports.__wbindgen_cb_drop = function(arg0) {
|
|
|
813
812
|
return ret;
|
|
814
813
|
};
|
|
815
814
|
|
|
816
|
-
module.exports.
|
|
817
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
815
|
+
module.exports.__wbindgen_closure_wrapper1447 = function(arg0, arg1, arg2) {
|
|
816
|
+
const ret = makeMutClosure(arg0, arg1, 448, __wbg_adapter_30);
|
|
818
817
|
return ret;
|
|
819
818
|
};
|
|
820
819
|
|
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
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;
|
|
10
|
-
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
11
4
|
export const buildInfo: () => any;
|
|
5
|
+
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
6
|
+
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
7
|
+
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
8
|
+
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
12
9
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
13
10
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
14
11
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
@@ -16,9 +13,12 @@ export const compressWitness: (a: any) => [number, number, number, number];
|
|
|
16
13
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
17
14
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
18
15
|
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
19
|
-
export const
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
16
|
+
export const and: (a: any, b: any) => any;
|
|
17
|
+
export const xor: (a: any, b: any) => any;
|
|
18
|
+
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
19
|
+
export const blake2s256: (a: number, b: number) => [number, number];
|
|
20
|
+
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
21
|
+
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
|
27
27
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
28
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
29
29
|
export const __externref_table_dealloc: (a: number) => void;
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure447_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure936_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,40 +1,44 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
|
|
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
|
|
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.
|
|
17
6
|
*/
|
|
18
|
-
export function
|
|
7
|
+
export function buildInfo(): BuildInfo;
|
|
19
8
|
/**
|
|
20
|
-
*
|
|
9
|
+
* Sets the package's logging level.
|
|
10
|
+
*
|
|
11
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
21
12
|
*/
|
|
22
|
-
export function
|
|
13
|
+
export function initLogLevel(filter: string): void;
|
|
23
14
|
/**
|
|
24
|
-
*
|
|
15
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
16
|
+
*
|
|
17
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
18
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
19
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
20
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
25
21
|
*/
|
|
26
|
-
export function
|
|
22
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
27
23
|
/**
|
|
28
|
-
*
|
|
24
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
25
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
29
26
|
*
|
|
30
|
-
* @param {
|
|
27
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
28
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
29
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
30
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
31
31
|
*/
|
|
32
|
-
export function
|
|
32
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
34
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
35
|
+
*
|
|
36
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
37
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
38
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
39
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
36
40
|
*/
|
|
37
|
-
export function
|
|
41
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
38
42
|
/**
|
|
39
43
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
40
44
|
*
|
|
@@ -89,33 +93,43 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
89
93
|
*/
|
|
90
94
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
91
95
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
95
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
96
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
97
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
96
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
98
97
|
*/
|
|
99
|
-
export function
|
|
98
|
+
export function and(lhs: string, rhs: string): string;
|
|
100
99
|
/**
|
|
101
|
-
*
|
|
102
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
103
|
-
*
|
|
104
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
105
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
106
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
107
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
100
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
108
101
|
*/
|
|
109
|
-
export function
|
|
102
|
+
export function xor(lhs: string, rhs: string): string;
|
|
110
103
|
/**
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
114
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
115
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
116
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
104
|
+
* Sha256 compression function
|
|
117
105
|
*/
|
|
118
|
-
export function
|
|
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
|
+
/**
|
|
121
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
122
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
123
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
124
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
125
|
+
*/
|
|
126
|
+
export type BuildInfo = {
|
|
127
|
+
gitHash: string;
|
|
128
|
+
version: string;
|
|
129
|
+
dirty: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
|
|
119
133
|
|
|
120
134
|
export type RawAssertionPayload = {
|
|
121
135
|
selector: string;
|
|
@@ -131,15 +145,6 @@ export type ExecutionError = Error & {
|
|
|
131
145
|
|
|
132
146
|
|
|
133
147
|
|
|
134
|
-
export type StackItem = {
|
|
135
|
-
index: number;
|
|
136
|
-
witness: WitnessMap;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
export type WitnessStack = Array<StackItem>;
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
148
|
// Map from witness index to hex string value of witness.
|
|
144
149
|
export type WitnessMap = Map<number, string>;
|
|
145
150
|
|
|
@@ -155,20 +160,6 @@ export type SolvedAndReturnWitness = {
|
|
|
155
160
|
|
|
156
161
|
|
|
157
162
|
|
|
158
|
-
/**
|
|
159
|
-
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
160
|
-
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
161
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
162
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
163
|
-
*/
|
|
164
|
-
export type BuildInfo = {
|
|
165
|
-
gitHash: string;
|
|
166
|
-
version: string;
|
|
167
|
-
dirty: string;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
163
|
export type ForeignCallInput = string[]
|
|
173
164
|
export type ForeignCallOutput = string | string[]
|
|
174
165
|
|
|
@@ -183,18 +174,24 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
183
174
|
|
|
184
175
|
|
|
185
176
|
|
|
177
|
+
export type StackItem = {
|
|
178
|
+
index: number;
|
|
179
|
+
witness: WitnessMap;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export type WitnessStack = Array<StackItem>;
|
|
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 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;
|
|
196
|
-
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
197
190
|
readonly buildInfo: () => any;
|
|
191
|
+
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
192
|
+
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
193
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
194
|
+
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
198
195
|
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
199
196
|
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
200
197
|
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
@@ -202,9 +199,12 @@ export interface InitOutput {
|
|
|
202
199
|
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
203
200
|
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
204
201
|
readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
205
|
-
readonly
|
|
206
|
-
readonly
|
|
207
|
-
readonly
|
|
202
|
+
readonly and: (a: any, b: any) => any;
|
|
203
|
+
readonly xor: (a: any, b: any) => any;
|
|
204
|
+
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
205
|
+
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
206
|
+
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
207
|
+
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
208
208
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
209
209
|
readonly __externref_table_alloc: () => number;
|
|
210
210
|
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -213,9 +213,9 @@ export interface InitOutput {
|
|
|
213
213
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
214
214
|
readonly __wbindgen_export_6: WebAssembly.Table;
|
|
215
215
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
216
|
-
readonly
|
|
217
|
-
readonly
|
|
218
|
-
readonly
|
|
216
|
+
readonly closure447_externref_shim: (a: number, b: number, c: any) => void;
|
|
217
|
+
readonly closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
218
|
+
readonly closure936_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
|
@@ -198,62 +198,31 @@ function debugString(val) {
|
|
|
198
198
|
return className;
|
|
199
199
|
}
|
|
200
200
|
/**
|
|
201
|
-
*
|
|
202
|
-
* @
|
|
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
|
-
}
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
213
|
-
* @param {string} lhs
|
|
214
|
-
* @param {string} rhs
|
|
215
|
-
* @returns {string}
|
|
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.
|
|
216
203
|
*/
|
|
217
|
-
export function
|
|
218
|
-
const ret = wasm.
|
|
204
|
+
export function buildInfo() {
|
|
205
|
+
const ret = wasm.buildInfo();
|
|
219
206
|
return ret;
|
|
220
207
|
}
|
|
221
208
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
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);
|
|
209
|
+
function takeFromExternrefTable0(idx) {
|
|
210
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
211
|
+
wasm.__externref_table_dealloc(idx);
|
|
212
|
+
return value;
|
|
241
213
|
}
|
|
242
214
|
/**
|
|
243
|
-
*
|
|
244
|
-
*
|
|
245
|
-
* @param {
|
|
246
|
-
* @returns {Uint32Array}
|
|
215
|
+
* Sets the package's logging level.
|
|
216
|
+
*
|
|
217
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
247
218
|
*/
|
|
248
|
-
export function
|
|
249
|
-
const ptr0 =
|
|
219
|
+
export function initLogLevel(filter) {
|
|
220
|
+
const ptr0 = passStringToWasm0(filter, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
250
221
|
const len0 = WASM_VECTOR_LEN;
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
256
|
-
return v3;
|
|
222
|
+
const ret = wasm.initLogLevel(ptr0, len0);
|
|
223
|
+
if (ret[1]) {
|
|
224
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
225
|
+
}
|
|
257
226
|
}
|
|
258
227
|
|
|
259
228
|
function passArray8ToWasm0(arg, malloc) {
|
|
@@ -262,92 +231,49 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
262
231
|
WASM_VECTOR_LEN = arg.length;
|
|
263
232
|
return ptr;
|
|
264
233
|
}
|
|
265
|
-
|
|
266
|
-
function getArrayU8FromWasm0(ptr, len) {
|
|
267
|
-
ptr = ptr >>> 0;
|
|
268
|
-
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
269
|
-
}
|
|
270
234
|
/**
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
* @
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
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}
|
|
235
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
236
|
+
*
|
|
237
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
238
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
239
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
240
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
291
241
|
*/
|
|
292
|
-
export function
|
|
293
|
-
const ptr0 = passArray8ToWasm0(
|
|
242
|
+
export function executeCircuit(program, initial_witness, foreign_call_handler) {
|
|
243
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
294
244
|
const len0 = WASM_VECTOR_LEN;
|
|
295
|
-
const
|
|
296
|
-
|
|
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;
|
|
245
|
+
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
246
|
+
return ret;
|
|
303
247
|
}
|
|
304
248
|
|
|
305
249
|
/**
|
|
306
|
-
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
* @param {Uint8Array}
|
|
310
|
-
* @param {
|
|
311
|
-
* @
|
|
250
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
251
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
252
|
+
*
|
|
253
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
254
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
255
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
256
|
+
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
312
257
|
*/
|
|
313
|
-
export function
|
|
314
|
-
const ptr0 = passArray8ToWasm0(
|
|
258
|
+
export function executeCircuitWithReturnWitness(program, initial_witness, foreign_call_handler) {
|
|
259
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
315
260
|
const len0 = WASM_VECTOR_LEN;
|
|
316
|
-
const
|
|
317
|
-
|
|
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;
|
|
261
|
+
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
262
|
+
return ret;
|
|
324
263
|
}
|
|
325
264
|
|
|
326
|
-
function takeFromExternrefTable0(idx) {
|
|
327
|
-
const value = wasm.__wbindgen_export_2.get(idx);
|
|
328
|
-
wasm.__externref_table_dealloc(idx);
|
|
329
|
-
return value;
|
|
330
|
-
}
|
|
331
265
|
/**
|
|
332
|
-
*
|
|
266
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
333
267
|
*
|
|
334
|
-
* @param {
|
|
268
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
269
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
270
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
271
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
335
272
|
*/
|
|
336
|
-
export function
|
|
337
|
-
const ptr0 =
|
|
273
|
+
export function executeProgram(program, initial_witness, foreign_call_handler) {
|
|
274
|
+
const ptr0 = passArray8ToWasm0(program, wasm.__wbindgen_malloc);
|
|
338
275
|
const len0 = WASM_VECTOR_LEN;
|
|
339
|
-
const ret = wasm.
|
|
340
|
-
if (ret[1]) {
|
|
341
|
-
throw takeFromExternrefTable0(ret[0]);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
347
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
348
|
-
*/
|
|
349
|
-
export function buildInfo() {
|
|
350
|
-
const ret = wasm.buildInfo();
|
|
276
|
+
const ret = wasm.executeProgram(ptr0, len0, initial_witness, foreign_call_handler);
|
|
351
277
|
return ret;
|
|
352
278
|
}
|
|
353
279
|
|
|
@@ -411,6 +337,10 @@ export function getPublicWitness(program, solved_witness) {
|
|
|
411
337
|
return takeFromExternrefTable0(ret[0]);
|
|
412
338
|
}
|
|
413
339
|
|
|
340
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
341
|
+
ptr = ptr >>> 0;
|
|
342
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
343
|
+
}
|
|
414
344
|
/**
|
|
415
345
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
416
346
|
*
|
|
@@ -477,61 +407,130 @@ export function decompressWitnessStack(compressed_witness) {
|
|
|
477
407
|
}
|
|
478
408
|
|
|
479
409
|
/**
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
* @param {
|
|
483
|
-
* @
|
|
484
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
485
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
410
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
411
|
+
* @param {string} lhs
|
|
412
|
+
* @param {string} rhs
|
|
413
|
+
* @returns {string}
|
|
486
414
|
*/
|
|
487
|
-
export function
|
|
488
|
-
const
|
|
489
|
-
const len0 = WASM_VECTOR_LEN;
|
|
490
|
-
const ret = wasm.executeCircuit(ptr0, len0, initial_witness, foreign_call_handler);
|
|
415
|
+
export function and(lhs, rhs) {
|
|
416
|
+
const ret = wasm.and(lhs, rhs);
|
|
491
417
|
return ret;
|
|
492
418
|
}
|
|
493
419
|
|
|
494
420
|
/**
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
* @
|
|
499
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
500
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
501
|
-
* @returns {SolvedAndReturnWitness} The solved witness calculated by executing the circuit on the provided inputs, as well as the return witness indices as specified by the circuit.
|
|
421
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
422
|
+
* @param {string} lhs
|
|
423
|
+
* @param {string} rhs
|
|
424
|
+
* @returns {string}
|
|
502
425
|
*/
|
|
503
|
-
export function
|
|
504
|
-
const
|
|
505
|
-
const len0 = WASM_VECTOR_LEN;
|
|
506
|
-
const ret = wasm.executeCircuitWithReturnWitness(ptr0, len0, initial_witness, foreign_call_handler);
|
|
426
|
+
export function xor(lhs, rhs) {
|
|
427
|
+
const ret = wasm.xor(lhs, rhs);
|
|
507
428
|
return ret;
|
|
508
429
|
}
|
|
509
430
|
|
|
431
|
+
let cachedUint32ArrayMemory0 = null;
|
|
432
|
+
|
|
433
|
+
function getUint32ArrayMemory0() {
|
|
434
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
435
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
436
|
+
}
|
|
437
|
+
return cachedUint32ArrayMemory0;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
function passArray32ToWasm0(arg, malloc) {
|
|
441
|
+
const ptr = malloc(arg.length * 4, 4) >>> 0;
|
|
442
|
+
getUint32ArrayMemory0().set(arg, ptr / 4);
|
|
443
|
+
WASM_VECTOR_LEN = arg.length;
|
|
444
|
+
return ptr;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
448
|
+
ptr = ptr >>> 0;
|
|
449
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
450
|
+
}
|
|
510
451
|
/**
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
* @param {
|
|
514
|
-
* @
|
|
515
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
516
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
452
|
+
* Sha256 compression function
|
|
453
|
+
* @param {Uint32Array} inputs
|
|
454
|
+
* @param {Uint32Array} state
|
|
455
|
+
* @returns {Uint32Array}
|
|
517
456
|
*/
|
|
518
|
-
export function
|
|
519
|
-
const ptr0 =
|
|
457
|
+
export function sha256_compression(inputs, state) {
|
|
458
|
+
const ptr0 = passArray32ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
520
459
|
const len0 = WASM_VECTOR_LEN;
|
|
521
|
-
const
|
|
522
|
-
|
|
460
|
+
const ptr1 = passArray32ToWasm0(state, wasm.__wbindgen_malloc);
|
|
461
|
+
const len1 = WASM_VECTOR_LEN;
|
|
462
|
+
const ret = wasm.sha256_compression(ptr0, len0, ptr1, len1);
|
|
463
|
+
var v3 = getArrayU32FromWasm0(ret[0], ret[1]).slice();
|
|
464
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
465
|
+
return v3;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
470
|
+
* @param {Uint8Array} inputs
|
|
471
|
+
* @returns {Uint8Array}
|
|
472
|
+
*/
|
|
473
|
+
export function blake2s256(inputs) {
|
|
474
|
+
const ptr0 = passArray8ToWasm0(inputs, wasm.__wbindgen_malloc);
|
|
475
|
+
const len0 = WASM_VECTOR_LEN;
|
|
476
|
+
const ret = wasm.blake2s256(ptr0, len0);
|
|
477
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
478
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
479
|
+
return v2;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
484
|
+
* @param {Uint8Array} hashed_msg
|
|
485
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
486
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
487
|
+
* @param {Uint8Array} signature
|
|
488
|
+
* @returns {boolean}
|
|
489
|
+
*/
|
|
490
|
+
export function ecdsa_secp256k1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
491
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
492
|
+
const len0 = WASM_VECTOR_LEN;
|
|
493
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
494
|
+
const len1 = WASM_VECTOR_LEN;
|
|
495
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
496
|
+
const len2 = WASM_VECTOR_LEN;
|
|
497
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
498
|
+
const len3 = WASM_VECTOR_LEN;
|
|
499
|
+
const ret = wasm.ecdsa_secp256k1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
500
|
+
return ret !== 0;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/**
|
|
504
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
505
|
+
* @param {Uint8Array} hashed_msg
|
|
506
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
507
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
508
|
+
* @param {Uint8Array} signature
|
|
509
|
+
* @returns {boolean}
|
|
510
|
+
*/
|
|
511
|
+
export function ecdsa_secp256r1_verify(hashed_msg, public_key_x_bytes, public_key_y_bytes, signature) {
|
|
512
|
+
const ptr0 = passArray8ToWasm0(hashed_msg, wasm.__wbindgen_malloc);
|
|
513
|
+
const len0 = WASM_VECTOR_LEN;
|
|
514
|
+
const ptr1 = passArray8ToWasm0(public_key_x_bytes, wasm.__wbindgen_malloc);
|
|
515
|
+
const len1 = WASM_VECTOR_LEN;
|
|
516
|
+
const ptr2 = passArray8ToWasm0(public_key_y_bytes, wasm.__wbindgen_malloc);
|
|
517
|
+
const len2 = WASM_VECTOR_LEN;
|
|
518
|
+
const ptr3 = passArray8ToWasm0(signature, wasm.__wbindgen_malloc);
|
|
519
|
+
const len3 = WASM_VECTOR_LEN;
|
|
520
|
+
const ret = wasm.ecdsa_secp256r1_verify(ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
521
|
+
return ret !== 0;
|
|
523
522
|
}
|
|
524
523
|
|
|
525
524
|
function __wbg_adapter_30(arg0, arg1, arg2) {
|
|
526
|
-
wasm.
|
|
525
|
+
wasm.closure447_externref_shim(arg0, arg1, arg2);
|
|
527
526
|
}
|
|
528
527
|
|
|
529
528
|
function __wbg_adapter_89(arg0, arg1, arg2, arg3, arg4) {
|
|
530
|
-
wasm.
|
|
529
|
+
wasm.closure932_externref_shim(arg0, arg1, arg2, arg3, arg4);
|
|
531
530
|
}
|
|
532
531
|
|
|
533
532
|
function __wbg_adapter_110(arg0, arg1, arg2, arg3) {
|
|
534
|
-
wasm.
|
|
533
|
+
wasm.closure936_externref_shim(arg0, arg1, arg2, arg3);
|
|
535
534
|
}
|
|
536
535
|
|
|
537
536
|
async function __wbg_load(module, imports) {
|
|
@@ -797,8 +796,8 @@ function __wbg_get_imports() {
|
|
|
797
796
|
const ret = false;
|
|
798
797
|
return ret;
|
|
799
798
|
};
|
|
800
|
-
imports.wbg.
|
|
801
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
799
|
+
imports.wbg.__wbindgen_closure_wrapper1447 = function(arg0, arg1, arg2) {
|
|
800
|
+
const ret = makeMutClosure(arg0, arg1, 448, __wbg_adapter_30);
|
|
802
801
|
return ret;
|
|
803
802
|
};
|
|
804
803
|
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,14 +1,11 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
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;
|
|
10
|
-
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
11
4
|
export const buildInfo: () => any;
|
|
5
|
+
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
6
|
+
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
7
|
+
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
8
|
+
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
12
9
|
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
13
10
|
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
14
11
|
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
@@ -16,9 +13,12 @@ export const compressWitness: (a: any) => [number, number, number, number];
|
|
|
16
13
|
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
17
14
|
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
18
15
|
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
19
|
-
export const
|
|
20
|
-
export const
|
|
21
|
-
export const
|
|
16
|
+
export const and: (a: any, b: any) => any;
|
|
17
|
+
export const xor: (a: any, b: any) => any;
|
|
18
|
+
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
19
|
+
export const blake2s256: (a: number, b: number) => [number, number];
|
|
20
|
+
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
21
|
+
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
22
22
|
export const __wbindgen_exn_store: (a: number) => void;
|
|
23
23
|
export const __externref_table_alloc: () => number;
|
|
24
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
|
@@ -27,7 +27,7 @@ export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
|
27
27
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
28
28
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
29
29
|
export const __externref_table_dealloc: (a: number) => void;
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
30
|
+
export const closure447_externref_shim: (a: number, b: number, c: any) => void;
|
|
31
|
+
export const closure932_externref_shim: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
32
|
+
export const closure936_externref_shim: (a: number, b: number, c: any, d: any) => void;
|
|
33
33
|
export const __wbindgen_start: () => void;
|