In my .env
file I have such environmental variable:
CRYPTO_KEY_SHORT=x12x34x56x78x9Ax12x32xE3
I use this string as a key in code, like this:
const decryptedHash = cryptoService.decryptHex(confirmToken, `${process.env.CRYPTO_KEY_SHORT}`, null)
And here is the problem, it doesn’t work this way, every time I get error – Error: Invalid key length
, but if I hardcode this it work:
const decryptedHash = cryptoService.decryptHex(confirmToken, "x12x34x56x78x9Ax12x32xE3", null)
So, after putting such variable to .env
how can I use it?