@noir-lang/acvm_js 0.45.0 → 0.46.0-6a7c7a9.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 +76 -71
- package/nodejs/acvm_js.js +171 -553
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +12 -14
- package/package.json +1 -1
- package/web/acvm_js.d.ts +88 -85
- package/web/acvm_js.js +169 -489
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +12 -14
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -51,43 +51,45 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
51
51
|
*/
|
|
52
52
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
53
53
|
/**
|
|
54
|
-
*
|
|
55
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
54
|
+
* @returns {Promise<WasmBlackBoxFunctionSolver>}
|
|
56
55
|
*/
|
|
57
|
-
export function
|
|
56
|
+
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
|
|
58
57
|
/**
|
|
59
|
-
*
|
|
58
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
60
59
|
*
|
|
61
60
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
62
|
-
* @param {WitnessMap}
|
|
63
|
-
* @
|
|
64
|
-
* @
|
|
65
|
-
* @param {WitnessMap} witness_map
|
|
66
|
-
* @returns {WitnessMap}
|
|
61
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
62
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
63
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
67
64
|
*/
|
|
68
|
-
export function
|
|
65
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
69
66
|
/**
|
|
70
|
-
*
|
|
67
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
68
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
71
69
|
*
|
|
70
|
+
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
72
71
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
73
|
-
* @param {WitnessMap}
|
|
74
|
-
* @
|
|
75
|
-
* @
|
|
76
|
-
* @param {WitnessMap} solved_witness
|
|
77
|
-
* @returns {WitnessMap}
|
|
72
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
73
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
74
|
+
* @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.
|
|
78
75
|
*/
|
|
79
|
-
export function
|
|
76
|
+
export function executeCircuitWithReturnWitness(_solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
80
77
|
/**
|
|
81
|
-
*
|
|
78
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
82
79
|
*
|
|
80
|
+
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
83
81
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
84
|
-
* @param {WitnessMap}
|
|
85
|
-
* @
|
|
86
|
-
* @
|
|
87
|
-
* @param {WitnessMap} solved_witness
|
|
88
|
-
* @returns {WitnessMap}
|
|
82
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
83
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
84
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
89
85
|
*/
|
|
90
|
-
export function
|
|
86
|
+
export function executeCircuitWithBlackBoxSolver(_solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
87
|
+
/**
|
|
88
|
+
*/
|
|
89
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
90
|
+
/**
|
|
91
|
+
*/
|
|
92
|
+
export function executeProgramWithBlackBoxSolver(_solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>;
|
|
91
93
|
/**
|
|
92
94
|
* Sets the package's logging level.
|
|
93
95
|
*
|
|
@@ -95,6 +97,11 @@ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap
|
|
|
95
97
|
*/
|
|
96
98
|
export function initLogLevel(filter: string): void;
|
|
97
99
|
/**
|
|
100
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
101
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
102
|
+
*/
|
|
103
|
+
export function buildInfo(): BuildInfo;
|
|
104
|
+
/**
|
|
98
105
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
99
106
|
*
|
|
100
107
|
* @param {WitnessMap} witness_map - A witness map.
|
|
@@ -124,64 +131,61 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
124
131
|
*/
|
|
125
132
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
126
133
|
/**
|
|
127
|
-
*
|
|
128
|
-
*/
|
|
129
|
-
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
|
|
130
|
-
/**
|
|
131
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
134
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
132
135
|
*
|
|
133
136
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
134
|
-
* @param {WitnessMap}
|
|
135
|
-
* @
|
|
136
|
-
* @
|
|
137
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
138
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
139
|
+
* @param {Uint8Array} program
|
|
140
|
+
* @param {WitnessMap} witness_map
|
|
141
|
+
* @returns {WitnessMap}
|
|
137
142
|
*/
|
|
138
|
-
export function
|
|
143
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
139
144
|
/**
|
|
140
|
-
*
|
|
141
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
145
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
142
146
|
*
|
|
143
|
-
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
144
147
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
145
|
-
* @param {WitnessMap}
|
|
146
|
-
* @
|
|
147
|
-
* @
|
|
148
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
149
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
150
|
+
* @param {Uint8Array} program
|
|
151
|
+
* @param {WitnessMap} solved_witness
|
|
152
|
+
* @returns {WitnessMap}
|
|
148
153
|
*/
|
|
149
|
-
export function
|
|
154
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
150
155
|
/**
|
|
151
|
-
*
|
|
156
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
152
157
|
*
|
|
153
|
-
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
154
158
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
155
|
-
* @param {WitnessMap}
|
|
156
|
-
* @
|
|
157
|
-
* @
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
*/
|
|
162
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
163
|
-
/**
|
|
159
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
160
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
161
|
+
* @param {Uint8Array} program
|
|
162
|
+
* @param {WitnessMap} solved_witness
|
|
163
|
+
* @returns {WitnessMap}
|
|
164
164
|
*/
|
|
165
|
-
export function
|
|
165
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
166
166
|
|
|
167
|
+
export type RawAssertionPayload = {
|
|
168
|
+
selector: string;
|
|
169
|
+
data: string[];
|
|
170
|
+
};
|
|
167
171
|
export type ExecutionError = Error & {
|
|
168
172
|
callStack?: string[];
|
|
173
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
169
174
|
};
|
|
170
175
|
|
|
171
176
|
|
|
172
177
|
|
|
173
|
-
|
|
174
|
-
export type
|
|
178
|
+
export type ForeignCallInput = string[]
|
|
179
|
+
export type ForeignCallOutput = string | string[]
|
|
175
180
|
|
|
176
181
|
/**
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
}
|
|
182
|
+
* A callback which performs an foreign call and returns the response.
|
|
183
|
+
* @callback ForeignCallHandler
|
|
184
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
185
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
186
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
187
|
+
*/
|
|
188
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
185
189
|
|
|
186
190
|
|
|
187
191
|
|
|
@@ -199,17 +203,18 @@ export type BuildInfo = {
|
|
|
199
203
|
|
|
200
204
|
|
|
201
205
|
|
|
202
|
-
|
|
203
|
-
export type
|
|
206
|
+
// Map from witness index to hex string value of witness.
|
|
207
|
+
export type WitnessMap = Map<number, string>;
|
|
204
208
|
|
|
205
209
|
/**
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
* An execution result containing two witnesses.
|
|
211
|
+
* 1. The full solved witness of the execution.
|
|
212
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
213
|
+
*/
|
|
214
|
+
export type SolvedAndReturnWitness = {
|
|
215
|
+
solvedWitness: WitnessMap;
|
|
216
|
+
returnWitness: WitnessMap;
|
|
217
|
+
}
|
|
213
218
|
|
|
214
219
|
|
|
215
220
|
|