import { createFileRoute } from '@tanstack/react-router' import { IS_PLATFORM, useParams } from 'common' import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader' import { JWTSecretKeysTable } from '@/components/interfaces/JwtSecrets/jwt-secret-keys-table' import JWTKeysLayout from '@/components/layouts/JWTKeys/JWTKeysLayout' import { AlertError } from '@/components/ui/AlertError' import { LocalSetupGuide } from '@/components/ui/LocalSetupGuide' import { NoPermission } from '@/components/ui/NoPermission' import { useDeploymentMode } from '@/hooks/misc/useDeploymentMode' import { DOCS_URL } from '@/lib/constants' import { useGrant } from '@/lib/grants' export const Route = createFileRoute('/project/$ref/settings/jwt/')({ component: SettingsJwtIndexRoute, staticData: { settingsLayoutTitle: 'JWT Keys' }, }) // Inline the JWTKeysLayout wrap here rather than via a `settings/jwt.tsx` // sub-shell — jwt/legacy doesn't use JWTKeysLayout, so a shared // sub-shell would wrap legacy in the wrong layout. function SettingsJwtIndexRoute() { return ( ) } function JWTSigningKeysPage() { const { isCli, isSelfHosted } = useDeploymentMode() const { ref: projectRef } = useParams() const signingKeysGrant = useGrant('GET /v1/projects/{ref}/config/auth/signing-keys', { projectRef, }) if (!IS_PLATFORM) { return (
{isCli && ( The asymmetric key pair used to sign user session JWTs is configured by the Supabase CLI.

} docsHref={`${DOCS_URL}/guides/local-development`} /> )} {isSelfHosted && ( The asymmetric key pair used to sign user session JWTs is configured via environment variables.

} docsHref={`${DOCS_URL}/guides/self-hosting/self-hosted-auth-keys`} /> )}
) } return ( <> {signingKeysGrant.status === 'loading' && } {signingKeysGrant.status === 'denied' && ( )} {signingKeysGrant.status === 'error' && ( )} {signingKeysGrant.status === 'granted' && } ) }