Skip to content

std::http::session

Status: experimental

Signed-cookie session store with pluggable backend trait.

API details and source

The implementation source contains the complete declarations and implementation notes. The table below lists canonical Gossamer call signatures; every item name links directly to its implementation file.

Item Canonical signature or declaration Description
SerializationMode type SerializationMode Session payload encoding: Json or Bincode.
Session type Session Per-request session view; mutations persist on response.
SessionConfig type SessionConfig Cookie name, domain, signing key, serialization mode.
SessionStore trait SessionStore Backend interface: load / save / delete by session id.
SignedCookieStore type SignedCookieStore Cookie-backed store with HMAC signature; no server state.
sign fn sign(value: String, secret: Vec<u8>) -> String Sign session data into a tamper-evident cookie value.
verify fn verify(value: String, secret: Vec<u8>) -> Result<String, errors::Error> Verify and decode a signed session cookie value.
with_session fn with_session(request: http::Request, secret: String) -> Result<http::Request, errors::Error> Run a closure with the session bound; persist any mutations.