v1.1.0 Fixed key generation by using correct generation for timestamp format

This commit is contained in:
2025-05-21 23:30:18 +02:00
parent 18605dfc64
commit 6a236c5d68
3 changed files with 12 additions and 10 deletions

View File

@@ -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);