@aztec/noir-acvm_js 0.0.1-commit.f295ac2 → 0.0.1-commit.f2ce05ee
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 +80 -80
- package/nodejs/acvm_js.js +177 -176
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +13 -13
- package/package.json +3 -3
- package/web/acvm_js.d.ts +93 -93
- package/web/acvm_js.js +177 -176
- 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
|
@@ -12,57 +12,29 @@ export function buildInfo(): BuildInfo;
|
|
|
12
12
|
*/
|
|
13
13
|
export function initLogLevel(filter: string): void;
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
18
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
19
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
20
|
-
* @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
|
|
15
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
21
16
|
*/
|
|
22
|
-
export function
|
|
17
|
+
export function and(lhs: string, rhs: string): string;
|
|
23
18
|
/**
|
|
24
|
-
*
|
|
25
|
-
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
26
|
-
*
|
|
27
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
28
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
|
|
29
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
|
|
30
|
-
* @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.
|
|
19
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
31
20
|
*/
|
|
32
|
-
export function
|
|
21
|
+
export function xor(lhs: string, rhs: string): string;
|
|
33
22
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
* @param {Uint8Array} program - A serialized representation of an ACIR program
|
|
37
|
-
* @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
|
|
38
|
-
* @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
|
|
39
|
-
* @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
|
|
23
|
+
* Sha256 compression function
|
|
40
24
|
*/
|
|
41
|
-
export function
|
|
25
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
42
26
|
/**
|
|
43
|
-
*
|
|
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.
|
|
27
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
48
28
|
*/
|
|
49
|
-
export function
|
|
29
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
50
30
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
54
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
55
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
31
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
56
32
|
*/
|
|
57
|
-
export function
|
|
33
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
58
34
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
62
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
63
|
-
* @returns {WitnessMap} A witness map containing the circuit's public inputs.
|
|
35
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
64
36
|
*/
|
|
65
|
-
export function
|
|
37
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
66
38
|
/**
|
|
67
39
|
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
68
40
|
*
|
|
@@ -93,29 +65,71 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
|
93
65
|
*/
|
|
94
66
|
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
95
67
|
/**
|
|
96
|
-
*
|
|
68
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
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.
|
|
97
74
|
*/
|
|
98
|
-
export function
|
|
75
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
99
76
|
/**
|
|
100
|
-
*
|
|
77
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
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.
|
|
101
84
|
*/
|
|
102
|
-
export function
|
|
85
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
103
86
|
/**
|
|
104
|
-
*
|
|
87
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
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.
|
|
105
93
|
*/
|
|
106
|
-
export function
|
|
94
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
107
95
|
/**
|
|
108
|
-
*
|
|
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.
|
|
109
101
|
*/
|
|
110
|
-
export function
|
|
102
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
111
103
|
/**
|
|
112
|
-
*
|
|
104
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
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.
|
|
113
109
|
*/
|
|
114
|
-
export function
|
|
110
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
115
111
|
/**
|
|
116
|
-
*
|
|
112
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
113
|
+
*
|
|
114
|
+
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
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.
|
|
117
117
|
*/
|
|
118
|
-
export function
|
|
118
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
119
|
+
|
|
120
|
+
export type ForeignCallInput = string[]
|
|
121
|
+
export type ForeignCallOutput = string | string[]
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* A callback which performs an foreign call and returns the response.
|
|
125
|
+
* @callback ForeignCallHandler
|
|
126
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
127
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
128
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
129
|
+
*/
|
|
130
|
+
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
131
|
+
|
|
132
|
+
|
|
119
133
|
|
|
120
134
|
/**
|
|
121
135
|
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
@@ -131,20 +145,6 @@ export type BuildInfo = {
|
|
|
131
145
|
|
|
132
146
|
|
|
133
147
|
|
|
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
148
|
// Map from witness index to hex string value of witness.
|
|
149
149
|
export type WitnessMap = Map<number, string>;
|
|
150
150
|
|
|
@@ -160,20 +160,6 @@ export type SolvedAndReturnWitness = {
|
|
|
160
160
|
|
|
161
161
|
|
|
162
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
163
|
export type StackItem = {
|
|
178
164
|
index: number;
|
|
179
165
|
witness: WitnessMap;
|
|
@@ -182,3 +168,17 @@ export type StackItem = {
|
|
|
182
168
|
export type WitnessStack = Array<StackItem>;
|
|
183
169
|
|
|
184
170
|
|
|
171
|
+
|
|
172
|
+
export type RawAssertionPayload = {
|
|
173
|
+
selector: string;
|
|
174
|
+
data: string[];
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
export type ExecutionError = Error & {
|
|
178
|
+
callStack?: string[];
|
|
179
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
180
|
+
acirFunctionId?: number;
|
|
181
|
+
brilligFunctionId?: number;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
|