Expand description
§Bitwarden Random
Provides an abstraction to provide the single rng impl for the sdk. This can be seeded if the
dangerous-seeded-rng-for-testing feature is enabled, but by default uses the OS CRNG.
Modules§
- ffi 🔒
- Cross-platform (WASM / UniFFI) bindings for random-number generation.
- seeded 🔒
- Deterministic, seeded RNG support for tests/benches.
- snow_
resolver 🔒
Structs§
- SdkCrypto
Resolver - A snow [
CryptoResolver] that supplies the SDK’sSdkRngImpl - SdkRandom
Number Client - Client exposing random-number generation to cross-platform bindings.
- SdkRng
Impl - The default Bitwarden RNG.
Enums§
- GenBytes
Error - Error returned by
SdkRandomNumberClient::gen_bytes. - GenRange
Error - Error returned by
SdkRandomNumberClient::gen_range. - Inner 🔒
- Scene
- A named, reproducible RNG scene for tests. Each variant maps to a fixed seed.
Constants§
- UNIFFI_
META_ 🔒CONST_ NAMESPACE_ BITWARDEN_ RANDOM - Export namespace metadata.
Traits§
- SdkRng
- Marker trait for random number generators usable within the Bitwarden SDK.
Functions§
- clear_
seed - Removes any thread-local seed, reverting
crate::rngto the OS entropy source on this thread. - rng
- Returns an
SdkRngImpl. Mirrors [rand::rng] for ergonomic drop-in replacement. - rng_
set_ scene - Seeds the current thread’s RNG with the deterministic seed for the given
Scene. - set_
seed_ raw - Sets up a deterministic, seeded ChaCha8 stream for the current thread.
Where possible, the higher level
rng_set_sceneshould be used instead.