fedimint_core/
rustls.rs

1use tokio::sync::OnceCell;
2
3static INSTALL_CRYPTO: OnceCell<()> = OnceCell::const_new();
4
5#[cfg(not(target_family = "wasm"))]
6pub async fn install_crypto_provider() {
7    use fedimint_logging::LOG_CORE;
8    use tracing::warn;
9
10    INSTALL_CRYPTO
11        .get_or_init(|| async {
12            if tokio_rustls::rustls::crypto::ring::default_provider()
13                .install_default()
14                .is_err()
15            {
16                warn!(
17                    target: LOG_CORE,
18                    "Failed to install rustls crypto provider. Hopefully harmless."
19                );
20            }
21        })
22        .await;
23}