Skip to content

Latest commit

 

History

History
 
 

obfuscated-fields

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Prisma Client Extension - Obfuscated Fields

This example uses an extension to obfuscate a sensitive password field on a User model. The password column is not included in selected columns in the underlying SQL queries, and it will resolve to undefined when accessed on a user result object. It could also resolve to any other value, such as an obfuscated string like "********".

Caveats

This extension is provided as an example only. It is not intended to be used in production environments.

Please read the documentation on result extensions for more information.

How to use

Prerequisites

1. Download example & install dependencies

Clone this repository:

git clone [email protected]:sbking/prisma-client-extensions.git

Install dependencies:

cd obfuscated-fields
npm install

2. Create an SQLite database and run migrations

Run the following command. An SQLite database will be created automatically:

npx prisma migrate deploy

3. Seed the database

Run the following command to add seed data to the database:

npx prisma db seed

4. Run the dev script

To run the script.ts file, run the following command:

npm run dev