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.
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user