Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update rand requirement from 0.8 to 0.9 #182

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 @@ -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"] }
Expand Down
3 changes: 1 addition & 2 deletions src/auth0/cache/crypto.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use chacha20poly1305::{aead::Aead, AeadCore, KeyInit, XChaCha20Poly1305};
use rand::thread_rng;
use serde::{Deserialize, Serialize};

const NONCE_SIZE: usize = 24;
Expand All @@ -16,7 +15,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 rand::rng());

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