signature

package
v0.0.49 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Signature

type Signature interface {

	// Generate 生成签名
	Generate(path string, method string, params url.Values) (authorization, date string, err error)

	// Verify 验证签名
	Verify(authorization, date string, path string, method string, params url.Values) (ok bool, err error)
	// contains filtered or unexported methods
}

func New

func New(key, secret string, ttl time.Duration) Signature

type SignatureConfig added in v0.0.49

type SignatureConfig struct {
	TokenKey       string `yaml:"tokenKey"`       // X-Signature, 签名验证 Authorization,Header 中传递的参数
	TokenDateKey   string `yaml:"tokenDateKey"`   // X-Signature-Date, 签名验证 Date,Header 中传递的参数
	Timeout        string `yaml:"timeout"`        // time.Minute * 2, 签名有效期为 2 分钟
	RedisKeyPrefix string `yaml:"redisKeyPrefix"` // default is "signature"
}

Jump to

Keyboard shortcuts

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