Hi everyone,
I'm trying to build the signature using the shared secret and the payload sent by Typeform webhook but the resulted hash is never the same as the retrieved from the header.
I belive the problem is the request body format.
The Typeform documentation says that the body must be binary, so i parse the JSON object that my applications give me to a buffer before i apply the HMAC SHA-256 algorithm. I also tryed to use JSON.stringfy method after the previous step.
What am i doing wrong?
let payload = request.body
payload = Buffer.from(JSON.stringify(payload))
// payload = JSON.stringify(payload)
const base64BinaryHash = crypto.createHmac('sha256', secret).update(payload).digest('base64')
const finalHash = `sha256=${base64BinaryHash}`