From 6a236c5d68b30c2796e9a68bcd47338a29be76c2 Mon Sep 17 00:00:00 2001 From: Jason Date: Wed, 21 May 2025 23:30:18 +0200 Subject: [PATCH] v1.1.0 Fixed key generation by using correct generation for timestamp format --- classes/EncryptionHelper.js | 6 ++++-- npm-shrinkwrap.json | 12 ++++++------ package.json | 4 ++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/classes/EncryptionHelper.js b/classes/EncryptionHelper.js index 9ca541a..b3eeb5c 100644 --- a/classes/EncryptionHelper.js +++ b/classes/EncryptionHelper.js @@ -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); diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 7c7407d..2365172 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,16 +1,16 @@ { "name": "virtueller-stundenplan", - "version": "1.0.0", + "version": "1.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "virtueller-stundenplan", - "version": "1.0.0", + "version": "1.1.0", "license": "CC-BY-NC-4.0", "dependencies": { "axios": "^1.8.4", - "luxon": "^3.5.0" + "luxon": "^3.6.1" } }, "node_modules/asynckit": { @@ -256,9 +256,9 @@ } }, "node_modules/luxon": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.5.0.tgz", - "integrity": "sha512-rh+Zjr6DNfUYR3bPwJEnuwDdqMbxZW7LOQfUN4B54+Cl+0o5zaU9RJ6bcidfDtC1cWCZXQ+nvX8bf6bAji37QQ==", + "version": "3.6.1", + "resolved": "https://registry.npmjs.org/luxon/-/luxon-3.6.1.tgz", + "integrity": "sha512-tJLxrKJhO2ukZ5z0gyjY1zPh3Rh88Ej9P7jNrZiHMUXHae1yvI2imgOZtL1TO8TW6biMMKfTtAOoEJANgtWBMQ==", "license": "MIT", "engines": { "node": ">=12" diff --git a/package.json b/package.json index eb19acd..8134542 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "virtueller-stundenplan", - "version": "1.0.0", + "version": "1.1.0", "description": "A library to access the data from virtueller-stundenplan.org", "main": "index.js", "scripts": { @@ -19,6 +19,6 @@ "license": "CC-BY-NC-4.0", "dependencies": { "axios": "^1.8.4", - "luxon": "^3.5.0" + "luxon": "^3.6.1" } }