1import CryptoJS from 'crypto-js'
2import AES from 'crypto-js/aes'
3
4const SECRET = 'I am batman'
5const plainText = 'This is Sparta!'
6
7export function enc(plainText){
8 // returns something like this U2FsdGVkX184He5Rp991JYAiCSdTwfZs8T3kJUk3zAc=
9 // but with random `/` and I dont want that
10 // I want it to be Hex but .toString(CryptoJs.enc.Hex)
11 // is not working, it just returns an '' empty string
12 // it's a string, I checked using typeof
13 return AES.encrypt(plainText, SECRET).toString();
14}
15