@succinctlabs/sp1-wasm-verifier 5.0.1
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/README.md +19 -0
- package/package.json +27 -0
- package/sp1_wasm_verifier.d.ts +23 -0
- package/sp1_wasm_verifier.js +16 -0
- package/sp1_wasm_verifier_bg.wasm +0 -0
package/README.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# SP1 Wasm verification
|
|
2
|
+
|
|
3
|
+
This repo wraps the [`sp1-verifier`](https://github.com/succinctlabs/sp1) crate in Wasm bindings, and invoke it from JavaScript (Node.js).
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Install the node module with the following command:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install sp1-wasm-verifier
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
`sp1-wasm-verifier` declare the following functions:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
function verify_groth16(proof: Uint8Array, public_inputs: Uint8Array, sp1_vk_hash: string): boolean;
|
|
17
|
+
function verify_plonk(proof: Uint8Array, public_inputs: Uint8Array, sp1_vk_hash: string): boolean
|
|
18
|
+
function verify_compressed(proof: Uint8Array, public_inputs: Uint8Array, sp1_vk_hash: Uint8Array): boolean;
|
|
19
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@succinctlabs/sp1-wasm-verifier",
|
|
3
|
+
"collaborators": [
|
|
4
|
+
"Bhargav Annem, Yuwen Zhang"
|
|
5
|
+
],
|
|
6
|
+
"description": "A rust verifier for BN254 curve",
|
|
7
|
+
"version": "5.0.1",
|
|
8
|
+
"license": "MIT/Apache-2.0",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "https://github.com/succinctlabs/example-sp1-wasm-verifier"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"sp1_wasm_verifier_bg.wasm",
|
|
15
|
+
"sp1_wasm_verifier.js",
|
|
16
|
+
"sp1_wasm_verifier.d.ts"
|
|
17
|
+
],
|
|
18
|
+
"main": "sp1_wasm_verifier.js",
|
|
19
|
+
"types": "sp1_wasm_verifier.d.ts",
|
|
20
|
+
"keywords": [
|
|
21
|
+
"zero-knowledge",
|
|
22
|
+
"cryptography",
|
|
23
|
+
"zkSNARK",
|
|
24
|
+
"SNARK",
|
|
25
|
+
"gnark"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Wrapper around [`sp1_verifier::CompressedVerifier::verify_sp1_proof`].
|
|
6
|
+
*
|
|
7
|
+
* We hardcode the Plonk VK bytes to only verify SP1 proofs.
|
|
8
|
+
*/
|
|
9
|
+
export function verify_compressed(proof: Uint8Array, public_inputs: Uint8Array, sp1_vk_hash: Uint8Array): boolean;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Wrapper around [`sp1_verifier::Groth16Verifier::verify`].
|
|
13
|
+
*
|
|
14
|
+
* We hardcode the Groth16 VK bytes to only verify SP1 proofs.
|
|
15
|
+
*/
|
|
16
|
+
export function verify_groth16(proof: Uint8Array, public_inputs: Uint8Array, sp1_vk_hash: string): boolean;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Wrapper around [`sp1_verifier::PlonkVerifier::verify`].
|
|
20
|
+
*
|
|
21
|
+
* We hardcode the Plonk VK bytes to only verify SP1 proofs.
|
|
22
|
+
*/
|
|
23
|
+
export function verify_plonk(proof: Uint8Array, public_inputs: Uint8Array, sp1_vk_hash: string): boolean;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
let imports = {};
|
|
3
|
+
import * as import0 from './sp1_wasm_verifier_bg.js';
|
|
4
|
+
imports['./sp1_wasm_verifier_bg.js'] = import0;
|
|
5
|
+
|
|
6
|
+
import { readFileSync } from 'node:fs';
|
|
7
|
+
|
|
8
|
+
const wasmUrl = new URL('sp1_wasm_verifier_bg.wasm', import.meta.url);
|
|
9
|
+
const wasmBytes = readFileSync(wasmUrl);
|
|
10
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
11
|
+
const wasm = new WebAssembly.Instance(wasmModule, imports).exports;
|
|
12
|
+
export { wasm as __wasm };
|
|
13
|
+
imports["./sp1_wasm_verifier_bg.js"].__wbg_set_wasm(wasm, wasmModule);
|
|
14
|
+
wasm.__wbindgen_start();
|
|
15
|
+
|
|
16
|
+
export * from "./sp1_wasm_verifier_bg.js";
|
|
Binary file
|