KemalIdentity::RandomSource
The only source of randomness in the shard.
Injected rather than called directly so that token generation is reproducible under
test. src/CLAUDE.md bans Random::Secure everywhere in src/ except
SecureRandomSource below; spec/unit/source_hygiene_spec.cr enforces that ban.
Constants
Minimum entropy for any secret this shard hands to a browser. Session tokens,
remember-me tokens and action tokens all use at least this many bytes
(docs/02-security-model.md, token discipline rule 1).
Class methods
Instance methods
A URL-safe secret of count random bytes, base64url encoded without padding.
Padding is stripped so the value carries no =, which keeps it safe in a cookie
value and in a URL without further escaping, and keeps its length fixed — the shape
check on the hot path is an exact length comparison, performed before any hashing or
I/O.