component

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AesCBCDecrypt

func AesCBCDecrypt(ciphertext, key []byte) ([]byte, error)

AesCBCDecrypt 解密

func AesCBCEncrypt

func AesCBCEncrypt(plantText, key []byte) ([]byte, error)

AesCBCEncrypt 加密

func GetSignature

func GetSignature(msg, token, timestamp, nonce string) (signature string)

GetSignature 获取签名信息

func PKCS7Padding

func PKCS7Padding(ciphertext []byte, blockSize int) []byte

PKCS7Padding PKCS7填充

func PKCS7UnPadding

func PKCS7UnPadding(plantText []byte, blockSize int) []byte

PKCS7UnPadding PKCS7删除

Types

type Authorizer

type Authorizer struct {
	*wechat.Wechat
	Component *Component
	// AuthorizerAppid        string
	// AuthorizerAccessToken  string
	// AccessTokenExpires     int64
	AuthorizerRefreshToken string
}

Authorizer Authorizer

func (*Authorizer) CodeToAccessToken

func (a *Authorizer) CodeToAccessToken(code string) (token *JUserAccessToken, err error)

CodeToAccessToken 通过code换取access_token

func (*Authorizer) GetAuthorizerAccessToken

func (a *Authorizer) GetAuthorizerAccessToken() (token *JAuthorizerAccessToken, err error)

GetAuthorizerAccessToken 获取Authorizer AccessToken

func (*Authorizer) GetAuthorizerInfo

func (a *Authorizer) GetAuthorizerInfo() (authorizer *JAuthorizer, err error)

GetAuthorizerInfo 获取授权详细信息

func (*Authorizer) GetWecaht

func (a *Authorizer) GetWecaht() (w *wechat.Wechat)

GetWecaht 获取微信方法

type Component

type Component struct {
	ComponentAppid        string
	ComponentAppsecret    string
	ComponentToken        string
	ComponentAesKey       string
	ComponentVerifyTicket string
	ComponentAccessToken  string
	AccessTokenExpires    int64
	AESKey                []byte
}

Component 第三平台信息

func NewComponent

func NewComponent(appid, appsecret, token, aeskey, verifyticket, accesstoken string, expires int64) (component *Component, err error)

NewComponent 新建第三方平台

func (*Component) AuthEventTicket

func (c *Component) AuthEventTicket(msg, signature, timestamp, nonce string) (event *XCEvent, err error)

AuthEventTicket 授权事件接收处理

func (*Component) CheckSignature

func (c *Component) CheckSignature(signature, msg, timestamp, nonce string) bool

CheckSignature 检查签名

func (*Component) GetComponentAccessToken

func (c *Component) GetComponentAccessToken() (token *JComponenAccessToken, err error)

GetComponentAccessToken 获取第三方AccessToken

func (*Component) GetPreAuthCode

func (c *Component) GetPreAuthCode() (authcode JPreAuthCode, err error)

GetPreAuthCode 获取预授权码

func (*Component) MsgDecrypt

func (c *Component) MsgDecrypt(data string) (result string, err error)

MsgDecrypt 消息解密

func (*Component) MsgEncrypt

func (c *Component) MsgEncrypt(data string) (result string, err error)

MsgEncrypt 消息加密

func (*Component) NewAuthorizer

func (c *Component) NewAuthorizer(appid, accesstoken string, tokenexpires int64, refreshtoken string) (authorizer *Authorizer, err error)

NewAuthorizer 新建Authorizer

func (*Component) QueryAuth

func (c *Component) QueryAuth(code string) (authorizer *Authorizer, err error)

QueryAuth 使用授权码换取公众号或小程序的接口调用凭据和授权信息

type JAuthorizationInfo

type JAuthorizationInfo struct {
	AuthorizerAppid        string      `json:"authorizer_appid"`
	AuthorizationAppid     string      `json:"authorization_appid"`
	AuthorizerAccessToken  string      `json:"authorizer_access_token"`
	ExpiresIn              int         `json:"expires_in"`
	AuthorizerRefreshToken string      `json:"authorizer_refresh_token"`
	FuncInfo               []JFuncInfo `json:"func_info"`
}

JAuthorizationInfo 授权信息

type JAuthorizer

type JAuthorizer struct {
	AuthorizerInfo    JAuthorizerInfo    `json:"authorizer_info"`
	AuthorizationInfo JAuthorizationInfo `json:"authorization_info"`
}

JAuthorizer 授权信息

type JAuthorizerAccessToken

type JAuthorizerAccessToken struct {
	AuthorizerAccessToken  string `json:"authorizer_access_token"`
	ExpiresIn              int    `json:"expires_in"`
	AuthorizerRefreshToken string `json:"authorizer_refresh_token"`
}

JAuthorizerAccessToken JAuthorizerAccessToken

type JAuthorizerInfo

type JAuthorizerInfo struct {
	NickName        string        `json:"nick_name"`
	HeadImg         string        `json:"head_img"`
	ServiceTypeInfo JTypeInfo     `json:"service_type_info"`
	VerifyTypeInfo  JTypeInfo     `json:"verify_type_info"`
	UserName        string        `json:"user_name"`
	PrincipalName   string        `json:"principal_name"`
	BusinessInfo    JBusinessInfo `json:"business_info"`
	Alias           string        `json:"alias"`
	QrcodeURL       string        `json:"qrcode_url"`
}

JAuthorizerInfo 授权信息

type JBusinessInfo

type JBusinessInfo struct {
	OpenStore int `json:"open_store"`
	OpenScan  int `json:"open_scan"`
	OpenPay   int `json:"open_pay"`
	OpenCard  int `json:"open_card"`
	OpenShake int `json:"open_shake"`
}

JBusinessInfo JBusinessInfo

type JComponenAccessToken

type JComponenAccessToken struct {
	ComponentAccessToken string `json:"component_access_token"`
	ExpiresIn            int    `json:"expires_in"`
}

JComponenAccessToken JComponenAccessToken

type JFuncInfo

type JFuncInfo struct {
	FuncscopeCategory JFuncscopeCategory `json:"funcscope_category"`
}

JFuncInfo 功能列表

type JFuncscopeCategory

type JFuncscopeCategory struct {
	ID int `json:"id"`
}

JFuncscopeCategory JFuncscopeCategory

type JPreAuthCode

type JPreAuthCode struct {
	PreAuthCode string `json:"pre_auth_code"`
	ExpiresIn   int    `json:"expires_in"`
}

JPreAuthCode 预授权码

type JSONError

type JSONError struct {
	Errcode int    `json:"errcode"`
	Errmsg  string `json:"errmsg"`
}

JSONError 微信错误

type JTypeInfo

type JTypeInfo struct {
	ID int `json:"id"`
}

JTypeInfo 类型信息

type JUserAccessToken

type JUserAccessToken struct {
	AccessToken  string `json:"access_token"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Openid       string `json:"openid"`
	Scope        string `json:"scope"`
}

JUserAccessToken 用户AccessToken

type XCEvent

type XCEvent struct {
	AppID                        string `xml:"AppId"`
	CreateTime                   string `xml:"CreateTime"`
	InfoType                     string `xml:"InfoType"`
	ComponentVerifyTicket        string `xml:"ComponentVerifyTicket"`
	AuthorizerAppid              string `xml:"AuthorizerAppid"`
	AuthorizationCode            string `xml:"AuthorizationCode"`
	AuthorizationCodeExpiredTime int    `xml:"AuthorizationCodeExpiredTime"`
	PreAuthCode                  string `xml:"PreAuthCode"`
}

XCEvent ticket协议和推送授权相关通知

type XEncryptMsg

type XEncryptMsg struct {
	AppID   string `xml:"AppId"`
	Encrypt string `xml:"Encrypt"`
}

XEncryptMsg 消息

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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