Skip to content
Discussion options

You must be logged in to vote

Hey @kmiyashiro,

As you already know, Supabase allows the use of pgcrypto.

Although this is normally used for sensitive data (passwords), you can use it for whatever you want.

Below is an example of how to use it:

# Create table users
CREATE TABLE users (id SERIAL PRIMARY KEY,
                    email TEXT NOT NULL UNIQUE,
                    password TEXT NOT NULL);

# Insert a new user
INSERT INTO users (email, password)
VALUES ('kmiyashiro@mail.com', crypt('kmiyashiropassword', gen_salt('bf')));

# Fetch the user ID using his/her email and encrypted password
SELECT id
FROM users
WHERE email = 'kmiyashiro@mail.com'
  AND password = crypt('kmiyashiropassword', password);

# This will re…

Replies: 1 comment 21 replies

Comment options

You must be logged in to vote
21 replies
@gcasesor
Comment options

@jakub-sekula
Comment options

@ivanbogdan-git
Comment options

@ivanbogdan-git
Comment options

@BeppeMarnell
Comment options

Answer selected by kmiyashiro
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet