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§
Sourcefn has_session(&self, fingerprint: &IdentityFingerprint) -> bool
fn has_session(&self, fingerprint: &IdentityFingerprint) -> bool
Check if a fingerprint exists in the cache
Sourcefn cache_session(
&mut self,
fingerprint: IdentityFingerprint,
) -> Result<(), RemoteClientError>
fn cache_session( &mut self, fingerprint: IdentityFingerprint, ) -> Result<(), RemoteClientError>
Cache a new session fingerprint
If the fingerprint already exists, updates the cached_at timestamp.
Sourcefn remove_session(
&mut self,
fingerprint: &IdentityFingerprint,
) -> Result<(), RemoteClientError>
fn remove_session( &mut self, fingerprint: &IdentityFingerprint, ) -> Result<(), RemoteClientError>
Remove a fingerprint from the cache
Sourcefn clear(&mut self) -> Result<(), RemoteClientError>
fn clear(&mut self) -> Result<(), RemoteClientError>
Clear all cached sessions
Sourcefn list_sessions(&self) -> Vec<(IdentityFingerprint, Option<String>, u64, u64)>
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)
Sourcefn set_session_name(
&mut self,
fingerprint: &IdentityFingerprint,
name: String,
) -> Result<(), RemoteClientError>
fn set_session_name( &mut self, fingerprint: &IdentityFingerprint, name: String, ) -> Result<(), RemoteClientError>
Set a friendly name for a cached session
Sourcefn update_last_connected(
&mut self,
fingerprint: &IdentityFingerprint,
) -> Result<(), RemoteClientError>
fn update_last_connected( &mut self, fingerprint: &IdentityFingerprint, ) -> Result<(), RemoteClientError>
Update the last_connected_at timestamp for a session
Sourcefn save_transport_state(
&mut self,
fingerprint: &IdentityFingerprint,
transport_state: MultiDeviceTransport,
) -> Result<(), RemoteClientError>
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.
Sourcefn load_transport_state(
&self,
fingerprint: &IdentityFingerprint,
) -> Result<Option<MultiDeviceTransport>, RemoteClientError>
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.