sdk: Players.VerifyAuth and VerifyWebhookSignature helper
CI / build (push) Successful in 55s

This commit is contained in:
edmand46
2026-08-28 13:36:03 +03:00
parent 989bd7646c
commit b57f170ba4
6 changed files with 66 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
package rudder
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
)
func VerifyWebhookSignature(secret string, body []byte, signature string) bool {
mac := hmac.New(sha256.New, []byte(secret))
mac.Write(body)
expected, err := hex.DecodeString(signature)
if err != nil {
return false
}
return hmac.Equal(mac.Sum(nil), expected)
}