CryptoJS
I was not able to figure out how to use the built-in Web Crypto API
or Node’s Crypto
to do symmetric encryption. So, using the older library CryptoJS
Just two simple functions:
export function encryptText(text) { return CryptoJS.AES.encrypt(text, KEY).toString();}
export function decryptText(text) { return CryptoJS.AES.decrypt(text, KEY).toString(CryptoJS.enc.Utf8);}
Source: