Work
Steam + Discord account linking with launcher-verified unlocks for an indie game
Summary
The Great Circle is an indie game with a Windows desktop launcher. Supporters and testers earn unlocks through Discord roles, and those unlocks are launcher-verified, with no secrets on the player's PC. The current launcher, through v1.2.0 (Nov 15, 2026), proves the player's Steam identity, checks Steam ownership, links Discord through OAuth, and receives a short-lived Ed25519-signed entitlement. It also ships auto-update and Patreon-tier test-branch codes. The launcher verifies that token. The game-side check is in progress. The opt-in bug-report pipeline and developer gating shipped in v1.2.0.
The problem
- Unlocks live in Discord roles, but the game runs through Steam. The two accounts need a reliable link.
- Anything in the client can be extracted, so it may hold only a public key.
- The game can't depend on a server at launch.
- One unlock shouldn't spread across many Steam accounts.
- Logs and crash dumps help with bugs but contain usernames, Steam IDs, and paths.
Architecture
How the flow works
- Steam identity. The launcher sends an identity-scoped Steam auth ticket to the account service. The service checks the input format and an allow-list of the game's app IDs, then validates the ticket with Steam. It issues a random session token, stores only its SHA-256 hash, and expires it after 24 hours.
- Discord link. The system browser opens Discord OAuth. A one-time
statevalue (10-minute lifetime, consumed atomically) blocks CSRF and replay. OAuth tokens are encrypted at rest with AES-256-GCM, using a random IV per value. - Entitlements. Roles are re-fetched when they're older than 10 minutes. If Discord is down, cached roles are served for up to 24 hours. A config module maps roles to entitlements (supporter tiers, developer, test-branch access), and the highest tier wins.
- Signing. The token is
base64url(payload).base64url(signature). The payload holds a version, the Steam ID, the entitlements, the issue time and a 7-day expiry. The Ed25519 private key exists only as a server secret. - Launcher verification. The launcher verifies the token against an embedded public key and saves it per user: valid signature, unexpired, and a Steam ID that matches the running user. The game-side check is in progress. The game does not verify the token today.
- Developer gating shipped in v1.2.0. It requires the
developerentitlement on a token fetched live within the last 15 minutes. A cached token does not unlock the tools. - Test-branch details ship in the current launcher, through v1.2.0. They come from an authenticated,
no-storeendpoint. They never appear in the token, on disk or in logs, and tests assert that.
One Discord account links to one Steam account, so re-linking moves the unlock and blocks code sharing.
Opt-in bug-report pipeline
Shipped in launcher v1.2.0 (Nov 15, 2026). The pipeline works as follows.
- Opt-in. The player sees a preview of the files and their size. Nothing leaves the PC until they click Send.
- Allow-list. The launcher collects the newest game log, the newest crash files, an optional screenshot (max 8 MB) and optional system info. It never collects config files, tokens or the clipboard.
- Scrubbed on the PC. The Windows username becomes
<user>in every path form, and Steam IDs become[steam]. The zip is capped at 25 MB. - Validation. The intake accepts multipart POST only and checks the size before parsing. It validates the category, the description length, and the file magic bytes. Webhook URLs are stripped from the text.
- Rate limits. Each install gets 5 reports per UTC day and each IP gets 20, with HTTP 429 and
Retry-Afterpast that. Only a hash of a random install ID is sent. IPs are hashed with a daily-rotating salt, and raw IPs are never stored or logged. Counters sit in KV with a TTL. - Private storage, 90-day retention. A lifecycle rule deletes reports after 90 days, and a daily purge backs it up. Partial writes roll back.
- Neutralised notice. A private staff channel gets the report ID, category, build and the first 200 characters of the description, with all mentions disabled. If the notice fails, the report is kept.
Threat model summary
| Threat | Mitigation | Residual risk (honest) |
|---|---|---|
| ThreatForged or edited unlock | MitigationThe launcher verifies the Ed25519 signature. Only the public key ships. The game-side check is in progress | Residual risk (honest)Someone who patches the launcher can skip its check. The game does not verify the token yet |
| ThreatToken copied to another PC | MitigationToken is bound to the Steam ID and expires in 7 days | Residual risk (honest)Works for up to 7 days on the same Steam account |
| ThreatCode sharing across accounts | MitigationOne Discord account ↔ one Steam account. Re-linking moves the unlock | Residual risk (honest)A determined group could rotate a link by hand |
| ThreatServer database leak | MitigationSessions stored hashed. OAuth tokens encrypted with AES-256-GCM | Residual risk (honest)Link records (Steam to Discord) would be exposed |
| ThreatStale roles after a supporter leaves | MitigationRoles refreshed every 10 minutes. Tokens last 7 days | Residual risk (honest)Access can outlive a role change by up to 7 days |
| ThreatBug-report spam (shipped in v1.2.0) | MitigationPer-install and per-IP daily limits, size caps, magic-byte checks | Residual risk (honest)Many installs or IPs together can still send volume |
| ThreatPersonal data in reports (shipped in v1.2.0) | MitigationOpt-in, allow-list, scrubbing on the PC, no raw IPs, 90-day deletion | Residual risk (honest)Scrubbing is tested on fixtures, not yet on a broad set of real game logs |
| ThreatMalicious content in the launcher UI | MitigationSandboxed renderer, context isolation, allow-listed bridge | Residual risk (honest)Depends on keeping Electron current |
How it's tested
Launcher CI is green on Ubuntu and Windows. The account service is tested locally. The bug-report and developer-gating suites cover code that shipped in launcher v1.2.0. The 37 account-service tests below are not part of the 105 total.
| Suite | What it covers | Count | Last run |
|---|---|---|---|
| SuiteLauncher unit tests | What it coversReport collection, scrubbing, developer gating | Count32 | Last runOct 26, Linux: all pass* |
| SuiteSelf-test script | What it coversLauncher integration self-checks | Count53 checks | Last runOct 26, Linux: all pass |
| SuiteBug-report Worker (vitest, in-memory mocks) | What it coversValidation, storage, rate limits, notice, retention | Count20 | Last runOct 26, Linux: all pass |
| SuiteTotal automated | Count105 | ||
| SuiteElectron smoke test | What it coversBoots the real app and checks the sandboxed bridge and page | Count1 | Last runPass on Linux (virtual display) |
| SuiteAccount service tests (mocked Discord and database) | What it coversTiers, role refresh, no secrets in tokens or logs | Count37 | Last runOct 26, local: all pass |
| SuiteSteam smoke test | What it coversReal Steam client sign-in | CountManual | Last runWindows only, run by hand |
*One test asserts a POSIX file permission and fails on Windows. That's a bug in the test, not the product, and it's being fixed. I also checked the full flow end to end on a test machine with Steam and Discord.
Lessons learned
- Signed tokens beat shared secrets. With only a public key in the client, there's nothing worth stealing, and the token is launcher-verified. The game-side check is in progress.
- Make freshness explicit. Separate lifetimes for sessions, roles, tokens and developer access made each trade-off visible and testable. Developer gating shipped in v1.2.0.
- Test what must never happen. The most valuable tests assert that passwords never reach tokens or logs.
- Fail open where it's harmless. In the bug-report pipeline that shipped in v1.2.0, a bad developer tag or a failed notice never loses a report.
- Cross-platform tests catch test bugs. Launcher CI is green on Ubuntu and Windows.
What's next
- Uploading a player's game summary, the consent screen for that upload, and deleting uploaded data are not in v1.2.0.
- Finish the game-side offline check of signature, expiry, and Steam ID.
- Add an Electron end-to-end smoke test.
- Fix the POSIX-only test on Windows.
- Exercise log scrubbing against more real-world game logs.
- Code-sign the installer to remove the SmartScreen warning.
How this was built
I designed, directed, reviewed and tested this system. AI coding agents wrote most of the code from my specs, in pull requests I reviewed and merged. I set the requirements, chose the architecture and trade-offs, ran the tests, and verified the end-to-end flow on Windows with Steam and Discord. Anything unfinished is listed above.
Links
- The account service is a private repository and is described here only.