@noir-lang/acvm_js 0.51.0 → 0.52.0-2f37610.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.
@@ -1,11 +1,43 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Sets the package's logging level.
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.
5
10
  *
6
- * @param {LogLevel} level - The maximum level of logging to be emitted.
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}
7
17
  */
8
- export function initLogLevel(filter: string): void;
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;
9
41
  /**
10
42
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
11
43
  *
@@ -35,6 +67,41 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
35
67
  */
36
68
  export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
37
69
  /**
70
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
71
+ *
72
+ * @param {WitnessMap} witness_map - A witness map.
73
+ * @returns {Uint8Array} A compressed witness map
74
+ */
75
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
76
+ /**
77
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
78
+ * This should be used to only fetch the witness map for the main function.
79
+ *
80
+ * @param {Uint8Array} compressed_witness - A compressed witness.
81
+ * @returns {WitnessMap} The decompressed witness map.
82
+ */
83
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
84
+ /**
85
+ * Compresses a `WitnessStack` into the binary format outputted by Nargo.
86
+ *
87
+ * @param {WitnessStack} witness_stack - A witness stack.
88
+ * @returns {Uint8Array} A compressed witness stack
89
+ */
90
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
91
+ /**
92
+ * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
93
+ *
94
+ * @param {Uint8Array} compressed_witness - A compressed witness.
95
+ * @returns {WitnessStack} The decompressed witness stack.
96
+ */
97
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
98
+ /**
99
+ * Sets the package's logging level.
100
+ *
101
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
102
+ */
103
+ export function initLogLevel(filter: string): void;
104
+ /**
38
105
  * Performs a bitwise AND operation between `lhs` and `rhs`
39
106
  * @param {string} lhs
40
107
  * @param {string} rhs
@@ -62,12 +129,6 @@ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uin
62
129
  */
63
130
  export function blake2s256(inputs: Uint8Array): Uint8Array;
64
131
  /**
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
132
  * Verifies a ECDSA signature over the secp256k1 curve.
72
133
  * @param {Uint8Array} hashed_msg
73
134
  * @param {Uint8Array} public_key_x_bytes
@@ -85,100 +146,13 @@ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_byte
85
146
  * @returns {boolean}
86
147
  */
87
148
  export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
88
- /**
89
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
90
- *
91
- * @param {WitnessMap} witness_map - A witness map.
92
- * @returns {Uint8Array} A compressed witness map
93
- */
94
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
95
- /**
96
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
97
- * This should be used to only fetch the witness map for the main function.
98
- *
99
- * @param {Uint8Array} compressed_witness - A compressed witness.
100
- * @returns {WitnessMap} The decompressed witness map.
101
- */
102
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
103
- /**
104
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
105
- *
106
- * @param {WitnessStack} witness_stack - A witness stack.
107
- * @returns {Uint8Array} A compressed witness stack
108
- */
109
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
110
- /**
111
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
112
- *
113
- * @param {Uint8Array} compressed_witness - A compressed witness.
114
- * @returns {WitnessStack} The decompressed witness stack.
115
- */
116
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
117
- /**
118
- * Returns the `BuildInfo` object containing information about how the installed package was built.
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.
124
- *
125
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
126
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
127
- * @returns {WitnessMap} A witness map containing the circuit's return values.
128
- * @param {Uint8Array} program
129
- * @param {WitnessMap} witness_map
130
- * @returns {WitnessMap}
131
- */
132
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
133
- /**
134
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
135
- *
136
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
137
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
138
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
139
- * @param {Uint8Array} program
140
- * @param {WitnessMap} solved_witness
141
- * @returns {WitnessMap}
142
- */
143
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
144
- /**
145
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
146
- *
147
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
148
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
149
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
150
- * @param {Uint8Array} program
151
- * @param {WitnessMap} solved_witness
152
- * @returns {WitnessMap}
153
- */
154
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
155
-
156
- // Map from witness index to hex string value of witness.
157
- export type WitnessMap = Map<number, string>;
158
149
 
159
- /**
160
- * An execution result containing two witnesses.
161
- * 1. The full solved witness of the execution.
162
- * 2. The return witness which contains the given public return values within the full witness.
163
- */
164
- export type SolvedAndReturnWitness = {
165
- solvedWitness: WitnessMap;
166
- returnWitness: WitnessMap;
150
+ export type StackItem = {
151
+ index: number;
152
+ witness: WitnessMap;
167
153
  }
168
154
 
169
-
170
-
171
- export type ForeignCallInput = string[]
172
- export type ForeignCallOutput = string | string[]
173
-
174
- /**
175
- * A callback which performs an foreign call and returns the response.
176
- * @callback ForeignCallHandler
177
- * @param {string} name - The identifier for the type of foreign call being performed.
178
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
179
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
180
- */
181
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
155
+ export type WitnessStack = Array<StackItem>;
182
156
 
183
157
 
184
158
 
@@ -209,11 +183,31 @@ export type ExecutionError = Error & {
209
183
 
210
184
 
211
185
 
212
- export type StackItem = {
213
- index: number;
214
- witness: WitnessMap;
215
- }
186
+ export type ForeignCallInput = string[]
187
+ export type ForeignCallOutput = string | string[]
216
188
 
217
- export type WitnessStack = Array<StackItem>;
189
+ /**
190
+ * A callback which performs an foreign call and returns the response.
191
+ * @callback ForeignCallHandler
192
+ * @param {string} name - The identifier for the type of foreign call being performed.
193
+ * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
194
+ * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
195
+ */
196
+ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
197
+
198
+
199
+
200
+ // Map from witness index to hex string value of witness.
201
+ export type WitnessMap = Map<number, string>;
202
+
203
+ /**
204
+ * An execution result containing two witnesses.
205
+ * 1. The full solved witness of the execution.
206
+ * 2. The return witness which contains the given public return values within the full witness.
207
+ */
208
+ export type SolvedAndReturnWitness = {
209
+ solvedWitness: WitnessMap;
210
+ returnWitness: WitnessMap;
211
+ }
218
212
 
219
213