Generating X-Hub-Signature
26 Aug 2019Today will be a quick one, because I could not google this exact question.
Lets say, you have a microservice that accepts github webhooks, and you want to test it with set secret. Github client libraries have ValidatePayload/ValidateSignatur: https://github.com/google/go-github/blob/master/github/messages.go#L201 but no generate signature.
You can use crypto packages to create signature for any payload like so: https://www.digitalocean.com/community/tutorials/how-to-use-node-js-and-github-webhooks-to-keep-remote-projects-in-sync
But if you just want to create a single signature for single payload, to unit test your endpoints, that seems like a overkill.
Fortunately IT swiss army knife CyberChef exists.
And it contains HMAC recipe