divviup / libprio-rs

Implementation of Prio in Rust.
Mozilla Public License 2.0
103 stars 31 forks source link

Add a wasm-compat feature for getrandom #1059

Closed mendess closed 6 months ago

mendess commented 6 months ago

If you're using prio from wasm you have to include getrandom = { version "*", feature = ["js"] } in your cargo toml, even if you don't make use of getrandom in your code, just so you can activate the "js" feature.

I think it would be nicer if prio let me activate the feature without this hack.

Stacked on top of #1058

divergentdave commented 6 months ago

We should document this new feature in the README:

| `wasm-compat` | No | Enables the `getrandom/js` feature. This is necessary for `wasm32-unknown-unknown` targets, when in a JavaScript environment. | ✅ |
cjpatton commented 6 months ago

wasm32-unknown-unknown?

This target is required for the workers runtime, at least for now. There is experimental WASI support, but we haven't had a chance to test it thoroughly.

mendess commented 6 months ago

We should document this new feature in the README:

| `wasm-compat` | No | Enables the `getrandom/js` feature. This is necessary for `wasm32-unknown-unknown` targets, when in a JavaScript environment. | ✅ |

Docs added