(path: string)
| 36 | const mintToken = (): string => randomBytes(32).toString("base64url"); |
| 37 | |
| 38 | const readToken = (path: string): string | null => { |
| 39 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: reading an optional on-disk secret file that may be absent or malformed |
| 40 | try { |
| 41 | // oxlint-disable-next-line executor/no-json-parse -- boundary: the secret file is a tiny {"token"} blob outside the Effect graph (used by the plain Bun/Electron boot path) |
| 42 | const parsed = JSON.parse(readFileSync(path, "utf8")) as { readonly token?: unknown }; |
| 43 | return typeof parsed.token === "string" && parsed.token.length > 0 ? parsed.token : null; |
| 44 | } catch { |
| 45 | return null; |
| 46 | } |
| 47 | }; |
| 48 | |
| 49 | const writeToken = (dataDir: string, token: string): string => { |
| 50 | const dir = serverControlDir(dataDir); |
no outgoing calls
no test coverage detected