47ng / prisma-field-encryption

Transparent field-level encryption at rest for Prisma
https://github.com/franky47/prisma-field-encryption-sandbox
MIT License
246 stars 29 forks source link

[mongo]: Hashes are not computed #79

Closed Ahmadre closed 1 year ago

Ahmadre commented 1 year ago

I created a brand new little nodejs project and installed prisma + this package.

After creating a document in my MongoDB Atlas (normal mongodb+srv connection), Hashes are not computed...

Bildschirmfoto 2023-08-28 um 01 11 23

is this a bug?

Because as I know: Mongo is not saving nullable fields into the db. But I don't know why prisma is not computing the hashes...

Ahmadre commented 1 year ago

Notice: I've added the @default("") fields to try to fix this, but it also didn't work...

Bildschirmfoto 2023-08-28 um 01 14 02
franky47 commented 1 year ago

Do you have a reproduction repository?

Ahmadre commented 1 year ago

Do you have a reproduction repository?

If you give me your gitlab.com username or email I can add you to the project. Just write me via rebar.ahmad@gmail.com

franky47 commented 1 year ago

I think I found the issue: the annotation for hash fields should be /// @encryption:hash(fieldName), not /// @encrypted:hash(fieldName).

Ahmadre commented 1 year ago

I think I found the issue: the annotation for hash fields should be /// @encryption:hash(fieldName), not /// @encrypted:hash(fieldName).

you're totally right 🙈.

Thank you for your finding ❤️.