auth

package
v0.0.0-...-59ebc2b Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

type Credentials struct {
	AccessKey string
	SecretKey string
}

Credentials 鉴权类,用于生成请求签名签名 https://developer.danghongyun.com/rest_api_new.html 文档

func New

func New(accessKey, secretKey string) *Credentials

New 构建一个Credentials对象

func (*Credentials) NewSignParams

func (ath *Credentials) NewSignParams(action string, version, timestamp string) map[string]string

NewSignParams new signparmas

func (*Credentials) Sign

func (ath *Credentials) Sign(action string, version string, timestamp int64) (signature string)

Sign 生成签名 action: action version: version timestamp: timestamp 毫秒 signature:请求签名,签名生成规则:对所有参数按照名称排序(CASE_INSENSITIVE_ORDER)生成一个字符串,并在字符串头上加上accessSecret,然后对该字符串调用[HmacSHA256](http://en.wikipedia.org/wiki/Hash-based_message_authentication_code) 算法生成signature。 每一个API,根据输入参数的不同,生成的签名都是不同的。

func (*Credentials) Sign2

func (ath *Credentials) Sign2(action string, version, timestamp string) (queryString, signature string)

Sign2 sign

func (*Credentials) SignExt

func (ath *Credentials) SignExt(queryParams map[string]string) (queryString, signature string)

SignExt sign

Jump to

Keyboard shortcuts

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