MCPcopy
hub / github.com/semaphoreui/semaphore / hmacHashPayload

Function hmacHashPayload

api/integration.go:43–48  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

41// see https://developer.github.com/webhooks/securing/#validating-payloads-from-github
42// returning the hash as a hexadecimal string
43func 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
50type IntegrationController struct {
51 integrationService server.IntegrationService

Callers 1

isValidHmacPayloadFunction · 0.85

Calls 1

WriteMethod · 0.80

Tested by

no test coverage detected