Files
GitHop/services/control-plane/internal/gitea/webhook.go
T
Hop d9544b435b Add the runnable Gitea, PostgreSQL, and Hop control-plane foundation
Hop-State: A_06FN3QYA1N56NQYGZ81DWGR
Hop-Proposal: R_06FN3QXJRYPPEQZQA6S69QG
Hop-Task: T_06FN3MVGY3MT82ESQ89BND0
Hop-Attempt: AT_06FN3MVGY092BFA5MR9C7EG
2026-07-11 08:50:48 -07:00

18 lines
337 B
Go

package gitea
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
)
func VerifySignature(body []byte, signature, secret string) bool {
provided, err := hex.DecodeString(signature)
if err != nil {
return false
}
mac := hmac.New(sha256.New, []byte(secret))
_, _ = mac.Write(body)
return hmac.Equal(provided, mac.Sum(nil))
}