fix highwayhash

This commit is contained in:
Tejal Desai
2019-12-21 12:18:09 -08:00
committed by Cole Wippern
parent 5a2cfeabba
commit 6b020a1f97
806 changed files with 188665 additions and 226974 deletions
+3 -3
View File
@@ -175,19 +175,19 @@ func ValidatePayload(r *http.Request, secretKey []byte) (payload []byte, err err
}
sig := r.Header.Get(signatureHeader)
if err := ValidateSignature(sig, body, secretKey); err != nil {
if err := validateSignature(sig, body, secretKey); err != nil {
return nil, err
}
return payload, nil
}
// ValidateSignature validates the signature for the given payload.
// validateSignature validates the signature for the given payload.
// signature is the GitHub hash signature delivered in the X-Hub-Signature header.
// payload is the JSON payload sent by GitHub Webhooks.
// secretKey is the GitHub Webhook secret message.
//
// GitHub API docs: https://developer.github.com/webhooks/securing/#validating-payloads-from-github
func ValidateSignature(signature string, payload, secretKey []byte) error {
func validateSignature(signature string, payload, secretKey []byte) error {
messageMAC, hashFunc, err := messageMAC(signature)
if err != nil {
return err