You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
bromine/src/utils.rs

12 lines
388 B
Rust

#[cfg(feature = "encryption_layer")]
/// Generates a secret that can be passed to the options of the encryption layer and for creating
/// a public key
pub fn generate_secret() -> x25519_dalek::StaticSecret {
let mut rng = rand::thread_rng();
use rand_core::RngCore;
let mut secret = [0u8; 32];
rng.fill_bytes(&mut secret);
x25519_dalek::StaticSecret::from(secret)
}