HeadyKey is the zero-trust identity layer for the entire Heady ecosystem. JWT sessions, OAuth2 OIDC, RBAC, API key management, Ed25519 trust receipts, and persistent user storage — all φ-scaled.
HS256-signed access tokens with 1-hour expiry. 30-day refresh tokens with 34-byte (fib(9)) entropy. Session cookies httpOnly + Secure + SameSite=Strict.
Four-tier RBAC: admin(4), operator(3), user(2), guest(1). Role enforcement middleware checks minimum level on every protected route.
Generate hdy_ prefixed keys with SHA-256 hashing. Keys are shown once at creation. Revoke, list, and audit through the management API.
23 explicit Heady origins whitelisted. Zero wildcard Access-Control-Allow-Origin. Server-to-server calls (no Origin header) allowed.
Onboarding preferences stored in 384D pgvector memory (user_memory_t2). Buddy configuration, interests, and plan persisted across sessions.
Identity → Interests → Buddy Config → Plan Selection → Completion. Auto-generates API key. Stores preferences in persistent memory tier.
Email/password or OAuth provider
JWT issued + session cookie set
5-stage personalization flow
hdy_ key auto-generated
Full ecosystem access
JWT, HS256 signed, 1-hour expiry. Contains userId, email, role. Passed via Authorization: Bearer header.
34-byte (fib(9)) CSPRNG hex. 30-day TTL. Hash-indexed in PostgreSQL. Exchange for new access token.
__heady_session. 8-hour TTL (fib(6) hours). httpOnly, Secure, SameSite=Strict. LIFO cleanup on logout.
hdy_ prefix. SHA-256 hashed in database. Optional TTL. Validated via X-API-Key header. Timing-safe comparison.