From 87ad32159216780d69c41d4eaa5a67c275702033 Mon Sep 17 00:00:00 2001 From: Akshat Jain Date: Wed, 27 Nov 2024 17:15:02 +0530 Subject: [PATCH] Fix encoding using buffer --- app/utils/signatureUtils.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/utils/signatureUtils.js b/app/utils/signatureUtils.js index e0d1a8c..821f7cb 100644 --- a/app/utils/signatureUtils.js +++ b/app/utils/signatureUtils.js @@ -1,7 +1,8 @@ const crypto = require('node:crypto'); function getHmacChecksum(message, secret) { - const hmac = crypto.createHmac('sha256', secret).update(message); + const encodedBytes = Buffer.from(message, 'utf-8'); + const hmac = crypto.createHmac('sha256', secret).update(encodedBytes); return hmac.digest('hex').toString(); }