signing-keys.ts31 lines · main
1import { components } from 'api-types'
2
3import { assertSelfHosted } from './util'
4
5type SigningKeyResponse = components['schemas']['SigningKeyResponse']
6
7const LEGACY_KEY_ID = '00000000-0000-0000-0000-000000000000'
8const LEGACY_KEY_CREATED_AT = '1970-01-01T00:00:00.000Z'
9
10/**
11 * Returns a synthetic legacy signing key entry representing the symmetric
12 * `AUTH_JWT_SECRET` so the Legacy JWT Secret page can render with the
13 * "secret has been migrated" state on self-hosted.
14 *
15 * The asymmetric signing-key lifecycle (create/rotate/revoke) is not
16 * supported here — those endpoints remain unmocked, and the JWT Signing
17 * Keys page renders a docs-pointing admonition instead of a table.
18 *
19 * _Only call this from server-side self-hosted code._
20 */
21export function getLegacySigningKey(): SigningKeyResponse {
22 assertSelfHosted()
23
24 return {
25 id: LEGACY_KEY_ID,
26 algorithm: 'HS256',
27 status: 'in_use',
28 created_at: LEGACY_KEY_CREATED_AT,
29 updated_at: LEGACY_KEY_CREATED_AT,
30 }
31}