function encrypt(text) {
  return new Promise (resolve => {
    let iv = crypto.randomBytes(IV_LENGTH);
    let cipher = crypto.createCipheriv('aes-256-cbc', new Buffer(ENCRYPTION_KEY), iv);
    let encrypted = cipher.update(text);

    encrypted = Buffer.concat([encrypted, cipher.final()]);

    resolve(iv.toString('hex') + ':' + encrypted.toString('hex'));
  });
}
// For AES, this is always 16
For AES, this is always 16
For AES this is always 16
function encrypt(text) {
  return new Promise (resolve => {
    let iv = crypto.randomBytes(IV_LENGTH);
    let cipher = crypto.createCipheriv('aes-256-cbc', new Buffer(ENCRYPTION_KEY), iv);
    let encrypted = cipher.update(text);
    encrypted = Buffer.concat([encrypted, cipher.final()]);
    resolve(iv.toString('hex') + ':' + encrypted.toString('hex'));
  });
}
function encrypt ( text ) { return new Promise ( resolve => { let iv = crypto . randomBytes ( IV_LENGTH ) ; let cipher = crypto . createCipheriv ( 'aes-256-cbc' , new Buffer ( ENCRYPTION_KEY ) , iv ) ; let encrypted = cipher . update ( text ) ; encrypted = Buffer . concat ( [ encrypted , cipher . final ( ) ] ) ; resolve ( iv . toString ( 'hex' ) + ':' + encrypted . toString ( 'hex' ) ) ; } ) ; }
For AES, this is always 16
For AES this is always 16