fix: naming convention

This commit is contained in:
bjarneo 2025-02-13 08:23:48 +01:00
parent c080a7e7bc
commit 1a95a8b689
No known key found for this signature in database
GPG Key ID: AA3697C46F530672
2 changed files with 3 additions and 3 deletions

View File

@ -82,7 +82,7 @@ const config = {
}, },
analytics: { analytics: {
enabled: JSON.parse(SECRET_ANALYTICS_ENABLED), enabled: JSON.parse(SECRET_ANALYTICS_ENABLED),
ipSalt: SECRET_ANALYTICS_HMAC_SECRET, hmacSecret: SECRET_ANALYTICS_HMAC_SECRET,
}, },
logger: true, logger: true,
cors: '*', cors: '*',

View File

@ -5,12 +5,12 @@ import { getCacheKey, getFromCache, setCache } from '../helpers/cache.js';
import getClientIp from '../helpers/client-ip.js'; import getClientIp from '../helpers/client-ip.js';
import prisma from '../services/prisma.js'; import prisma from '../services/prisma.js';
const { enabled, ipSalt } = config.get('analytics'); const { enabled, hmacSecret } = config.get('analytics');
function createUniqueId(ip, userAgent) { function createUniqueId(ip, userAgent) {
// Use HMAC for secure hashing // Use HMAC for secure hashing
return crypto return crypto
.createHmac('sha256', ipSalt) .createHmac('sha256', hmacSecret)
.update(ip + userAgent) .update(ip + userAgent)
.digest('hex'); .digest('hex');
} }