So I needed to encrypt some fields. But I realized that the only plugin that does it works only on Mongoose < 5. And it's not very slick, like, you need to change stuff in your queries to make it work.My plugin, which is unpublished as of yet:https://github.com/Chubek/mongoose-jumblatorFixes everything. All you have to do is to mark the field as "encrypt: true" and it will be encrypted. Mark it as "searchable: true" and it will be searched. Otherwise if you search for the field in your queries, it won't bring up anything. Why? because it creates to fields, one for the search hash, one for the cipher stuff. Like if your field is named "banana" it will set "banana" to "undefined" and will create two fields, called "__banana_enc" and "__banana_hash". But when you "find" or "findOne" it, it will return you "banana" decrypted.I've just finished making the plugin, and I'm excited to see what you guys think. if you test it, and report it to me, on Discord or here, I will be ecstatic!Thank you!
Submitted May 03, 2020 at 05:14AM by TheAvogadroConstant
No comments:
Post a Comment