diff --git a/lib/utils/encrypt-decrypt.js b/lib/utils/encrypt-decrypt.js index ae78087..5cb3e55 100644 --- a/lib/utils/encrypt-decrypt.js +++ b/lib/utils/encrypt-decrypt.js @@ -2,9 +2,9 @@ const crypto = require('crypto'); const algorithm = process.env.LEGACY_CRYPTO ? 'aes-256-ctr' : 'aes-256-cbc'; const iv = crypto.randomBytes(16); const secretKey = crypto.createHash('sha256') - .update(String(process.env.JWT_SECRET)) + .update(process.env.ENCRYPTION_SECRET || process.env.JWT_SECRET) .digest('base64') - .substr(0, 32); + .substring(0, 32); const encrypt = (text) => { const cipher = crypto.createCipheriv(algorithm, secretKey, iv);