Documentation
¶
Overview ¶
Package cache provides rate limiting, cooldown, and failure-policy abstractions for Email OTP.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCacheCheckFailed = errors.New("cache: security check failed")
ErrCacheCheckFailed is returned when an operation is rejected due to a cache failure under FailClosed.
Functions ¶
func HashIdentifier ¶
HashIdentifier produces an opaque hex hash of the identifier to avoid storing plaintext emails in cache keys.
Types ¶
type FailurePolicy ¶
type FailurePolicy string
FailurePolicy defines how cache failures (timeouts, partition, downtime) are handled for security controls.
const ( // FailOpen allows requests to proceed when cache operations fail, prioritizing availability. FailOpen FailurePolicy = "fail_open" // FailClosed denies requests when cache operations fail, prioritizing abuse protection. FailClosed FailurePolicy = "fail_closed" )
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter manages rate limiting and cooldown state, utilizing Core Cache when available.
func NewLimiter ¶
NewLimiter constructs a Limiter instance.
Click to show internal directories.
Click to hide internal directories.