hmacHashPayload computes the hash of payload's body according to the webhook's secret token see https://developer.github.com/webhooks/securing/#validating-payloads-from-github returning the hash as a hexadecimal string
(secret string, payloadBody []byte)
| 41 | // see https://developer.github.com/webhooks/securing/#validating-payloads-from-github |
| 42 | // returning the hash as a hexadecimal string |
| 43 | func hmacHashPayload(secret string, payloadBody []byte) string { |
| 44 | hm := hmac.New(sha256.New, []byte(secret)) |
| 45 | hm.Write(payloadBody) |
| 46 | sum := hm.Sum(nil) |
| 47 | return fmt.Sprintf("%x", sum) |
| 48 | } |
| 49 | |
| 50 | type IntegrationController struct { |
| 51 | integrationService server.IntegrationService |
no test coverage detected