Transparent encryption for Mongoose fields with built-in password migration.
Allows you to easily encrypt
String fields using
Store a timestamp along the encrypted data to allow painless password migration.
The data that is stored in MongoDB as base64 encoded strings and consists of (from left to right)
ENCRYPTED___to handle a mix of encrypted/unencrypted data (you can drop this plugin into your existing data),
npm install mongoose-encrypt.
Now imagine a website where users sign up with their Twitter account. It's probably a good idea to encrypt the OAuth token.
var encrypt = ;var userSchema =createdAt: Datetwitter:name: Stringtoken: String;userSchema;
That's it! The plugin sets up a
setter to decrypt and encrypt each path on the fly using
As mentioned above storing OAuth tokens or similar in plain text is probably a bad idea. Additional this plugin was created to securely store bank account data on behalf of users.
I'm not a security expert. Not at all. If you have any concerns regarding this plugin please create an issue (or contact me via e-mail if it's a critical issue).