1 2 3 4 5 6 7 8 9 10 11
use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; /// Generates a secure nonce. pub fn generate_nonce() -> String { thread_rng() .sample_iter(&Alphanumeric) .take(17) .map(char::from) .collect() }