From 97ae0c43f0bf8003f8e33d9349a83d97f2f6728a Mon Sep 17 00:00:00 2001 From: Azure Date: Thu, 25 Dec 2025 01:41:01 +0100 Subject: [PATCH] Move serverKeys initialization into signProfileData Relocated the serverKeys variable from module scope to inside the signProfileData function to ensure keys are fetched at the time of signing. This improves encapsulation and may help with key rotation or dynamic key management. --- modules/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/utils.js b/modules/utils.js index 09c155a..08d34ba 100644 --- a/modules/utils.js +++ b/modules/utils.js @@ -2,7 +2,6 @@ const path = require("node:path") const logger = require("./logger") const crypto = require("node:crypto") const certificatesManager = require("./certificatesManager") -const serverKeys = certificatesManager.getKeys() async function getRegistrationCountryFromIp(ipAddress) { const apiUrl = `https://ip-api.com/json/${ipAddress}?fields=countryCode` @@ -27,6 +26,7 @@ async function getRegistrationCountryFromIp(ipAddress) { } function signProfileData(dataBase64) { + const serverKeys = certificatesManager.getKeys() try { const privateKey = serverKeys.playerCertificateKeys.private const signer = crypto.createSign("SHA1")