diff --git a/apps/studio/components/interfaces/Integrations/Landing/Integrations.constants.tsx b/apps/studio/components/interfaces/Integrations/Landing/Integrations.constants.tsx index a642e87976d..528a6438755 100644 --- a/apps/studio/components/interfaces/Integrations/Landing/Integrations.constants.tsx +++ b/apps/studio/components/interfaces/Integrations/Landing/Integrations.constants.tsx @@ -204,16 +204,6 @@ const supabaseIntegrations: IntegrationDefinition[] = [ loading: Loading, } ) - case 'keys': - return dynamic( - () => - import('../Vault/Keys/EncryptionKeysManagement').then( - (mod) => mod.EncryptionKeysManagement - ), - { - loading: Loading, - } - ) case 'secrets': return dynamic( () => import('../Vault/Secrets/SecretsManagement').then((mod) => mod.SecretsManagement), diff --git a/apps/studio/components/interfaces/Integrations/Vault/Keys/EncryptionKeySelector.tsx b/apps/studio/components/interfaces/Integrations/Vault/Keys/EncryptionKeySelector.tsx deleted file mode 100644 index 071eae7ef06..00000000000 --- a/apps/studio/components/interfaces/Integrations/Vault/Keys/EncryptionKeySelector.tsx +++ /dev/null @@ -1,98 +0,0 @@ -import { noop } from 'lodash' -import { Plus } from 'lucide-react' -import { - Input, - SelectContent_Shadcn_, - SelectGroup_Shadcn_, - SelectItem_Shadcn_, - SelectTrigger_Shadcn_, - Select_Shadcn_, -} from 'ui' - -import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext' -import { usePgSodiumKeysQuery } from 'data/pg-sodium-keys/pg-sodium-keys-query' - -interface EncryptionKeySelectorProps { - nameId?: string - label?: string - labelOptional?: string - selectedKeyId?: any - error?: string - onSelectKey: (keyId: string) => void - onUpdateDescription?: (desc: string) => void -} - -const EncryptionKeySelector = ({ - nameId = 'keyName', - label = 'Encryption key', - labelOptional, - selectedKeyId, - error, - onSelectKey = noop, - onUpdateDescription = noop, -}: EncryptionKeySelectorProps) => { - const { project } = useProjectContext() - - const { data } = usePgSodiumKeysQuery({ - projectRef: project?.ref, - connectionString: project?.connectionString, - }) - - const keys = data || [] - - return ( - <> -
- {label && ( -
- - {labelOptional && ( - {labelOptional} - )} -
- )} - - - {keys.find((key) => key.id === selectedKeyId)?.name || 'Select an encryption key'} - - - - - - - Create a new Encryption Key - - - {keys.length > 0 && ( - <> -
- {keys.map((key) => ( - -
-

{key.name || 'No name provided'}

-

- ID: {key.id} -

-
-
- ))} - - )} - - - -
- {selectedKeyId === 'create-new' && ( - onUpdateDescription(event.target.value)} - descriptionText="Provide a name for your key for easier identification" - /> - )} - - ) -} - -export default EncryptionKeySelector diff --git a/apps/studio/components/interfaces/Integrations/Vault/Keys/EncryptionKeysManagement.tsx b/apps/studio/components/interfaces/Integrations/Vault/Keys/EncryptionKeysManagement.tsx deleted file mode 100644 index ef7a070cb40..00000000000 --- a/apps/studio/components/interfaces/Integrations/Vault/Keys/EncryptionKeysManagement.tsx +++ /dev/null @@ -1,310 +0,0 @@ -import { PermissionAction } from '@supabase/shared-types/out/constants' -import dayjs from 'dayjs' -import { sortBy } from 'lodash' -import { Fragment, useEffect, useState } from 'react' -import { toast } from 'sonner' - -import { useParams } from 'common' -import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext' -import { ButtonTooltip } from 'components/ui/ButtonTooltip' -import { DocsButton } from 'components/ui/DocsButton' -import { usePgSodiumKeyCreateMutation } from 'data/pg-sodium-keys/pg-sodium-key-create-mutation' -import { usePgSodiumKeyDeleteMutation } from 'data/pg-sodium-keys/pg-sodium-key-delete-mutation' -import { usePgSodiumKeysQuery } from 'data/pg-sodium-keys/pg-sodium-keys-query' -import { useCheckPermissions } from 'hooks/misc/useCheckPermissions' -import { Key, Loader, Search, Trash, X } from 'lucide-react' -import { Button, Form, Input, Listbox, Modal, Separator } from 'ui' -import { Admonition } from 'ui-patterns' - -const DEFAULT_KEY_NAME = 'No description provided' - -export const EncryptionKeysManagement = () => { - const { search } = useParams() - const { project } = useProjectContext() - - const [searchValue, setSearchValue] = useState('') - const [selectedSort, setSelectedSort] = useState<'name' | 'created'>('created') - const [showAddKeyModal, setShowAddKeyModal] = useState(false) - const [selectedKeyToRemove, setSelectedKeyToRemove] = useState() - const canManageKeys = useCheckPermissions(PermissionAction.TENANT_SQL_ADMIN_WRITE, 'tables') - - useEffect(() => { - if (search !== undefined) setSearchValue(search) - }, [search]) - - const { data, isLoading } = usePgSodiumKeysQuery({ - projectRef: project?.ref, - connectionString: project?.connectionString, - }) - const { mutate: addKeyMutation, isLoading: isCreating } = usePgSodiumKeyCreateMutation({ - onSuccess: () => { - toast.success('Successfully added new key') - setShowAddKeyModal(false) - }, - }) - const { mutate: deleteKeyMutation, isLoading: isDeleting } = usePgSodiumKeyDeleteMutation({ - onSuccess: () => { - toast.success(`Successfully deleted encryption key`) - setSelectedKeyToRemove(undefined) - }, - }) - - const allKeys = data || [] - const keys = sortBy( - searchValue - ? allKeys.filter( - (key) => - (key?.name ?? '').toLowerCase().includes(searchValue.toLowerCase()) || - key.id.toLowerCase().includes(searchValue.toLowerCase()) - ) - : allKeys, - (k) => { - if (selectedSort === 'created') { - return Number(new Date(k.created)) - } else { - return k[selectedSort] - } - } - ) - - const addKey = async (values: any, { setSubmitting }: any) => { - if (!project) return console.error('Project is required') - - addKeyMutation({ - projectRef: project.ref, - connectionString: project.connectionString, - name: values.name, - }) - } - - const confirmDeleteKey = async () => { - if (!selectedKeyToRemove) return - if (!project) return console.error('Project is required') - - deleteKeyMutation({ - projectRef: project.ref, - connectionString: project.connectionString, - id: selectedKeyToRemove.id, - }) - } - - return ( - <> -
-
-
- setSearchValue(event.target.value)} - icon={} - actions={ - searchValue.length > 0 - ? [ -
-
- - setShowAddKeyModal(true)} - tooltip={{ - content: { - side: 'bottom', - text: !canManageKeys ? 'You need additional permissions to add keys' : undefined, - }, - }} - > - Add new key - -
-
- - {/* Table of keys */} -
- {isLoading ? ( -
- -

Loading keys from the Vault

-
- ) : ( - <> - {keys.map((key, idx) => { - return ( - -
- -
-

- {key.name || DEFAULT_KEY_NAME} -

-

- ID: {key.id} -

-
-
-

- Added on {dayjs(key.created).format('MMM D, YYYY')} -

- } - disabled={!canManageKeys} - onClick={() => setSelectedKeyToRemove(key)} - tooltip={{ - content: { - side: 'bottom', - text: !canManageKeys - ? 'You need additional permissions to delete keys' - : undefined, - }, - }} - /> -
-
- {idx !== keys.length - 1 && } -
- ) - })} - {keys.length === 0 && ( - <> - {searchValue.length === 0 ? ( -
-

No encryption keys added yet

-

- Encryption keys are created by the pgsodium extension and can be used to - encrypt your columns and secrets -

-
- ) : ( -
-

No results found

-

- Your search for "{searchValue}" did not return any results -

-
- )} - - )} - - )} -
-
- - setSelectedKeyToRemove(undefined)} - onConfirm={confirmDeleteKey} - loading={isDeleting} - header="Confirm to delete key" - > - - -

- The following key will be permanently removed and cannot be recovered. -

-
-

- {selectedKeyToRemove?.name ?? DEFAULT_KEY_NAME} -

-

- ID: {selectedKeyToRemove?.id} -

-
-
-
- - setShowAddKeyModal(false)} - header="Add a new key" - > -
{ - const errors: any = {} - if (values.name.length === 0) errors.name = 'Please provide a name for your key' - return errors - }} - onSubmit={addKey} - > - {() => { - return ( - <> - -

Provide a name for your key for easier identification.

- -
- - - - - - - ) - }} - -
- - ) -} diff --git a/apps/studio/components/interfaces/Integrations/Vault/Secrets/AddNewSecretModal.tsx b/apps/studio/components/interfaces/Integrations/Vault/Secrets/AddNewSecretModal.tsx index 2337b5b9ffb..0f9996d60da 100644 --- a/apps/studio/components/interfaces/Integrations/Vault/Secrets/AddNewSecretModal.tsx +++ b/apps/studio/components/interfaces/Integrations/Vault/Secrets/AddNewSecretModal.tsx @@ -4,12 +4,9 @@ import { toast } from 'sonner' import { useProjectContext } from 'components/layouts/ProjectLayout/ProjectContext' import InformationBox from 'components/ui/InformationBox' import { GenericSkeletonLoader } from 'components/ui/ShimmeringLoader' -import { usePgSodiumKeyCreateMutation } from 'data/pg-sodium-keys/pg-sodium-key-create-mutation' -import { usePgSodiumKeysQuery } from 'data/pg-sodium-keys/pg-sodium-keys-query' import { useVaultSecretCreateMutation } from 'data/vault/vault-secret-create-mutation' import { Eye, EyeOff, HelpCircle } from 'lucide-react' import { Button, Form, Input, Modal } from 'ui' -import EncryptionKeySelector from '../Keys/EncryptionKeySelector' interface AddNewSecretModalProps { visible: boolean @@ -18,35 +15,20 @@ interface AddNewSecretModalProps { const AddNewSecretModal = ({ visible, onClose }: AddNewSecretModalProps) => { const [showSecretValue, setShowSecretValue] = useState(false) - const [selectedKeyId, setSelectedKeyId] = useState() const { project } = useProjectContext() - const { mutateAsync: addKeyMutation } = usePgSodiumKeyCreateMutation() const { mutateAsync: addSecret } = useVaultSecretCreateMutation() - // const { data: keys, isLoading } = usePgSodiumKeysQuery( - // { - // projectRef: project?.ref, - // connectionString: project?.connectionString, - // }, - // { - // enabled: visible, - // } - // ) - - // useEffect(() => { - // if (visible && keys) { - // setShowSecretValue(false) - // setSelectedKeyId(keys[0]?.id ?? 'create-new') - // } - // }, [visible, keys]) + useEffect(() => { + if (visible) { + setShowSecretValue(false) + } + }, [visible]) const validate = (values: any) => { const errors: any = {} if (values.name.length === 0) errors.name = 'Please provide a name for your secret' if (values.secret.length === 0) errors.secret = 'Please enter your secret value' - if (selectedKeyId === 'create-new' && values.keyName.length === 0) - errors.keyName = 'Please provide a name for your new key' return errors } @@ -54,18 +36,9 @@ const AddNewSecretModal = ({ visible, onClose }: AddNewSecretModalProps) => { if (!project) return console.error('Project is required') setSubmitting(true) - let encryptionKeyId = selectedKeyId try { setSubmitting(true) - if (selectedKeyId === 'create-new') { - const addKeyRes = await addKeyMutation({ - projectRef: project?.ref!, - connectionString: project?.connectionString, - name: values.keyName || undefined, - }) - encryptionKeyId = addKeyRes[0].id - } await addSecret({ projectRef: project.ref, @@ -73,7 +46,6 @@ const AddNewSecretModal = ({ visible, onClose }: AddNewSecretModalProps) => { name: values.name, description: values.description, secret: values.secret, - key_id: encryptionKeyId, }) toast.success(`Successfully added new secret ${values.name}`) onClose() @@ -86,11 +58,6 @@ const AddNewSecretModal = ({ visible, onClose }: AddNewSecretModalProps) => { return ( - {/* {isLoading ? ( - - - - ) : ( */}
{ /> - - <> - {/* */} - {/* } - url="https://github.com/supabase/vault" - urlLabel="Vault documentation" - title="What is a key?" - description={ -
-

- Keys are used to encrypt data inside your database, and every secret in the - Vault is encrypted with a key. -

-

- You may create different keys for different purposes, such as one for - encrypting user data, and another for application data. -

-
- } - /> */} -
-
- - - {secret.key_id} - + +

+ {secret.id} +

diff --git a/apps/studio/components/interfaces/Integrations/Vault/Secrets/SecretsManagement.tsx b/apps/studio/components/interfaces/Integrations/Vault/Secrets/SecretsManagement.tsx index c88dd085827..2faf363d538 100644 --- a/apps/studio/components/interfaces/Integrations/Vault/Secrets/SecretsManagement.tsx +++ b/apps/studio/components/interfaces/Integrations/Vault/Secrets/SecretsManagement.tsx @@ -39,10 +39,8 @@ export const SecretsManagement = () => { const allSecrets = data || [] const secrets = sortBy( searchValue.length > 0 - ? allSecrets.filter( - (secret) => - (secret?.name ?? '').toLowerCase().includes(searchValue.toLowerCase()) || - secret.key_id.toLowerCase().includes(searchValue.toLowerCase()) + ? allSecrets.filter((secret) => + (secret?.name ?? '').toLowerCase().includes(searchValue.toLowerCase()) ) : allSecrets, (s) => { @@ -99,14 +97,6 @@ export const SecretsManagement = () => { > Name - - Key ID -
diff --git a/apps/studio/data/fdw/fdw-create-mutation.ts b/apps/studio/data/fdw/fdw-create-mutation.ts index 536057117cc..47bf99ae9b7 100644 --- a/apps/studio/data/fdw/fdw-create-mutation.ts +++ b/apps/studio/data/fdw/fdw-create-mutation.ts @@ -7,7 +7,6 @@ import { } from 'components/interfaces/Integrations/Wrappers/Wrappers.types' import { entityTypeKeys } from 'data/entity-types/keys' import { foreignTableKeys } from 'data/foreign-tables/keys' -import { pgSodiumKeys } from 'data/pg-sodium-keys/keys' import { executeSql } from 'data/sql/execute-sql-query' import { wrapWithTransaction } from 'data/sql/utils/transaction' import { vaultSecretsKeys } from 'data/vault/keys' @@ -243,7 +242,6 @@ export const useFDWCreateMutation = ({ queryClient.invalidateQueries(fdwKeys.list(projectRef), { refetchType: 'all' }), queryClient.invalidateQueries(entityTypeKeys.list(projectRef)), queryClient.invalidateQueries(foreignTableKeys.list(projectRef)), - queryClient.invalidateQueries(pgSodiumKeys.list(projectRef)), queryClient.invalidateQueries(vaultSecretsKeys.list(projectRef)), ]) diff --git a/apps/studio/data/fdw/fdw-delete-mutation.ts b/apps/studio/data/fdw/fdw-delete-mutation.ts index 2e520b9b441..bed193cb09c 100644 --- a/apps/studio/data/fdw/fdw-delete-mutation.ts +++ b/apps/studio/data/fdw/fdw-delete-mutation.ts @@ -4,7 +4,6 @@ import { toast } from 'sonner' import type { WrapperMeta } from 'components/interfaces/Integrations/Wrappers/Wrappers.types' import { entityTypeKeys } from 'data/entity-types/keys' import { foreignTableKeys } from 'data/foreign-tables/keys' -import { pgSodiumKeys } from 'data/pg-sodium-keys/keys' import { executeSql } from 'data/sql/execute-sql-query' import { wrapWithTransaction } from 'data/sql/utils/transaction' import { vaultSecretsKeys } from 'data/vault/keys' @@ -113,7 +112,6 @@ export const useFDWDeleteMutation = ({ queryClient.invalidateQueries(fdwKeys.list(projectRef), { refetchType: 'all' }), queryClient.invalidateQueries(entityTypeKeys.list(projectRef)), queryClient.invalidateQueries(foreignTableKeys.list(projectRef)), - queryClient.invalidateQueries(pgSodiumKeys.list(projectRef)), queryClient.invalidateQueries(vaultSecretsKeys.list(projectRef)), ]) diff --git a/apps/studio/data/fdw/fdw-update-mutation.ts b/apps/studio/data/fdw/fdw-update-mutation.ts index c49c729559f..710413255e7 100644 --- a/apps/studio/data/fdw/fdw-update-mutation.ts +++ b/apps/studio/data/fdw/fdw-update-mutation.ts @@ -4,7 +4,6 @@ import { toast } from 'sonner' import type { WrapperMeta } from 'components/interfaces/Integrations/Wrappers/Wrappers.types' import { entityTypeKeys } from 'data/entity-types/keys' import { foreignTableKeys } from 'data/foreign-tables/keys' -import { pgSodiumKeys } from 'data/pg-sodium-keys/keys' import { executeSql } from 'data/sql/execute-sql-query' import { wrapWithTransaction } from 'data/sql/utils/transaction' import { vaultSecretsKeys } from 'data/vault/keys' @@ -76,7 +75,6 @@ export const useFDWUpdateMutation = ({ queryClient.invalidateQueries(fdwKeys.list(projectRef), { refetchType: 'all' }), queryClient.invalidateQueries(entityTypeKeys.list(projectRef)), queryClient.invalidateQueries(foreignTableKeys.list(projectRef)), - queryClient.invalidateQueries(pgSodiumKeys.list(projectRef)), queryClient.invalidateQueries(vaultSecretsKeys.list(projectRef)), ]) diff --git a/apps/studio/data/pg-sodium-keys/keys.ts b/apps/studio/data/pg-sodium-keys/keys.ts deleted file mode 100644 index 9c35fc21e50..00000000000 --- a/apps/studio/data/pg-sodium-keys/keys.ts +++ /dev/null @@ -1,3 +0,0 @@ -export const pgSodiumKeys = { - list: (projectRef: string | undefined) => ['projects', projectRef, 'pg-sodium-keys'] as const, -} diff --git a/apps/studio/data/pg-sodium-keys/pg-sodium-key-create-mutation.ts b/apps/studio/data/pg-sodium-keys/pg-sodium-key-create-mutation.ts deleted file mode 100644 index d92bb1c6cb4..00000000000 --- a/apps/studio/data/pg-sodium-keys/pg-sodium-key-create-mutation.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' -import { toast } from 'sonner' - -import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' -import { pgSodiumKeys } from './keys' - -export type CreateEncryptionKeyVariables = { - projectRef: string - connectionString?: string - name: string -} - -export async function createEncryptionKey({ - projectRef, - connectionString, - name, -}: CreateEncryptionKeyVariables) { - const sql = - name !== undefined - ? `select * from pgsodium.create_key(name := '${name}')` - : `select * from pgsodium.create_key()` - - const { result } = await executeSql({ - projectRef, - connectionString, - sql, - queryKey: ['projects', projectRef, 'pg-sodium-keys', 'create'], - }) - - return result -} - -type EncryptionKeyCreateData = Awaited> - -export const usePgSodiumKeyCreateMutation = ({ - onError, - onSuccess, - ...options -}: Omit< - UseMutationOptions, - 'mutationFn' -> = {}) => { - const queryClient = useQueryClient() - - return useMutation( - (vars) => createEncryptionKey(vars), - { - async onSuccess(data, variables, context) { - const { projectRef } = variables - await queryClient.invalidateQueries(pgSodiumKeys.list(projectRef)) - await onSuccess?.(data, variables, context) - }, - async onError(data, variables, context) { - if (onError === undefined) { - toast.error(`Failed to create key: ${data.message}`) - } else { - onError(data, variables, context) - } - }, - ...options, - } - ) -} diff --git a/apps/studio/data/pg-sodium-keys/pg-sodium-key-delete-mutation.ts b/apps/studio/data/pg-sodium-keys/pg-sodium-key-delete-mutation.ts deleted file mode 100644 index 32d42c08b08..00000000000 --- a/apps/studio/data/pg-sodium-keys/pg-sodium-key-delete-mutation.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { useMutation, UseMutationOptions, useQueryClient } from '@tanstack/react-query' -import { toast } from 'sonner' - -import { Query } from '@supabase/pg-meta/src/query' -import { executeSql } from 'data/sql/execute-sql-query' -import type { ResponseError } from 'types' -import { pgSodiumKeys } from './keys' - -export type VaultSecretDeleteVariables = { - projectRef: string - connectionString?: string - id: string -} - -export async function deleteVaultSecret({ - projectRef, - connectionString, - id, -}: VaultSecretDeleteVariables) { - const sql = new Query().from('key', 'pgsodium').delete().match({ id }).toSql() - const { result } = await executeSql({ - projectRef, - connectionString, - sql, - queryKey: ['projects', projectRef, 'pg-sodium-keys', 'delete', id], - }) - return result -} - -type VaultSecretDeleteData = Awaited> - -export const usePgSodiumKeyDeleteMutation = ({ - onError, - onSuccess, - ...options -}: Omit< - UseMutationOptions, - 'mutationFn' -> = {}) => { - const queryClient = useQueryClient() - - return useMutation( - (vars) => deleteVaultSecret(vars), - { - async onSuccess(data, variables, context) { - const { projectRef } = variables - await queryClient.invalidateQueries(pgSodiumKeys.list(projectRef)) - await onSuccess?.(data, variables, context) - }, - async onError(data, variables, context) { - if (onError === undefined) { - toast.error(`Failed to delete key: ${data.message}`) - } else { - onError(data, variables, context) - } - }, - ...options, - } - ) -} diff --git a/apps/studio/data/pg-sodium-keys/pg-sodium-keys-query.ts b/apps/studio/data/pg-sodium-keys/pg-sodium-keys-query.ts deleted file mode 100644 index c6bfbc52693..00000000000 --- a/apps/studio/data/pg-sodium-keys/pg-sodium-keys-query.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { UseQueryOptions, useQuery } from '@tanstack/react-query' -import { Query } from '@supabase/pg-meta/src/query' -import { sortBy } from 'lodash' -import { executeSql } from '../sql/execute-sql-query' -import { pgSodiumKeys } from './keys' - -export interface EncryptionKey { - id: string - key_id: number - name: string - comment: string - created: string - status: string -} - -export const getPgSodiumKeysQuery = () => { - const sql = new Query() - .from('key', 'pgsodium') - .select('id,key_id,name,comment,created,status') - .toSql() - - return sql -} - -export type PgSodiumKeysVariables = { - projectRef?: string - connectionString?: string -} - -const getPgSodiumKeys = async ( - { projectRef, connectionString }: PgSodiumKeysVariables, - signal?: AbortSignal -) => { - const sql = getPgSodiumKeysQuery() - const { result } = await executeSql( - { - projectRef, - connectionString, - sql, - queryKey: pgSodiumKeys.list(projectRef), - }, - signal - ) - return result -} - -export type PgSodiumKeysData = EncryptionKey[] -export type PgSodiumKeysError = unknown - -export const usePgSodiumKeysQuery = ( - { projectRef, connectionString }: PgSodiumKeysVariables, - { enabled = true, ...options }: UseQueryOptions = {} -) => - useQuery( - pgSodiumKeys.list(projectRef), - ({ signal }) => getPgSodiumKeys({ projectRef, connectionString }, signal), - { - select(data) { - return sortBy(data, (k) => Number(new Date(k.created))) as any - }, - enabled: enabled && typeof projectRef !== 'undefined', - ...options, - } - ) diff --git a/apps/studio/data/vault/vault-secret-create-mutation.ts b/apps/studio/data/vault/vault-secret-create-mutation.ts index bb28f59cd5c..bba2b6300c3 100644 --- a/apps/studio/data/vault/vault-secret-create-mutation.ts +++ b/apps/studio/data/vault/vault-secret-create-mutation.ts @@ -16,13 +16,12 @@ export async function createVaultSecret({ connectionString, ...newSecret }: VaultSecretCreateVariables) { - const { name, description, secret, key_id } = newSecret + const { name, description, secret } = newSecret const sql = /* SQL */ ` select vault.create_secret( new_secret := ${quoteLiteral(secret)} ${name ? `, new_name := ${quoteLiteral(name)}` : ''} ${description ? `, new_description := ${quoteLiteral(description)}` : ''} - ${key_id ? `, new_key_id := ${quoteLiteral(key_id)}` : ''} ) ` diff --git a/apps/studio/data/vault/vault-secret-update-mutation.ts b/apps/studio/data/vault/vault-secret-update-mutation.ts index a1467eb50d0..779d2cf45ce 100644 --- a/apps/studio/data/vault/vault-secret-update-mutation.ts +++ b/apps/studio/data/vault/vault-secret-update-mutation.ts @@ -18,14 +18,13 @@ export async function updateVaultSecret({ id, ...payload }: VaultSecretUpdateVariables) { - const { name, description, secret, key_id } = payload + const { name, description, secret } = payload const sql = /* SQL */ ` select vault.update_secret( secret_id := ${quoteLiteral(id)} ${secret ? `, new_secret := ${quoteLiteral(secret)}` : ''} ${name ? `, new_name := ${quoteLiteral(name)}` : ''} ${description ? `, new_description := ${quoteLiteral(description)}` : ''} - ${key_id ? `, new_key_id := ${quoteLiteral(key_id)}` : ''} ) ` diff --git a/apps/studio/data/vault/vault-secrets-query.ts b/apps/studio/data/vault/vault-secrets-query.ts index 52ed1229707..283a339bcd3 100644 --- a/apps/studio/data/vault/vault-secrets-query.ts +++ b/apps/studio/data/vault/vault-secrets-query.ts @@ -7,7 +7,7 @@ import { vaultSecretsKeys } from './keys' export const getVaultSecretsSql = () => { const sql = new Query() .from('secrets', 'vault') - .select('id,name,description,secret,key_id,created_at,updated_at') + .select('id,name,description,secret,created_at,updated_at') .toSql() return sql diff --git a/apps/studio/types/ui.ts b/apps/studio/types/ui.ts index 79637a5b3ad..69d3cea5cf4 100644 --- a/apps/studio/types/ui.ts +++ b/apps/studio/types/ui.ts @@ -31,7 +31,6 @@ export interface VaultSecret { description: string secret: string decryptedSecret?: string - key_id: string created_at: string updated_at: string }