Files
Nip-05-api/internal/webhook/signer.go
2026-04-29 02:35:00 +00:00

17 lines
263 B
Go

package webhook
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
)
func Sign(secret string, body []byte) string {
if secret == "" {
return ""
}
mac := hmac.New(sha256.New, []byte(secret))
mac.Write(body)
return hex.EncodeToString(mac.Sum(nil))
}