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