Skip to content

Commit 72de57d

Browse files
dependabot[bot]cpiemonteseemiliano-at-prima
authored
Update rand requirement from 0.8 to 0.9 (#182)
* Update rand requirement from 0.8 to 0.9 Updates the requirements on [rand](https://github.com/rust-random/rand) to permit the latest version. - [Release notes](https://github.com/rust-random/rand/releases) - [Changelog](https://github.com/rust-random/rand/blob/master/CHANGELOG.md) - [Commits](rust-random/rand@0.8.0...0.9.0) --- updated-dependencies: - dependency-name: rand dependency-type: direct:production ... Signed-off-by: dependabot[bot] <[email protected]> * fix errors partially * fix: OsRng --------- Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cristiano Piemontese <[email protected]> Co-authored-by: Emiliano Bovetti <[email protected]>
1 parent 7eee239 commit 72de57d

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ dashmap = { version = "6.0", optional = true }
118118
futures = "0.3"
119119
futures-util = "0.3"
120120
jsonwebtoken = { version = "9.0", optional = true }
121-
rand = { version = "0.8", optional = true }
121+
rand = { version = "0.9", features = ["thread_rng"], optional = true }
122122
redis = { version = "0.32", features = ["tokio-comp"], optional = true }
123123
reqwest = { version = "0.12", features = ["json", "multipart", "stream"] }
124124
serde = { version = "1.0", features = ["derive"] }

src/auth0/cache/crypto.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
use chacha20poly1305::{aead::Aead, AeadCore, KeyInit, XChaCha20Poly1305};
2-
use rand::thread_rng;
1+
use chacha20poly1305::aead::{Aead, AeadCore, KeyInit, OsRng};
2+
use chacha20poly1305::XChaCha20Poly1305;
33
use serde::{Deserialize, Serialize};
44

55
const NONCE_SIZE: usize = 24;
@@ -16,7 +16,7 @@ pub fn encrypt<T: Serialize>(value_ref: &T, token_encryption_key_str: &str) -> R
1616
let json: String = serde_json::to_string(value_ref)?;
1717

1818
let enc = XChaCha20Poly1305::new_from_slice(token_encryption_key_str.as_bytes()).unwrap();
19-
let nonce = XChaCha20Poly1305::generate_nonce(&mut thread_rng());
19+
let nonce = XChaCha20Poly1305::generate_nonce(&mut OsRng);
2020

2121
let mut ciphertext = enc.encrypt(&nonce, json.as_bytes())?;
2222
ciphertext.extend(nonce);

src/auth0/util.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ impl StalenessCheckPercentage {
1515

1616
pub fn random_value_between(&self) -> f64 {
1717
use rand::Rng;
18-
rand::thread_rng().gen_range(self.0.clone())
18+
rand::rng().random_range(self.0.clone())
1919
}
2020
}
2121

0 commit comments

Comments
 (0)