-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a42a35a
commit c562fd2
Showing
10 changed files
with
598 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "js_wasm" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
|
||
[dependencies] | ||
hex = "0.4.3" | ||
wasm-bindgen = "0.2.92" | ||
getrandom = { version = "0.2.7", features = ["js"] } | ||
num-bigint = "0.4.5" | ||
num-traits = "0.2.19" | ||
rand = "0.8.5" | ||
serde = { version = "1.0.197" ,features = ["derive"] } | ||
tsify = "0.4.5" | ||
halo2curves-axiom = { git = "https://github.com/axiom-crypto/halo2curves.git" } | ||
pse-poseidon = { git = "https://github.com/shreyas-londhe/pse-poseidon.git" } | ||
k256 = { version = "0.13.3", features = ["arithmetic", "hash2curve", "expose-field" ] } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<title>Wasm Function Example</title> | ||
</head> | ||
<body> | ||
<script type="module"> | ||
import init, { computeAllInputs } from "./pkg/js_wasm.js"; | ||
|
||
async function run() { | ||
await init(); | ||
const plume = computeAllInputs( | ||
"hello world", | ||
"db8f65ab8e9a54b25d57d7cb55401806ecdd1c7deb676808f9aa721f43bd3906", | ||
"", | ||
1, | ||
); | ||
console.log("Plume:", plume); | ||
} | ||
|
||
run(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* @param {string} message | ||
* @param {string} secret_key | ||
* @param {string | undefined} [_r] | ||
* @param {number | undefined} [_version] | ||
* @returns {PlumeInputs} | ||
*/ | ||
export function computeAllInputs(message: string, secret_key: string, _r?: string, _version?: number): PlumeInputs; | ||
export interface PlumeInputs { | ||
plume: string; | ||
publicKey: string; | ||
hashMPkPowR: string; | ||
gPowR: string; | ||
c: string; | ||
s: string; | ||
} | ||
|
||
|
||
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module; | ||
|
||
export interface InitOutput { | ||
readonly memory: WebAssembly.Memory; | ||
readonly computeAllInputs: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => number; | ||
readonly __wbindgen_malloc: (a: number, b: number) => number; | ||
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number; | ||
readonly __wbindgen_exn_store: (a: number) => void; | ||
} | ||
|
||
export type SyncInitInput = BufferSource | WebAssembly.Module; | ||
/** | ||
* Instantiates the given `module`, which can either be bytes or | ||
* a precompiled `WebAssembly.Module`. | ||
* | ||
* @param {SyncInitInput} module | ||
* | ||
* @returns {InitOutput} | ||
*/ | ||
export function initSync(module: SyncInitInput): InitOutput; | ||
|
||
/** | ||
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and | ||
* for everything else, calls `WebAssembly.instantiate` directly. | ||
* | ||
* @param {InitInput | Promise<InitInput>} module_or_path | ||
* | ||
* @returns {Promise<InitOutput>} | ||
*/ | ||
export default function __wbg_init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>; |
Oops, something went wrong.