@noir-lang/acvm_js 1.0.0-beta.15-1fce7ca.nightly → 1.0.0-beta.15-881acee.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,35 +1,62 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Performs a bitwise AND operation between `lhs` and `rhs`
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
5
8
  */
6
- export function and(lhs: string, rhs: string): string;
9
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
7
10
  /**
8
- * Performs a bitwise XOR operation between `lhs` and `rhs`
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.
9
16
  */
10
- export function xor(lhs: string, rhs: string): string;
17
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
11
18
  /**
12
- * Sha256 compression function
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
13
23
  */
14
- export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
24
+ export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
15
25
  /**
16
- * Calculates the Blake2s256 hash of the input bytes
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.
17
30
  */
18
- export function blake2s256(inputs: Uint8Array): Uint8Array;
31
+ export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
19
32
  /**
20
- * Verifies a ECDSA signature over the secp256k1 curve.
33
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
34
+ *
35
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
36
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
37
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
38
+ * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
21
39
  */
22
- export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
40
+ export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
23
41
  /**
24
- * Verifies a ECDSA signature over the secp256r1 curve.
42
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
43
+ * This method also extracts the public return values from the solved witness into its own return witness.
44
+ *
45
+ * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
46
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
47
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
48
+ * @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.
25
49
  */
26
- export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
50
+ export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
27
51
  /**
28
- * Sets the package's logging level.
52
+ * Executes an ACIR circuit to generate the solved witness from the initial witness.
29
53
  *
30
- * @param {LogLevel} level - The maximum level of logging to be emitted.
54
+ * @param {Uint8Array} program - A serialized representation of an ACIR program
55
+ * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
56
+ * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
57
+ * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
31
58
  */
32
- export function initLogLevel(filter: string): void;
59
+ export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
33
60
  /**
34
61
  * Returns the `BuildInfo` object containing information about how the installed package was built.
35
62
  * @returns {BuildInfo} - Information on how the installed package was built.
@@ -60,71 +87,35 @@ export function getPublicParametersWitness(program: Uint8Array, solved_witness:
60
87
  */
61
88
  export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
62
89
  /**
63
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
64
- *
65
- * @param {WitnessMap} witness_map - A witness map.
66
- * @returns {Uint8Array} A compressed witness map
90
+ * Performs a bitwise AND operation between `lhs` and `rhs`
67
91
  */
68
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
92
+ export function and(lhs: string, rhs: string): string;
69
93
  /**
70
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
71
- * This should be used to only fetch the witness map for the main function.
72
- *
73
- * @param {Uint8Array} compressed_witness - A compressed witness.
74
- * @returns {WitnessMap} The decompressed witness map.
94
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
75
95
  */
76
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
96
+ export function xor(lhs: string, rhs: string): string;
77
97
  /**
78
- * Compresses a `WitnessStack` into the binary format outputted by Nargo.
79
- *
80
- * @param {WitnessStack} witness_stack - A witness stack.
81
- * @returns {Uint8Array} A compressed witness stack
98
+ * Sha256 compression function
82
99
  */
83
- export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
100
+ export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
84
101
  /**
85
- * Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
86
- *
87
- * @param {Uint8Array} compressed_witness - A compressed witness.
88
- * @returns {WitnessStack} The decompressed witness stack.
102
+ * Calculates the Blake2s256 hash of the input bytes
89
103
  */
90
- export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
104
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
91
105
  /**
92
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
93
- *
94
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
95
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
96
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
97
- * @returns {WitnessMap} The solved witness calculated by executing the circuit on the provided inputs.
106
+ * Verifies a ECDSA signature over the secp256k1 curve.
98
107
  */
99
- export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
108
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
100
109
  /**
101
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
102
- * This method also extracts the public return values from the solved witness into its own return witness.
103
- *
104
- * @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
105
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `circuit`..
106
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the circuit.
107
- * @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.
110
+ * Verifies a ECDSA signature over the secp256r1 curve.
108
111
  */
109
- export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
112
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
110
113
  /**
111
- * Executes an ACIR circuit to generate the solved witness from the initial witness.
114
+ * Sets the package's logging level.
112
115
  *
113
- * @param {Uint8Array} program - A serialized representation of an ACIR program
114
- * @param {WitnessMap} initial_witness - The initial witness map defining all of the inputs to `program`.
115
- * @param {ForeignCallHandler} foreign_call_handler - A callback to process any foreign calls from the program.
116
- * @returns {WitnessStack} The solved witness calculated by executing the program on the provided inputs.
116
+ * @param {LogLevel} level - The maximum level of logging to be emitted.
117
117
  */
118
- export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
119
-
120
- export type StackItem = {
121
- index: number;
122
- witness: WitnessMap;
123
- }
124
-
125
- export type WitnessStack = Array<StackItem>;
126
-
127
-
118
+ export function initLogLevel(filter: string): void;
128
119
 
129
120
  /**
130
121
  * @typedef {Object} BuildInfo - Information about how the installed package was built
@@ -182,3 +173,12 @@ export type ForeignCallOutput = string | string[]
182
173
  export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
183
174
 
184
175
 
176
+
177
+ export type StackItem = {
178
+ index: number;
179
+ witness: WitnessMap;
180
+ }
181
+
182
+ export type WitnessStack = Array<StackItem>;
183
+
184
+