OpenAgentID documentation
Source referencesRust module referenceaegis-auth

aegis-auth · store

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

Source: aegis/aegis-auth/src/store.rs. SHA-256: e56e013658859f28040b06b7de74fcdff41bf5d01d95a2fd1b476032bb93ebe3.

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.

store::SessionStore

Pluggable storage backend for authentication sessions.

Implementations may use in-memory storage, databases, or distributed caches. All operations are async to accommodate network-backed stores.

#[async_trait]
pub trait SessionStore: Send + Sync {
    /// Persist a session. Overwrites any existing session with the same ID.
    async fn store_session(&self, session: &Session) -> Result<(), AuthError>;

    /// Retrieve a session by its unique identifier.
    ///
    /// Returns `None` if no session with the given ID exists.
    async fn get_session(&self, session_id: &str) -> Result<Option<Session>, AuthError>;

    /// Delete a session by ID.
    ///
    /// Returns `true` if a session was found and removed, `false` if no
    /// session with the given ID existed.
    async fn delete_session(&self, session_id: &str) -> Result<bool, AuthError>;

    /// List sessions belonging to a specific DID with pagination.
    async fn list_by_did(
        &self,
        did: &str,
        pagination: Pagination,
    ) -> Result<Vec<Session>, AuthError>;

    /// Remove all expired sessions from the store.
    ///
    /// Returns the number of sessions removed.
    async fn cleanup_expired(&self) -> Result<usize, AuthError>;
}

Source line: 25.

store::InMemorySessionStore

In-memory session store backed by a RwLock<HashMap>.

Suitable for development, testing, and single-instance deployments. For production multi-node deployments, use a database-backed or distributed cache implementation of [SessionStore].

pub struct InMemorySessionStore {

}

Source line: 62.

store::InMemorySessionStore::new

Creates a new empty in-memory session store.

pub fn new() -> Self;

Source line: 68.

store::NonceStore

Pluggable storage backend for cryptographic nonce tracking.

Used to prevent challenge replay attacks. Each nonce should be recorded exactly once; subsequent attempts to record the same nonce indicate a replay and should be rejected.

#[async_trait]
pub trait NonceStore: Send + Sync {
    /// Record a nonce as used.
    ///
    /// Returns `true` if the nonce was newly recorded, `false` if it was
    /// already present (indicating a replay attempt).
    async fn record_nonce(&self, nonce: &str) -> Result<bool, AuthError>;

    /// Check whether a nonce has already been recorded.
    async fn has_nonce(&self, nonce: &str) -> Result<bool, AuthError>;

    /// Remove old nonces. Returns the number of entries removed.
    ///
    /// The cleanup strategy is implementation-defined. In-memory stores
    /// clear all entries; persistent stores may use TTL-based eviction.
    async fn cleanup(&self) -> Result<usize, AuthError>;
}

Source line: 144.

store::InMemoryNonceStore

In-memory nonce store backed by a RwLock<HashSet>.

Records nonces in a set. Cleanup clears all recorded nonces; callers should schedule cleanup periodically to bound memory usage.

pub struct InMemoryNonceStore {

}

Source line: 169.

store::InMemoryNonceStore::new

Creates a new empty in-memory nonce store.

pub fn new() -> Self;

Source line: 175.

On this page