Skip to content

Commit 0acf0ff

Browse files
authored
Add feature for wasm targets (MystenLabs#849)
* Add feature for wasm targets * Update readme
1 parent 4e4dfe7 commit 0acf0ff

3 files changed

Lines changed: 11 additions & 0 deletions

File tree

Cargo.lock

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ $ cargo build --bin ecvrf-cli
7373
$ target/debug/ecvrf-cli -h
7474
```
7575

76+
## WASM
77+
78+
The `fastcrypto` crate can be used when building WASM modules. To do this, enable the `wasm` feature flag when including the `fastcrypto` crate in your `Cargo.toml` file and follow the instructions found in the [Rust and WASM book](https://rustwasm.github.io/docs/book/) to build the WASM module.
79+
7680
## Tests
7781

7882
There exist unit tests for all primitives in all three crates, which can be run by:

fastcrypto/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ fastcrypto-derive = { path = "../fastcrypto-derive", version = "0.1.3" }
5353
serde_json = "1.0.93"
5454
num-bigint = "0.4.4"
5555
bech32 = "0.9.1"
56+
getrandom = {version = "0.2.15", features = ["js"], optional = true}
5657

5758
# Required for bulletproofs
5859
bulletproofs = { version = "4.0.0", optional = true }
@@ -114,6 +115,9 @@ experimental = ["dep:bulletproofs", "dep:merlin"]
114115
# Include AES and its modes.
115116
aes = ["dep:aes", "dep:cbc", "dep:aes-gcm", "dep:ctr", "dep:aes-gcm-siv"]
116117

118+
# Needs to be enabled for wasm targets.
119+
wasm = ["dep:getrandom"]
120+
117121
[dev-dependencies]
118122
criterion = "0.5.1"
119123
k256 = { version = "0.11.6", features = ["ecdsa", "sha256", "keccak256"] }

0 commit comments

Comments
 (0)