OpenAgentID documentation
Source referencesRust module referencearsenal-sdk

arsenal-sdk · session_manager

Declared module signatures, types, configuration, and source documentation.

Source: arsenal/crates/arsenal-sdk/src/session_manager.rs. SHA-256: 2689b01839e16765db0e6c17b6ef8bb0e4624fb3816e56a4104578b0d5576e2c.

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_manager::SessionManager

Session manager for handling agent sessions

pub struct SessionManager {

}

Source line: 18.

session_manager::SessionConfig

Session configuration

#[derive(Debug, Clone)]
pub struct SessionConfig {
/// Default session TTL in seconds

pub session_ttl_seconds: u64,
/// Token TTL in seconds

pub token_ttl_seconds: i64,
/// Renewal threshold in permille (renew when this fraction of TTL remains).

///

/// Example: `200` = renew when 20% of TTL remains.

pub renewal_threshold_permille: u16,
/// Maximum renewal attempts

pub max_renewal_attempts: u32,
/// Renewal backoff base in milliseconds

pub renewal_backoff_ms: u64
}

Source line: 43.

session_manager::SessionManager::new

Create a new session manager

#[must_use]
pub fn new(identity: Arc<AgentIdentityLoader>, config: SessionConfig) -> Self;

Source line: 73.

session_manager::SessionManager::with_defaults

Create with default configuration

#[must_use]
pub fn with_defaults(identity: Arc<AgentIdentityLoader>) -> Self;

Source line: 83.

session_manager::SessionManager::start_session

Start a new session

Errors

Returns an error if session creation fails

pub async fn start_session(&self) -> ArsenalResult<SessionId>;

Source line: 91.

session_manager::SessionManager::session_id

Get the current session ID

Errors

Returns an error if no session is active

pub async fn session_id(&self) -> ArsenalResult<SessionId>;

Source line: 132.

session_manager::SessionManager::has_active_session

Check if a session is active

pub async fn has_active_session(&self) -> bool;

Source line: 141.

session_manager::SessionManager::session_state

Get session state

pub async fn session_state(&self) -> Option<SessionState>;

Source line: 149.

session_manager::SessionManager::record_activity

Record activity (updates last activity time)

pub async fn record_activity(&self);

Source line: 155.

session_manager::SessionManager::set_current_token

Set the current capability token

Errors

Returns an error if no session is active

pub async fn set_current_token(&self, token: AgentCapabilityToken) -> ArsenalResult<()>;

Source line: 167.

session_manager::SessionManager::current_token

Get the current capability token

pub async fn current_token(&self) -> Option<AgentCapabilityToken>;

Source line: 187.

session_manager::SessionManager::needs_token_renewal

Check if the current token needs renewal

pub async fn needs_token_renewal(&self) -> bool;

Source line: 193.

session_manager::SessionManager::needs_session_renewal

Check if the session needs renewal

pub async fn needs_session_renewal(&self) -> bool;

Source line: 212.

session_manager::SessionManager::sign_with_session_key

Sign a message with the session key (for PoP)

Errors

Returns an error if no session is active

pub async fn sign_with_session_key(&self, message: &[u8]) -> ArsenalResult<[u8; 64]>;

Source line: 231.

session_manager::SessionManager::end_session

End the current session

Errors

Returns an error if ending fails

pub async fn end_session(&self) -> ArsenalResult<()>;

Source line: 244.

session_manager::SessionManager::revoke_session

Revoke the current session (immediate termination)

pub async fn revoke_session(&self);

Source line: 257.

session_manager::SessionManager::stats

Get session statistics

pub async fn stats(&self) -> SessionStats;

Source line: 269.

session_manager::SessionStats

Session statistics

#[derive(Debug, Clone)]
pub struct SessionStats {
/// Current session ID

pub session_id: Option<SessionId>,
/// Session state

pub state: SessionState,
/// Number of active tokens

pub active_tokens: u64,
/// Session age in seconds

pub session_age_secs: u64,
/// Seconds since last activity

pub idle_secs: u64,
/// Whether there's a valid token

pub has_valid_token: bool
}

Source line: 291.

On this page