diff options
Diffstat (limited to '')
| -rw-r--r-- | crates/daemon/src/aclient/api_client.rs | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/crates/daemon/src/aclient/api_client.rs b/crates/daemon/src/aclient/api_client.rs index 666e6dce..c0688cf9 100644 --- a/crates/daemon/src/aclient/api_client.rs +++ b/crates/daemon/src/aclient/api_client.rs @@ -10,7 +10,6 @@ use turtle_common::{api::ErrorResponse, record::RecordStatus}; use turtle_common::{ api::{ATUIN_CARGO_VERSION, ATUIN_HEADER_VERSION, ATUIN_VERSION}, record::{EncryptedData, HostId, Record, RecordIdx}, - tls::ensure_crypto_provider, }; use semver::Version; @@ -101,6 +100,22 @@ async fn handle_resp_error(resp: Response) -> Result<Response> { Ok(resp) } +use std::sync::Once; + +static INIT: Once = Once::new(); + +/// Ensure the rustls crypto provider (ring) is installed. +/// +/// Must be called before creating any reqwest clients. Safe to call +/// multiple times — only the first call installs the provider. +fn ensure_crypto_provider() { + INIT.call_once(|| { + rustls::crypto::ring::default_provider() + .install_default() + .expect("Failed to install rustls crypto provider"); + }); +} + impl<'a> Client<'a> { pub(crate) fn new( sync_addr: &'a str, |
