@noir-lang/acvm_js 0.55.0 → 1.0.0-9c1fafc.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.
- package/nodejs/acvm_js.d.ts +166 -177
- package/nodejs/acvm_js.js +710 -782
- package/nodejs/acvm_js_bg.wasm +0 -0
- package/nodejs/acvm_js_bg.wasm.d.ts +31 -27
- package/package.json +14 -14
- package/web/acvm_js.d.ts +215 -221
- package/web/acvm_js.js +735 -762
- package/web/acvm_js_bg.wasm +0 -0
- package/web/acvm_js_bg.wasm.d.ts +31 -27
package/nodejs/acvm_js_bg.wasm
CHANGED
|
Binary file
|
|
@@ -1,30 +1,34 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export const
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
28
|
-
export
|
|
29
|
-
export
|
|
30
|
-
export
|
|
4
|
+
export const and: (a: any, b: any) => any;
|
|
5
|
+
export const xor: (a: any, b: any) => any;
|
|
6
|
+
export const sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
7
|
+
export const blake2s256: (a: number, b: number) => [number, number];
|
|
8
|
+
export const ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
9
|
+
export const ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
10
|
+
export const buildInfo: () => any;
|
|
11
|
+
export const compressWitness: (a: any) => [number, number, number, number];
|
|
12
|
+
export const decompressWitness: (a: number, b: number) => [number, number, number];
|
|
13
|
+
export const compressWitnessStack: (a: any) => [number, number, number, number];
|
|
14
|
+
export const decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
15
|
+
export const executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
16
|
+
export const executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
17
|
+
export const executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
18
|
+
export const initLogLevel: (a: number, b: number) => [number, number];
|
|
19
|
+
export const getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
20
|
+
export const getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
21
|
+
export const getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
22
|
+
export const wasm_bindgen__closure__destroy__h2cbd9f7ce6b3c35b: (a: number, b: number) => void;
|
|
23
|
+
export const wasm_bindgen__convert__closures_____invoke__h19cd9ea1cbe9b0b3: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
24
|
+
export const wasm_bindgen__convert__closures_____invoke__h00439a7bc380f87a: (a: number, b: number, c: any) => [number, number];
|
|
25
|
+
export const wasm_bindgen__convert__closures_____invoke__h75e989036704f034: (a: number, b: number, c: any, d: any) => void;
|
|
26
|
+
export const wasm_bindgen__convert__closures_____invoke__h75e989036704f034_21: (a: number, b: number, c: any, d: any) => void;
|
|
27
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
28
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
29
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
30
|
+
export const __externref_table_alloc: () => number;
|
|
31
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
32
|
+
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
33
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
34
|
+
export const __wbindgen_start: () => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noir-lang/acvm_js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-9c1fafc.nightly",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -26,27 +26,27 @@
|
|
|
26
26
|
"package.json"
|
|
27
27
|
],
|
|
28
28
|
"sideEffects": false,
|
|
29
|
-
"packageManager": "yarn@
|
|
29
|
+
"packageManager": "yarn@4.5.2",
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "bash ./build.sh",
|
|
32
|
-
"test": "
|
|
32
|
+
"test": "mocha",
|
|
33
33
|
"test:browser": "web-test-runner",
|
|
34
|
-
"lint": "NODE_NO_WARNINGS=1 eslint . --
|
|
34
|
+
"lint": "NODE_NO_WARNINGS=1 eslint . --max-warnings 0",
|
|
35
35
|
"publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
|
|
36
36
|
"nightly:version": "jq --arg new_version \"-$(git rev-parse --short HEAD)$1\" '.version = .version + $new_version' package.json > package-tmp.json && mv package-tmp.json package.json",
|
|
37
37
|
"clean": "chmod u+w web nodejs || true && rm -rf web nodejs"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@esm-bundle/chai": "^4.3.4-fix.0",
|
|
41
|
-
"@web/dev-server-esbuild": "^0.
|
|
42
|
-
"@web/test-runner": "^0.
|
|
43
|
-
"@web/test-runner-playwright": "^0.
|
|
44
|
-
"chai": "^
|
|
45
|
-
"eslint": "^
|
|
46
|
-
"eslint-plugin-prettier": "^5.
|
|
47
|
-
"mocha": "^
|
|
48
|
-
"prettier": "3.
|
|
49
|
-
"
|
|
50
|
-
"typescript": "^
|
|
41
|
+
"@web/dev-server-esbuild": "^2.0.0",
|
|
42
|
+
"@web/test-runner": "^1.0.0",
|
|
43
|
+
"@web/test-runner-playwright": "^1.0.0",
|
|
44
|
+
"chai": "^6.3.0",
|
|
45
|
+
"eslint": "^10.13.0",
|
|
46
|
+
"eslint-plugin-prettier": "^5.5.7",
|
|
47
|
+
"mocha": "^12.0.3",
|
|
48
|
+
"prettier": "3.9.10",
|
|
49
|
+
"tsx": "^4.23.15",
|
|
50
|
+
"typescript": "^6.0.3"
|
|
51
51
|
}
|
|
52
52
|
}
|
package/web/acvm_js.d.ts
CHANGED
|
@@ -1,166 +1,63 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
|
|
3
4
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @
|
|
7
|
-
* @
|
|
8
|
-
*/
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
* @param {WitnessStack} witness_stack - A witness stack.
|
|
22
|
-
* @returns {Uint8Array} A compressed witness stack
|
|
23
|
-
*/
|
|
24
|
-
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
25
|
-
/**
|
|
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.
|
|
30
|
-
*/
|
|
31
|
-
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
32
|
-
/**
|
|
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.
|
|
39
|
-
*/
|
|
40
|
-
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
41
|
-
/**
|
|
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.
|
|
49
|
-
*/
|
|
50
|
-
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
51
|
-
/**
|
|
52
|
-
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
53
|
-
*
|
|
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.
|
|
58
|
-
*/
|
|
59
|
-
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
60
|
-
/**
|
|
61
|
-
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
62
|
-
* @param {string} lhs
|
|
63
|
-
* @param {string} rhs
|
|
64
|
-
* @returns {string}
|
|
65
|
-
*/
|
|
66
|
-
export function and(lhs: string, rhs: string): string;
|
|
67
|
-
/**
|
|
68
|
-
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
69
|
-
* @param {string} lhs
|
|
70
|
-
* @param {string} rhs
|
|
71
|
-
* @returns {string}
|
|
72
|
-
*/
|
|
73
|
-
export function xor(lhs: string, rhs: string): string;
|
|
74
|
-
/**
|
|
75
|
-
* Sha256 compression function
|
|
76
|
-
* @param {Uint32Array} inputs
|
|
77
|
-
* @param {Uint32Array} state
|
|
78
|
-
* @returns {Uint32Array}
|
|
79
|
-
*/
|
|
80
|
-
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
81
|
-
/**
|
|
82
|
-
* Calculates the Blake2s256 hash of the input bytes
|
|
83
|
-
* @param {Uint8Array} inputs
|
|
84
|
-
* @returns {Uint8Array}
|
|
85
|
-
*/
|
|
86
|
-
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
87
|
-
/**
|
|
88
|
-
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
89
|
-
* @param {Uint8Array} hashed_msg
|
|
90
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
91
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
92
|
-
* @param {Uint8Array} signature
|
|
93
|
-
* @returns {boolean}
|
|
94
|
-
*/
|
|
95
|
-
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
96
|
-
/**
|
|
97
|
-
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
98
|
-
* @param {Uint8Array} hashed_msg
|
|
99
|
-
* @param {Uint8Array} public_key_x_bytes
|
|
100
|
-
* @param {Uint8Array} public_key_y_bytes
|
|
101
|
-
* @param {Uint8Array} signature
|
|
102
|
-
* @returns {boolean}
|
|
103
|
-
*/
|
|
104
|
-
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
107
|
-
* @returns {BuildInfo} - Information on how the installed package was built.
|
|
108
|
-
*/
|
|
109
|
-
export function buildInfo(): BuildInfo;
|
|
110
|
-
/**
|
|
111
|
-
* Sets the package's logging level.
|
|
112
|
-
*
|
|
113
|
-
* @param {LogLevel} level - The maximum level of logging to be emitted.
|
|
114
|
-
*/
|
|
115
|
-
export function initLogLevel(filter: string): void;
|
|
116
|
-
/**
|
|
117
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
118
|
-
*
|
|
119
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
120
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
121
|
-
* @returns {WitnessMap} A witness map containing the circuit's return values.
|
|
122
|
-
* @param {Uint8Array} program
|
|
123
|
-
* @param {WitnessMap} witness_map
|
|
124
|
-
* @returns {WitnessMap}
|
|
125
|
-
*/
|
|
126
|
-
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
127
|
-
/**
|
|
128
|
-
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
129
|
-
*
|
|
130
|
-
* @param {Uint8Array} circuit - A serialized representation of an ACIR circuit
|
|
131
|
-
* @param {WitnessMap} witness_map - The completed witness map after executing the circuit.
|
|
132
|
-
* @returns {WitnessMap} A witness map containing the circuit's public parameters.
|
|
133
|
-
* @param {Uint8Array} program
|
|
134
|
-
* @param {WitnessMap} solved_witness
|
|
135
|
-
* @returns {WitnessMap}
|
|
136
|
-
*/
|
|
137
|
-
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
5
|
+
* @typedef {Object} BuildInfo - Information about how the installed package was built
|
|
6
|
+
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
7
|
+
* @property {string} version - The version of the package at the built git commit.
|
|
8
|
+
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
9
|
+
*/
|
|
10
|
+
export type BuildInfo = {
|
|
11
|
+
gitHash: string;
|
|
12
|
+
version: string;
|
|
13
|
+
dirty: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
// Map from witness index to hex string value of witness.
|
|
19
|
+
export type WitnessMap = Map<number, string>;
|
|
20
|
+
|
|
138
21
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
22
|
+
* An execution result containing two witnesses.
|
|
23
|
+
* 1. The full solved witness of the execution.
|
|
24
|
+
* 2. The return witness which contains the given public return values within the full witness.
|
|
25
|
+
*/
|
|
26
|
+
export type SolvedAndReturnWitness = {
|
|
27
|
+
solvedWitness: WitnessMap;
|
|
28
|
+
returnWitness: WitnessMap;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
149
32
|
|
|
150
33
|
export type ForeignCallInput = string[]
|
|
151
34
|
export type ForeignCallOutput = string | string[]
|
|
152
35
|
|
|
153
36
|
/**
|
|
154
|
-
* A callback which performs an foreign call and returns the response.
|
|
155
|
-
* @callback ForeignCallHandler
|
|
156
|
-
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
157
|
-
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
158
|
-
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
159
|
-
*/
|
|
37
|
+
* A callback which performs an foreign call and returns the response.
|
|
38
|
+
* @callback ForeignCallHandler
|
|
39
|
+
* @param {string} name - The identifier for the type of foreign call being performed.
|
|
40
|
+
* @param {string[][]} inputs - An array of hex encoded inputs to the foreign call.
|
|
41
|
+
* @returns {Promise<string[]>} outputs - An array of hex encoded outputs containing the results of the foreign call.
|
|
42
|
+
*/
|
|
160
43
|
export type ForeignCallHandler = (name: string, inputs: ForeignCallInput[]) => Promise<ForeignCallOutput[]>;
|
|
161
44
|
|
|
162
45
|
|
|
163
46
|
|
|
47
|
+
export type RawAssertionPayload = {
|
|
48
|
+
selector: string;
|
|
49
|
+
data: string[];
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export type ExecutionError = Error & {
|
|
53
|
+
callStack?: string[];
|
|
54
|
+
rawAssertionPayload?: RawAssertionPayload;
|
|
55
|
+
acirFunctionId?: number;
|
|
56
|
+
brilligFunctionId?: number;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
164
61
|
export type StackItem = {
|
|
165
62
|
index: number;
|
|
166
63
|
witness: WitnessMap;
|
|
@@ -171,97 +68,194 @@ export type WitnessStack = Array<StackItem>;
|
|
|
171
68
|
|
|
172
69
|
|
|
173
70
|
/**
|
|
174
|
-
*
|
|
175
|
-
* @property {string} gitHash - The hash of the git commit from which the package was built.
|
|
176
|
-
* @property {string} version - The version of the package at the built git commit.
|
|
177
|
-
* @property {boolean} dirty - Whether the package contained uncommitted changes when built.
|
|
71
|
+
* Performs a bitwise AND operation between `lhs` and `rhs`
|
|
178
72
|
*/
|
|
179
|
-
export
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
73
|
+
export function and(lhs: string, rhs: string): string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Calculates the Blake2s256 hash of the input bytes
|
|
77
|
+
*/
|
|
78
|
+
export function blake2s256(inputs: Uint8Array): Uint8Array;
|
|
184
79
|
|
|
80
|
+
/**
|
|
81
|
+
* Returns the `BuildInfo` object containing information about how the installed package was built.
|
|
82
|
+
* @returns {`BuildInfo`} - Information on how the installed package was built.
|
|
83
|
+
*/
|
|
84
|
+
export function buildInfo(): BuildInfo;
|
|
185
85
|
|
|
86
|
+
/**
|
|
87
|
+
* Compresses a `WitnessMap` into the binary format outputted by Nargo.
|
|
88
|
+
*
|
|
89
|
+
* @param {`WitnessMap`} `witness_map` - A witness map.
|
|
90
|
+
* @returns {`Uint8Array`} A compressed witness map
|
|
91
|
+
*/
|
|
92
|
+
export function compressWitness(witness_map: WitnessMap): Uint8Array;
|
|
186
93
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
94
|
+
/**
|
|
95
|
+
* Compresses a `WitnessStack` into the binary format outputted by Nargo.
|
|
96
|
+
*
|
|
97
|
+
* @param {`WitnessStack`} `witness_stack` - A witness stack.
|
|
98
|
+
* @returns {`Uint8Array`} A compressed witness stack
|
|
99
|
+
*/
|
|
100
|
+
export function compressWitnessStack(witness_stack: WitnessStack): Uint8Array;
|
|
191
101
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
}
|
|
102
|
+
/**
|
|
103
|
+
* Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
|
|
104
|
+
* This should be used to only fetch the witness map for the main function.
|
|
105
|
+
*
|
|
106
|
+
* @param {`Uint8Array`} `compressed_witness` - A compressed witness.
|
|
107
|
+
* @returns {`WitnessMap`} The decompressed witness map.
|
|
108
|
+
*/
|
|
109
|
+
export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
|
|
197
110
|
|
|
111
|
+
/**
|
|
112
|
+
* Decompresses a compressed witness stack as outputted by Nargo into a `WitnessStack`.
|
|
113
|
+
*
|
|
114
|
+
* @param {`Uint8Array`} `compressed_witness` - A compressed witness.
|
|
115
|
+
* @returns {`WitnessStack`} The decompressed witness stack.
|
|
116
|
+
*/
|
|
117
|
+
export function decompressWitnessStack(compressed_witness: Uint8Array): WitnessStack;
|
|
198
118
|
|
|
119
|
+
/**
|
|
120
|
+
* Verifies a ECDSA signature over the secp256k1 curve.
|
|
121
|
+
*/
|
|
122
|
+
export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
199
123
|
|
|
200
|
-
|
|
201
|
-
|
|
124
|
+
/**
|
|
125
|
+
* Verifies a ECDSA signature over the secp256r1 curve.
|
|
126
|
+
*/
|
|
127
|
+
export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
|
|
202
128
|
|
|
203
129
|
/**
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
130
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
131
|
+
*
|
|
132
|
+
* @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
|
|
133
|
+
* @param {`WitnessMap`} `initial_witness` - The initial witness map defining all of the inputs to `circuit`..
|
|
134
|
+
* @param {`ForeignCallHandler`} `foreign_call_handler` - A callback to process any foreign calls from the circuit.
|
|
135
|
+
* @returns {`WitnessMap`} The solved witness calculated by executing the circuit on the provided inputs.
|
|
207
136
|
*/
|
|
208
|
-
export
|
|
209
|
-
solvedWitness: WitnessMap;
|
|
210
|
-
returnWitness: WitnessMap;
|
|
211
|
-
}
|
|
137
|
+
export function executeCircuit(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessMap>;
|
|
212
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
141
|
+
* This method also extracts the public return values from the solved witness into its own return witness.
|
|
142
|
+
*
|
|
143
|
+
* @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
|
|
144
|
+
* @param {`WitnessMap`} `initial_witness` - The initial witness map defining all of the inputs to `circuit`..
|
|
145
|
+
* @param {`ForeignCallHandler`} `foreign_call_handler` - A callback to process any foreign calls from the circuit.
|
|
146
|
+
* @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.
|
|
147
|
+
*/
|
|
148
|
+
export function executeCircuitWithReturnWitness(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<SolvedAndReturnWitness>;
|
|
213
149
|
|
|
150
|
+
/**
|
|
151
|
+
* Executes an ACIR circuit to generate the solved witness from the initial witness.
|
|
152
|
+
*
|
|
153
|
+
* @param {`Uint8Array`} program - A serialized representation of an ACIR program
|
|
154
|
+
* @param {`WitnessMap`} `initial_witness` - The initial witness map defining all of the inputs to `program`.
|
|
155
|
+
* @param {`ForeignCallHandler`} `foreign_call_handler` - A callback to process any foreign calls from the program.
|
|
156
|
+
* @returns {`WitnessStack`} The solved witness calculated by executing the program on the provided inputs.
|
|
157
|
+
*/
|
|
158
|
+
export function executeProgram(program: Uint8Array, initial_witness: WitnessMap, foreign_call_handler: ForeignCallHandler): Promise<WitnessStack>;
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public parameters.
|
|
162
|
+
*
|
|
163
|
+
* @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
|
|
164
|
+
* @param {`WitnessMap`} `witness_map` - The completed witness map after executing the circuit.
|
|
165
|
+
* @returns {`WitnessMap`} A witness map containing the circuit's public parameters.
|
|
166
|
+
*/
|
|
167
|
+
export function getPublicParametersWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's public inputs.
|
|
171
|
+
*
|
|
172
|
+
* @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
|
|
173
|
+
* @param {`WitnessMap`} `witness_map` - The completed witness map after executing the circuit.
|
|
174
|
+
* @returns {`WitnessMap`} A witness map containing the circuit's public inputs.
|
|
175
|
+
*/
|
|
176
|
+
export function getPublicWitness(program: Uint8Array, solved_witness: WitnessMap): WitnessMap;
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Extracts a `WitnessMap` containing the witness indices corresponding to the circuit's return values.
|
|
180
|
+
*
|
|
181
|
+
* @param {`Uint8Array`} circuit - A serialized representation of an ACIR circuit
|
|
182
|
+
* @param {`WitnessMap`} `witness_map` - The completed witness map after executing the circuit.
|
|
183
|
+
* @returns {`WitnessMap`} A witness map containing the circuit's return values.
|
|
184
|
+
*/
|
|
185
|
+
export function getReturnWitness(program: Uint8Array, witness_map: WitnessMap): WitnessMap;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Sets the package's logging level.
|
|
189
|
+
*
|
|
190
|
+
* @param {`LogLevel`} level - The maximum level of logging to be emitted.
|
|
191
|
+
*/
|
|
192
|
+
export function initLogLevel(filter: string): void;
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Sha256 compression function
|
|
196
|
+
*/
|
|
197
|
+
export function sha256_compression(inputs: Uint32Array, state: Uint32Array): Uint32Array;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Performs a bitwise XOR operation between `lhs` and `rhs`
|
|
201
|
+
*/
|
|
202
|
+
export function xor(lhs: string, rhs: string): string;
|
|
214
203
|
|
|
215
204
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
216
205
|
|
|
217
206
|
export interface InitOutput {
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
207
|
+
readonly memory: WebAssembly.Memory;
|
|
208
|
+
readonly and: (a: any, b: any) => any;
|
|
209
|
+
readonly xor: (a: any, b: any) => any;
|
|
210
|
+
readonly sha256_compression: (a: number, b: number, c: number, d: number) => [number, number];
|
|
211
|
+
readonly blake2s256: (a: number, b: number) => [number, number];
|
|
212
|
+
readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
213
|
+
readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
|
|
214
|
+
readonly buildInfo: () => any;
|
|
215
|
+
readonly compressWitness: (a: any) => [number, number, number, number];
|
|
216
|
+
readonly decompressWitness: (a: number, b: number) => [number, number, number];
|
|
217
|
+
readonly compressWitnessStack: (a: any) => [number, number, number, number];
|
|
218
|
+
readonly decompressWitnessStack: (a: number, b: number) => [number, number, number];
|
|
219
|
+
readonly executeCircuit: (a: number, b: number, c: any, d: any) => any;
|
|
220
|
+
readonly executeCircuitWithReturnWitness: (a: number, b: number, c: any, d: any) => any;
|
|
221
|
+
readonly executeProgram: (a: number, b: number, c: any, d: any) => any;
|
|
222
|
+
readonly initLogLevel: (a: number, b: number) => [number, number];
|
|
223
|
+
readonly getReturnWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
224
|
+
readonly getPublicParametersWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
225
|
+
readonly getPublicWitness: (a: number, b: number, c: any) => [number, number, number];
|
|
226
|
+
readonly wasm_bindgen__closure__destroy__h2cbd9f7ce6b3c35b: (a: number, b: number) => void;
|
|
227
|
+
readonly wasm_bindgen__convert__closures_____invoke__h19cd9ea1cbe9b0b3: (a: number, b: number, c: any, d: number, e: any) => void;
|
|
228
|
+
readonly wasm_bindgen__convert__closures_____invoke__h00439a7bc380f87a: (a: number, b: number, c: any) => [number, number];
|
|
229
|
+
readonly wasm_bindgen__convert__closures_____invoke__h75e989036704f034: (a: number, b: number, c: any, d: any) => void;
|
|
230
|
+
readonly wasm_bindgen__convert__closures_____invoke__h75e989036704f034_21: (a: number, b: number, c: any, d: any) => void;
|
|
231
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
232
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
233
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
234
|
+
readonly __externref_table_alloc: () => number;
|
|
235
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
236
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
237
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
238
|
+
readonly __wbindgen_start: () => void;
|
|
246
239
|
}
|
|
247
240
|
|
|
248
241
|
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
242
|
+
|
|
249
243
|
/**
|
|
250
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
251
|
-
* a precompiled `WebAssembly.Module`.
|
|
252
|
-
*
|
|
253
|
-
* @param {SyncInitInput} module
|
|
254
|
-
*
|
|
255
|
-
* @returns {InitOutput}
|
|
256
|
-
*/
|
|
257
|
-
export function initSync(module: SyncInitInput): InitOutput;
|
|
244
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
245
|
+
* a precompiled `WebAssembly.Module`.
|
|
246
|
+
*
|
|
247
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
248
|
+
*
|
|
249
|
+
* @returns {InitOutput}
|
|
250
|
+
*/
|
|
251
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
258
252
|
|
|
259
253
|
/**
|
|
260
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
261
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
262
|
-
*
|
|
263
|
-
* @param {InitInput | Promise<InitInput>} module_or_path
|
|
264
|
-
*
|
|
265
|
-
* @returns {Promise<InitOutput>}
|
|
266
|
-
*/
|
|
267
|
-
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;
|
|
254
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
255
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
256
|
+
*
|
|
257
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
258
|
+
*
|
|
259
|
+
* @returns {Promise<InitOutput>}
|
|
260
|
+
*/
|
|
261
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|