2

Looking at how to implement hash+salt password storing strategy in NodeJS using bcrypt I found this article, which suggests using native Postgress function pgcrypto.

Prisma docs have an example of using pgcrypto only for generating random id, as a @default value in the Prisma schema.

I'm curious if pgcrypto can be used with Prisma, as in this use case it's not a default value, but a transformation to the value given to the DB at the moment of creating of the record.

OlehZiniak
  • 933
  • 1
  • 13
  • 29

1 Answers1

-3

pgcrypto contains a lot of functions that are related in some way to cryptography. Your 2nd link about using gen_random_uuid is a completely different topic (although still touching on cryptography), and has nothing useful to say about the subject of your question. Just forget that article and focus on the first one, and the docs, and the first principles of security.

I don't think there are any special 'gotchas' about using pgcrypto from prisma. You just need to do it. (Or look for prisma libraries that already do it for you.)

jjanes
  • 37,812
  • 5
  • 27
  • 34
  • 1
    I'm finding it hard to find how it answers my question: "how to use pgcrypto with prisma". "There are no special gotchas" seems a bit vague. – OlehZiniak Dec 30 '21 at 10:17