credential

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (

	//CacheKeyOfficialAccountPrefix 微信公众号cache key前缀
	CacheKeyOfficialAccountPrefix = "gowechat_officialaccount_"
	//CacheKeyMiniProgramPrefix 小程序cache key前缀
	CacheKeyMiniProgramPrefix = "gowechat_miniprogram_"
)

Variables

This section is empty.

Functions

func GetSignature

func GetSignature(body string, pem string) string

GetSignature 获取签名信息

Types

type AccessTokenHandle

type AccessTokenHandle interface {
	GetAccessToken() (accessToken string, err error)
}

AccessTokenHandle AccessToken 接口

func NewDefaultAccessToken

func NewDefaultAccessToken(appID, appSecret, cacheKeyPrefix string, cache cache.Cache) AccessTokenHandle

NewDefaultAccessToken new DefaultAccessToken

type AuthorizationHandle

type AuthorizationHandle interface {
	GetAuthorization(method, url, timestamp, nonceStr string, body []byte) (authorization string, err error)
}

AuthorizationHandle 获取微信支付的认证信息

func NewDefaultAuthorization

func NewDefaultAuthorization(mchID, serialNo string) AuthorizationHandle

NewDefaultAuthorization 创建微信支付的认证信息

type DefaultAccessToken

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

DefaultAccessToken 默认AccessToken 获取

func (*DefaultAccessToken) GetAccessToken

func (ak *DefaultAccessToken) GetAccessToken() (accessToken string, err error)

GetAccessToken 获取access_token,先从cache中获取,没有则从服务端获取

type DefaultAuthorization

type DefaultAuthorization struct {
	SerialNo string
	MchID    string
}

DefaultAuthorization 微信支付的认证信息

func (*DefaultAuthorization) GetAuthorization

func (da *DefaultAuthorization) GetAuthorization(method, url, timestamp, nonceStr string, body []byte) (authorization string, err error)

GetAuthorization 获取认证信息

type ResAccessToken

type ResAccessToken struct {
	common.Error

	AccessToken string `json:"access_token"`
	ExpiresIn   int64  `json:"expires_in"`
}

ResAccessToken struct

func GetTokenFromServer

func GetTokenFromServer(appID, appSecret string) (resAccessToken ResAccessToken, err error)

GetTokenFromServer 强制从微信服务器获取token

Jump to

Keyboard shortcuts

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