hmacprovider

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2025 License: Apache-2.0 Imports: 9 Imported by: 2

Documentation

Index

Constants

View Source
const (
	DefaultKeyInterval = 5 * time.Minute
	MaxInputSize       = 32 * 1024 * 1024 // 32MB
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HMACProvider

type HMACProvider struct {
	// contains filtered or unexported fields
}

func NewHmacProvider

func NewHmacProvider(secretKey *secure.Credential, opts ...HMACProviderOption) *HMACProvider

func (*HMACProvider) SHA256Sign

func (h *HMACProvider) SHA256Sign(data io.Reader) (string, error)

SHA256Sign generate a simple SHA256 HMAC, no nounce, no timestamp

func (*HMACProvider) SHA256Verify

func (h *HMACProvider) SHA256Verify(data io.Reader, hash string) (bool, error)

SHA256Verify verify a simple SHA256 HMAC, no nounce, no timestamp the hash must be a hex-encoded sha256 hash

func (*HMACProvider) Sign256

func (h *HMACProvider) Sign256(data io.Reader) (hash string, timestamp string, nonce string, err error)

Sign256 generates a HMAC256 signature using timestamp and nonce

func (*HMACProvider) Verify256

func (h *HMACProvider) Verify256(data io.Reader, hash string, timestamp string, nonce string) (bool, error)

Verify256 verifies a HMAC256 signature using timestamp and nonce

type HMACProviderOption

type HMACProviderOption func(*HMACProvider)

func WithKeyInterval

func WithKeyInterval(interval time.Duration) HMACProviderOption

func WithMaxInputSize

func WithMaxInputSize(maxInputSize int) HMACProviderOption

func WithNonceStore

func WithNonceStore(nonceStore store.NonceStore) HMACProviderOption

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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