v1.1.0 Fixed key generation by using correct generation for timestamp format
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const crypto = require('node:crypto');
|
||||
const { DateTime } = require('luxon');
|
||||
|
||||
class EncryptionHelper {
|
||||
static encryptDataAESGCM(plainText, key) {
|
||||
@@ -17,8 +18,9 @@ class EncryptionHelper {
|
||||
}
|
||||
|
||||
static makeEncryptedParameter(username, key) {
|
||||
const timestamp = new Date().toISOString().replace('T', ' ').split('.')[0];
|
||||
const plainText = `${timestamp} ${username}`;
|
||||
const timestamp = DateTime.now().setZone('Europe/Berlin');
|
||||
const tsFormatted = timestamp.toFormat('yyyy-MM-dd HH:mm:ss');
|
||||
const plainText = `${tsFormatted} ${username}`;
|
||||
|
||||
const hash = crypto.createHash('sha256').update(key, 'utf8').digest();
|
||||
const encryptedData = this.encryptDataAESGCM(plainText, hash);
|
||||
|
||||
Reference in New Issue
Block a user