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