Securing webhooks
{ "event_type": "create_shipment", "timestamp": 1643117545594, "signature": "string", "token": "string" }
Parameter
Type
Description
Last updated
{ "event_type": "create_shipment", "timestamp": 1643117545594, "signature": "string", "token": "string" }
Last updated
const crypto = require('crypto')
const verify = ({ signingKey, timestamp, token, signature }) => {
const encodedToken = crypto
.createHmac('sha256', signingKey)
.update(timestamp.concat(token))
.digest('hex')
return (encodedToken === signature)
}