Documentation
¶
Overview ¶
Package token mints high-entropy random tokens and stores their sha256 hashes. The pattern: generate a random token, send it in URLs/emails, store only the hash. A DB dump leaks no usable tokens; lookups remain O(1) via a UNIQUE index on the hash column.
Index ¶
Constants ¶
View Source
const SizeBytes = 32
SizeBytes is the random payload length. 32 bytes (256 bits) is far beyond brute-force budgets for any plausible attacker. base64url-encoded it produces a 43-character ASCII-safe URL fragment.
Variables ¶
This section is empty.
Functions ¶
func Equal ¶
Equal compares two hashes in constant time. Use this instead of bytes.Equal anywhere a comparison's timing could leak information.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.