@noir-lang/acvm_js 0.43.0 → 0.44.0-1ec9cdc.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 +124 -103
- package/nodejs/acvm_js.js +271 -252
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +16 -15
- package/package.json +1 -1
- package/web/acvm_js.d.ts +140 -118
- package/web/acvm_js.js +265 -246
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +16 -15
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,63 +1,60 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @param {
|
|
7
|
-
* @returns {
|
|
8
|
-
*/
|
|
9
|
-
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
10
|
-
/**
|
|
11
|
-
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
12
|
-
* This should be used to only fetch the witness map for the main function.
|
|
13
|
-
*
|
|
14
|
-
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
15
|
-
* @returns {WitnessMap} The decompressed witness map.
|
|
4
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
5
|
+
* @param {string} lhs
|
|
6
|
+
* @param {string} rhs
|
|
7
|
+
* @returns {string}
|
|
16
8
|
*/
|
|
17
|
-
export function
|
|
9
|
+
export function and(lhs: string, rhs: string): string;
|
|
18
10
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
* @param {
|
|
22
|
-
* @returns {
|
|
11
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
12
|
+
* @param {string} lhs
|
|
13
|
+
* @param {string} rhs
|
|
14
|
+
* @returns {string}
|
|
23
15
|
*/
|
|
24
|
-
export function
|
|
16
|
+
export function xor(lhs: string, rhs: string): string;
|
|
25
17
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @
|
|
29
|
-
* @returns {WitnessStack} The decompressed witness stack.
|
|
18
|
+
* Calculates the SHA256 hash of the input bytes
|
|
19
|
+
* @param {Uint8Array} inputs
|
|
20
|
+
* @returns {Uint8Array}
|
|
30
21
|
*/
|
|
31
|
-
export function
|
|
22
|
+
export function sha256(inputs: Uint8Array): Uint8Array;
|
|
32
23
|
/**
|
|
33
|
-
*
|
|
24
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
25
|
+
* @param {Uint8Array} inputs
|
|
26
|
+
* @returns {Uint8Array}
|
|
34
27
|
*/
|
|
35
|
-
export function
|
|
28
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
36
29
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
* @
|
|
40
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
41
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
42
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
30
|
+
* Calculates the Keccak256 hash of the input bytes
|
|
31
|
+
* @param {Uint8Array} inputs
|
|
32
|
+
* @returns {Uint8Array}
|
|
43
33
|
*/
|
|
44
|
-
export function
|
|
34
|
+
export function keccak256(inputs: Uint8Array): Uint8Array;
|
|
45
35
|
/**
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
* @param {
|
|
49
|
-
* @param {Uint8Array}
|
|
50
|
-
* @param {
|
|
51
|
-
* @
|
|
52
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
36
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
37
|
+
* @param {Uint8Array} hashed_msg
|
|
38
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
39
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
40
|
+
* @param {Uint8Array} signature
|
|
41
|
+
* @returns {boolean}
|
|
53
42
|
*/
|
|
54
|
-
export function
|
|
43
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
55
44
|
/**
|
|
45
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
46
|
+
* @param {Uint8Array} hashed_msg
|
|
47
|
+
* @param {Uint8Array} public_key_x_bytes
|
|
48
|
+
* @param {Uint8Array} public_key_y_bytes
|
|
49
|
+
* @param {Uint8Array} signature
|
|
50
|
+
* @returns {boolean}
|
|
56
51
|
*/
|
|
57
|
-
export function
|
|
52
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
58
53
|
/**
|
|
54
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
55
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
59
56
|
*/
|
|
60
|
-
export function
|
|
57
|
+
export function buildInfo(): BuildInfo;
|
|
61
58
|
/**
|
|
62
59
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
63
60
|
*
|
|
@@ -92,80 +89,80 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
92
89
|
*/
|
|
93
90
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
94
91
|
/**
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
* @param {
|
|
98
|
-
* @returns {string}
|
|
92
|
+
* Sets the package's logging level.
|
|
93
|
+
*
|
|
94
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
99
95
|
*/
|
|
100
|
-
export function
|
|
96
|
+
export function initLogLevel(filter: string): void;
|
|
101
97
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* @param {
|
|
105
|
-
* @returns {
|
|
98
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
99
|
+
*
|
|
100
|
+
* @param {WitnessMap} witness_map - A witness map.
|
|
101
|
+
* @returns {Uint8Array} A compressed witness map
|
|
106
102
|
*/
|
|
107
|
-
export function
|
|
103
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
108
104
|
/**
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
105
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
106
|
+
* This should be used to only fetch the witness map for the main function.
|
|
107
|
+
*
|
|
108
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
109
|
+
* @returns {WitnessMap} The decompressed witness map.
|
|
112
110
|
*/
|
|
113
|
-
export function
|
|
111
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
114
112
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
* @
|
|
113
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
114
|
+
*
|
|
115
|
+
* @param {WitnessStack} witness_stack - A witness stack.
|
|
116
|
+
* @returns {Uint8Array} A compressed witness stack
|
|
118
117
|
*/
|
|
119
|
-
export function
|
|
118
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
120
119
|
/**
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
* @
|
|
120
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
121
|
+
*
|
|
122
|
+
* @param {Uint8Array} compressed_witness - A compressed witness.
|
|
123
|
+
* @returns {WitnessStack} The decompressed witness stack.
|
|
124
124
|
*/
|
|
125
|
-
export function
|
|
125
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
126
126
|
/**
|
|
127
|
-
*
|
|
128
|
-
* @param {Uint8Array} hashed_msg
|
|
129
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
130
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
131
|
-
* @param {Uint8Array} signature
|
|
132
|
-
* @returns {boolean}
|
|
127
|
+
* @returns {Promise<WasmBlackBoxFunctionSolver>}
|
|
133
128
|
*/
|
|
134
|
-
export function
|
|
129
|
+
export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
|
|
135
130
|
/**
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
* @param {Uint8Array}
|
|
139
|
-
* @param {
|
|
140
|
-
* @param {
|
|
141
|
-
* @returns {
|
|
131
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
132
|
+
*
|
|
133
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
134
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
135
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
136
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
142
137
|
*/
|
|
143
|
-
export function
|
|
138
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
144
139
|
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
140
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
141
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
142
|
+
*
|
|
143
|
+
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
144
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
145
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
146
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
147
|
+
* @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.
|
|
147
148
|
*/
|
|
148
|
-
export function
|
|
149
|
+
export function executeCircuitWithReturnWitness(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
149
150
|
/**
|
|
150
|
-
*
|
|
151
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
151
152
|
*
|
|
152
|
-
* @param {
|
|
153
|
+
* @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
|
|
154
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
155
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
156
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
157
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
153
158
|
*/
|
|
154
|
-
export function
|
|
155
|
-
|
|
156
|
-
export type ForeignCallInput = string[]
|
|
157
|
-
export type ForeignCallOutput = string | string[]
|
|
158
|
-
|
|
159
|
+
export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
159
160
|
/**
|
|
160
|
-
* A callback which performs an foreign call and returns the response.
|
|
161
|
-
* @callback ForeignCallHandler
|
|
162
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
163
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
164
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
165
161
|
*/
|
|
166
|
-
export
|
|
167
|
-
|
|
168
|
-
|
|
162
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
163
|
+
/**
|
|
164
|
+
*/
|
|
165
|
+
export function executeProgramWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>;
|
|
169
166
|
|
|
170
167
|
export type ExecutionError = Error & {
|
|
171
168
|
callStack?: string[];
|
|
@@ -176,15 +173,16 @@ export type ExecutionError = Error & {
|
|
|
176
173
|
// Map from witness index to hex string value of witness.
|
|
177
174
|
export type WitnessMap = Map<number, string>;
|
|
178
175
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
176
|
+
/**
|
|
177
|
+
* An execution result containing two witnesses.
|
|
178
|
+
* 1. The full solved witness of the execution.
|
|
179
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
180
|
+
*/
|
|
181
|
+
export type SolvedAndReturnWitness = {
|
|
182
|
+
solvedWitness: WitnessMap;
|
|
183
|
+
returnWitness: WitnessMap;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
export type WitnessStack = Array<StackItem>;
|
|
187
|
-
|
|
188
186
|
|
|
189
187
|
|
|
190
188
|
/**
|
|
@@ -200,6 +198,29 @@ export type BuildInfo = {
|
|
|
200
198
|
}
|
|
201
199
|
|
|
202
200
|
|
|
201
|
+
|
|
202
|
+
export type ForeignCallInput = string[]
|
|
203
|
+
export type ForeignCallOutput = string | string[]
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* A callback which performs an foreign call and returns the response.
|
|
207
|
+
* @callback ForeignCallHandler
|
|
208
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
209
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
210
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
211
|
+
*/
|
|
212
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
export type StackItem = {
|
|
217
|
+
index: number;
|
|
218
|
+
witness: WitnessMap;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export type WitnessStack = Array<StackItem>;
|
|
222
|
+
|
|
223
|
+
|
|
203
224
|
/**
|
|
204
225
|
*/
|
|
205
226
|
export class WasmBlackBoxFunctionSolver {
|