Documentation
¶
Index ¶
- Constants
- type HMACProvider
- func (h *HMACProvider) SHA256Sign(data io.Reader) (string, error)
- func (h *HMACProvider) SHA256Verify(data io.Reader, hash string) (bool, error)
- func (h *HMACProvider) Sign256(data io.Reader) (hash string, timestamp string, nonce string, err error)
- func (h *HMACProvider) Verify256(data io.Reader, hash string, timestamp string, nonce string) (bool, error)
- type HMACProviderOption
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 ¶
SHA256Verify verify a simple SHA256 HMAC, no nounce, no timestamp the hash must be a hex-encoded sha256 hash
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
Click to show internal directories.
Click to hide internal directories.