Files
Stojan DimitrovskiandIvan Vasilov 4945ba1861 feat: add asymmetric JWT UI (#36519)
* original files from previous PR

* get rid of router in jwt-secrets to make it show up

* rename jwt-secrets page to jwt-signing-keys

* add jwt-signing-keys query

* add legacy jwt signing keys query

* wire-up JwtSecretKeysTable with queries

* add jwt signing keys page to settings menu

* deduplicate labels, descriptions, etc

* add create, update jwt-signing-key mutations

* update types

* remove unused components, to be refactored later

* make everything into a mostly working state

* legacy migration added

* put jwt keys page like api keys

* fully migrate legacy jwt secret page

* fix prettier

* fix typecheck ts-expect-error

* rm unneeded file

* Fix compile errors.

* Rename the files and move them to the same folder.

* Merge the two constant files.

* Fix the imports.

* Fix a bug in the API keys page when opening it in a new tab.

* Change the page to be at /signing-keys

* Fix some minor types.

* Break apart some of the components in the signing keys UI.

* Use a feature banner for the initial action.

* Make a create key dialog and move functionality there.

* Fix some cosmetic issues.

* Minor cosmetic fixes.

* Remove extra keys in RQ cache.

* Add a missing link

* Add a banner when the feature flag is false.

* Minor type fix.

* more tiny type fix

* fix error on create standby key

* add alert to prevent revoking legacy jwt secret without disabling legacy api keys first

---------

Co-authored-by: Ivan Vasilov <vasilov.ivan@gmail.com>
2025-06-23 09:36:07 +12:00

39 lines
2.0 KiB
TypeScript

import { JwtSecretUpdateError, JwtSecretUpdateProgress } from '@supabase/shared-types/out/events'
import { JWTSigningKey } from 'data/jwt-signing-keys/jwt-signing-keys-query'
export const statusLabels: Record<JWTSigningKey['status'], string> = {
in_use: 'Current key',
standby: 'Standby key',
previously_used: 'Previous key',
revoked: 'Revoked',
}
export const statusColors: Record<JWTSigningKey['status'], string> = {
standby: 'bg-surface-300 bg-opacity-100 text-foreground border border-foreground-muted',
in_use: 'bg-brand-200 bg-opacity-100 text-brand-600 border-brand-500',
previously_used: 'bg-purple-300 dark:bg-purple-100 text-purple-1200 border-purple-800',
revoked: 'bg-destructive-200 bg-opacity-100 text-destructive-600 border-destructive-500',
}
export const JWT_SECRET_UPDATE_ERROR_MESSAGES = {
[JwtSecretUpdateError.APIServicesConfigurationUpdateFailed]:
'failed to update configuration for API services',
[JwtSecretUpdateError.APIServicesRestartFailed]: 'failed to restart API services',
[JwtSecretUpdateError.DatabaseAdminAPIConfigurationUpdateFailed]:
'failed to update configuration for database admin API',
[JwtSecretUpdateError.PostgreSQLRestartFailed]: 'failed to restart PostgreSQL service',
[JwtSecretUpdateError.SupabaseAPIKeyUpdateFailed]: 'failed to update Supabase API key',
[JwtSecretUpdateError.APIGatewayUpdateFailed]: 'failed to update API Gateway',
}
export const JWT_SECRET_UPDATE_PROGRESS_MESSAGES = {
[JwtSecretUpdateProgress.RestartedAPIServices]: 'restarted API services',
[JwtSecretUpdateProgress.RestartedPostgreSQL]: 'restarted PostgreSQL service',
[JwtSecretUpdateProgress.Started]: 'started updating',
[JwtSecretUpdateProgress.UpdatedAPIServicesConfiguration]:
'updated configuration for API services',
[JwtSecretUpdateProgress.UpdatedDatabaseAdminAPIConfiguration]:
'updated configuration for database admin API',
[JwtSecretUpdateProgress.UpdatedAPIGatewayConfiguration]: 'updated configuration for API Gateway',
}