Skip to main content

SessionStore

Trait SessionStore 

Source
pub trait SessionStore: Send + Sync {
    // Required methods
    fn has_session(&self, fingerprint: &IdentityFingerprint) -> bool;
    fn cache_session(
        &mut self,
        fingerprint: IdentityFingerprint,
    ) -> Result<(), RemoteClientError>;
    fn remove_session(
        &mut self,
        fingerprint: &IdentityFingerprint,
    ) -> Result<(), RemoteClientError>;
    fn clear(&mut self) -> Result<(), RemoteClientError>;
    fn list_sessions(
        &self,
    ) -> Vec<(IdentityFingerprint, Option<String>, u64, u64)>;
    fn set_session_name(
        &mut self,
        fingerprint: &IdentityFingerprint,
        name: String,
    ) -> Result<(), RemoteClientError>;
    fn update_last_connected(
        &mut self,
        fingerprint: &IdentityFingerprint,
    ) -> Result<(), RemoteClientError>;
    fn save_transport_state(
        &mut self,
        fingerprint: &IdentityFingerprint,
        transport_state: MultiDeviceTransport,
    ) -> Result<(), RemoteClientError>;
    fn load_transport_state(
        &self,
        fingerprint: &IdentityFingerprint,
    ) -> Result<Option<MultiDeviceTransport>, RemoteClientError>;
}
Expand description

Trait for session cache storage implementations

Provides an abstraction for storing and retrieving approved remote fingerprints. Implementations must be thread-safe for use in async contexts.

Required Methods§

Source

fn has_session(&self, fingerprint: &IdentityFingerprint) -> bool

Check if a fingerprint exists in the cache

Source

fn cache_session( &mut self, fingerprint: IdentityFingerprint, ) -> Result<(), RemoteClientError>

Cache a new session fingerprint

If the fingerprint already exists, updates the cached_at timestamp.

Source

fn remove_session( &mut self, fingerprint: &IdentityFingerprint, ) -> Result<(), RemoteClientError>

Remove a fingerprint from the cache

Source

fn clear(&mut self) -> Result<(), RemoteClientError>

Clear all cached sessions

Source

fn list_sessions(&self) -> Vec<(IdentityFingerprint, Option<String>, u64, u64)>

List all cached sessions

Returns tuples of (fingerprint, optional_name, created_timestamp, last_connected_timestamp)

Source

fn set_session_name( &mut self, fingerprint: &IdentityFingerprint, name: String, ) -> Result<(), RemoteClientError>

Set a friendly name for a cached session

Source

fn update_last_connected( &mut self, fingerprint: &IdentityFingerprint, ) -> Result<(), RemoteClientError>

Update the last_connected_at timestamp for a session

Source

fn save_transport_state( &mut self, fingerprint: &IdentityFingerprint, transport_state: MultiDeviceTransport, ) -> Result<(), RemoteClientError>

Save transport state for a session

This allows session resumption without requiring a new Noise handshake.

Source

fn load_transport_state( &self, fingerprint: &IdentityFingerprint, ) -> Result<Option<MultiDeviceTransport>, RemoteClientError>

Load transport state for a session

Returns None if no transport state is stored for this session.

Implementors§