@noir-lang/acvm_js 0.45.0 → 0.46.0-7936262.nightly

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,60 +1,34 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Performs a bitwise AND operation between `lhs` and `rhs`
5
- * @param {string} lhs
6
- * @param {string} rhs
7
- * @returns {string}
8
- */
9
- export function and(lhs: string, rhs: string): string;
10
- /**
11
- * Performs a bitwise XOR operation between `lhs` and `rhs`
12
- * @param {string} lhs
13
- * @param {string} rhs
14
- * @returns {string}
15
- */
16
- export function xor(lhs: string, rhs: string): string;
17
- /**
18
- * Calculates the SHA256 hash of the input bytes
19
- * @param {Uint8Array} inputs
20
- * @returns {Uint8Array}
21
- */
22
- export function sha256(inputs: Uint8Array): Uint8Array;
23
- /**
24
- * Calculates the Blake2s256 hash of the input bytes
25
- * @param {Uint8Array} inputs
26
- * @returns {Uint8Array}
27
- */
28
- export function blake2s256(inputs: Uint8Array): Uint8Array;
29
- /**
30
- * Calculates the Keccak256 hash of the input bytes
31
- * @param {Uint8Array} inputs
32
- * @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
33
8
  */
34
- export function keccak256(inputs: Uint8Array): Uint8Array;
9
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
35
10
  /**
36
- * Verifies a ECDSA signature over the secp256k1 curve.
37
- * @param {Uint8Array} hashed_msg
38
- * @param {Uint8Array} public_key_x_bytes
39
- * @param {Uint8Array} public_key_y_bytes
40
- * @param {Uint8Array} signature
41
- * @returns {boolean}
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.
42
16
  */
43
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
17
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
44
18
  /**
45
- * Verifies a ECDSA signature over the secp256r1 curve.
46
- * @param {Uint8Array} hashed_msg
47
- * @param {Uint8Array} public_key_x_bytes
48
- * @param {Uint8Array} public_key_y_bytes
49
- * @param {Uint8Array} signature
50
- * @returns {boolean}
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
51
23
  */
52
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
24
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
53
25
  /**
54
- * Returns the `BuildInfo` object containing information about how the installed package was built.
55
- * @returns {BuildInfo} - Information on how the installed package was built.
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.
56
30
  */
57
- export function buildInfo(): BuildInfo;
31
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
58
32
  /**
59
33
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
60
34
  *
@@ -89,40 +63,55 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
89
63
  */
90
64
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
91
65
  /**
92
- * Sets the package's logging level.
93
- *
94
- * @param {LogLevel} level - The maximum level of logging to be emitted.
66
+ * Performs a bitwise AND operation between `lhs` and `rhs`
67
+ * @param {string} lhs
68
+ * @param {string} rhs
69
+ * @returns {string}
95
70
  */
96
- export function initLogLevel(filter: string): void;
71
+ export function and(lhs: string, rhs: string): string;
97
72
  /**
98
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
99
- *
100
- * @param {WitnessMap} witness_map - A witness map.
101
- * @returns {Uint8Array} A compressed witness map
73
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
74
+ * @param {string} lhs
75
+ * @param {string} rhs
76
+ * @returns {string}
102
77
  */
103
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
78
+ export function xor(lhs: string, rhs: string): string;
104
79
  /**
105
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
106
- * This should be used to only fetch the witness map for the main function.
107
- *
108
- * @param {Uint8Array} compressed_witness - A compressed witness.
109
- * @returns {WitnessMap} The decompressed witness map.
80
+ * Calculates the SHA256 hash of the input bytes
81
+ * @param {Uint8Array} inputs
82
+ * @returns {Uint8Array}
110
83
  */
111
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
84
+ export function sha256(inputs: Uint8Array): Uint8Array;
112
85
  /**
113
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
114
- *
115
- * @param {WitnessStack} witness_stack - A witness stack.
116
- * @returns {Uint8Array} A compressed witness stack
86
+ * Calculates the Blake2s256 hash of the input bytes
87
+ * @param {Uint8Array} inputs
88
+ * @returns {Uint8Array}
117
89
  */
118
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
90
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
119
91
  /**
120
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
121
- *
122
- * @param {Uint8Array} compressed_witness - A compressed witness.
123
- * @returns {WitnessStack} The decompressed witness stack.
92
+ * Calculates the Keccak256 hash of the input bytes
93
+ * @param {Uint8Array} inputs
94
+ * @returns {Uint8Array}
124
95
  */
125
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
96
+ export function keccak256(inputs: Uint8Array): Uint8Array;
97
+ /**
98
+ * Verifies a ECDSA signature over the secp256k1 curve.
99
+ * @param {Uint8Array} hashed_msg
100
+ * @param {Uint8Array} public_key_x_bytes
101
+ * @param {Uint8Array} public_key_y_bytes
102
+ * @param {Uint8Array} signature
103
+ * @returns {boolean}
104
+ */
105
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
106
+ /**
107
+ * Verifies a ECDSA signature over the secp256r1 curve.
108
+ * @param {Uint8Array} hashed_msg
109
+ * @param {Uint8Array} public_key_x_bytes
110
+ * @param {Uint8Array} public_key_y_bytes
111
+ * @param {Uint8Array} signature
112
+ * @returns {boolean}
113
+ */
114
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
126
115
  /**
127
116
  * @returns {Promise<WasmBlackBoxFunctionSolver>}
128
117
  */
@@ -163,12 +152,17 @@ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap,
163
152
  /**
164
153
  */
165
154
  export function executeProgramWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_executor: ForeignCallHandler): Promise<WitnessStack>;
166
-
167
- export type ExecutionError = Error & {
168
- callStack?: string[];
169
- };
170
-
171
-
155
+ /**
156
+ * Sets the package's logging level.
157
+ *
158
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
159
+ */
160
+ export function initLogLevel(filter: string): void;
161
+ /**
162
+ * Returns the `BuildInfo` object containing information about how the installed package was built.
163
+ * @returns {BuildInfo} - Information on how the installed package was built.
164
+ */
165
+ export function buildInfo(): BuildInfo;
172
166
 
173
167
  // Map from witness index to hex string value of witness.
174
168
  export type WitnessMap = Map<number, string>;
@@ -185,6 +179,17 @@ export type SolvedAndReturnWitness = {
185
179
 
186
180
 
187
181
 
182
+ export type RawAssertionPayload = {
183
+ selector: string;
184
+ data: string[];
185
+ };
186
+ export type ExecutionError = Error & {
187
+ callStack?: string[];
188
+ rawAssertionPayload?: RawAssertionPayload;
189
+ };
190
+
191
+
192
+
188
193
  /**
189
194
  * @typedef {Object} BuildInfo - Information about how the installed package was built
190
195
  * @property {string} gitHash - The hash of the git commit from which the package was built.