const crypto = require('crypto'); const { HASH_KEY } = require('../utils/consts'); function generateHMACSHA256(input, key) { const hmac = crypto.createHmac('sha256', key); hmac.update(input, 'utf8'); // Ensure input encoding matches C# (UTF-8) return hmac.digest('hex'); } function getHashCode(type) { const inputString = "||2023-11-22 14:57:38"; const inputString_GetInvestorDashboard = "368907||2023-11-22 14:57:38"; const inputString_GetTransactionById = "5151974||368907||2023-11-22 14:57:38"; const key = HASH_KEY; const hash = generateHMACSHA256(inputString, key); const hash_GetInvestorDashboard = generateHMACSHA256(inputString_GetInvestorDashboard, key); const hash_GetTransactionById = generateHMACSHA256(inputString_GetTransactionById, key); if (type === 1) { return hash } if (type === 2) { return hash_GetInvestorDashboard } if (type === 3) { return hash_GetTransactionById } } module.exports = { getHashCode }