diff --git a/Cargo.toml b/Cargo.toml index ae0a886..f5269c3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -98,7 +98,7 @@ dashmap = { version = "6.0", optional = true } futures = "0.3" futures-util = "0.3" jsonwebtoken = { version = "9.0", optional = true } -rand = { version = "0.8", optional = true } +rand = { version = "0.9", features = ["thread_rng"], optional = true } redis = { version = "0.29", features = ["tokio-comp"], optional = true } reqwest = { version = "0.12", features = ["json", "multipart", "stream"] } serde = { version = "1.0", features = ["derive"] } diff --git a/src/auth0/cache/crypto.rs b/src/auth0/cache/crypto.rs index 7e51de8..be429c4 100644 --- a/src/auth0/cache/crypto.rs +++ b/src/auth0/cache/crypto.rs @@ -1,5 +1,4 @@ use chacha20poly1305::{aead::Aead, AeadCore, KeyInit, XChaCha20Poly1305}; -use rand::thread_rng; use serde::{Deserialize, Serialize}; const NONCE_SIZE: usize = 24; @@ -16,7 +15,7 @@ pub fn encrypt(value_ref: &T, token_encryption_key_str: &str) -> R let json: String = serde_json::to_string(value_ref)?; let enc = XChaCha20Poly1305::new_from_slice(token_encryption_key_str.as_bytes()).unwrap(); - let nonce = XChaCha20Poly1305::generate_nonce(&mut thread_rng()); + let nonce = XChaCha20Poly1305::generate_nonce(&mut rand::rng()); let mut ciphertext = enc.encrypt(&nonce, json.as_bytes())?; ciphertext.extend(nonce); diff --git a/src/auth0/util.rs b/src/auth0/util.rs index e93ca96..d39a79e 100644 --- a/src/auth0/util.rs +++ b/src/auth0/util.rs @@ -15,7 +15,7 @@ impl StalenessCheckPercentage { pub fn random_value_between(&self) -> f64 { use rand::Rng; - rand::thread_rng().gen_range(self.0.clone()) + rand::rng().random_range(self.0.clone()) } }