hmacvalidator

package
v13.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 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

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