add playersettings, img, more match endpoints

This commit is contained in:
Devin Zuczek
2026-06-12 17:15:18 -04:00
parent 4a97e05866
commit 4d1ea9fe3e
42 changed files with 21397 additions and 2538 deletions
+6 -6
View File
@@ -6,12 +6,12 @@ stubbed for now — no real KV/D1/DO bindings yet.
## Routes
| Method | Path | Description |
| ------ | --------------------------------------------- | -------------------------------------------- |
| GET | `/eac/challenge` | EAC challenge, served as text |
| GET | `/cachedlogin/forplatformid/:platform/:id` | Cached logins (stubbed → `[]`) |
| POST | `/connect/token` | OAuth token endpoint, issues a JWT |
| GET | `/role/developer/:id` | Developer role lookup (TODO) |
| Method | Path | Description |
| ------ | ------------------------------------------ | ---------------------------------- |
| GET | `/eac/challenge` | EAC challenge, served as text |
| GET | `/cachedlogin/forplatformid/:platform/:id` | Cached logins (stubbed → `[]`) |
| POST | `/connect/token` | OAuth token endpoint, issues a JWT |
| GET | `/role/developer/:id` | Developer role lookup (TODO) |
## Notes / TODO
+8 -15
View File
@@ -1,18 +1,11 @@
import { Hono } from 'hono';
import { useWorkersLogger } from 'workers-tagged-logger';
import { Hono } from 'hono'
import { useWorkersLogger } from 'workers-tagged-logger'
import { logger, withNotFound, withOnError } from '@repo/hono-helpers'
import { generateToken, TOKEN_TTL_SECONDS } from './jwt'
import { logger, withNotFound, withOnError } from '@repo/hono-helpers';
import { generateToken, TOKEN_TTL_SECONDS } from './jwt';
import type { App } from './context';
import type { App } from './context'
/** OAuth scopes granted by `/connect/token`. */
const TOKEN_SCOPE =
@@ -44,9 +37,9 @@ const app = new Hono<App>()
{
accountId: 1,
platform: '0',
'platformId': '0',
'lastLoginTime': '2026-06-10T00:00:00Z',
'requirePassword': false
platformId: '0',
lastLoginTime: '2026-06-10T00:00:00Z',
requirePassword: false,
},
])
})
+1 -2
View File
@@ -10,8 +10,7 @@ const DEV_SECRET = 'dev-insecure-signing-key-change-me'
export const TOKEN_TTL_SECONDS = 3600
function base64url(input: ArrayBuffer | string): string {
const bytes =
typeof input === 'string' ? new TextEncoder().encode(input) : new Uint8Array(input)
const bytes = typeof input === 'string' ? new TextEncoder().encode(input) : new Uint8Array(input)
let binary = ''
for (const byte of bytes) {
binary += String.fromCharCode(byte)
+5 -1
View File
@@ -26,7 +26,11 @@ describe('auth worker routes', () => {
body: 'account_id=42&platform_id=steam-123',
})
expect(res.status).toBe(200)
const json = (await res.json()) as { access_token: string; token_type: string; expires_in: number }
const json = (await res.json()) as {
access_token: string
token_type: string
expires_in: number
}
expect(json.token_type).toBe('Bearer')
expect(json.expires_in).toBe(3600)
// header.payload.signature