Skip to main content

Crate moirai_tls

Crate moirai_tls 

Source
Expand description

Async TLS client for the Moirai runtime.

Drives the sans-I/O rustls state machine (via the runtime-agnostic futures_rustls adapter) over a Moirai async socket — no Tokio. Moirai’s moirai_async::io::AsyncRead/AsyncWrite traits are signature-identical to futures_io, so the bridge is two zero-cost newtypes; all TLS cryptography and record framing are delegated to the audited rustls stack (ADR-015 — moirai owns transport, not crypto reimplementation).

use moirai_tls::{TlsConnector, ServerName};
let connector = TlsConnector::with_webpki_roots();
let domain = ServerName::try_from("example.com").unwrap();
let _tls = connector.connect(domain, sock).await.unwrap();

Re-exports§

pub use futures_rustls::rustls;

Structs§

TlsConnector
Client TLS connector wrapping a shared rustls::ClientConfig.
ToFuturesIo
Zero-cost adapter exposing a Moirai async stream as a futures_io stream.
ToMoiraiIo
Zero-cost adapter exposing a futures_io stream as a Moirai async stream.

Enums§

ServerName
Server name used for SNI and certificate validation. Encodes ways a client can know the expected name of the server.

Functions§

client_config_with_roots
Construct a pure-Rust RustCrypto-backed ClientConfig with safe default protocol versions trusting roots. Uses moirai_crypto::provider instead of ring — zero C dependencies. Shared by TlsConnector::with_webpki_roots and tests that supply a custom root (self-signed) store.

Type Aliases§

TlsStream
A negotiated client-side TLS stream over a Moirai async socket S.