openagent-auth-protocol · session
Declared module signatures, types, configuration, and source documentation.
Source: openagent-sdk/crates/openagent-auth-protocol/src/session.rs. SHA-256: 846a27ff5bfe6506161ceae4398609265381bae29a2a2cdf9816a125e4d270e8.
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.
session::SessionId
Opaque session identifier (BLAKE3 of random bytes, hex-encoded).
pub type SessionId = String;Source line: 17.
session::SessionState
States a session transitions through during the handshake.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum SessionState {
/// Challenge issued; waiting for PROVE.
AwaitingProof,
/// Handshake complete; session is usable.
Established,
/// Session revoked or expired.
Closed,
}Source line: 21.
session::Session
An authenticated session between two agents.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Session {
/// Unique session identifier.
pub id: SessionId,
/// Current handshake state.
pub state: SessionState,
/// DID of the initiator (client).
pub initiator_did: String,
/// DID of the responder (server).
pub responder_did: String,
/// Nonce issued in the CHALLENGE step.
pub nonce: String,
/// When the session was created.
pub created_at: DateTime<Utc>,
/// When the session expires.
pub expires_at: DateTime<Utc>,
/// Capabilities granted upon establishment.
#[serde(default)]
pub capabilities: Vec<String>
}Source line: 32.
session::Session::is_expired
Returns true if the session has expired.
pub fn is_expired(&self) -> bool;Source line: 54.
session::Session::is_valid
Returns true if the session is established and not expired.
pub fn is_valid(&self) -> bool;Source line: 59.
session::SessionStore
Trait for pluggable session storage backends.
Implementations must be Send + Sync for use with async runtimes.
#[async_trait::async_trait]
pub trait SessionStore: Send + Sync {
/// Persist a new or updated session.
async fn put(&self, session: Session) -> Result<(), AuthProtocolError>;
/// Retrieve a session by its ID. Returns `None` if not found.
async fn get(&self, id: &str) -> Result<Option<Session>, AuthProtocolError>;
/// Remove a session by its ID.
async fn remove(&self, id: &str) -> Result<(), AuthProtocolError>;
}Source line: 68.
session::InMemorySessionStore
In-memory session store — suitable for tests and single-node deployments.
#[derive(Debug, Clone, Default)]
pub struct InMemorySessionStore {
}Source line: 79.
session::InMemorySessionStore::new
Creates a new empty session store.
pub fn new() -> Self;Source line: 85.