Closed Jaivijay029 closed 4 months ago
CryptoJS is deprecated in postman, try require("crypto-js") and let me know.
@rangav Issue is not with Postman.. In Postman it is working as expected. In Thunder client we are not getting expected result for HMAC calculation.
Question: HMAC calculation is not same as POSTMAN for below script
POSTMAN: var ClientRequestId = 1234567; var time = 1715167893828; var requestBody = request.data; var rawSignature = key + ClientRequestId + time + requestBody;
var computedHash = CryptoJS.algo.HMAC.create(CryptoJS.algo.SHA256, secret.toString()); computedHash.update(rawSignature); computedHash = computedHash.finalize(); var computedHmac = CryptoJS.enc.Base64.stringify(computedHash);
ThunderClient: var ClientRequestId = 1234567; var time = 1715167893828; var requestBody = tc.request.body; var rawSignature = key + ClientRequestId + time + requestBody;
var crypto = require('crypto-js') var computedHash = crypto.algo.HMAC.create(crypto.algo.SHA256, secret.toString()); computedHash.update(rawSignature); computedHash = computedHash.finalize(); var computedHmac = crypto.enc.Base64.stringify(computedHash);
tc.setVar("key", key, "request"); tc.setVar("time", time, "request"); tc.setVar("signature", computedHmac, "request"); tc.setVar("ClientRequestId", ClientRequestId, "request");
Are you using the free version/paid version/trial: Free version