Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions packages/agent/src/vendor/bls/README.md
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`.
Loading