Skip to content
Merged
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
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ is not automatically supported since, from the target name alone, we cannot dedu
which JavaScript interface should be used (or if JavaScript is available at all).

To enable `getrandom`'s functionality on `wasm32-unknown-unknown` using the Web
Crypto methods [described above](#opt-in-backends) via [`wasm-bindgen`], do
Crypto methods [described above][opt-in] via [`wasm-bindgen`], do
*both* of the following:

- Use the `wasm_js` feature flag, i.e.
`getrandom = { version = "0.3", features = ["wasm_js"] }`.
On its own, this only makes the backend available. (As a side effect this
will make your `Cargo.lock` significantly larger if you are not already
using [`wasm-bindgen`], but otherwise enabling this feature is harmless.)
- Set `RUSTFLAGS='--cfg getrandom_backend="wasm_js"'` ([see above](#opt-in-backends)).
- Set `RUSTFLAGS='--cfg getrandom_backend="wasm_js"'` ([see above][opt-in]).

This backend supports both web browsers (main window and Web Workers)
and Node.js (v19 or later) environments.
Expand All @@ -147,9 +147,10 @@ and Node.js (v19 or later) environments.

If this crate does not support your target out of the box or you have to use
a non-default entropy source, then you can provide a custom implementation.
You need to enable the custom backend as described in the [configuration flags]
section. Next, you need to define an `extern` function with the following
signature:
You need to enable the custom backend as described in the
[opt-in backends][opt-in] section.

Next, you need to define an `extern` function with the following signature:

```rust
use getrandom::Error;
Expand Down Expand Up @@ -375,6 +376,7 @@ dual licensed as above, without any additional terms or conditions.
[platform-support]: https://doc.rust-lang.org/stable/rustc/platform-support.html
[WASI]: https://github.com/WebAssembly/WASI
[Emscripten]: https://emscripten.org
[opt-in]: #opt-in-backends

[//]: # (licenses)

Expand Down
Loading