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)) }