ic-dummy-getrandom-for-wasm

Crates.ioic-dummy-getrandom-for-wasm
lib.rsic-dummy-getrandom-for-wasm
version0.1.0
created_at2025-02-14 19:31:45.984281+00
updated_at2025-02-14 19:31:45.984281+00
descriptionWorkaround a problem with rand on wasm32-unknown-unknown targets
homepage
repository
max_upload_size
id1555930
size5,602
Franz-Stefan Preiss (fspreiss)

documentation

https://internetcomputer.org/docs/

README

ic-dummy-getrandom-for-wasm

The rand crate is widely used in the Rust ecosystem. The rand crate in turn relies on getrandom to acquire cryptographic seed material. For policy reasons, getrandom refuses to compile on the wasm32-unknown-unknown target used by the Internet Computer. This prevents using rand without workarounds.

This crate implements such a workaround; on wasm32-unknown-unknown target, it registers a custom getrandom implementation which just returns an error at runtime. On any other target, it does nothing.

Commit count: 0

cargo fmt