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

Feature request: Add support to sanitize hashes #109

Closed martijn-dev closed 3 months ago

martijn-dev commented 3 months ago

It would be great to sanitize inputs before hashing them:

For example: We have the following model:

model User {
  id                String  @id
  name          String  @unique /// @encrypted
  nameHash String? @unique /// @encryption:hash(name)
}

The user provides a name: MartijN. Now I would like to be able to find this user back with a lowercase string martijn, but still decrypt the name field back to MartijN.

Discussed in 102.