decdn_common/tls.rs
1//! The process-wide rustls crypto provider.
2//!
3//! Every client build links one TLS backend, ring: iroh's QUIC stack already
4//! uses it, and the workspace builds reqwest with `rustls-no-provider` so that
5//! aws-lc-rs stays out of the client SDK and the CLI. The cost of
6//! `rustls-no-provider` is that reqwest takes its provider from the process
7//! default and panics in `Client::build` when none is installed — and alloy's
8//! HTTP transport builds a `reqwest::Client` for every `connect_http`, whatever
9//! the URL scheme. Call [`install_crypto_provider`] before building one.
10
11/// Install ring as the process-wide rustls crypto provider.
12///
13/// Idempotent and cheap: a second call, or a host application that installed
14/// its own provider first, leaves the installed provider in place.
15pub fn install_crypto_provider() {
16 // `Err` means a provider is already installed, which is the goal.
17 let _ = rustls::crypto::ring::default_provider().install_default();
18}