@noir-lang/acvm_js 0.51.0 → 0.52.0-600ffeb.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 +99 -105
- package/nodejs/acvm_js.js +295 -316
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +9 -10
- package/package.json +1 -1
- package/web/acvm_js.d.ts +108 -115
- package/web/acvm_js.js +257 -278
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +9 -10
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export function
|
|
4
|
+
export function buildInfo(): number;
|
|
5
|
+
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
6
|
+
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
7
|
+
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
5
8
|
export function executeCircuit(a: number, b: number, c: number, d: number): number;
|
|
6
9
|
export function executeCircuitWithReturnWitness(a: number, b: number, c: number, d: number): number;
|
|
7
10
|
export function executeProgram(a: number, b: number, c: number, d: number): number;
|
|
11
|
+
export function compressWitness(a: number, b: number): void;
|
|
12
|
+
export function decompressWitness(a: number, b: number, c: number): void;
|
|
13
|
+
export function compressWitnessStack(a: number, b: number): void;
|
|
14
|
+
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
15
|
+
export function initLogLevel(a: number, b: number, c: number): void;
|
|
8
16
|
export function and(a: number, b: number): number;
|
|
9
17
|
export function xor(a: number, b: number): number;
|
|
10
18
|
export function sha256_compression(a: number, b: number, c: number, d: number, e: number): void;
|
|
11
19
|
export function blake2s256(a: number, b: number, c: number): void;
|
|
12
|
-
export function keccak256(a: number, b: number, c: number): void;
|
|
13
20
|
export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
14
21
|
export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
|
|
15
|
-
export function compressWitness(a: number, b: number): void;
|
|
16
|
-
export function decompressWitness(a: number, b: number, c: number): void;
|
|
17
|
-
export function compressWitnessStack(a: number, b: number): void;
|
|
18
|
-
export function decompressWitnessStack(a: number, b: number, c: number): void;
|
|
19
|
-
export function buildInfo(): number;
|
|
20
|
-
export function getReturnWitness(a: number, b: number, c: number, d: number): void;
|
|
21
|
-
export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
|
|
22
|
-
export function getPublicWitness(a: number, b: number, c: number, d: number): void;
|
|
23
22
|
export function __wbindgen_malloc(a: number): number;
|
|
24
23
|
export function __wbindgen_realloc(a: number, b: number, c: number): number;
|
|
25
24
|
export const __wbindgen_export_2: WebAssembly.Table;
|
package/package.json
CHANGED
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,11 +1,43 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
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 {
|
|
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
|
|
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
|
-
|
|
161
|
-
|
|
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,12 +183,32 @@ export type ExecutionError = Error & {
|
|
|
209
183
|
|
|
210
184
|
|
|
211
185
|
|
|
212
|
-
export type
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
186
|
+
export type ForeignCallInput = string[]
|
|
187
|
+
export type ForeignCallOutput = string | string[]
|
|
188
|
+
|
|
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[]>;
|
|
216
197
|
|
|
217
|
-
|
|
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
|
|
|
220
214
|
|
|
@@ -222,25 +216,24 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
222
216
|
|
|
223
217
|
export interface InitOutput {
|
|
224
218
|
readonly memory: WebAssembly.Memory;
|
|
225
|
-
readonly
|
|
219
|
+
readonly buildInfo: () => number;
|
|
220
|
+
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
221
|
+
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
222
|
+
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
|
|
226
223
|
readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
|
|
227
224
|
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: number, d: number) => number;
|
|
228
225
|
readonly executeProgram: (a: number, b: number, c: number, d: number) => number;
|
|
226
|
+
readonly compressWitness: (a: number, b: number) => void;
|
|
227
|
+
readonly decompressWitness: (a: number, b: number, c: number) => void;
|
|
228
|
+
readonly compressWitnessStack: (a: number, b: number) => void;
|
|
229
|
+
readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
|
|
230
|
+
readonly initLogLevel: (a: number, b: number, c: number) => void;
|
|
229
231
|
readonly and: (a: number, b: number) => number;
|
|
230
232
|
readonly xor: (a: number, b: number) => number;
|
|
231
233
|
readonly sha256_compression: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
232
234
|
readonly blake2s256: (a: number, b: number, c: number) => void;
|
|
233
|
-
readonly keccak256: (a: number, b: number, c: number) => void;
|
|
234
235
|
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
235
236
|
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
236
|
-
readonly compressWitness: (a: number, b: number) => void;
|
|
237
|
-
readonly decompressWitness: (a: number, b: number, c: number) => void;
|
|
238
|
-
readonly compressWitnessStack: (a: number, b: number) => void;
|
|
239
|
-
readonly decompressWitnessStack: (a: number, b: number, c: number) => void;
|
|
240
|
-
readonly buildInfo: () => number;
|
|
241
|
-
readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
|
|
242
|
-
readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
|
|
243
|
-
readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
|
|
244
237
|
readonly __wbindgen_malloc: (a: number) => number;
|
|
245
238
|
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
|
|
246
239
|
readonly __wbindgen_export_2: WebAssembly.Table;
|