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