Files
supabase/apps/docs/pages/guides/database/extensions/pgsodium.mdx
T
Greg Richardson 98c4103463 Docs: Switch tabs using query param (#17626)
* feat: switch tabs using url hash

* feat: switch tabs using query param
2023-09-22 11:29:25 -06:00

93 lines
3.6 KiB
Plaintext

import Layout from '~/layouts/DefaultGuideLayout'
export const meta = {
id: 'pgsodium',
title: 'pgsodium: Encryption Features',
description: 'Encryption library for PostgreSQL',
}
[pgsodium](https://github.com/michelp/pgsodium) is a PostgreSQL
extension which provides SQL access to
[libsodium's](https://doc.libsodium.org/) high-level cryptographic
algorithms.
libsodium is a modern, easy-to-use software library for encryption,
decryption, signatures, password hashing, and more. It is a portable,
cross-compilable, installable, and packageable fork of the
[NaCl](http://nacl.cr.yp.to/) library, with a compatible but extended
API to improve usability even further.
Its goal is to provide all of the core operations needed to build
higher-level cryptographic tools. Sodium is cross-platform and
cross-language. It runs on many compilers and operating systems,
including Windows (with MinGW or Visual Studio, x86 and x86_64), iOS,
and Android. JavaScript and WebAssembly versions are also available
and fully supported. Furthermore, bindings for all common programming
languages are available and well-supported.
The design choices emphasize security and ease of use. But despite the
emphasis on high security, primitives are faster across-the-board than
most implementations.
pgsodium exposes the following libsodium APIs to SQL:
- [Generating Random Data](https://github.com/michelp/pgsodium/#generating-random-data)
- [Secret key cryptography](https://github.com/michelp/pgsodium/#secret-key-cryptography)
- [Authenticated encryption](https://github.com/michelp/pgsodium/#authenticated-encryption)
- [Authentication](https://github.com/michelp/pgsodium/#authentication)
- [Public key cryptography](https://github.com/michelp/pgsodium/#public-key-cryptography)
- [Authenticated encryption](https://github.com/michelp/pgsodium/#authenticated-encryption-1)
- [Public key signatures](https://github.com/michelp/pgsodium/#public-key-signatures)
- [Sealed boxes](https://github.com/michelp/pgsodium/#sealed-boxes)
- [Hashing](https://github.com/michelp/pgsodium/#hashing)
- [Password hashing](https://github.com/michelp/pgsodium/#password-hashing)
- [Key Derivation](https://github.com/michelp/pgsodium/#key-derivation)
- [Key Exchange](https://github.com/michelp/pgsodium/#key-exchange)
- [HMAC512](https://github.com/michelp/pgsodium/#hmac512)
- [Advanced Stream API](https://github.com/michelp/pgsodium/#advanced-stream-api)
- [XChaCha20-SIV](https://github.com/michelp/pgsodium/#xchacha20-siv)
- [Signcryption](https://github.com/michelp/pgsodium/#signcryption)
It also enables some Postgres specific features including:
- [Server Key Management](https://github.com/michelp/pgsodium#server-key-management)
- [Transparent Column Encryption](https://github.com/michelp/pgsodium#transparent-column-encryption)
## Enable the extension
<Tabs
scrollable
size="small"
type="underlined"
defaultActiveId="dashboard"
queryGroup="database-method"
>
<TabPanel id="dashboard" label="Dashboard">
1. Go to the [Database](https://supabase.com/dashboard/project/_/database/tables) page in the Dashboard.
2. Click on **Extensions** in the sidebar.
3. Search for "pgsodium" and enable the extension.
</TabPanel>
<TabPanel id="sql" label="SQL">
{/* prettier-ignore */}
```sql
-- Enable the "pgsodium" extension
create extension pgsodium;
-- Disable the "pgsodium" extension
drop extension if exists pgsodium;
```
</TabPanel>
</Tabs>
## Resources
- Official [`pgsodium` documentation](https://github.com/michelp/pgsodium)
export const Page = ({ children }) => <Layout meta={meta} children={children} />
export default Page