Skip to content

Commit 270cb19

Browse files
Copilotgoloroden
andcommitted
Fix build issue with rand 0.9 upgrade by using rand_core::OsRng
Co-authored-by: goloroden <[email protected]>
1 parent 6a46b24 commit 270cb19

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ categories = ["database"]
1717
[features]
1818
default = []
1919
cloudevents = ["dep:cloudevents-sdk"]
20-
testcontainer = ["dep:testcontainers", "dep:rand", "ed25519-dalek/rand_core"]
20+
testcontainer = ["dep:testcontainers", "dep:rand", "dep:rand_core", "ed25519-dalek/rand_core"]
2121

2222
[dependencies]
2323
chrono = { version = "0.4.42", features = ["serde"] }
@@ -41,6 +41,7 @@ sha2 = "0.10.9"
4141
hex = "0.4.3"
4242
ed25519-dalek = { version = "2.2.0", features = ["rand_core", "pkcs8", "pem"] }
4343
rand = { version = "0.9", optional = true }
44+
rand_core = { version = "0.6", features = ["getrandom"], optional = true }
4445

4546
[dev-dependencies]
4647
testcontainers = { version = "0.25.2", features = ["http_wait"] }

src/container.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ use ed25519_dalek::{
3838
SigningKey, VerifyingKey,
3939
pkcs8::{EncodePrivateKey, spki::der::pem::LineEnding},
4040
};
41-
use rand::prelude::ThreadRng;
41+
use rand_core::OsRng;
4242
use testcontainers::{
4343
ContainerAsync, CopyDataSource, GenericImage,
4444
core::{ContainerPort, ImageExt, WaitFor, wait::HttpWaitStrategy},
@@ -115,8 +115,7 @@ impl ContainerBuilder {
115115
/// The private key will be used to sign events and the public key will be used to verify them.
116116
#[must_use]
117117
pub fn with_signing_key(mut self) -> Self {
118-
let mut rng: ThreadRng = rand::thread_rng();
119-
self.signing_key = Some(SigningKey::generate(&mut rng));
118+
self.signing_key = Some(SigningKey::generate(&mut OsRng));
120119
self
121120
}
122121

0 commit comments

Comments
 (0)