@noir-lang/acvm_js 0.27.0 → 0.28.0-10eae15.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.
Binary file
@@ -1,24 +1,31 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export function decompressWitness(a: number, b: number, c: number): void;
5
+ export function compressWitness(a: number, b: number): void;
4
6
  export function buildInfo(): number;
7
+ export function ecdsa_secp256r1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
8
+ export function ecdsa_secp256k1_verify(a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number): number;
9
+ export function keccak256(a: number, b: number, c: number): void;
10
+ export function blake2s256(a: number, b: number, c: number): void;
11
+ export function sha256(a: number, b: number, c: number): void;
12
+ export function xor(a: number, b: number): number;
13
+ export function and(a: number, b: number): number;
5
14
  export function executeCircuitWithBlackBoxSolver(a: number, b: number, c: number, d: number, e: number): number;
6
15
  export function executeCircuit(a: number, b: number, c: number, d: number): number;
7
16
  export function createBlackBoxSolver(): number;
8
17
  export function __wbg_wasmblackboxfunctionsolver_free(a: number): void;
9
- export function decompressWitness(a: number, b: number, c: number): void;
10
- export function compressWitness(a: number, b: number): void;
11
18
  export function initLogLevel(a: number): void;
12
19
  export function getPublicWitness(a: number, b: number, c: number, d: number): void;
13
20
  export function getPublicParametersWitness(a: number, b: number, c: number, d: number): void;
14
21
  export function getReturnWitness(a: number, b: number, c: number, d: number): void;
15
22
  export function __wbg_trap_free(a: number): void;
16
23
  export function trap___wbgd_downcast_token(): number;
17
- export function __wbindgen_malloc(a: number, b: number): number;
18
- export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
24
+ export function __wbindgen_malloc(a: number): number;
25
+ export function __wbindgen_realloc(a: number, b: number, c: number): number;
19
26
  export const __wbindgen_export_2: WebAssembly.Table;
20
- export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7be0e81f38bcb593(a: number, b: number, c: number): void;
27
+ export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb1f60a5b015b6c5(a: number, b: number, c: number): void;
21
28
  export function __wbindgen_add_to_stack_pointer(a: number): number;
22
- export function __wbindgen_free(a: number, b: number, c: number): void;
29
+ export function __wbindgen_free(a: number, b: number): void;
23
30
  export function __wbindgen_exn_store(a: number): void;
24
- export function wasm_bindgen__convert__closures__invoke2_mut__h2cc2a3675130eda0(a: number, b: number, c: number, d: number): void;
31
+ export function wasm_bindgen__convert__closures__invoke2_mut__h72933b4dbc34aade(a: number, b: number, c: number, d: number): void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noir-lang/acvm_js",
3
- "version": "0.27.0",
3
+ "version": "0.28.0-10eae15.nightly",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/noir-lang/acvm.git"
@@ -20,5 +20,30 @@
20
20
  "web",
21
21
  "package.json"
22
22
  ],
23
- "sideEffects": false
24
- }
23
+ "sideEffects": false,
24
+ "packageManager": "yarn@3.5.1",
25
+ "scripts": {
26
+ "build": "bash ./build.sh",
27
+ "test": "env TS_NODE_COMPILER_OPTIONS='{\"module\": \"commonjs\" }' mocha",
28
+ "test:browser": "web-test-runner",
29
+ "lint": "NODE_NO_WARNINGS=1 eslint . --ext .ts --ignore-path ./.eslintignore --max-warnings 0",
30
+ "publish": "echo 📡 publishing `$npm_package_name` && yarn npm publish",
31
+ "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",
32
+ "clean": "chmod u+w web nodejs || true && rm -rf web nodejs",
33
+ "build:nix": "nix build -L .#acvm_js",
34
+ "install:from:nix": "yarn clean && yarn build:nix && cp -rL ./result/acvm_js/nodejs ./ && cp -rL ./result/acvm_js/web ./"
35
+ },
36
+ "devDependencies": {
37
+ "@esm-bundle/chai": "^4.3.4-fix.0",
38
+ "@web/dev-server-esbuild": "^0.3.6",
39
+ "@web/test-runner": "^0.15.3",
40
+ "@web/test-runner-playwright": "^0.10.0",
41
+ "chai": "^4.3.7",
42
+ "eslint": "^8.50.0",
43
+ "eslint-plugin-prettier": "^5.0.0",
44
+ "mocha": "^10.2.0",
45
+ "prettier": "3.0.3",
46
+ "ts-node": "^10.9.1",
47
+ "typescript": "^5.0.4"
48
+ }
49
+ }
package/web/acvm_js.d.ts CHANGED
@@ -1,11 +1,76 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
+ * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
5
+ *
6
+ * @param {Uint8Array} compressed_witness - A compressed witness.
7
+ * @returns {WitnessMap} The decompressed witness map.
8
+ */
9
+ export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
10
+ /**
11
+ * Compresses a `WitnessMap` into the binary format outputted by Nargo.
12
+ *
13
+ * @param {Uint8Array} compressed_witness - A witness map.
14
+ * @returns {WitnessMap} A compressed witness map
15
+ */
16
+ export function compressWitness(witness_map: WitnessMap): Uint8Array;
17
+ /**
4
18
  * Returns the `BuildInfo` object containing information about how the installed package was built.
5
19
  * @returns {BuildInfo} - Information on how the installed package was built.
6
20
  */
7
21
  export function buildInfo(): BuildInfo;
8
22
  /**
23
+ * Verifies a ECDSA signature over the secp256r1 curve.
24
+ * @param {Uint8Array} hashed_msg
25
+ * @param {Uint8Array} public_key_x_bytes
26
+ * @param {Uint8Array} public_key_y_bytes
27
+ * @param {Uint8Array} signature
28
+ * @returns {boolean}
29
+ */
30
+ export function ecdsa_secp256r1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
31
+ /**
32
+ * Calculates the Blake2s256 hash of the input bytes and represents these as a single field element.
33
+ * Verifies a ECDSA signature over the secp256k1 curve.
34
+ * @param {Uint8Array} hashed_msg
35
+ * @param {Uint8Array} public_key_x_bytes
36
+ * @param {Uint8Array} public_key_y_bytes
37
+ * @param {Uint8Array} signature
38
+ * @returns {boolean}
39
+ */
40
+ export function ecdsa_secp256k1_verify(hashed_msg: Uint8Array, public_key_x_bytes: Uint8Array, public_key_y_bytes: Uint8Array, signature: Uint8Array): boolean;
41
+ /**
42
+ * Calculates the Keccak256 hash of the input bytes
43
+ * @param {Uint8Array} inputs
44
+ * @returns {Uint8Array}
45
+ */
46
+ export function keccak256(inputs: Uint8Array): Uint8Array;
47
+ /**
48
+ * Calculates the Blake2s256 hash of the input bytes
49
+ * @param {Uint8Array} inputs
50
+ * @returns {Uint8Array}
51
+ */
52
+ export function blake2s256(inputs: Uint8Array): Uint8Array;
53
+ /**
54
+ * Calculates the SHA256 hash of the input bytes
55
+ * @param {Uint8Array} inputs
56
+ * @returns {Uint8Array}
57
+ */
58
+ export function sha256(inputs: Uint8Array): Uint8Array;
59
+ /**
60
+ * Performs a bitwise XOR operation between `lhs` and `rhs`
61
+ * @param {string} lhs
62
+ * @param {string} rhs
63
+ * @returns {string}
64
+ */
65
+ export function xor(lhs: string, rhs: string): string;
66
+ /**
67
+ * Performs a bitwise AND operation between `lhs` and `rhs`
68
+ * @param {string} lhs
69
+ * @param {string} rhs
70
+ * @returns {string}
71
+ */
72
+ export function and(lhs: string, rhs: string): string;
73
+ /**
9
74
  * Executes an ACIR circuit to generate the solved witness from the initial witness.
10
75
  *
11
76
  * @param {&WasmBlackBoxFunctionSolver} solver - A black box solver.
@@ -29,20 +94,6 @@ export function executeCircuit(circuit: Uint8Array, initial_witness: WitnessMap,
29
94
  */
30
95
  export function createBlackBoxSolver(): Promise<WasmBlackBoxFunctionSolver>;
31
96
  /**
32
- * Decompresses a compressed witness as outputted by Nargo into a `WitnessMap`.
33
- *
34
- * @param {Uint8Array} compressed_witness - A compressed witness.
35
- * @returns {WitnessMap} The decompressed witness map.
36
- */
37
- export function decompressWitness(compressed_witness: Uint8Array): WitnessMap;
38
- /**
39
- * Compresses a `WitnessMap` into the binary format outputted by Nargo.
40
- *
41
- * @param {Uint8Array} compressed_witness - A witness map.
42
- * @returns {WitnessMap} A compressed witness map
43
- */
44
- export function compressWitness(witness_map: WitnessMap): Uint8Array;
45
- /**
46
97
  * Sets the package's logging level.
47
98
  *
48
99
  * @param {LogLevel} level - The maximum level of logging to be emitted.
@@ -144,27 +195,34 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
144
195
 
145
196
  export interface InitOutput {
146
197
  readonly memory: WebAssembly.Memory;
198
+ readonly decompressWitness: (a: number, b: number, c: number) => void;
199
+ readonly compressWitness: (a: number, b: number) => void;
147
200
  readonly buildInfo: () => number;
201
+ readonly ecdsa_secp256r1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
202
+ readonly ecdsa_secp256k1_verify: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => number;
203
+ readonly keccak256: (a: number, b: number, c: number) => void;
204
+ readonly blake2s256: (a: number, b: number, c: number) => void;
205
+ readonly sha256: (a: number, b: number, c: number) => void;
206
+ readonly xor: (a: number, b: number) => number;
207
+ readonly and: (a: number, b: number) => number;
148
208
  readonly executeCircuitWithBlackBoxSolver: (a: number, b: number, c: number, d: number, e: number) => number;
149
209
  readonly executeCircuit: (a: number, b: number, c: number, d: number) => number;
150
210
  readonly createBlackBoxSolver: () => number;
151
211
  readonly __wbg_wasmblackboxfunctionsolver_free: (a: number) => void;
152
- readonly decompressWitness: (a: number, b: number, c: number) => void;
153
- readonly compressWitness: (a: number, b: number) => void;
154
212
  readonly initLogLevel: (a: number) => void;
155
213
  readonly getPublicWitness: (a: number, b: number, c: number, d: number) => void;
156
214
  readonly getPublicParametersWitness: (a: number, b: number, c: number, d: number) => void;
157
215
  readonly getReturnWitness: (a: number, b: number, c: number, d: number) => void;
158
216
  readonly __wbg_trap_free: (a: number) => void;
159
217
  readonly trap___wbgd_downcast_token: () => number;
160
- readonly __wbindgen_malloc: (a: number, b: number) => number;
161
- readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
218
+ readonly __wbindgen_malloc: (a: number) => number;
219
+ readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
162
220
  readonly __wbindgen_export_2: WebAssembly.Table;
163
- readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7be0e81f38bcb593: (a: number, b: number, c: number) => void;
221
+ readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__heb1f60a5b015b6c5: (a: number, b: number, c: number) => void;
164
222
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
165
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
223
+ readonly __wbindgen_free: (a: number, b: number) => void;
166
224
  readonly __wbindgen_exn_store: (a: number) => void;
167
- readonly wasm_bindgen__convert__closures__invoke2_mut__h2cc2a3675130eda0: (a: number, b: number, c: number, d: number) => void;
225
+ readonly wasm_bindgen__convert__closures__invoke2_mut__h72933b4dbc34aade: (a: number, b: number, c: number, d: number) => void;
168
226
  }
169
227
 
170
228
  export type SyncInitInput = BufferSource | WebAssembly.Module;