Features
Time-Based Rolling
Keys auto-expire based on configurable cadence (hourly to daily)
Offline Capable
No key server needed - derive from public info + secret
No Revocation
Keys expire naturally - nothing to revoke
Rainbow Resistant
LTHN hash prevents precomputation attacks
Installation
import "github.com/Snider/Enchantrix/pkg/crypt"
// Time-based key derivation
key := crypt.DeriveStreamKey(secret, contentID, time.Now())
Usage
Key Rolling
Secret: "artist-master-key"
Content: "album-001"
Time: 2026-01-20T14:00:00Z
Cadence: hourly
Key = LTHN(secret + content + "2026-01-20T14")
At 15:00:
Key = LTHN(secret + content + "2026-01-20T15")
Old key automatically invalid. No revocation needed.
Use Case: Streaming
Subscriber has the secret. Content is encrypted with time-based keys. Subscription ends → subscriber no longer has current secret → can't derive current keys → content inaccessible.
Quick Links
More from Lethean R&D Labs
Fancy helping out?
Spotted a bug? Got an idea? We'd love to hear from you.
Read the contributing guide →