From 1dc7739ef5f907947f2df57bfc5d151e3c6d65ad Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 2 Dec 2026 23:23:41 +0100 Subject: [PATCH] Docs: ghostlight Google sign-in, app-authenticated starts, begin firstLoginGrant Co-Authored-By: Claude Sonnet 5.5 --- docs/app-profiles/ghostlight.md | 21 +++++++++++++++------ docs/service-contract.md | 18 +++++++++++++----- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/docs/app-profiles/ghostlight.md b/docs/app-profiles/ghostlight.md index 58470f4..38ad159 100644 --- a/docs/app-profiles/ghostlight.md +++ b/docs/app-profiles/ghostlight.md @@ -11,14 +11,23 @@ selection, and every world mutation. - `app_slug`: `ghostlight` - public URL: `https://yggdrasil.gamecult.org/ghostlight/` -- identity provider: Discord -- access rule: Ghostlight supplies its configured KLTST Discord-role policy on - the app-authenticated private boundary; Heimdall evaluates the policy and - grants `app_access` only when it succeeds +- identity providers: Discord and Google +- access rule: Heimdall authenticates; `app_access` is `identity.authenticated`. + Who may play is the Dungeon's account catalog and its one-time invites, not a + Discord role. No Discord role policy is required of begin or refresh, and one + a caller still sends is evaluated by nobody for this app +- starts: every start is app-authenticated (`startRequiresAppCaller`); a public + start without the app secret is `401 app_auth_required` +- first Google sign-in: Google is linked-identity only, so a `sub` no account + holds is refused (`identity_not_linked`) unless the begin carried + `firstLoginGrant: "invite"`, which the Dungeon sends only for an invite its + catalog holds live. The grant mints a Heimdall account for a new `sub`; it + never attaches to or moves an existing account ## Capabilities -- `app_access`: shared capability granting entry to the demo +- `app_access`: shared capability; every authenticated identity has it, and + admission is the Dungeon's catalog - `campaign_play`: hybrid capability; Ghostlight must also prove that the authenticated account owns the selected campaign @@ -27,6 +36,6 @@ plugin stores only an opaque attempt handle. Ghostlight redeems that handle over the encrypted loopback command plane, verifies the resulting `aud=ghostlight` claim against Heimdall JWKS, and establishes app-local campaign authority. Short-lived local access continues without a Heimdall round trip. Scheduled -refresh re-evaluates the Ghostlight-owned KLTST role policy; explicit logout +refresh re-evaluates nothing app-specific; explicit logout revokes both Ghostlight's local session and the matching Heimdall refresh custody record. diff --git a/docs/service-contract.md b/docs/service-contract.md index 2412fbb..e91747e 100644 --- a/docs/service-contract.md +++ b/docs/service-contract.md @@ -187,10 +187,10 @@ Failure modes: the caller did not authenticate as that app via `x-heimdall-app-secret` (`resolveAppCaller`, `src/app-caller.ts`) -- this applies regardless of `handoff.kind` or app slug; a caller with no policy to attach needs no secret, - unless the app's profile sets `startRequiresAppCaller` (Bifrost only): then + unless the app's profile sets `startRequiresAppCaller` (Bifrost and Ghostlight): then every start for that app, with or without a policy, needs that app's secret. - Bifrost binds browser completion to a nonce that rides readable in the signed - state's `return_to`, so only Bifrost may mint a Bifrost state; apps whose + Bifrost and Ghostlight bind browser completion to a nonce that rides readable + in the signed state's `return_to`, so only the app may mint its own state; apps whose browser starts are public by design leave the flag unset - `401 app_auth_required` also when `mode` is `connect` and the body carries a `connection` (a creator or account target): a connection target is app-backend @@ -261,7 +261,7 @@ person an app has invited (see the invite grant below). refused and mints nothing. A `sub` linked to another account is refused and never moved. Both audit as `oauth_callback_failed` with error class `LinkRefusal` and the code `identity_not_linked` or `link_initiator_mismatch`. -- Invite grant. An app whose profile sets `mayGrantFirstLogin` (only `bifrost`) +- Invite grant. An app whose profile sets `mayGrantFirstLogin` (`bifrost` and `ghostlight`) may start `mode: "sign_in"` with `firstLoginGrant: "invite"`, saying it has invited this person. The start must carry that app's own secret: any other caller, including a public start, is `401 app_auth_required`. An app whose @@ -287,7 +287,7 @@ person an app has invited (see the invite grant below). what Discord or Patreon grant. - Configure with `GC_ACCESS_PROVIDER_GOOGLE_CLIENT_ID` and `GC_ACCESS_PROVIDER_GOOGLE_CLIENT_SECRET_FILE`. Admitted to the `bifrost` - app profile only. + and `ghostlight` app profiles only. ### `GET /v1/oauth/{provider}/callback` @@ -1005,6 +1005,14 @@ same result only for the exact same authenticated request; content changes are denied. Completion consumption remains single-use in Heimdall's canonical store. +`heimdall.auth.begin` takes `provider`, `mode`, `returnTo`, an optional +`entitlementPolicy` (accepted for any app, required of none) and an optional +`firstLoginGrant`. Absent or null is no grant; exactly `"invite"` is passed to +the same start gate as the public route (the app's own caller, `sign_in` only, +an app whose profile may grant); any other value is refused before an attempt +is created. Ghostlight sends `"invite"` only for a browser whose invite the +Dungeon's catalog holds live; Heimdall holds no invite records. + Refresh claims are admitted only while their exact persisted session, app/account custody, access revision, and refresh expiry still match. Logout uses the refresh claim as custody proof and atomically advances the persisted