openagent-weave · peer_auth
Declared module signatures, types, configuration, and source documentation.
Source: openagent-sdk/adapters/weave/src/peer_auth.rs. SHA-256: 1d288e2675cff08c6905e3ec68b20bf61d08dc8501d838e8954cb839871c0fe0.
This source reference follows declared modules and preserves feature attributes. It includes public declarations and implementation methods in those modules. Private-module exports and trait resolution still require the compiler; not every declaration is a crate-root import. Function bodies and constant values are omitted. Source comments describe their implementation context and are not a production deployment claim.
peer_auth::PeerAuthState
Authentication state for a single peer.
#[derive(Debug, Clone)]
pub struct PeerAuthState {
/// The authenticated DID of the peer.
pub did: String,
/// The session ID from the ESTABLISHED step.
pub session_id: String,
/// When the session was established.
pub established_at: Instant,
/// When the session expires.
pub expires_at: Instant,
/// Current state of the handshake.
pub phase: HandshakePhase
}Source line: 17.
peer_auth::HandshakePhase
Which phase of the handshake this peer is in.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum HandshakePhase {
/// PRESENT sent, awaiting CHALLENGE.
PresentSent,
/// CHALLENGE issued by us, awaiting PROVE.
ChallengeIssued,
/// PROVE sent, awaiting ESTABLISHED.
ProveSent,
/// Handshake complete.
Established,
}Source line: 32.
peer_auth::PeerAuthState::is_valid
Returns true if the session is established and not expired.
pub fn is_valid(&self) -> bool;Source line: 45.
peer_auth::PeerAuthState::is_expired
Returns true if the session has expired.
pub fn is_expired(&self) -> bool;Source line: 50.
peer_auth::PeerAuthStore
Thread-safe store for per-peer authentication state.
Keyed by libp2p PeerId. Handles concurrent access from the swarm event
loop and application code.
#[derive(Debug, Clone, Default)]
pub struct PeerAuthStore {
}Source line: 60.
peer_auth::PeerAuthStore::new
Creates a new empty peer auth store.
pub fn new() -> Self;Source line: 66.
peer_auth::PeerAuthStore::put
Record or update a peer's auth state.
pub fn put(&self, peer: PeerId, state: PeerAuthState) -> Result<(), WeaveAuthError>;Source line: 71.
peer_auth::PeerAuthStore::get
Retrieve a peer's auth state.
pub fn get(&self, peer: &PeerId) -> Result<Option<PeerAuthState>, WeaveAuthError>;Source line: 81.
peer_auth::PeerAuthStore::remove
Remove a peer's auth state (on disconnect or session revocation).
pub fn remove(&self, peer: &PeerId) -> Result<(), WeaveAuthError>;Source line: 90.
peer_auth::PeerAuthStore::is_authenticated
Returns true if the peer has a valid, non-expired established session.
pub fn is_authenticated(&self, peer: &PeerId) -> bool;Source line: 100.
peer_auth::PeerAuthStore::gc_expired
Remove all expired sessions. Returns the number removed.
pub fn gc_expired(&self) -> Result<usize, WeaveAuthError>;Source line: 108.
peer_auth::PeerAuthStore::len
Returns the number of peers in the store.
pub fn len(&self) -> usize;Source line: 119.
peer_auth::PeerAuthStore::is_empty
Returns true if the store has no entries.
pub fn is_empty(&self) -> bool;Source line: 124.