import { FileHelper, z } from '@start9labs/start-sdk' import { sdk } from '../sdk' /** * `joinSecret` is D14's server-wide secret (`docs/architecture/multiplayer.md` in the game repo): * whoever holds it may create a game, and may join any created game that has not started. The * server refuses to start without one (`src/server/index.ts`), so `joinSecret` is seeded on * install (`init/generateSecrets.ts`) and never left unset. */ const shape = z.object({ joinSecret: z.string().optional().catch(undefined), /** * Gates the server's `/api/games` administration routes, and is deliberately a SECOND secret. * Every player holds `joinSecret`, so gating a delete with it would let anyone at the table * destroy anyone else's game. This one belongs to whoever runs the box; it is never shown to a * player and never leaves this package except as the daemon's `ADMIN_SECRET`. */ adminSecret: z.string().optional().catch(undefined), }) export const storeJson = FileHelper.json( { base: sdk.volumes.data, subpath: 'store.json' }, shape, )