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