Trait rustls::StoresServerSessions [] [src]

pub trait StoresServerSessions: Send + Sync {
    fn generate(&self) -> SessionID;
fn put(&self, id: &SessionID, value: Vec<u8>) -> bool;
fn get(&self, id: &SessionID) -> Option<Vec<u8>>;
fn del(&self, id: &SessionID) -> bool; }

A trait for the ability to generate Session IDs, and store server session data. The keys and values are opaque.

Both the keys and values should be treated as highly sensitive data, containing enough key material to break all security of the corresponding session.

put and del are mutating operations; this isn't expressed in the type system to allow implementations freedom in how to achieve interior mutability. Mutex is a common choice.

Required Methods

Generate a session ID.

Store session secrets encoded in value against key id, overwrites any existing value against id. Returns true if the value was stored.

Find a session with the given id. Return it, or None if it doesn't exist.

Erase a session with the given id. Return true if id existed and was removed.

Implementors