Fix rand breaking changes
This commit is contained in:
		@@ -21,7 +21,7 @@ pub struct TotpKey {
 | 
			
		||||
impl TotpKey {
 | 
			
		||||
    /// Generate a new TOTP key
 | 
			
		||||
    pub fn new_random() -> Self {
 | 
			
		||||
        let random_bytes = rand::thread_rng().gen::<[u8; 20]>();
 | 
			
		||||
        let random_bytes = rand::rng().random::<[u8; 20]>();
 | 
			
		||||
        Self {
 | 
			
		||||
            encoded: base32::encode(BASE32_ALPHABET, &random_bytes),
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,14 +1,9 @@
 | 
			
		||||
use lazy_regex::regex_find;
 | 
			
		||||
use rand::distributions::Alphanumeric;
 | 
			
		||||
use rand::Rng;
 | 
			
		||||
use rand::distr::{Alphanumeric, SampleString};
 | 
			
		||||
 | 
			
		||||
/// Generate a random string of a given size
 | 
			
		||||
pub fn rand_str(len: usize) -> String {
 | 
			
		||||
    rand::thread_rng()
 | 
			
		||||
        .sample_iter(&Alphanumeric)
 | 
			
		||||
        .map(char::from)
 | 
			
		||||
        .take(len)
 | 
			
		||||
        .collect()
 | 
			
		||||
    Alphanumeric.sample_string(&mut rand::rng(), len)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Parse environment variables
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user