A simple module wrapping around NodeJS Crypto module (AES-CBC-256) allowing handling IV by prefixing it to encrypted string.
npm install encryption-se@0.5.3
###Description A simple module wrapping around NodeJS Crypto module allowing handling IV by prefixing it to encrypted string.
(under development...)
// First you have to get module and instantiate it
npm install encryption-se
OR
yarn add encryption-se
After installing module, add this to your code:
const options = {
password: process.env.encryptionPassword || 'SomePassword',
passwordSalt: 'This is my salt 362'
};
const encryption = require('encryption-se')(options);
encryption
.encrypt('This is to be encrypted')
.then((enc) => {
// 'enc' contains encrypted string in base64 format
})
.catch((err) => {
// This is to handle errors
})
encryption
.decrypt('iQ6qlRWlwWXtmGPFbBiEc4WKKAbHCLQK0+HLxoGLKY0=')
.then((text) => {
// 'text' contains decrypted string
})
.catch((err) => {
// This is to handle errors
})