@noir-lang/acvm_js 0.41.0 → 0.42.0-c46b164.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,6 +1,56 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
+ * Verifies a ECDSA signature over the secp256r1 curve.
5
+ * @param {Uint8Array} hashed_msg
6
+ * @param {Uint8Array} public_key_x_bytes
7
+ * @param {Uint8Array} public_key_y_bytes
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}
25
+ */
26
+ export function keccak256(inputs: Uint8Array): Uint8Array;
27
+ /**
28
+ * Calculates the Blake2s256 hash of the input bytes
29
+ * @param {Uint8Array} inputs
30
+ * @returns {Uint8Array}
31
+ */
32
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
33
+ /**
34
+ * Calculates the SHA256 hash of the input bytes
35
+ * @param {Uint8Array} inputs
36
+ * @returns {Uint8Array}
37
+ */
38
+ export function sha256(inputs: Uint8Array): Uint8Array;
39
+ /**
40
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
41
+ * @param {string} lhs
42
+ * @param {string} rhs
43
+ * @returns {string}
44
+ */
45
+ export function xor(lhs: string, rhs: string): string;
46
+ /**
47
+ * Performs a bitwise AND operation between `lhs` and `rhs`
48
+ * @param {string} lhs
49
+ * @param {string} rhs
50
+ * @returns {string}
51
+ */
52
+ export function and(lhs: string, rhs: string): string;
53
+ /**
4
54
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
5
55
  *
6
56
  * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
@@ -9,7 +59,7 @@
9
59
  * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
10
60
  * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
11
61
  */
12
- export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
62
+ export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSolver, program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
13
63
  /**
14
64
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
15
65
  *
@@ -18,7 +68,7 @@ export function executeCircuitWithBlackBoxSolver(solver: WasmBlackBoxFunctionSol
18
68
  * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
19
69
  * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
20
70
  */
21
- export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
71
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
22
72
  /**
23
73
  * @returns {Promise<WasmBlackBoxFunctionSolver>}
24
74
  */
@@ -29,33 +79,39 @@ export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
29
79
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
30
80
  * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
31
81
  * @returns {WitnessMap} A witness map containing the circuit's public inputs.
32
- * @param {Uint8Array} circuit
82
+ * @param {Uint8Array} program
33
83
  * @param {WitnessMap} solved_witness
34
84
  * @returns {WitnessMap}
35
85
  */
36
- export function getPublicWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap;
86
+ export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
37
87
  /**
38
88
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
39
89
  *
40
90
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
41
91
  * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
42
92
  * @returns {WitnessMap} A witness map containing the circuit's public parameters.
43
- * @param {Uint8Array} circuit
93
+ * @param {Uint8Array} program
44
94
  * @param {WitnessMap} solved_witness
45
95
  * @returns {WitnessMap}
46
96
  */
47
- export function getPublicParametersWitness(circuit: Uint8Array, solved_witness: WitnessMap): WitnessMap;
97
+ export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
48
98
  /**
49
99
  * Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
50
100
  *
51
101
  * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
52
102
  * @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
53
103
  * @returns {WitnessMap} A witness map containing the circuit's return values.
54
- * @param {Uint8Array} circuit
104
+ * @param {Uint8Array} program
55
105
  * @param {WitnessMap} witness_map
56
106
  * @returns {WitnessMap}
57
107
  */
58
- export function getReturnWitness(circuit: Uint8Array, witness_map: WitnessMap): WitnessMap;
108
+ export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
109
+ /**
110
+ * Sets the package's logging level.
111
+ *
112
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
113
+ */
114
+ export function initLogLevel(filter: string): void;
59
115
  /**
60
116
  * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
61
117
  *
@@ -71,67 +127,22 @@ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
71
127
  */
72
128
  export function compressWitness(witness_map: WitnessMap): Uint8Array;
73
129
  /**
74
- * Verifies a ECDSA signature over the secp256r1 curve.
75
- * @param {Uint8Array} hashed_msg
76
- * @param {Uint8Array} public_key_x_bytes
77
- * @param {Uint8Array} public_key_y_bytes
78
- * @param {Uint8Array} signature
79
- * @returns {boolean}
80
- */
81
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
82
- /**
83
- * Verifies a ECDSA signature over the secp256k1 curve.
84
- * @param {Uint8Array} hashed_msg
85
- * @param {Uint8Array} public_key_x_bytes
86
- * @param {Uint8Array} public_key_y_bytes
87
- * @param {Uint8Array} signature
88
- * @returns {boolean}
89
- */
90
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
91
- /**
92
- * Calculates the Keccak256 hash of the input bytes
93
- * @param {Uint8Array} inputs
94
- * @returns {Uint8Array}
95
- */
96
- export function keccak256(inputs: Uint8Array): Uint8Array;
97
- /**
98
- * Calculates the Blake2s256 hash of the input bytes
99
- * @param {Uint8Array} inputs
100
- * @returns {Uint8Array}
101
- */
102
- export function blake2s256(inputs: Uint8Array): Uint8Array;
103
- /**
104
- * Calculates the SHA256 hash of the input bytes
105
- * @param {Uint8Array} inputs
106
- * @returns {Uint8Array}
107
- */
108
- export function sha256(inputs: Uint8Array): Uint8Array;
109
- /**
110
- * Performs a bitwise XOR operation between `lhs` and `rhs`
111
- * @param {string} lhs
112
- * @param {string} rhs
113
- * @returns {string}
114
- */
115
- export function xor(lhs: string, rhs: string): string;
116
- /**
117
- * Performs a bitwise AND operation between `lhs` and `rhs`
118
- * @param {string} lhs
119
- * @param {string} rhs
120
- * @returns {string}
121
- */
122
- export function and(lhs: string, rhs: string): string;
123
- /**
124
- * Sets the package's logging level.
125
- *
126
- * @param {LogLevel} level - The maximum level of logging to be emitted.
127
- */
128
- export function initLogLevel(filter: string): void;
129
- /**
130
130
  * Returns the `BuildInfo` object containing information about how the installed package was built.
131
131
  * @returns {BuildInfo} - Information on how the installed package was built.
132
132
  */
133
133
  export function buildInfo(): BuildInfo;
134
134
 
135
+ export type ExecutionError = Error & {
136
+ callStack?: string[];
137
+ };
138
+
139
+
140
+
141
+ // Map from witness index to hex string value of witness.
142
+ export type WitnessMap = Map<number, string>;
143
+
144
+
145
+
135
146
  export type ForeignCallInput = string[]
136
147
  export type ForeignCallOutput = string | string[]
137
148
 
@@ -146,17 +157,6 @@ export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => P
146
157
 
147
158
 
148
159
 
149
- // Map from witness index to hex string value of witness.
150
- export type WitnessMap = Map<number, string>;
151
-
152
-
153
-
154
- export type ExecutionError = Error & {
155
- callStack?: string[];
156
- };
157
-
158
-
159
-
160
160
  /**
161
161
  * @typedef {Object} BuildInfo - Information about how the installed package was built
162
162
  * @property {string} gitHash - The hash of the git commit from which the package was built.