signing-keys.ts 999 B

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