Expand description
Opaque session tokens and their stored hashes.
A token is 32 bytes from the OS RNG, encoded as 43 characters of unpadded base64url. Nothing else is encoded in it. Only the SHA-256 of the token is ever stored, so a database leak does not leak usable cookies.
Structs§
- Session
Token - A freshly issued session token. The value is wiped from memory on drop and redacted from
Debugoutput. - Token
Hash - SHA-256 of a token. Comparison is constant-time.
Constants§
- TOKEN_
LEN - Length of an encoded token in characters.
Functions§
- is_
well_ formed - Whether
valuehas the shape of a token we issue: exactly 43 base64url characters.