pub trait SessionManager<V: Serialize + DeserializeOwned>: Send + Sync {
// Required methods
fn deserialize(&self, bytes: &[u8]) -> Result<Session<V>, SessionError>;
fn serialize(&self, session: &Session<V>) -> Result<Vec<u8>, SessionError>;
fn is_encrypted(&self) -> bool;
}
Expand description
Base trait that provides session management.
Required Methods§
Sourcefn deserialize(&self, bytes: &[u8]) -> Result<Session<V>, SessionError>
fn deserialize(&self, bytes: &[u8]) -> Result<Session<V>, SessionError>
Given a slice of bytes perform the following options to convert it into a Session
:
- Decrypt (optional)
- Verify signature / MAC
- Parse / deserialize into a
Session
struct
Sourcefn serialize(&self, session: &Session<V>) -> Result<Vec<u8>, SessionError>
fn serialize(&self, session: &Session<V>) -> Result<Vec<u8>, SessionError>
Given a session perform the following options to convert a Session
into bytes:
- Encode / serialize into bytes
- Encrypt (optional)
- Sign / MAC
Sourcefn is_encrypted(&self) -> bool
fn is_encrypted(&self) -> bool
Whether or not the sessions are encrypted.