mirror of
https://github.com/adnanh/webhook.git
synced 2025-05-15 10:04:44 +00:00
fixed payload-hash-sha1 for github header
This commit is contained in:
parent
40d01e4d5a
commit
0b269e4870
1 changed files with 4 additions and 0 deletions
|
@ -12,6 +12,10 @@ import (
|
|||
|
||||
// CheckPayloadSignature calculates and verifies SHA1 signature of the given payload
|
||||
func CheckPayloadSignature(payload []byte, secret string, signature string) (string, bool) {
|
||||
if strings.HasPrefix(signature, "sha1=") {
|
||||
signature = signature[5:]
|
||||
}
|
||||
|
||||
mac := hmac.New(sha1.New, []byte(secret))
|
||||
mac.Write(payload)
|
||||
expectedMAC := hex.EncodeToString(mac.Sum(nil))
|
||||
|
|
Loading…
Add table
Reference in a new issue