The Uber documentation say
The value of this field is a hexadecimal HMAC signature of the webhook HTTP request body, using the client secret as a key and SHA256 as the hash function.
But what is the HTTP request body? I assume it is the JSON body received from the webhook (https://developer.uber.com/docs/webhooks#section-example-post).
If it is, then how to validate it in NodeJS as the crypto module for HMAC doesn't accept JSON[I've tried to stringify the JSON, but it generates a different hash]. Or how to I convert the JSON into a buffer, since that is the next best option
If not, then what should I be using?
[UPDATE1] Code used for the task:
app.post("/",function(req,res){
const crypto = require('crypto');
var input = res.body
var str_input=JSON.stringify(input)
const hmac = crypto.createHmac('sha256', '<CLIENT SECRET>');
hmac.update(str_input);
console.log(hmac.digest('hex')); // print same as below
console.log("e034ac7db29c3c0c10dfeced41a6cd850ed74c1c3c620863d47654cc7390359a")
})