hmacvalidator

package
v9.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalculateHmac

func CalculateHmac(data interface{}, secret string) (string, error)

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 added in v9.2.0

func ValidateHmacPayload(hmacSignature string, key string, payload string) bool

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL