Skip to main content

Crate topcoat_session

Crate topcoat_session 

Source

Modules§

cookiecookie

Structs§

OriginLayerrouter
A router layer that rejects state-changing cross-origin requests, as a defense against cross-site request forgery (CSRF).
Rotation
The outcome of rotate: the replacement session and the hash it replaces.
Session
A session as the application should record it, returned by start, refresh, and rotate.
SessionConfig
Session configuration, registered on the app context (with the router’s sessions extension method).
SessionConfigBuilder
Assembles a SessionConfig. Created with SessionConfig::builder.
SessionLayerrouter
A router layer that makes the session state available for the current request.
SessionState
The request-scoped session cell, registered on the request context by the session layer (or manually via CxTestBuilder in tests).
Token
A session token: 32 bytes of cryptographically secure randomness, held by the client as its proof of a session.
TokenHash
The SHA-256 hash of a Token, identifying a session.

Enums§

DecodeError
The reason a Token::decode call rejected its input.

Constants§

DEFAULT_LIFETIME
How long a session lives without being refreshed, unless overridden with SessionConfigBuilder::lifetime: 30 days.

Traits§

RouterBuilderSessionExtrouter
Installs session support on a RouterBuilder.
TokenStore
The client-side transport for the session token.

Functions§

refresh
Extends the current session’s lifetime without changing its token.
rotate
Replaces the current session’s token with a fresh one.
start
Starts a new session, issuing a fresh token to the client.
stop
Stops the current session, instructing the client to discard its token.
token_hash
Returns the hash identifying the current request’s session, or None when the request carries no (valid) token.
verify_originrouter
Verifies that the current request is not a cross-site request forgery (CSRF).

Type Aliases§

TokenStoreFuture
The future returned by TokenStore methods: a boxed, Send future borrowing the store and the request context.