Documentation ¶
Index ¶
- func CalculateHmac(data interface{}, secret string) (string, error)
- func GetDataToSign(notificationRequestItem interface{}) string
- func ValidateHmac(notificationRequestItem webhook.NotificationRequestItem, key string) bool
- func ValidateHmacPayload(hmacSignature string, key string, payload string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateHmac ¶
CalculateHmac calculates the SHA-256 HMAC for the given data and key
func GetDataToSign ¶
func GetDataToSign(notificationRequestItem interface{}) string
GetDataToSign converts a notificationRequestItem to string, which later on can be used for calculating a HMAC
func ValidateHmac ¶
func ValidateHmac(notificationRequestItem webhook.NotificationRequestItem, key string) bool
ValidateHmac validates the HMAC signature of the NotificationRequestItem object. Use for webhooks that provide the hmacSignature as part of the payload `AdditionalData` (i.e. Payments)
Params: notificationRequestItem: NotificationRequestItem object key: HMAC key to generate the signature
func ValidateHmacPayload ¶
ValidateHmacPayload validates the HMAC signature of a payload against an expected signature. Use for webhooks that provide the hmacSignature in the HTTP header (i.e. Banking, Management API)
Params: hmacSignature: HMAC signature to validate key: HMAC key to generate the signature payload: webhook payload
Types ¶
This section is empty.