feat(tls): add TLS provider initialization and integrate with van-weather
This commit is contained in:
1 parent
8a11cb4659
commit
3960254b27
4 files changed
+42
-1
No files matched your search
@@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "tls"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
description = "Shared AWS-LC TLS provider initialization"
|
||||
license = "MIT"
|
||||
publish = false
|
||||
|
||||
[dependencies]
|
||||
anyhow.workspace = true
|
||||
rustls.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
@@ -0,0 +1,16 @@
|
||||
//! Shared TLS configuration for workspace applications.
|
||||
|
||||
use anyhow::{Result, anyhow};
|
||||
|
||||
/// Install AWS-LC as the process-wide default TLS crypto provider.
|
||||
///
|
||||
/// Call once at startup, before creating HTTP clients.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// Returns an error if a TLS crypto provider has already been initialized.
|
||||
pub fn install_tls_provider() -> Result<()> {
|
||||
rustls::crypto::aws_lc_rs::default_provider()
|
||||
.install_default()
|
||||
.map_err(|_| anyhow!("TLS crypto provider was already initialized"))
|
||||
}
|
||||
Reference in new issue
Block a user