Skip to main content

Entropy

Trait Entropy 

Source
pub trait Entropy: Sealed {
    // Required method
    fn fill(&self, buf: &mut [u8]) -> Result<()>;

    // Provided method
    fn token_bytes<const N: usize>(&self) -> Result<[u8; N]> { ... }
}
Expand description

Cryptographically secure bytes.

CONTRACT: never a PRNG fallback. An adapter that cannot reach the OS CSPRNG returns an error; it does not degrade to something seeded from the clock. The one consumer that matters is the session token, and a guessable session token is a session anyone can drive.

Required Methods§

Source

fn fill(&self, buf: &mut [u8]) -> Result<()>

Provided Methods§

Source

fn token_bytes<const N: usize>(&self) -> Result<[u8; N]>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§