Land first stateful Discord auth slice

This commit is contained in:
Meta Vens 2026-04-26 12:50:07 +01:00
commit cb0041343a
21 changed files with 2479 additions and 188 deletions

View file

@ -23,6 +23,10 @@ What exists right now is:
- Ed25519 JWT signing plus JWKS/discovery exposure
- OAuth start/callback contract surfaces with signed `state`
- app-profile-driven claim issuance for Repixelizer and StreamPixels
- in-memory/Postgres auth-control-plane storage
- persisted accounts, linked identities, sessions, grants, entitlement
snapshots, and audit records
- a real Discord provider callback slice for Repixelizer access
- explicit state/doctrine scaffolding so the plan does not immediately turn into
soup
@ -54,6 +58,7 @@ Goals:
- define OAuth start/callback/link surfaces
- define grant and entitlement persistence boundaries
- define how app backends verify claims locally
This is now the next missing seam, not a hypothetical one.
### 3. Make Repixelizer the first auth-blank consumer
@ -94,8 +99,8 @@ Landed in the first pass:
Still to do in this phase:
- durable grant / entitlement / audit record shapes
- persistence-backed account and linked-identity schema details
- production-safe signing key persistence
- token custody hardening instead of plain placeholder storage
### Phase 2: Heimdall service skeleton
@ -108,16 +113,16 @@ Landed in the first pass:
Next in this phase:
- account / linked-identity persistence
- provider token exchange and refresh
- audit logging
- provider refresh/revocation flows
- non-ephemeral signing key handling
- token encryption at rest
### Phase 3: Repixelizer binding
- integrate Heimdall into the hosted demo
- gate `POST /api/jobs`
- gate per-job read/cancel/event routes by local session ownership
- land a small verifier seam so Repixelizer can trust Heimdall JWTs locally
### Phase 4: StreamPixels authority migration

View file

@ -1,10 +1,10 @@
# Heimdall Service Contract
This file describes the first landed Heimdall service skeleton.
This file describes the first landed Heimdall service slice.
It is the concrete HTTP/JWKS contract that now exists in the repo. It is not a
claim that provider token exchange, persistence, or app bindings are fully
implemented yet.
claim that every provider, consumer binding, or production-hardening concern is
done yet.
## Current stack
@ -28,6 +28,7 @@ Response:
"ok": true,
"service": "heimdall",
"issuer": "https://heimdall.gamecult.org",
"storageBackend": "memory",
"now": "2026-04-26T12:00:00.000Z"
}
```
@ -157,11 +158,15 @@ Current status:
- validates signed `state`
- returns provider errors cleanly
- returns `501 token_exchange_not_implemented` after successful state/code
validation
That is deliberate. The contract is landed; provider token exchange and account
persistence are next.
- for Discord, exchanges the authorization code, resolves the provider
identity, persists the local account/link/session/audit records, evaluates
Repixelizer entitlement facts, and issues a signed Heimdall access claim
- for browser-style callers, redirects back to `returnTo` with a fragment
carrying status and the issued access token
- for non-browser callers, returns JSON with the issued claim, session, account
summary, token metadata, and entitlement result
- other configured providers still return "not implemented" at the runtime
adapter layer until their callback paths are added
### `POST /v1/apps/{appSlug}/claims/issue`
@ -254,19 +259,17 @@ Examples:
The following are not landed yet:
- provider token exchange on callback
- durable account/session/grant storage
- linked-identity persistence
- entitlement snapshot persistence
- non-ephemeral signing key handling
- actual token encryption at rest and secret-management policy
- refresh/revocation flows
- app-facing middleware packages or reference verifiers
- admin/grant management surfaces
## Next implementation move
Build durable storage plus the first real provider path on top of this
skeleton:
Build the first consumer seam and harden the custody story:
- persisted signing key material
- accounts and linked identities
- real callback exchange for one provider slice
- first end-to-end Repixelizer binding
- real token encryption at rest
- a reference verifier / middleware contract for app backends
- the first Repixelizer consumer binding that trusts Heimdall claims locally