add env LEGACY_CRYPTO

This commit is contained in:
Dave Horton
2021-11-29 09:03:43 -05:00
parent 3e49616191
commit 114f65b36a
3 changed files with 12 additions and 153 deletions

View File

@@ -1,5 +1,5 @@
const crypto = require('crypto');
const algorithm = 'aes-256-cbc';
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))