wheresvic / mongoose-field-encryption

A simple symmetric encryption plugin for individual fields. Dependency free, only mongoose peer dependency.
MIT License
74 stars 32 forks source link

.select workaround based on field names for find and findOne #62

Closed doguhanokumus closed 3 years ago

doguhanokumus commented 3 years ago

Upon our needs for our business, I've made a workaround on .select with a pre-hook. This hook automatically adds __enc_key and __enc_key_d for relevant fieldsToEncrypt.

Note: only works on top-level fields at the moment.

Doguhan

doguhanokumus commented 3 years ago

I am going to send another PR as by mistake I've done some typescript work on this one.