Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Init vault

Joshen Limf52276c17213
diff --git a/packages/ui/src/lib/theme/defaultTheme.ts b/packages/ui/src/lib/theme/defaultTheme.ts
index e14706669f2..de5dc6a4984 100644
--- a/packages/ui/src/lib/theme/defaultTheme.ts
+++ b/packages/ui/src/lib/theme/defaultTheme.ts
@@ -1111,7 +1111,7 @@ export default {
},
},
description: {
- base: 'mt-2 text-scale-900',
+ base: 'mt-2 text-scale-900 leading-normal',
size: {
...defaults.size.text,
},
diff --git a/studio/components/interfaces/Auth/index.tsx b/studio/components/interfaces/Auth/index.tsx
index 47547d1131f..b911335c567 100644
--- a/studio/components/interfaces/Auth/index.tsx
+++ b/studio/components/interfaces/Auth/index.tsx
@@ -1,7 +1,8 @@
import AuthProvidersForm from './AuthProvidersForm/AuthProvidersForm'
+import AutoSchemaForm from './AutoSchemaForm'
import EmailTemplates from './EmailTemplates/EmailTemplates'
import SmtpForm from './SmtpForm/SmtpForm'
import Users from './Users'
-export { Users, AuthProvidersForm, EmailTemplates, SmtpForm }
+export { Users, AuthProvidersForm, AutoSchemaForm, EmailTemplates, SmtpForm }
diff --git a/studio/components/interfaces/Settings/API/ServiceList.tsx b/studio/components/interfaces/Settings/API/ServiceList.tsx
index f1dcce06dca..aba88820aac 100644
--- a/studio/components/interfaces/Settings/API/ServiceList.tsx
+++ b/studio/components/interfaces/Settings/API/ServiceList.tsx
@@ -60,46 +60,44 @@ const ServiceList: FC<Props> = ({ projectRef }) => {
const apiConfig = apiService?.app_config
return (
- <>
- <div className="">
- <h3 className="text-scale-1200 mb-6 text-xl">API Settings</h3>
- <section>
- <Panel title={<h5 className="mb-0">Project URL</h5>}>
- <Panel.Content>
- {isError ? (
- <div className="flex items-center justify-center space-x-2 py-4">
- <IconAlertCircle size={16} strokeWidth={1.5} />
- <p className="text-sm text-scale-1100">Failed to retrieve project URL</p>
- </div>
- ) : (
- <Input
- copy
- label="URL"
- readOnly
- disabled
- className="input-mono"
- value={`https://${apiConfig?.endpoint ?? '-'}`}
- descriptionText="A RESTful endpoint for querying and managing your database."
- layout="horizontal"
- />
- )}
- </Panel.Content>
- </Panel>
- </section>
+ <div>
+ <h3 className="text-scale-1200 mb-6 text-xl">API Settings</h3>
+ <section>
+ <Panel title={<h5 className="mb-0">Project URL</h5>}>
+ <Panel.Content>
+ {isError ? (
+ <div className="flex items-center justify-center space-x-2 py-4">
+ <IconAlertCircle size={16} strokeWidth={1.5} />
+ <p className="text-sm text-scale-1100">Failed to retrieve project URL</p>
+ </div>
+ ) : (
+ <Input
+ copy
+ label="URL"
+ readOnly
+ disabled
+ className="input-mono"
+ value={`https://${apiConfig?.endpoint ?? '-'}`}
+ descriptionText="A RESTful endpoint for querying and managing your database."
+ layout="horizontal"
+ />
+ )}
+ </Panel.Content>
+ </Panel>
+ </section>
- <section>
- <DisplayApiSettings key="DisplayAPISettings" />
- </section>
+ <section>
+ <DisplayApiSettings key="DisplayAPISettings" />
+ </section>
- <section>
- <JWTSettings />
- </section>
+ <section>
+ <JWTSettings />
+ </section>
- <section>
- <PostgrestConfig />
- </section>
- </div>
- </>
+ <section>
+ <PostgrestConfig />
+ </section>
+ </div>
)
}
diff --git a/studio/components/interfaces/Settings/General/Vault.tsx b/studio/components/interfaces/Settings/General/Vault.tsx
new file mode 100644
index 00000000000..fec266b5773
--- /dev/null
+++ b/studio/components/interfaces/Settings/General/Vault.tsx
@@ -0,0 +1,102 @@
+import { FC } from 'react'
+import { Form, Button, Toggle, IconExternalLink, Alert, IconHelpCircle, IconAlertCircle } from 'ui'
+
+import {
+ FormHeader,
+ FormPanel,
+ FormActions,
+ FormSection,
+ FormSectionContent,
+} from 'components/ui/Forms'
+import { PermissionAction } from '@supabase/shared-types/out/constants'
+import { checkPermissions } from 'hooks'
+import InformationBox from 'components/ui/InformationBox'
+
+interface Props {}
+
+const Vault: FC<Props> = () => {
+ const formId = 'project-vault-settings'
+ const canToggleVault = checkPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'extensions')
+
+ const initialValues = { enabled: true }
+
+ const onSubmit = async (values: any, { setSubmitting, resetForm }: any) => {}
+
+ return (
+ <Form id={formId} initialValues={initialValues} onSubmit={onSubmit}>
+ {({ isSubmitting, handleReset, values, initialValues }: any) => {
+ const hasChanges = JSON.stringify(values) !== JSON.stringify(initialValues)
+ return (
+ <>
+ <FormHeader
+ title="Vault"
+ description="Enable application level encryption for your project"
+ />
+
+ <FormPanel
+ disabled={!canToggleVault}
+ footer={
+ <div className="flex py-4 px-8">
+ <Button type="default" icon={<IconExternalLink />}>
+ What is Supabase Vault?
+ </Button>
+ <FormActions
+ form={formId}
+ isSubmitting={isSubmitting}
+ hasChanges={hasChanges}
+ handleReset={handleReset}
+ helper={
+ !canToggleVault
+ ? 'You need additional permissions to toggle Vault for this project'
+ : undefined
+ }
+ />
+ </div>
+ }
+ >
+ <FormSection>
+ <FormSectionContent fullWidth loading={false}>
+ <Toggle
+ id="enabled"
+ size="small"
+ layout="flex"
+ label="Enable Supabase Vault"
+ descriptionText="Vault provides secret management and data encryption for your project"
+ disabled={!canToggleVault}
+ />
+ {hasChanges && (
+ <>
+ {values.enabled ? (
+ <InformationBox
+ defaultVisibility
+ hideCollapse
+ icon={<IconAlertCircle strokeWidth={2} />}
+ title="Enabling Vault for your project"
+ description={
+ <div>
+ <p className="text-sm">
+ A new schema <code>vault</code> will be created in your database,
+ where you will be able to manage your secrets.
+ </p>
+ </div>
+ }
+ />
+ ) : (
+ <Alert withIcon variant="warning" title="Disabling Vault for your project">
+ The schema <code>vault</code> will be removed from your database and
+ [highlight other side effects]
+ </Alert>
+ )}
+ </>
+ )}
+ </FormSectionContent>
+ </FormSection>
+ </FormPanel>
+ </>
+ )
+ }}
+ </Form>
+ )
+}
+
+export default Vault
diff --git a/studio/components/interfaces/Settings/General/index.ts b/studio/components/interfaces/Settings/General/index.ts
index 108fd79d1a7..8502444ce42 100644
--- a/studio/components/interfaces/Settings/General/index.ts
+++ b/studio/components/interfaces/Settings/General/index.ts
@@ -1,6 +1,7 @@
import General from './General'
+import Vault from './Vault'
import Infrastructure from './Infrastructure/Infrastructure'
import DeleteProjectPanel from './DeleteProjectPanel/DeleteProjectPanel'
import DeleteProjectButton from './DeleteProjectPanel/DeleteProjectButton'
-export { General, Infrastructure, DeleteProjectPanel, DeleteProjectButton }
+export { General, Vault, Infrastructure, DeleteProjectPanel, DeleteProjectButton }
diff --git a/studio/pages/project/[ref]/settings/api.tsx b/studio/pages/project/[ref]/settings/api.tsx
index 15224b86f1e..df4f44df3a0 100644
--- a/studio/pages/project/[ref]/settings/api.tsx
+++ b/studio/pages/project/[ref]/settings/api.tsx
@@ -38,7 +38,7 @@ const ApiSettings: NextPageWithLayout = () => {
return (
<PageContext.Provider value={PageState}>
- <div className="1xl:px-28 mx-auto flex flex-col gap-4 px-5 py-6 lg:px-16 xl:px-24 2xl:px-32">
+ <div className="1xl:px-28 mx-auto flex flex-col gap-8 px-5 py-6 lg:px-16 xl:px-24 2xl:px-32">
<ServiceList projectRef={ref as string} />
</div>
</PageContext.Provider>
diff --git a/studio/pages/project/[ref]/settings/auth.tsx b/studio/pages/project/[ref]/settings/auth.tsx
index 4ac0f372b80..cd090a2af79 100644
--- a/studio/pages/project/[ref]/settings/auth.tsx
+++ b/studio/pages/project/[ref]/settings/auth.tsx
@@ -4,11 +4,9 @@ import { PermissionAction } from '@supabase/shared-types/out/constants'
import { NextPageWithLayout } from 'types'
import { checkPermissions, useStore } from 'hooks'
-import AutoSchemaForm from 'components/interfaces/Auth/AutoSchemaForm'
import { SettingsLayout } from 'components/layouts'
-import { FormsContainer } from 'components/ui/Forms'
import NoPermission from 'components/ui/NoPermission'
-import { SmtpForm } from 'components/interfaces'
+import { SmtpForm, AutoSchemaForm } from 'components/interfaces/Auth'
const PageLayout: NextPageWithLayout = () => {
const { ui, authConfig } = useStore()
@@ -23,7 +21,7 @@ const PageLayout: NextPageWithLayout = () => {
return <NoPermission isFullPage resourceText="access your project's authentication settings" />
} else if (authConfig) {
return (
- <div className="1xl:px-28 mx-auto flex flex-col gap-4 px-5 py-6 lg:px-16 xl:px-24 2xl:px-32">
+ <div className="1xl:px-28 mx-auto flex flex-col gap-8 px-5 py-6 lg:px-16 xl:px-24 2xl:px-32">
<AutoSchemaForm />
<SmtpForm />
</div>
diff --git a/studio/pages/project/[ref]/settings/general.tsx b/studio/pages/project/[ref]/settings/general.tsx
index 63f43cd3ca1..697f85f6575 100644
--- a/studio/pages/project/[ref]/settings/general.tsx
+++ b/studio/pages/project/[ref]/settings/general.tsx
@@ -1,13 +1,19 @@
import { observer } from 'mobx-react-lite'
import { NextPageWithLayout } from 'types'
import { SettingsLayout } from 'components/layouts'
-import { General, Infrastructure, DeleteProjectPanel } from 'components/interfaces/Settings/General'
+import {
+ General,
+ Infrastructure,
+ Vault,
+ DeleteProjectPanel,
+} from 'components/interfaces/Settings/General'
const ProjectSettings: NextPageWithLayout = () => {
return (
<div className="1xl:px-28 mx-auto flex flex-col gap-8 px-5 py-6 lg:px-16 xl:px-24 2xl:px-32 ">
<General />
<Infrastructure />
+ <Vault />
<DeleteProjectPanel />
</div>
)