Skip to content

Commit eac6b69

Browse files
fix: ensure rustls crypto provider is installed in TactClient
TactClient::new creates a reqwest::Client directly, bypassing the HttpClient transport layer which calls ensure_crypto_provider(). This caused "No provider set" panics in tests and code coverage CI. Make ensure_crypto_provider() pub(crate) and call it from TactClient::new.
1 parent dd4be68 commit eac6b69

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

crates/cascette-protocol/src/client/tact.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ impl TactClient {
2121
/// Create a new TACT client
2222
#[cfg(not(target_arch = "wasm32"))]
2323
pub fn new(base_url: String, _use_https: bool) -> Result<Self> {
24+
crate::transport::ensure_crypto_provider();
2425
let client = Client::builder()
2526
.pool_idle_timeout(Duration::from_secs(90))
2627
.pool_max_idle_per_host(10)

crates/cascette-protocol/src/transport/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use std::time::Duration;
1515
/// Uses ring as the crypto provider. If another provider was already installed
1616
/// (e.g. by the application), this is a no-op.
1717
#[cfg(not(target_arch = "wasm32"))]
18-
fn ensure_crypto_provider() {
18+
pub(crate) fn ensure_crypto_provider() {
1919
// OnceLock ensures we only attempt installation once.
2020
// install_default() returns Err if a provider is already set, which we ignore.
2121
static INIT: OnceLock<()> = OnceLock::new();

0 commit comments

Comments
 (0)