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