@noir-lang/acvm_js 0.51.0 → 0.52.0-075c3d3.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 +93 -99
- package/nodejs/acvm_js.js +205 -225
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +7 -8
- package/package.json +1 -1
- package/web/acvm_js.d.ts +100 -107
- package/web/acvm_js.js +201 -221
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +7 -8
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,40 +1,6 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* Sets the package's logging level.
|
|
5
|
-
*
|
|
6
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
7
|
-
*/
|
|
8
|
-
export function initLogLevel(filter: string): void;
|
|
9
|
-
/**
|
|
10
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
11
|
-
*
|
|
12
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
13
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
14
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
15
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
16
|
-
*/
|
|
17
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
18
|
-
/**
|
|
19
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
20
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
21
|
-
*
|
|
22
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
23
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
24
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
25
|
-
* @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.
|
|
26
|
-
*/
|
|
27
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
28
|
-
/**
|
|
29
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
30
|
-
*
|
|
31
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
32
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
33
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
34
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
35
|
-
*/
|
|
36
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
37
|
-
/**
|
|
38
4
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
39
5
|
* @param {string} lhs
|
|
40
6
|
* @param {string} rhs
|
|
@@ -62,12 +28,6 @@ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uin
|
|
|
62
28
|
*/
|
|
63
29
|
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
64
30
|
/**
|
|
65
|
-
* Calculates the Keccak256 hash of the input bytes
|
|
66
|
-
* @param {Uint8Array} inputs
|
|
67
|
-
* @returns {Uint8Array}
|
|
68
|
-
*/
|
|
69
|
-
export function keccak256(inputs: Uint8Array): Uint8Array;
|
|
70
|
-
/**
|
|
71
31
|
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
72
32
|
* @param {Uint8Array} hashed_msg
|
|
73
33
|
* @param {Uint8Array} public_key_x_bytes
|
|
@@ -86,6 +46,45 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
86
46
|
*/
|
|
87
47
|
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
88
48
|
/**
|
|
49
|
+
* Sets the package's logging level.
|
|
50
|
+
*
|
|
51
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
52
|
+
*/
|
|
53
|
+
export function initLogLevel(filter: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
56
|
+
*
|
|
57
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
58
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
59
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
60
|
+
* @param {Uint8Array} program
|
|
61
|
+
* @param {WitnessMap} witness_map
|
|
62
|
+
* @returns {WitnessMap}
|
|
63
|
+
*/
|
|
64
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
65
|
+
/**
|
|
66
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
67
|
+
*
|
|
68
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
69
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
70
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
71
|
+
* @param {Uint8Array} program
|
|
72
|
+
* @param {WitnessMap} solved_witness
|
|
73
|
+
* @returns {WitnessMap}
|
|
74
|
+
*/
|
|
75
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
76
|
+
/**
|
|
77
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
78
|
+
*
|
|
79
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
80
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
81
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
82
|
+
* @param {Uint8Array} program
|
|
83
|
+
* @param {WitnessMap} solved_witness
|
|
84
|
+
* @returns {WitnessMap}
|
|
85
|
+
*/
|
|
86
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
87
|
+
/**
|
|
89
88
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
90
89
|
*
|
|
91
90
|
* @param {WitnessMap} witness_map - A witness map.
|
|
@@ -115,57 +114,59 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
115
114
|
*/
|
|
116
115
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
117
116
|
/**
|
|
118
|
-
*
|
|
119
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
120
|
-
*/
|
|
121
|
-
export function buildInfo(): BuildInfo;
|
|
122
|
-
/**
|
|
123
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
117
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
124
118
|
*
|
|
125
119
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
126
|
-
* @param {WitnessMap}
|
|
127
|
-
* @
|
|
128
|
-
* @
|
|
129
|
-
* @param {WitnessMap} witness_map
|
|
130
|
-
* @returns {WitnessMap}
|
|
120
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
121
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
122
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
131
123
|
*/
|
|
132
|
-
export function
|
|
124
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
133
125
|
/**
|
|
134
|
-
*
|
|
126
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
127
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
135
128
|
*
|
|
136
129
|
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
137
|
-
* @param {WitnessMap}
|
|
138
|
-
* @
|
|
139
|
-
* @
|
|
140
|
-
* @param {WitnessMap} solved_witness
|
|
141
|
-
* @returns {WitnessMap}
|
|
130
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
131
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
132
|
+
* @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.
|
|
142
133
|
*/
|
|
143
|
-
export function
|
|
134
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
144
135
|
/**
|
|
145
|
-
*
|
|
136
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
146
137
|
*
|
|
147
|
-
* @param {Uint8Array}
|
|
148
|
-
* @param {WitnessMap}
|
|
149
|
-
* @
|
|
150
|
-
* @
|
|
151
|
-
* @param {WitnessMap} solved_witness
|
|
152
|
-
* @returns {WitnessMap}
|
|
138
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
139
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
140
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
141
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
153
142
|
*/
|
|
154
|
-
export function
|
|
143
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
144
|
+
/**
|
|
145
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
146
|
+
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
147
|
+
*/
|
|
148
|
+
export function buildInfo(): BuildInfo;
|
|
155
149
|
|
|
156
|
-
|
|
157
|
-
|
|
150
|
+
export type RawAssertionPayload = {
|
|
151
|
+
selector: string;
|
|
152
|
+
data: string[];
|
|
153
|
+
};
|
|
158
154
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
155
|
+
export type ExecutionError = Error & {
|
|
156
|
+
callStack?: string[];
|
|
157
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
158
|
+
brilligFunctionId?: number;
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
export type StackItem = {
|
|
164
|
+
index: number;
|
|
165
|
+
witness: WitnessMap;
|
|
167
166
|
}
|
|
168
167
|
|
|
168
|
+
export type WitnessStack = Array<StackItem>;
|
|
169
|
+
|
|
169
170
|
|
|
170
171
|
|
|
171
172
|
export type ForeignCallInput = string[]
|
|
@@ -182,6 +183,21 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
182
183
|
|
|
183
184
|
|
|
184
185
|
|
|
186
|
+
// Map from witness index to hex string value of witness.
|
|
187
|
+
export type WitnessMap = Map<number, string>;
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* An execution result containing two witnesses.
|
|
191
|
+
* 1. The full solved witness of the execution.
|
|
192
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
193
|
+
*/
|
|
194
|
+
export type SolvedAndReturnWitness = {
|
|
195
|
+
solvedWitness: WitnessMap;
|
|
196
|
+
returnWitness: WitnessMap;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
|
|
185
201
|
/**
|
|
186
202
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
187
203
|
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
@@ -195,25 +211,3 @@ export type BuildInfo = {
|
|
|
195
211
|
}
|
|
196
212
|
|
|
197
213
|
|
|
198
|
-
|
|
199
|
-
export type RawAssertionPayload = {
|
|
200
|
-
selector: string;
|
|
201
|
-
data: string[];
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
export type ExecutionError = Error & {
|
|
205
|
-
callStack?: string[];
|
|
206
|
-
rawAssertionPayload?: RawAssertionPayload;
|
|
207
|
-
brilligFunctionId?: number;
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
export type StackItem = {
|
|
213
|
-
index: number;
|
|
214
|
-
witness: WitnessMap;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
export type WitnessStack = Array<StackItem>;
|
|
218
|
-
|
|
219
|
-
|