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