@aztec/noir-acvm_js 0.0.1-commit.d3ec352c → 0.0.1-commit.d6f2b3f94

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.
@@ -1,68 +1,40 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
5
- *
6
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
7
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
8
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
9
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
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.
10
6
  */
11
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
7
+ export function buildInfo(): BuildInfo;
12
8
  /**
13
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
14
- * This method also extracts the public return values from the solved witness into its own return witness.
9
+ * Sets the package's logging level.
15
10
  *
16
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
17
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
18
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
19
- * @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.
11
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
20
12
  */
21
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
13
+ export function initLogLevel(filter: string): void;
22
14
  /**
23
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
24
- *
25
- * @param {Uint8Array} program - A serialized representation of an ACIR program
26
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
27
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
28
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
15
+ * Performs a bitwise AND operation between `lhs` and `rhs`
29
16
  */
30
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
17
+ export function and(lhs: string, rhs: string): string;
31
18
  /**
32
- * Sets the package's logging level.
33
- *
34
- * @param {LogLevel} level - The maximum level of logging to be emitted.
19
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
35
20
  */
36
- export function initLogLevel(filter: string): void;
21
+ export function xor(lhs: string, rhs: string): string;
37
22
  /**
38
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
39
- *
40
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
41
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
42
- * @returns {WitnessMap} A witness map containing the circuit's return values.
23
+ * Sha256 compression function
43
24
  */
44
- export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
25
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
45
26
  /**
46
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
47
- *
48
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
49
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
50
- * @returns {WitnessMap} A witness map containing the circuit's public parameters.
27
+ * Calculates the Blake2s256 hash of the input bytes
51
28
  */
52
- export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
29
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
53
30
  /**
54
- * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
55
- *
56
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
57
- * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
58
- * @returns {WitnessMap} A witness map containing the circuit's public inputs.
31
+ * Verifies a ECDSA signature over the secp256k1 curve.
59
32
  */
60
- export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
33
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
61
34
  /**
62
- * Returns the `BuildInfo` object containing information about how the installed package was built.
63
- * @returns {BuildInfo} - Information on how the installed package was built.
35
+ * Verifies a ECDSA signature over the secp256r1 curve.
64
36
  */
65
- export function buildInfo(): BuildInfo;
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,85 @@ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
93
65
  */
94
66
  export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
95
67
  /**
96
- * Performs a bitwise AND operation between `lhs` and `rhs`
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 and(lhs: string, rhs: string): string;
75
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
99
76
  /**
100
- * Performs a bitwise XOR operation between `lhs` and `rhs`
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 xor(lhs: string, rhs: string): string;
85
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
103
86
  /**
104
- * Sha256 compression function
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 sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
94
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
107
95
  /**
108
- * Calculates the Blake2s256 hash of the input bytes
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 blake2s256(inputs: Uint8Array): Uint8Array;
102
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
111
103
  /**
112
- * Verifies a ECDSA signature over the secp256k1 curve.
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 ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
110
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
115
111
  /**
116
- * Verifies a ECDSA signature over the secp256r1 curve.
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 ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
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
+
133
+
134
+ /**
135
+ * @typedef {Object} BuildInfo - Information about how the installed package was built
136
+ * @property {string} gitHash - The hash of the git commit from which the package was built.
137
+ * @property {string} version - The version of the package at the built git commit.
138
+ * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
139
+ */
140
+ export type BuildInfo = {
141
+ gitHash: string;
142
+ version: string;
143
+ dirty: string;
144
+ }
145
+
146
+
119
147
 
120
148
  // Map from witness index to hex string value of witness.
121
149
  export type WitnessMap = Map<number, string>;
@@ -141,20 +169,6 @@ export type WitnessStack = Array<StackItem>;
141
169
 
142
170
 
143
171
 
144
- export type ForeignCallInput = string[]
145
- export type ForeignCallOutput = string | string[]
146
-
147
- /**
148
- * A callback which performs an foreign call and returns the response.
149
- * @callback ForeignCallHandler
150
- * @param {string} name - The identifier for the type of foreign call being performed.
151
- * @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
152
- * @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
153
- */
154
- export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
155
-
156
-
157
-
158
172
  export type RawAssertionPayload = {
159
173
  selector: string;
160
174
  data: string[];
@@ -168,17 +182,3 @@ export type ExecutionError = Error & {
168
182
  };
169
183
 
170
184
 
171
-
172
- /**
173
- * @typedef {Object} BuildInfo - Information about how the installed package was built
174
- * @property {string} gitHash - The hash of the git commit from which the package was built.
175
- * @property {string} version - The version of the package at the built git commit.
176
- * @property {boolean} dirty - Whether the package contained uncommitted changes when built.
177
- */
178
- export type BuildInfo = {
179
- gitHash: string;
180
- version: string;
181
- dirty: string;
182
- }
183
-
184
-