Crates.io | ic-dummy-getrandom-for-wasm |
lib.rs | ic-dummy-getrandom-for-wasm |
version | 0.1.0 |
created_at | 2025-02-14 19:31:45.984281+00 |
updated_at | 2025-02-14 19:31:45.984281+00 |
description | Workaround a problem with rand on wasm32-unknown-unknown targets |
homepage | |
repository | |
max_upload_size | |
id | 1555930 |
size | 5,602 |
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.