mongoose-field-encryption
Advanced tools
Comparing version 5.0.0 to 5.0.1
{ | ||
"name": "mongoose-field-encryption", | ||
"version": "5.0.0", | ||
"version": "5.0.1", | ||
"description": "A simple symmetric encryption plugin for individual fields. Dependency free, only mongoose peer dependency.", | ||
@@ -5,0 +5,0 @@ "main": "lib/mongoose-field-encryption.js", |
@@ -170,5 +170,6 @@ # mongoose-field-encryption | ||
```js | ||
const fieldEncryption = require('mongoose-field-encryption') | ||
const encrypted = fieldEncryption.encrypt('some text', 'secret')); | ||
const decrypted = fieldEncryption.decrypt(encrypted, 'secret')); // decrypted = 'some text' | ||
const fieldEncryption = require('mongoose-field-encryption'); | ||
const _hash = (secret) => crypto.createHash("sha256").update(secret).digest("hex").substring(0, 32); | ||
const encrypted = fieldEncryption.encrypt('some text', _hash('secret'))); | ||
const decrypted = fieldEncryption.decrypt(encrypted, _hash('secret'))); // decrypted = 'some text' | ||
``` | ||
@@ -180,3 +181,3 @@ | ||
See comment for discussion: [https://github.com/wheresvic/mongoose-field-encryption/issues/34#issuecomment-577383776](https://github.com/wheresvic/mongoose-field-encryption/issues/34#issuecomment-577383776). | ||
See comment for discussion: [https://github.com/wheresvic/mongoose-field-encryption/issues/34#issuecomment-577383776](https://github.com/wheresvic/mongoose-field-encryption/issues/34#issuecomment-577383776). | ||
@@ -251,2 +252,6 @@ _Please also note that this example is provided as a best-effort basis and this plugin does not take responsibility for what quirks mongoose might bring if you use this feature._ | ||
### 5.0.1 | ||
- Update README, no functionality affected | ||
### 5.0.0 | ||
@@ -253,0 +258,0 @@ |
27968
345