fix: CryptoProvider::get_default returned None

This commit is contained in:
DarkCat09 2024-08-06 18:36:40 +04:00
parent 39c31d9651
commit 1395bb04ff
Signed by: DarkCat09
GPG key ID: 0A26CD5B3345D6E3

View file

@ -9,7 +9,11 @@ pub struct AllowAllCertVerifier(std::sync::Arc<CryptoProvider>);
impl AllowAllCertVerifier {
pub fn yes_i_know_what_i_am_doing() -> Self {
AllowAllCertVerifier(CryptoProvider::get_default().unwrap().clone())
AllowAllCertVerifier(
CryptoProvider::get_default()
.map(|c| c.clone())
.unwrap_or_else(|| std::sync::Arc::new(rustls::crypto::ring::default_provider())),
)
}
}