AES-256 Encryption / Decryption with Key in environment variable
This is a very simple AES-256 string encryption/decryption program written in Node.JS using the built-in crypto library.
// aes256.js
const crypto = require('crypto');
const ENCODING = 'base64';
const KEY = process.env.MY_SECRET_KEY;
function verifyKey() {
if (!KEY) {
throw new Error('MY_SECRET_KEY was not found!');
}
}
function