Skip to main content

try_random_bytes

Function try_random_bytes 

Source
pub fn try_random_bytes<const N: usize>() -> Result<[u8; N]>
Expand description

Generate cryptographically secure random bytes, returning an error instead of panicking if the RNG health check fails. Preferred over random_bytes in key/secret generation paths that can propagate a Result (#685).