spiffe_rustls_tokio/lib.rs
1#![deny(missing_docs)]
2#![deny(unsafe_code)]
3#![warn(missing_debug_implementations)]
4#![warn(clippy::all)]
5#![warn(clippy::pedantic)]
6#![allow(clippy::module_name_repetitions)]
7#![allow(clippy::must_use_candidate)]
8
9//! # spiffe-rustls-tokio
10//!
11//! Tokio-native accept/connect helpers for [spiffe-rustls](https://docs.rs/spiffe-rustls) configs.
12//!
13//! Integrates `tokio-rustls` with automatic peer SPIFFE ID extraction. Provides `TlsAcceptor` and
14//! `TlsConnector` that return `(TlsStream, PeerIdentity)` after successful handshakes. Runtime-agnostic
15//! TLS configuration remains in `spiffe-rustls`.
16//!
17//! ## Example
18//!
19//! ```no_run
20//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
21//! use spiffe::X509Source;
22//! use spiffe_rustls::{authorizer, mtls_client};
23//! use spiffe_rustls_tokio::TlsConnector;
24//! use std::sync::Arc;
25//!
26//! let source = X509Source::new().await?;
27//! let client_config = mtls_client(source)
28//! .authorize(authorizer::any())
29//! .build()?;
30//!
31//! let connector = TlsConnector::new(Arc::new(client_config));
32//! # Ok(())
33//! # }
34//! ```
35
36mod acceptor;
37mod connector;
38mod error;
39mod identity;
40
41pub use acceptor::TlsAcceptor;
42pub use connector::TlsConnector;
43pub use error::Error;
44pub use identity::PeerIdentity;