zer0-secret-stream · crate
Source declarations, signatures and documentation for crate.
Source: sigil/weave/network/zer0-secret-stream/src/lib.rs. SHA-256: 01b9849897635035b8b35e0128c7b5a377564db5c4b2a5ffca7ac3c70bc6a560.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
bridge
pub mod bridge;Source line: 9.
codec
pub mod codec;Source line: 10.
config
pub mod config;Source line: 11.
errors
pub mod errors;Source line: 12.
metrics
pub mod metrics;Source line: 14.
protocol
pub mod protocol;Source line: 15.
session
pub mod session;Source line: 16.
pub use bridge::Bridge;
pub use bridge::Bridge;Source line: 41.
pub use config::SecretTunables as SecretStreamTunables;
pub use config::SecretTunables as SecretStreamTunables;Source line: 42.
pub use errors::{Result, SecretStreamError};
pub use errors::{Result, SecretStreamError};Source line: 43.
pub use handshake::{Handshake, HandshakeResult};
#[cfg(feature = "legacy-api")]
pub use handshake::{Handshake, HandshakeResult};Source line: 47.
pub use handshake::{HandshakeError, HandshakePattern};
pub use handshake::{HandshakeError, HandshakePattern};Source line: 48.
pub use metrics::{SecretStreamMetrics as SecretStreamMetricsType, SecretStreamMetricsSnapshot};
pub use metrics::{SecretStreamMetrics as SecretStreamMetricsType, SecretStreamMetricsSnapshot};Source line: 49.
pub use protocol::{
ApplicationAuthTranscriptV1, ChannelBinding, EndpointProfile, FeatureSet, OpaqueApplicationAuthInputs, ProtocolError, ProtocolId, RouteBinding, ServiceRoles, SessionBootstrapContext, SessionBootstrapV1, TransportPeerId, };
pub use protocol::{
ApplicationAuthTranscriptV1, ChannelBinding, EndpointProfile, FeatureSet,
OpaqueApplicationAuthInputs, ProtocolError, ProtocolId, RouteBinding, ServiceRoles,
SessionBootstrapContext, SessionBootstrapV1, TransportPeerId,
};Source line: 50.
pub use session::{
MigrationGeneration, ReplacementAttempt, ReplacementPlan, SecureSession, SecureSessionError, SecureSessionOptions, SessionCancellation, SessionClock, SessionFlowController, SessionOperation, SessionPolicy, SessionPriority, SessionResourceGovernor, SessionResourceLimits, SessionResourcePermit, SessionResourceSnapshot, };
pub use session::{
MigrationGeneration, ReplacementAttempt, ReplacementPlan, SecureSession, SecureSessionError,
SecureSessionOptions, SessionCancellation, SessionClock, SessionFlowController,
SessionOperation, SessionPolicy, SessionPriority, SessionResourceGovernor,
SessionResourceLimits, SessionResourcePermit, SessionResourceSnapshot,
};Source line: 55.
::SecretOptions
Options for creating a new SecretStream
#[derive(Debug, Clone)]
pub struct SecretOptions {
/// Full local signing key pair. Required when a stable local public key is expected.
pub key_pair: Option<zer0_crypto::KeyPair>,
/// The public key of the local peer
pub public_key: Option<[u8; 32]>,
/// The expected public key of the remote peer
pub remote_public_key: Option<[u8; 32]>,
/// Handshake pattern to use (default: XX)
pub pattern: HandshakePattern,
/// Keep-alive interval in milliseconds (0 = disabled)
pub keep_alive: u64,
/// Connection timeout in milliseconds (0 = disabled)
pub timeout: u64,
/// Enable sending of unordered messages
pub enable_send: bool
}Source line: 77.
::Message
Message received via the unordered message channel
#[derive(Debug, Clone)]
pub struct Message {
pub data: Bytes
}Source line: 110.
::StreamState
State of the secret stream
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum StreamState {
Handshaking,
Connected,
Closed,
}Source line: 116.
::SecretStream
The encrypted stream primitive underlying SecureSession.
The Protocol 1.0 alpha feature deliberately exposes no safe raw constructor:
# let stream = tokio::io::duplex(64).0;
let _ = zer0_secret_stream::SecretStream::new(
stream,
true,
zer0_secret_stream::SecretOptions::default(),
);Isolated compatibility builds must opt out of protocol1-alpha and opt in to
legacy-api; the two features cannot coexist.
#[pin_project(PinnedDrop)]
pub struct SecretStream<S> {
}Source line: 138.
::SecretStream<S>::new
Construct the stream used by weave-sdk replication (Noise XX over TCP).
Available regardless of Protocol 1.0 alpha vs legacy feature selection so operator tools can dogfood against live DHT without feature-unification traps.
pub fn new(inner: S, is_initiator: bool, options: SecretOptions) -> Result<Self>;Source line: 519.
::SecretStream<S>::state
Get the current state of the stream
pub fn state(&self) -> StreamState;Source line: 524.
::SecretStream<S>::public_key
Get the local public key
pub fn public_key(&self) -> [u8; 32];Source line: 529.
::SecretStream<S>::remote_public_key
Get the remote public key (if connected)
pub fn remote_public_key(&self) -> Option<[u8; 32]>;Source line: 534.
::SecretStream<S>::handshake_hash
Get the handshake hash (if connected)
pub fn handshake_hash(&self) -> Option<[u8; 32]>;Source line: 539.
::SecretStream<S>::is_initiator
Check if this peer is the initiator
pub fn is_initiator(&self) -> bool;Source line: 598.
::SecretStream<S>::metrics
Get a clone of the metrics handle
pub fn metrics(&self) -> Arc<SecretStreamMetrics>;Source line: 603.
::SecretStream<S>::tunables
Get current tunables (by value)
pub fn tunables(&self) -> SecretTunables;Source line: 608.
::SecretStream<S>::export_metrics_text
Export metrics text for scraping
pub fn export_metrics_text(&self, namespace: &str) -> String;Source line: 613.
::SecretStream<S>::key_pair
Generate a new key pair
pub fn key_pair(seed: Option<&[u8; 32]>) -> zer0_crypto::KeyPair;Source line: 618.
::SecretStream<S>::id
Generate stream ID for the given handshake hash
pub fn id(handshake_hash: &[u8; 32], is_initiator: bool) -> [u8; 32];Source line: 623.
::SecretStream<S>::send_message
Send an unordered message (UDP-style)
#[cfg(feature = "legacy-api")]
pub async fn send_message(&mut self, data: impl Into<Bytes>) -> Result<()>;Source line: 629.
::SecretStream<S>::recv_message
Receive an unordered message
#[cfg(feature = "legacy-api")]
pub async fn recv_message(&mut self) -> Result<Option<Message>>;Source line: 696.
::SecretStream<S>::handshake
Perform handshake
pub async fn handshake(&mut self) -> Result<()>;Source line: 704.