Skip to content

Commit 3dfdc86

Browse files
committed
Update deprecated methods
1 parent ec92c1e commit 3dfdc86

File tree

3 files changed

+5
-22
lines changed

3 files changed

+5
-22
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/bitwarden-core/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ bitwarden-error = { workspace = true }
5959
# By default, we use rustls as the TLS stack and rust-platform-verifier to support user-installed root certificates
6060
# The only exception is WASM, as it just uses the browsers/node fetch
6161
reqwest = { workspace = true, features = ["rustls-tls-manual-roots"] }
62+
rustls = { version = "0.23.19", default-features = false }
6263
rustls-platform-verifier = "0.4.0"
6364

6465
[dev-dependencies]

crates/bitwarden-core/src/client/client.rs

+3-22
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ impl Client {
2727

2828
#[cfg(not(target_arch = "wasm32"))]
2929
{
30+
use rustls::ClientConfig;
31+
use rustls_platform_verifier::ConfigVerifierExt;
3032
client_builder =
31-
client_builder.use_preconfigured_tls(rustls_platform_verifier::tls_config());
33+
client_builder.use_preconfigured_tls(ClientConfig::with_platform_verifier());
3234
}
3335

3436
client_builder
@@ -83,24 +85,3 @@ impl Client {
8385
}
8486
}
8587
}
86-
87-
#[cfg(test)]
88-
mod tests {
89-
#[cfg(not(target_arch = "wasm32"))]
90-
#[test]
91-
fn test_reqwest_rustls_platform_verifier_are_compatible() {
92-
// rustls-platform-verifier is generating a rustls::ClientConfig,
93-
// which reqwest accepts as a &dyn Any and then downcasts it to a
94-
// rustls::ClientConfig.
95-
96-
// This means that if the rustls version of the two crates don't match,
97-
// the downcast will fail and we will get a runtime error.
98-
99-
// This tests is added to ensure that it doesn't happen.
100-
101-
let _ = reqwest::ClientBuilder::new()
102-
.use_preconfigured_tls(rustls_platform_verifier::tls_config())
103-
.build()
104-
.unwrap();
105-
}
106-
}

0 commit comments

Comments
 (0)