Skip to content

Commit 9ef3280

Browse files
committed
Update the tls based dependencies to match the payjoin msrv
This commit updates the tls related dependencies to mathc the new payjoin msrv to 1.85.0> All these crates have these changes together as the crates are all interdependent on each other. As well there are some significant api changes that come with these new dep bumps. payjoin-cli and payjoin-directory both use tokio-rustls which has an internal rustls module accesible so I removed their direct rustls deps in hopes that it could prevent some divergent changes in the future.
1 parent 7178620 commit 9ef3280

File tree

10 files changed

+521
-593
lines changed

10 files changed

+521
-593
lines changed

Cargo-minimal.lock

Lines changed: 242 additions & 275 deletions
Large diffs are not rendered by default.

Cargo-recent.lock

Lines changed: 242 additions & 275 deletions
Large diffs are not rendered by default.

payjoin-cli/Cargo.toml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ path = "src/main.rs"
2121
[features]
2222
default = ["v2"]
2323
native-certs = ["reqwest/rustls-tls-native-roots"]
24-
_manual-tls = ["rcgen", "reqwest/rustls-tls", "rustls", "hyper-rustls", "payjoin/_manual-tls", "tokio-rustls"]
24+
_manual-tls = ["rcgen", "reqwest/rustls-tls", "hyper-rustls", "payjoin/_manual-tls", "tokio-rustls"]
2525
v1 = ["payjoin/v1","hyper", "hyper-util", "http-body-util"]
2626
v2 = ["payjoin/v2", "payjoin/io"]
2727

@@ -35,21 +35,20 @@ env_logger = "0.11.8"
3535
futures = "0.3.31"
3636
http-body-util = { version = "0.1.3", optional = true }
3737
hyper = { version = "1.6.0", features = ["http1", "server"], optional = true }
38-
hyper-rustls = { version = "0.26", optional = true }
38+
hyper-rustls = { version = "0.27.7", default-features=false, features = ["ring"], optional = true }
3939
hyper-util = { version = "0.1.16", optional = true }
4040
log = "0.4.27"
4141
payjoin = { version = "0.24.0", default-features = false }
4242
r2d2 = "0.8.10"
4343
r2d2_sqlite = "0.22.0"
44-
rcgen = { version = "0.11.1", optional = true }
45-
reqwest = { version = "0.12", default-features = false, features = ["json", "rustls-tls"] }
44+
rcgen = { version = "0.14.3", optional = true }
45+
reqwest = { version = "0.12.23", default-features = false, features = ["json", "rustls-tls"] }
4646
rusqlite = { version = "0.29.0", features = ["bundled"] }
47-
rustls = { version = "0.22.4", optional = true }
4847
serde_json = "1.0.142"
4948
serde = { version = "1.0.219", features = ["derive"] }
5049
sled = "0.34.7"
5150
tokio = { version = "1.47.1", features = ["full"] }
52-
tokio-rustls = { version = "0.25", features = ["ring"], default-features = false, optional = true }
51+
tokio-rustls = { version = "0.26.2", features = ["ring"], default-features = false, optional = true }
5352
url = { version = "2.5.4", features = ["serde"] }
5453
dirs = "6.0.0"
5554

payjoin-cli/src/app/v1.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,10 @@ impl App {
180180

181181
#[cfg(feature = "_manual-tls")]
182182
fn init_tls_acceptor(&self) -> Result<tokio_rustls::TlsAcceptor> {
183-
use rustls::pki_types::{CertificateDer, PrivateKeyDer};
184-
use rustls::ServerConfig;
183+
use std::sync::Arc;
184+
185+
use tokio_rustls::rustls::pki_types::{CertificateDer, PrivateKeyDer};
186+
use tokio_rustls::rustls::ServerConfig;
185187
use tokio_rustls::TlsAcceptor;
186188

187189
let key_der = std::fs::read(

payjoin-cli/tests/e2e.rs

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,12 @@ mod e2e {
8383

8484
let cert = local_cert_key();
8585
let cert_path = &temp_dir.path().join("localhost.crt");
86-
tokio::fs::write(
87-
cert_path,
88-
cert.serialize_der().expect("must be able to serialize self signed certificate"),
89-
)
90-
.await
91-
.expect("must be able to write self signed certificate");
86+
tokio::fs::write(cert_path, cert.cert.der().to_vec())
87+
.await
88+
.expect("must be able to write self signed certificate");
9289

9390
let key_path = &temp_dir.path().join("localhost.key");
94-
tokio::fs::write(key_path, cert.serialize_private_key_der())
91+
tokio::fs::write(key_path, cert.signing_key.serialize_der())
9592
.await
9693
.expect("must be able to write self signed certificate");
9794

@@ -450,15 +447,12 @@ mod e2e {
450447
// Set up certificates for v1 receiver (needs local HTTPS server)
451448
let cert = local_cert_key();
452449
let cert_path = &temp_dir.path().join("localhost.crt");
453-
tokio::fs::write(
454-
cert_path,
455-
cert.serialize_der().expect("must be able to serialize self signed certificate"),
456-
)
457-
.await
458-
.expect("must be able to write self signed certificate");
450+
tokio::fs::write(cert_path, cert.cert.der().to_vec())
451+
.await
452+
.expect("must be able to write self signed certificate");
459453

460454
let key_path = &temp_dir.path().join("localhost.key");
461-
tokio::fs::write(key_path, cert.serialize_private_key_der())
455+
tokio::fs::write(key_path, cert.signing_key.serialize_der())
462456
.await
463457
.expect("must be able to write self signed certificate");
464458

payjoin-directory/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ resolver = "2"
1515
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1616

1717
[features]
18-
_manual-tls = ["hyper-rustls", "rustls", "tokio-rustls"]
18+
_manual-tls = ["hyper-rustls", "tokio-rustls"]
1919

2020
[dependencies]
2121
anyhow = "1.0.99"
@@ -24,14 +24,13 @@ bhttp = { version = "0.6.1", features = ["http"] }
2424
futures = "0.3.31"
2525
http-body-util = "0.1.3"
2626
hyper = { version = "1.6.0", features = ["http1", "server"] }
27-
hyper-rustls = { version = "0.26", optional = true }
27+
hyper-rustls = { version = "0.27.7", default-features=false, features = ["webpki-roots", "http1", "ring"], optional=true }
2828
hyper-util = { version = "0.1.16", features = ["tokio"] }
2929
ohttp = { package = "bitcoin-ohttp", version = "0.6.0"}
3030
payjoin = { version = "0.24.0", features = ["directory"], default-features = false }
3131
redis = { version = "0.32.5", features = ["aio", "tokio-comp"] }
32-
rustls = { version = "0.22.4", optional = true }
3332
tokio = { version = "1.23.31", features = ["full"] }
34-
tokio-rustls = { version = "0.25", features = ["ring"], default-features = false, optional = true }
33+
tokio-rustls = { version = "0.26.2", features = ["ring"], default-features = false, optional = true }
3534
tracing = "0.1.41"
3635
tracing-subscriber = { version = "0.3.19", features = ["env-filter"] }
3736
prometheus = "0.13.4"

payjoin-directory/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ pub type BoxError = Box<dyn std::error::Error + Send + Sync>;
3939

4040
#[cfg(feature = "_manual-tls")]
4141
fn init_tls_acceptor(cert_key: (Vec<u8>, Vec<u8>)) -> Result<tokio_rustls::TlsAcceptor> {
42-
use rustls::pki_types::{CertificateDer, PrivateKeyDer};
43-
use rustls::ServerConfig;
42+
use tokio_rustls::rustls::pki_types::{CertificateDer, PrivateKeyDer};
43+
use tokio_rustls::rustls::ServerConfig;
4444
use tokio_rustls::TlsAcceptor;
4545
let (cert, key) = cert_key;
4646
let cert = CertificateDer::from(cert);

payjoin-test-utils/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ bitcoind = { version = "0.36.1", features = ["0_21_2"] }
1515
http = "1.3.1"
1616
log = "0.4.27"
1717
ohttp = { package = "bitcoin-ohttp", version = "0.6.0" }
18-
ohttp-relay = { version = "0.0.10", features = ["_test-util"] }
18+
ohttp-relay = { version = "0.0.11", features = ["_test-util"] }
1919
once_cell = "1.21.3"
2020
payjoin = { version = "0.24.0", features = ["io", "_manual-tls", "_test-utils"] }
2121
payjoin-directory = { version = "0.0.3", features = ["_manual-tls"] }
22-
rcgen = "0.11"
23-
rustls = "0.22"
24-
reqwest = { version = "0.12", default-features = false, features = ["rustls-tls"] }
22+
rcgen = "0.14.3"
23+
rustls = { version = "0.23.31", default-features=false, features = ["ring"] }
24+
reqwest = { version = "0.12.23", default-features = false, features = ["rustls-tls"] }
2525
testcontainers-modules = { version = "0.12.1", features = ["redis"]}
2626
tokio = { version = "1.47.1", features = ["full"] }
2727
tracing = "0.1.41"

payjoin-test-utils/src/lib.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,31 @@ impl TestServices {
6161
pub async fn initialize() -> Result<Self, BoxSendSyncError> {
6262
// TODO add a UUID, and cleanup guard to delete after on successful run
6363
let cert = local_cert_key();
64-
let cert_der = cert.serialize_der().expect("Failed to serialize cert");
65-
let key_der = cert.serialize_private_key_der();
66-
let cert_key = (cert_der.clone(), key_der.clone());
64+
let cert_der = cert.cert.der().to_vec();
65+
let key_der = cert.signing_key.serialize_der();
66+
let cert_key = (cert_der.clone(), key_der);
6767

6868
let mut root_store = RootCertStore::empty();
69-
root_store.add(CertificateDer::from(cert.serialize_der().unwrap())).unwrap();
69+
root_store.add(CertificateDer::from(cert.cert.der().to_vec())).unwrap();
7070

7171
let redis = init_redis().await;
7272
let db_host = format!("127.0.0.1:{}", redis.0);
73-
let directory = init_directory(db_host, cert_key.clone()).await?;
73+
let directory = init_directory(db_host, cert_key).await?;
7474
let gateway_origin =
7575
ohttp_relay::GatewayUri::from_str(&format!("https://localhost:{}", directory.0))?;
7676
let ohttp_relay = ohttp_relay::listen_tcp_on_free_port(gateway_origin, root_store).await?;
7777
let http_agent: Arc<Client> = Arc::new(http_agent(cert_der)?);
7878

7979
Ok(Self {
80-
cert,
80+
cert: cert.cert,
8181
redis,
8282
directory: (directory.0, Some(directory.1)),
8383
ohttp_relay: (ohttp_relay.0, Some(ohttp_relay.1)),
8484
http_agent,
8585
})
8686
}
8787

88-
pub fn cert(&self) -> Vec<u8> { self.cert.serialize_der().expect("Failed to serialize cert") }
88+
pub fn cert(&self) -> Vec<u8> { self.cert.der().to_vec() }
8989

9090
pub fn directory_url(&self) -> Url {
9191
Url::parse(&format!("https://localhost:{}", self.directory.0)).expect("invalid URL")
@@ -159,7 +159,7 @@ async fn bind_free_port() -> Result<tokio::net::TcpListener, std::io::Error> {
159159
}
160160

161161
/// generate or get a DER encoded localhost cert and key.
162-
pub fn local_cert_key() -> rcgen::Certificate {
162+
pub fn local_cert_key() -> rcgen::CertifiedKey<rcgen::KeyPair> {
163163
rcgen::generate_simple_self_signed(vec!["0.0.0.0".to_string(), "localhost".to_string()])
164164
.expect("Failed to generate cert")
165165
}

payjoin/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ log = { version = "0.4.27"}
3535
http = { version = "1.3.1", optional = true }
3636
bhttp = { version = "0.6.1", optional = true }
3737
ohttp = { package = "bitcoin-ohttp", version = "0.6.0", optional = true }
38-
reqwest = { version = "0.12", default-features = false, optional = true }
39-
rustls = { version = "0.22.4", optional = true }
4038
serde = { version = "1.0.219", default-features = false, optional = true }
41-
serde_json = { version = "1.0.142", optional = true }
39+
reqwest = { version = "0.12.23", default-features = false, optional = true }
40+
rustls = { version = "0.23.31", optional = true, default-features=false, features = ["ring"] }
4241
url = { version = "2.5.4", optional = true }
42+
serde_json = { version = "1.0.142", optional = true }
4343

4444
[dev-dependencies]
4545
bitcoind = { version = "0.36.1", features = ["0_21_2"] }

0 commit comments

Comments
 (0)