Add public mechanism for installing aws-lc-rs

This commit is contained in:
asonix 2024-05-03 23:05:17 -05:00
parent 39da69b1aa
commit 33e72266f5
2 changed files with 15 additions and 0 deletions

View file

@ -1937,6 +1937,19 @@ impl PictRsConfiguration {
Ok(self) Ok(self)
} }
/// Install aws-lc-rs as the default crypto provider
///
/// This would happen automatically anyway unless rustls crate features get mixed up
pub fn install_crypto_provider(self) -> Self {
if rustls023::crypto::aws_lc_rs::default_provider()
.install_default()
.is_err()
{
tracing::info!("rustls crypto provider already installed");
}
self
}
/// Run the pict-rs application on a tokio `LocalSet` /// Run the pict-rs application on a tokio `LocalSet`
/// ///
/// This must be called from within `tokio::main` directly /// This must be called from within `tokio::main` directly

View file

@ -4,6 +4,7 @@ fn main() -> color_eyre::Result<()> {
pict_rs::PictRsConfiguration::build_default()? pict_rs::PictRsConfiguration::build_default()?
.install_tracing()? .install_tracing()?
.install_metrics()? .install_metrics()?
.install_crypto_provider()
.run() .run()
.await .await
}) })
@ -18,6 +19,7 @@ fn main() -> color_eyre::Result<()> {
pict_rs::PictRsConfiguration::build_default()? pict_rs::PictRsConfiguration::build_default()?
.install_tracing()? .install_tracing()?
.install_metrics()? .install_metrics()?
.install_crypto_provider()
.run_on_localset() .run_on_localset()
.await .await
}) })