@noir-lang/acvm_js 0.50.0 → 0.51.0-052aee8.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 +106 -105
- package/nodejs/acvm_js.js +253 -231
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +9 -9
- package/package.json +2 -2
- package/web/acvm_js.d.ts +115 -114
- package/web/acvm_js.js +250 -227
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +9 -9
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,6 +1,78 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
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.
|
|
6
|
+
*/
|
|
7
|
+
export function buildInfo(): BuildInfo;
|
|
8
|
+
/**
|
|
9
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
10
|
+
*
|
|
11
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
12
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
13
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
14
|
+
* @param {Uint8Array} program
|
|
15
|
+
* @param {WitnessMap} witness_map
|
|
16
|
+
* @returns {WitnessMap}
|
|
17
|
+
*/
|
|
18
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
19
|
+
/**
|
|
20
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
21
|
+
*
|
|
22
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
23
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
24
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
25
|
+
* @param {Uint8Array} program
|
|
26
|
+
* @param {WitnessMap} solved_witness
|
|
27
|
+
* @returns {WitnessMap}
|
|
28
|
+
*/
|
|
29
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
30
|
+
/**
|
|
31
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
32
|
+
*
|
|
33
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
34
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
35
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
36
|
+
* @param {Uint8Array} program
|
|
37
|
+
* @param {WitnessMap} solved_witness
|
|
38
|
+
* @returns {WitnessMap}
|
|
39
|
+
*/
|
|
40
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
41
|
+
/**
|
|
42
|
+
* Sets the package's logging level.
|
|
43
|
+
*
|
|
44
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
45
|
+
*/
|
|
46
|
+
export function initLogLevel(filter: string): void;
|
|
47
|
+
/**
|
|
48
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
49
|
+
*
|
|
50
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
51
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
52
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
53
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
54
|
+
*/
|
|
55
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
56
|
+
/**
|
|
57
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
58
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
59
|
+
*
|
|
60
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
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 {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.
|
|
64
|
+
*/
|
|
65
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
66
|
+
/**
|
|
67
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
68
|
+
*
|
|
69
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
70
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
71
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
72
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
73
|
+
*/
|
|
74
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
75
|
+
/**
|
|
4
76
|
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
5
77
|
* @param {string} lhs
|
|
6
78
|
* @param {string} rhs
|
|
@@ -15,11 +87,12 @@ export function and(lhs: string, rhs: string): string;
|
|
|
15
87
|
*/
|
|
16
88
|
export function xor(lhs: string, rhs: string): string;
|
|
17
89
|
/**
|
|
18
|
-
*
|
|
19
|
-
* @param {
|
|
20
|
-
* @
|
|
90
|
+
* Sha256 compression function
|
|
91
|
+
* @param {Uint32Array} inputs
|
|
92
|
+
* @param {Uint32Array} state
|
|
93
|
+
* @returns {Uint32Array}
|
|
21
94
|
*/
|
|
22
|
-
export function
|
|
95
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
23
96
|
/**
|
|
24
97
|
* Calculates the Blake2s256 hash of the input bytes
|
|
25
98
|
* @param {Uint8Array} inputs
|
|
@@ -79,107 +152,6 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
79
152
|
* @returns {WitnessStack} The decompressed witness stack.
|
|
80
153
|
*/
|
|
81
154
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
82
|
-
/**
|
|
83
|
-
* Sets the package's logging level.
|
|
84
|
-
*
|
|
85
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
86
|
-
*/
|
|
87
|
-
export function initLogLevel(filter: string): void;
|
|
88
|
-
/**
|
|
89
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
90
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
91
|
-
*/
|
|
92
|
-
export function buildInfo(): BuildInfo;
|
|
93
|
-
/**
|
|
94
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
95
|
-
*
|
|
96
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
97
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
98
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
99
|
-
* @param {Uint8Array} program
|
|
100
|
-
* @param {WitnessMap} witness_map
|
|
101
|
-
* @returns {WitnessMap}
|
|
102
|
-
*/
|
|
103
|
-
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
104
|
-
/**
|
|
105
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
106
|
-
*
|
|
107
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
108
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
109
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
110
|
-
* @param {Uint8Array} program
|
|
111
|
-
* @param {WitnessMap} solved_witness
|
|
112
|
-
* @returns {WitnessMap}
|
|
113
|
-
*/
|
|
114
|
-
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
115
|
-
/**
|
|
116
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
117
|
-
*
|
|
118
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
119
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
120
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
121
|
-
* @param {Uint8Array} program
|
|
122
|
-
* @param {WitnessMap} solved_witness
|
|
123
|
-
* @returns {WitnessMap}
|
|
124
|
-
*/
|
|
125
|
-
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
126
|
-
/**
|
|
127
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
128
|
-
*
|
|
129
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
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 {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
133
|
-
*/
|
|
134
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
135
|
-
/**
|
|
136
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
137
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
138
|
-
*
|
|
139
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
140
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
141
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
142
|
-
* @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.
|
|
143
|
-
*/
|
|
144
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
145
|
-
/**
|
|
146
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
147
|
-
*
|
|
148
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
149
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
150
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
151
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
152
|
-
*/
|
|
153
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
154
|
-
|
|
155
|
-
export type ForeignCallInput = string[]
|
|
156
|
-
export type ForeignCallOutput = string | string[]
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
* A callback which performs an foreign call and returns the response.
|
|
160
|
-
* @callback ForeignCallHandler
|
|
161
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
162
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
163
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
164
|
-
*/
|
|
165
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
// Map from witness index to hex string value of witness.
|
|
170
|
-
export type WitnessMap = Map<number, string>;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* An execution result containing two witnesses.
|
|
174
|
-
* 1. The full solved witness of the execution.
|
|
175
|
-
* 2. The return witness which contains the given public return values within the full witness.
|
|
176
|
-
*/
|
|
177
|
-
export type SolvedAndReturnWitness = {
|
|
178
|
-
solvedWitness: WitnessMap;
|
|
179
|
-
returnWitness: WitnessMap;
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
|
|
183
155
|
|
|
184
156
|
/**
|
|
185
157
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -216,3 +188,32 @@ export type StackItem = {
|
|
|
216
188
|
export type WitnessStack = Array<StackItem>;
|
|
217
189
|
|
|
218
190
|
|
|
191
|
+
|
|
192
|
+
// Map from witness index to hex string value of witness.
|
|
193
|
+
export type WitnessMap = Map<number, string>;
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
|
+
* An execution result containing two witnesses.
|
|
197
|
+
* 1. The full solved witness of the execution.
|
|
198
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
199
|
+
*/
|
|
200
|
+
export type SolvedAndReturnWitness = {
|
|
201
|
+
solvedWitness: WitnessMap;
|
|
202
|
+
returnWitness: WitnessMap;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
export type ForeignCallInput = string[]
|
|
208
|
+
export type ForeignCallOutput = string | string[]
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* A callback which performs an foreign call and returns the response.
|
|
212
|
+
* @callback ForeignCallHandler
|
|
213
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
214
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
215
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
216
|
+
*/
|
|
217
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
218
|
+
|
|
219
|
+
|