Documentation
¶
Overview ¶
Package security provides small privacy-preserving primitives shared across Herald: peppered digests for PII that must be used as a stable key/label (rate-limit keys, audit fingerprints) without landing raw email/phone values in Redis or logs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Digester ¶
type Digester struct {
// contains filtered or unexported fields
}
Digester computes stable, non-reversible digests of PII using an HMAC keyed by a server-side pepper. The same input always maps to the same digest (so it is usable as a rate-limit / dedup key) but the raw value cannot be recovered from Redis or exported metrics.
func NewDigester ¶
NewDigester creates a Digester and copies its pepper. A Digester must not be copied after first use. An empty pepper is allowed (it uses HMAC-SHA256 with an empty key) but callers SHOULD supply a non-empty pepper in production; config.Validate enforces this at startup.
func (*Digester) Digest ¶
Digest returns a hex-encoded, peppered digest of the given value. Empty input returns an empty string so callers can distinguish "no value" from a hash of the empty string.
func (*Digester) DigestParts ¶
DigestParts returns a peppered digest over multiple parts with an unambiguous separator so ("a","bc") and ("ab","c") do not collide.