@aztec/noir-acvm_js 0.0.1-commit.f146247c → 0.0.1-commit.f224bb98b
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 +112 -94
- package/nodejs/acvm_js.js +639 -679
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +13 -12
- package/package.json +3 -3
- package/web/acvm_js.d.ts +159 -139
- package/web/acvm_js.js +717 -716
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +13 -12
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -1,10 +1,88 @@
|
|
|
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
|
*
|
|
@@ -12,6 +90,15 @@ export function buildInfo(): BuildInfo;
|
|
|
12
90
|
* @returns {Uint8Array} A compressed witness map
|
|
13
91
|
*/
|
|
14
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
|
+
|
|
15
102
|
/**
|
|
16
103
|
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
17
104
|
* This should be used to only fetch the witness map for the main function.
|
|
@@ -20,13 +107,7 @@ export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
|
20
107
|
* @returns {WitnessMap} The decompressed witness map.
|
|
21
108
|
*/
|
|
22
109
|
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
23
|
-
|
|
24
|
-
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
25
|
-
*
|
|
26
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
27
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
28
|
-
*/
|
|
29
|
-
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
110
|
+
|
|
30
111
|
/**
|
|
31
112
|
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
32
113
|
*
|
|
@@ -34,30 +115,17 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
34
115
|
* @returns {WitnessStack} The decompressed witness stack.
|
|
35
116
|
*/
|
|
36
117
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
37
|
-
|
|
38
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
39
|
-
*/
|
|
40
|
-
export function and(lhs: string, rhs: string): string;
|
|
41
|
-
/**
|
|
42
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
43
|
-
*/
|
|
44
|
-
export function xor(lhs: string, rhs: string): string;
|
|
45
|
-
/**
|
|
46
|
-
* Sha256 compression function
|
|
47
|
-
*/
|
|
48
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
49
|
-
/**
|
|
50
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
51
|
-
*/
|
|
52
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
118
|
+
|
|
53
119
|
/**
|
|
54
120
|
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
55
121
|
*/
|
|
56
122
|
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
123
|
+
|
|
57
124
|
/**
|
|
58
125
|
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
59
126
|
*/
|
|
60
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
|
*
|
|
@@ -67,6 +135,7 @@ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_byte
|
|
|
67
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.
|
|
@@ -77,6 +146,7 @@ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap,
|
|
|
77
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
|
*
|
|
@@ -86,20 +156,7 @@ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_wit
|
|
|
86
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>;
|
|
89
|
-
|
|
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;
|
|
95
|
-
/**
|
|
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
|
-
*/
|
|
102
|
-
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
159
|
+
|
|
103
160
|
/**
|
|
104
161
|
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
105
162
|
*
|
|
@@ -108,6 +165,7 @@ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap):
|
|
|
108
165
|
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
109
166
|
*/
|
|
110
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.
|
|
113
171
|
*
|
|
@@ -117,68 +175,28 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
|
|
|
117
175
|
*/
|
|
118
176
|
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
119
177
|
|
|
120
|
-
export type StackItem = {
|
|
121
|
-
index: number;
|
|
122
|
-
witness: WitnessMap;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export type WitnessStack = Array<StackItem>;
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
178
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
* @
|
|
133
|
-
* @
|
|
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.
|
|
134
184
|
*/
|
|
135
|
-
export
|
|
136
|
-
gitHash: string;
|
|
137
|
-
version: string;
|
|
138
|
-
dirty: string;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
export type RawAssertionPayload = {
|
|
144
|
-
selector: string;
|
|
145
|
-
data: string[];
|
|
146
|
-
};
|
|
147
|
-
|
|
148
|
-
export type ExecutionError = Error & {
|
|
149
|
-
callStack?: string[];
|
|
150
|
-
rawAssertionPayload?: RawAssertionPayload;
|
|
151
|
-
acirFunctionId?: number;
|
|
152
|
-
brilligFunctionId?: number;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
// Map from witness index to hex string value of witness.
|
|
158
|
-
export type WitnessMap = Map<number, string>;
|
|
185
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
159
186
|
|
|
160
187
|
/**
|
|
161
|
-
*
|
|
162
|
-
*
|
|
163
|
-
*
|
|
188
|
+
* Sets the package's logging level.
|
|
189
|
+
*
|
|
190
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
164
191
|
*/
|
|
165
|
-
export
|
|
166
|
-
solvedWitness: WitnessMap;
|
|
167
|
-
returnWitness: WitnessMap;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
export type ForeignCallInput = string[]
|
|
173
|
-
export type ForeignCallOutput = string | string[]
|
|
192
|
+
export function initLogLevel(filter: string): void;
|
|
174
193
|
|
|
175
194
|
/**
|
|
176
|
-
*
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
180
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
181
|
-
*/
|
|
182
|
-
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
183
|
-
|
|
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;
|