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