-
Notifications
You must be signed in to change notification settings - Fork 136
Improve Support for WASM #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
thiserror is not no_std safe
- add new `std` feature - add `simd_backend` - move `colored` dep behind profile feature
since curve25519-dalek (v3) uses old rand(v0.7) we need this. should upgrade curve25519-dalek to v4 once it out of pre release
@microsoft-github-policy-service agree |
@ashutoshvarma thanks for the PR! It looks great! From the CI, it looks like there is a minor issue. I don't seem to have the write access to fix this in the PR branch. Can you add a commit to fix this? error: this |
That's weird, "Allow edits and access to secrets by maintainers" checkbox is checked for this PR.
Sure. |
@srinathsetty fix pushed! |
Motivation
Use Spartan in WASM environment (browser or WASM runtimes,
wasm32-unknown-unknown
).Ref #54
Things changed
std
features behind new featurestd
(a58ddef)Previously there was no way to disable the std features if someone wants to build it in
no_std
or partial std target. Now the same can be done by simply disabling the default feature.rand_core
dependency asrand
re-exports it.XofReader
instead ofio::Read
for no_std compatibility (f63812b)How to use Spartan in
wasm32-unknown-unknown
?When adding Spartan to
wasm-bindgen
projects or any project that targetwasm32-unknown-unknown
, simply disable the default features and addgetrandom
(v0.1) as a dependency withwasm-bindgen
feature enabled.Details for
getrandom
Spartan uses
rand
v0.7 (Why not latest rand v0.8? becausecurve25519-dalek
v3'sScalar::random
will break as it uses rand v0.7).The
rand::rngs::OsRng
depends upongetrandom
(v0.1) crate which silently fails inwasm32-unknown-unknown
during runtime, see the discussion rust-random/getrandom#87 (comment) unlesswasm-bindgen
feature is enabled.