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