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
f004871
commit 97f9352
Showing
3 changed files
with
15 additions
and
813 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
# How to generate bls.wasm | ||
# How to Generate `wasm.ts` | ||
|
||
The Wasm is generated from the BLS Rust code of the Agent RS (see http://github.com/dfinity/agent-rs/), | ||
with the following `Cargo.toml`. | ||
This WASM is generated from the miracl BLS Rust code (see https://github.com/dfinity/miracl_core_bls12381/) | ||
|
||
``` | ||
[dependencies] | ||
wasm-bindgen = "0.2.70" | ||
Run the following commands to build, minify, and base64 encode the wasm. | ||
|
||
```bash | ||
wasm-pack build --out-name bls --no-default-features --features="wasm-bindgen allow_alt_compress" --profile=wasm | ||
|
||
[profile.release] | ||
lto = true | ||
opt-level = 'z' | ||
echo -n "export const wasmBytesBase64 = \`" >pkg/wasm.ts | ||
base64 ./pkg/bls_bg.wasm | tr -d "\n" >>pkg/wasm.ts | ||
echo "\`;" >>pkg/wasm.ts | ||
``` | ||
|
||
To build the package, run `wasm-pack build --target web`. You can base64 encode the wasm binary and | ||
paste it into `bls.ts`. | ||
Copy the resulting `pkg/wasm.ts` to `packages/agent/src/vendor/bls/wasm.ts`. |
Oops, something went wrong.