Skip to main content

Crate bitwarden_random

Crate bitwarden_random 

Source
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§

SdkCryptoResolver
A snow [CryptoResolver] that supplies the SDK’s SdkRngImpl
SdkRandomNumberClient
Client exposing random-number generation to cross-platform bindings.
SdkRngImpl
The default Bitwarden RNG.

Enums§

GenBytesError
Error returned by SdkRandomNumberClient::gen_bytes.
GenRangeError
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::rng to 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_scene should be used instead.