@noir-lang/acvm_js 0.46.0 → 0.47.0-49e1b0c.nightly
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 +54 -71
- package/nodejs/acvm_js.js +234 -685
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +8 -14
- package/package.json +1 -1
- package/web/acvm_js.d.ts +62 -85
- package/web/acvm_js.js +200 -587
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +8 -14
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -12,6 +12,35 @@ export function initLogLevel(filter: string): void;
|
|
|
12
12
|
*/
|
|
13
13
|
export function buildInfo(): BuildInfo;
|
|
14
14
|
/**
|
|
15
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
16
|
+
*
|
|
17
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
18
|
+
* @returns {Uint8Array} A compressed witness map
|
|
19
|
+
*/
|
|
20
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
21
|
+
/**
|
|
22
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
23
|
+
* This should be used to only fetch the witness map for the main function.
|
|
24
|
+
*
|
|
25
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
26
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
27
|
+
*/
|
|
28
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
29
|
+
/**
|
|
30
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
31
|
+
*
|
|
32
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
33
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
34
|
+
*/
|
|
35
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
36
|
+
/**
|
|
37
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
38
|
+
*
|
|
39
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
40
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
41
|
+
*/
|
|
42
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
43
|
+
/**
|
|
15
44
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
16
45
|
* @param {string} lhs
|
|
17
46
|
* @param {string} rhs
|
|
@@ -62,39 +91,6 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
62
91
|
*/
|
|
63
92
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
64
93
|
/**
|
|
65
|
-
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
66
|
-
*
|
|
67
|
-
* @param {WitnessMap} witness_map - A witness map.
|
|
68
|
-
* @returns {Uint8Array} A compressed witness map
|
|
69
|
-
*/
|
|
70
|
-
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
71
|
-
/**
|
|
72
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
73
|
-
* This should be used to only fetch the witness map for the main function.
|
|
74
|
-
*
|
|
75
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
76
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
77
|
-
*/
|
|
78
|
-
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
79
|
-
/**
|
|
80
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
81
|
-
*
|
|
82
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
83
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
84
|
-
*/
|
|
85
|
-
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
86
|
-
/**
|
|
87
|
-
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
88
|
-
*
|
|
89
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
90
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
91
|
-
*/
|
|
92
|
-
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
93
|
-
/**
|
|
94
|
-
* @returns {Promise<WasmBlackBoxFunctionSolver>}
|
|
95
|
-
*/
|
|
96
|
-
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
|
|
97
|
-
/**
|
|
98
94
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
99
95
|
*
|
|
100
96
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
@@ -107,30 +103,22 @@ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap,
|
|
|
107
103
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
108
104
|
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
109
105
|
*
|
|
110
|
-
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
111
106
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
112
107
|
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
113
108
|
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
114
109
|
* @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.
|
|
115
110
|
*/
|
|
116
|
-
export function executeCircuitWithReturnWitness(
|
|
111
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
117
112
|
/**
|
|
118
113
|
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
119
114
|
*
|
|
120
|
-
* @param {
|
|
121
|
-
* @param {
|
|
122
|
-
* @param {
|
|
123
|
-
* @
|
|
124
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
125
|
-
*/
|
|
126
|
-
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
127
|
-
/**
|
|
115
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
116
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
117
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
118
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
128
119
|
*/
|
|
129
120
|
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
130
121
|
/**
|
|
131
|
-
*/
|
|
132
|
-
export function executeProgramWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>;
|
|
133
|
-
/**
|
|
134
122
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
135
123
|
*
|
|
136
124
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
@@ -164,21 +152,6 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
164
152
|
*/
|
|
165
153
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
166
154
|
|
|
167
|
-
// Map from witness index to hex string value of witness.
|
|
168
|
-
export type WitnessMap = Map<number, string>;
|
|
169
|
-
|
|
170
|
-
/**
|
|
171
|
-
* An execution result containing two witnesses.
|
|
172
|
-
* 1. The full solved witness of the execution.
|
|
173
|
-
* 2. The return witness which contains the given public return values within the full witness.
|
|
174
|
-
*/
|
|
175
|
-
export type SolvedAndReturnWitness = {
|
|
176
|
-
solvedWitness: WitnessMap;
|
|
177
|
-
returnWitness: WitnessMap;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
155
|
/**
|
|
183
156
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
184
157
|
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
@@ -193,6 +166,15 @@ export type BuildInfo = {
|
|
|
193
166
|
|
|
194
167
|
|
|
195
168
|
|
|
169
|
+
export type StackItem = {
|
|
170
|
+
index: number;
|
|
171
|
+
witness: WitnessMap;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export type WitnessStack = Array<StackItem>;
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
196
178
|
export type ForeignCallInput = string[]
|
|
197
179
|
export type ForeignCallOutput = string | string[]
|
|
198
180
|
|
|
@@ -218,16 +200,17 @@ export type ExecutionError = Error & {
|
|
|
218
200
|
|
|
219
201
|
|
|
220
202
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
witness: WitnessMap;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
export type WitnessStack = Array<StackItem>;
|
|
227
|
-
|
|
203
|
+
// Map from witness index to hex string value of witness.
|
|
204
|
+
export type WitnessMap = Map<number, string>;
|
|
228
205
|
|
|
229
206
|
/**
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
207
|
+
* An execution result containing two witnesses.
|
|
208
|
+
* 1. The full solved witness of the execution.
|
|
209
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
210
|
+
*/
|
|
211
|
+
export type SolvedAndReturnWitness = {
|
|
212
|
+
solvedWitness: WitnessMap;
|
|
213
|
+
returnWitness: WitnessMap;
|
|
233
214
|
}
|
|
215
|
+
|
|
216
|
+
|