encrypt
Some (hopefully) sensible defaults for encrypting in node
The data is serialized using msgpack5
. This allows for any valid js structure to be encrypted/decrypted
Install
npm install --save @iteam/encrypt
Use
Super simple
const {encrypt, decrypt} = require('@iteam/encrypt').init('my super secret password')
const encrypted = encrypt('some text')
const decrypted = decrypt(encrypted)
With options
const {encrypt, decrypt} = require('@iteam/encrypt')
.init({
algorithm: 'aes-256-gcm',
authTag: true,
encoding: 'base64',
iv: Buffer.alloc(16),
password: 'some password'
})
const encrypted = encrypt('some text')
const decrypted = decrypt(encrypted)