Skip to main content

Crate hyperlane_plugin_session

Crate hyperlane_plugin_session 

Source
Expand description

hyperlane-plugin-session

High-concurrency sharded session plugin for Hyperlane with pluggable async SessionStore traits, optional HMAC-SHA256 signed cookies, dirty-tracked zero-write reads, and session-fixation ID regeneration.

Structs§

InMemorySessionStore
High-concurrency 64-way sharded bounded in-memory SessionStore.
SessionConfig
Configuration controlling cookie attributes, signing, TTL, and capacity for SessionPlugin.
SessionHandle
Thread-safe handle stored in Hyperlane Context allowing handlers to read and mutate the active session.
SessionPlugin
Process-wide SessionPlugin singleton storing SessionConfig and a pluggable SessionStore.
SessionRequestHook
Opt-in request middleware loading the incoming session cookie into SessionHandle.
SessionResponseHook
Opt-in response middleware persisting modified/regenerated/destroyed sessions and emitting Set-Cookie.

Constants§

ATTR_SESSION_HANDLE
Context attribute key storing the per-request crate::SessionHandle.
DEFAULT_MAX_SESSIONS
Default maximum active sessions stored in memory.
DEFAULT_SESSION_COOKIE_NAME
Default HTTP session cookie name.
DEFAULT_SESSION_COOKIE_PATH
Default cookie Path attribute.
DEFAULT_SESSION_SAME_SITE
Default cookie SameSite policy.
DEFAULT_SESSION_TTL_SECS
Default session idle TTL in seconds (1 hour).

Traits§

SessionStore
Pluggable asynchronous session backend (in-memory sharded, Redis, PostgreSQL, etc.).

Functions§

generate_session_id
Generates an unpredictable 128-bit lowercase hexadecimal session identifier.
sign_session_cookie
Signs session_id with secret into "<session_id>.<hex_hmac>".
verify_session_cookie
Verifies a signed session cookie value in constant time and returns the underlying session ID.

Type Aliases§

SessionFuture
Boxed Send future returned by async SessionStore trait methods.
SharedSessionStore
Thread-safe shared reference to a pluggable SessionStore.