Expand description
Session management for What framework
Provides session storage with pluggable backends:
- SQLite (default, for local development and single-server deployments)
- Cloudflare Workers KV (for globally distributed, durable sessions)
Structs§
- KvSession
Store - Session store backed by Cloudflare Workers KV via REST API
- Session
- Session data structure
- Sqlite
Session Store - Session store backed by SQLite with connection pooling. Uses r2d2 for concurrent reads and spawn_blocking to avoid blocking the async runtime.
Enums§
- Atomic
Mutation - Atomic session mutation operation — used by the server to apply mutations at the SQL level
- Session
Backend - Pluggable session storage backend
Constants§
- CSRF_
TOKEN_ KEY - Reserved session key for the CSRF token
Functions§
- apply_
mutation_ in_ memory - Apply a mutation to in-memory session data (used for KV fallback and testing).
- build_
clear_ session_ cookie - Build a Set-Cookie header that expires the session cookie (used on logout).
- build_
session_ cookie - Build Set-Cookie header value
- generate_
csrf_ token - Generate a cryptographically secure CSRF token Returns 64 hex characters (32 bytes of random data)
- generate_
session_ id - Generate a cryptographically secure session ID Returns 128 hex characters (64 bytes of random data)
- parse_
session_ cookie - Parse session ID from cookie header