Documentation
¶
Overview ¶
Package ids provides trace IDs and deterministic hashes derived from named request values.
Index ¶
Constants ¶
const AllZeroKeyHash = "0000000000000000"
AllZeroKeyHash is the key_hash for requests with no Authorization/x-api-key header. File names like "data/<date>/00000000.jsonl" come from this.
const KeyHashLen = 16
KeyHashLen is the canonical length of key_hash in SQLite (16 hex chars = 64 bits). File names use only the first 8 chars (key_hash[:8]) for brevity. See ARCHITECTURE § 2 for the full definition.
Variables ¶
This section is empty.
Functions ¶
func KeyHashFromHeaders ¶
KeyHashFromHeaders computes the canonical key_hash for a request's auth headers. Preference order (per ARCHITECTURE § 2):
- Authorization header value (including any "Bearer " prefix)
- x-api-key header value
- empty string → AllZeroKeyHash
The hash is the lowercase hex of sha256 truncated to KeyHashLen chars.
func KeyHashShort ¶
KeyHashShort returns the first 8 hex chars of a key_hash. Used for file naming.
func NewTraceID ¶
func NewTraceID() string
NewTraceID returns a new ULID for the current time using the package entropy source. Safe for concurrent use.
Types ¶
This section is empty.