Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,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.32", features = ["tokio-comp"], optional = true }
reqwest = { version = "0.12", features = ["json", "multipart", "stream"] }
serde = { version = "1.0", features = ["derive"] }
Expand Down
6 changes: 3 additions & 3 deletions src/auth0/cache/crypto.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use chacha20poly1305::{aead::Aead, AeadCore, KeyInit, XChaCha20Poly1305};
use rand::thread_rng;
use chacha20poly1305::aead::{Aead, AeadCore, KeyInit, OsRng};
use chacha20poly1305::XChaCha20Poly1305;
use serde::{Deserialize, Serialize};

const NONCE_SIZE: usize = 24;
Expand All @@ -16,7 +16,7 @@ pub fn encrypt<T: Serialize>(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 OsRng);

let mut ciphertext = enc.encrypt(&nonce, json.as_bytes())?;
ciphertext.extend(nonce);
Expand Down
2 changes: 1 addition & 1 deletion src/auth0/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}

Expand Down
Loading