sign

package
v1.0.1001 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// 时间戳字段名
	KeyNameTimeStamp = "timestamp"

	// 随机数
	KeyNameNonceStr = "nonce_str"

	// app_id
	KeyNameAppID = "app_id"

	// 签名key
	KeyNameSignKey = "key"

	// 签名
	KeyNameSign = "sign"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

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

*

  • 验证 *
  • @create 2021-8-28
  • @author deatil

func NewCheck

func NewCheck() *Check

实例化

func (*Check) CheckData

func (this *Check) CheckData() (bool, error)

检测数据

func (*Check) CheckKeys

func (this *Check) CheckKeys() error

检测字段

func (*Check) CheckSign

func (this *Check) CheckSign(data string, signData string) bool

检测签名

func (*Check) CheckTimeStamp

func (this *Check) CheckTimeStamp() error

检查时间戳

func (*Check) GetAppID

func (this *Check) GetAppID() string

获取 AppId

func (*Check) GetConfig

func (this *Check) GetConfig(name string) interface{}

获取配置

func (*Check) GetData

func (this *Check) GetData(key string) string

返回单个

func (*Check) GetDataInt64

func (this *Check) GetDataInt64(key string) int64

返回单个 int64

func (*Check) GetDataWithoutSign

func (this *Check) GetDataWithoutSign() map[string]string

获取不包含 sign 字段的数据

func (*Check) GetNonceStr

func (this *Check) GetNonceStr() string

返回随机字符

func (*Check) GetSign

func (this *Check) GetSign() string

获取签名

func (*Check) GetTimestamp

func (this *Check) GetTimestamp() int64

获取时间戳

func (*Check) MustHasKeys

func (this *Check) MustHasKeys(keys ...string) error

必须包含指定的字段参数

func (*Check) String

func (this *Check) String() string

返回字符

func (*Check) WithConfig

func (this *Check) WithConfig(config map[string]interface{}) *Check

设置配置

func (*Check) WithData

func (this *Check) WithData(key string, value string) *Check

批量设置

func (*Check) WithDatas

func (this *Check) WithDatas(data map[string]string) *Check

批量设置

func (*Check) WithDriver

func (this *Check) WithDriver(driver interfaces.Driver) *Check

func (*Check) WithTimeout

func (this *Check) WithTimeout(timeout int64) *Check

设置过期时间

type Sign

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

*

  • 签名 *
  • @create 2021-8-28
  • @author deatil

func NewSign

func NewSign() *Sign

实例化

func (*Sign) CreateSign

func (this *Sign) CreateSign(data string) string

生成签名

func (*Sign) GetAppID

func (this *Sign) GetAppID() string

获取 AppId

func (*Sign) GetConfig

func (this *Sign) GetConfig(name string) interface{}

获取配置

func (*Sign) GetData

func (this *Sign) GetData(key string) string

返回单个

func (*Sign) GetDatas

func (this *Sign) GetDatas() map[string]string

返回全部

func (*Sign) GetDriver

func (this *Sign) GetDriver() interfaces.Driver

获取驱动

func (*Sign) GetNonceStr

func (this *Sign) GetNonceStr() string

返回随机字符

func (*Sign) GetSignDataString

func (this *Sign) GetSignDataString() (string, error)

获取要签名的字符

func (*Sign) GetSignKey

func (this *Sign) GetSignKey() string

获取签名key

func (*Sign) GetSignMap

func (this *Sign) GetSignMap() map[string]string

获取生成的所有数据

func (*Sign) GetTimestamp

func (this *Sign) GetTimestamp() string

获取时间戳

func (*Sign) MakeSign

func (this *Sign) MakeSign() (string, error)

生成签名

func (*Sign) String

func (this *Sign) String() string

返回字符

func (*Sign) WithAppID

func (this *Sign) WithAppID(appID string) *Sign

设置 AppId

func (*Sign) WithConfig

func (this *Sign) WithConfig(config map[string]interface{}) *Sign

设置配置

func (*Sign) WithData

func (this *Sign) WithData(key string, value string) *Sign

添加签名体字段和值

func (*Sign) WithDatas

func (this *Sign) WithDatas(data map[string]string) *Sign

批量设置

func (*Sign) WithDriver

func (this *Sign) WithDriver(driver interfaces.Driver) *Sign

设置驱动

func (*Sign) WithNonceStr

func (this *Sign) WithNonceStr(nonce string) *Sign

设置随机字符

func (*Sign) WithSignKey

func (this *Sign) WithSignKey(signKey string) *Sign

设置签名key

func (*Sign) WithTimestamp

func (this *Sign) WithTimestamp(ts int64) *Sign

设置时间戳

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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