@noir-lang/acvm_js 1.0.0-beta.17-32f513f.nightly → 1.0.0-beta.18
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 +77 -77
- package/nodejs/acvm_js.js +202 -203
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +13 -13
- package/package.json +1 -1
- package/web/acvm_js.d.ts +90 -90
- package/web/acvm_js.js +200 -201
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +13 -13
package/nodejs/acvm_js.d.ts
CHANGED
|
@@ -6,35 +6,57 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export function buildInfo(): BuildInfo;
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
*
|
|
9
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
10
|
+
*
|
|
11
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
12
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
13
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
14
|
+
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
14
15
|
*/
|
|
15
|
-
export function
|
|
16
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
16
17
|
/**
|
|
17
|
-
*
|
|
18
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
19
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
20
|
+
*
|
|
21
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
22
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
23
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
24
|
+
* @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.
|
|
18
25
|
*/
|
|
19
|
-
export function
|
|
26
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
20
27
|
/**
|
|
21
|
-
*
|
|
28
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
29
|
+
*
|
|
30
|
+
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
31
|
+
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
32
|
+
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
33
|
+
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
22
34
|
*/
|
|
23
|
-
export function
|
|
35
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
24
36
|
/**
|
|
25
|
-
*
|
|
37
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
38
|
+
*
|
|
39
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
40
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
41
|
+
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
26
42
|
*/
|
|
27
|
-
export function
|
|
43
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
28
44
|
/**
|
|
29
|
-
*
|
|
45
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
46
|
+
*
|
|
47
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
48
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
49
|
+
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
30
50
|
*/
|
|
31
|
-
export function
|
|
51
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
32
52
|
/**
|
|
33
|
-
*
|
|
53
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
34
54
|
*
|
|
35
|
-
* @param {
|
|
55
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
56
|
+
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
57
|
+
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
36
58
|
*/
|
|
37
|
-
export function
|
|
59
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
38
60
|
/**
|
|
39
61
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
40
62
|
*
|
|
@@ -65,57 +87,35 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
65
87
|
*/
|
|
66
88
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
67
89
|
/**
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
71
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
72
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
73
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
90
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
74
91
|
*/
|
|
75
|
-
export function
|
|
92
|
+
export function and(lhs: string, rhs: string): string;
|
|
76
93
|
/**
|
|
77
|
-
*
|
|
78
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
79
|
-
*
|
|
80
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
81
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
82
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
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.
|
|
94
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
84
95
|
*/
|
|
85
|
-
export function
|
|
96
|
+
export function xor(lhs: string, rhs: string): string;
|
|
86
97
|
/**
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
90
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
91
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
92
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
98
|
+
* Sha256 compression function
|
|
93
99
|
*/
|
|
94
|
-
export function
|
|
100
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
95
101
|
/**
|
|
96
|
-
*
|
|
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.
|
|
102
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
101
103
|
*/
|
|
102
|
-
export function
|
|
104
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
103
105
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
107
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
108
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
106
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
109
107
|
*/
|
|
110
|
-
export function
|
|
108
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
111
109
|
/**
|
|
112
|
-
*
|
|
110
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
111
|
+
*/
|
|
112
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Sets the package's logging level.
|
|
113
115
|
*
|
|
114
|
-
* @param {
|
|
115
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
116
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
116
|
+
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
117
117
|
*/
|
|
118
|
-
export function
|
|
118
|
+
export function initLogLevel(filter: string): void;
|
|
119
119
|
|
|
120
120
|
/**
|
|
121
121
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -140,17 +140,18 @@ export type WitnessStack = Array<StackItem>;
|
|
|
140
140
|
|
|
141
141
|
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
data: string[];
|
|
146
|
-
};
|
|
143
|
+
// Map from witness index to hex string value of witness.
|
|
144
|
+
export type WitnessMap = Map<number, string>;
|
|
147
145
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
146
|
+
/**
|
|
147
|
+
* An execution result containing two witnesses.
|
|
148
|
+
* 1. The full solved witness of the execution.
|
|
149
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
150
|
+
*/
|
|
151
|
+
export type SolvedAndReturnWitness = {
|
|
152
|
+
solvedWitness: WitnessMap;
|
|
153
|
+
returnWitness: WitnessMap;
|
|
154
|
+
}
|
|
154
155
|
|
|
155
156
|
|
|
156
157
|
|
|
@@ -168,17 +169,16 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
|
|
|
168
169
|
|
|
169
170
|
|
|
170
171
|
|
|
171
|
-
|
|
172
|
-
|
|
172
|
+
export type RawAssertionPayload = {
|
|
173
|
+
selector: string;
|
|
174
|
+
data: string[];
|
|
175
|
+
};
|
|
173
176
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
solvedWitness: WitnessMap;
|
|
181
|
-
returnWitness: WitnessMap;
|
|
182
|
-
}
|
|
177
|
+
export type ExecutionError = Error & {
|
|
178
|
+
callStack?: string[];
|
|
179
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
180
|
+
acirFunctionId?: number;
|
|
181
|
+
brilligFunctionId?: number;
|
|
182
|
+
};
|
|
183
183
|
|
|
184
184
|
|