Documentation
¶
Index ¶
- func AesCBCDecrypt(ciphertext, key []byte) ([]byte, error)
- func AesCBCEncrypt(plantText, key []byte) ([]byte, error)
- func GetSignature(msg, token, timestamp, nonce string) (signature string)
- func PKCS7Padding(ciphertext []byte, blockSize int) []byte
- func PKCS7UnPadding(plantText []byte, blockSize int) []byte
- type Authorizer
- func (a *Authorizer) CodeToAccessToken(code string) (token *JUserAccessToken, err error)
- func (a *Authorizer) GetAuthorizerAccessToken() (token *JAuthorizerAccessToken, err error)
- func (a *Authorizer) GetAuthorizerInfo() (authorizer *JAuthorizer, err error)
- func (a *Authorizer) GetWecaht() (w *wechat.Wechat)
- type Component
- func (c *Component) AuthEventTicket(msg, signature, timestamp, nonce string) (event *XCEvent, err error)
- func (c *Component) CheckSignature(signature, msg, timestamp, nonce string) bool
- func (c *Component) GetComponentAccessToken() (token *JComponenAccessToken, err error)
- func (c *Component) GetPreAuthCode() (authcode JPreAuthCode, err error)
- func (c *Component) MsgDecrypt(data string) (result string, err error)
- func (c *Component) MsgEncrypt(data string) (result string, err error)
- func (c *Component) NewAuthorizer(appid, accesstoken string, tokenexpires int64, refreshtoken string) (authorizer *Authorizer, err error)
- func (c *Component) QueryAuth(code string) (authorizer *Authorizer, err error)
- type JAuthorizationInfo
- type JAuthorizer
- type JAuthorizerAccessToken
- type JAuthorizerInfo
- type JBusinessInfo
- type JComponenAccessToken
- type JFuncInfo
- type JFuncscopeCategory
- type JPreAuthCode
- type JSONError
- type JTypeInfo
- type JUserAccessToken
- type XCEvent
- type XEncryptMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSignature ¶
GetSignature 获取签名信息
func PKCS7UnPadding ¶
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 获取授权详细信息
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 ¶
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 ¶
MsgDecrypt 消息解密
func (*Component) MsgEncrypt ¶
MsgEncrypt 消息加密
func (*Component) NewAuthorizer ¶
func (c *Component) NewAuthorizer(appid, accesstoken string, tokenexpires int64, refreshtoken string) (authorizer *Authorizer, err error)
NewAuthorizer 新建Authorizer
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 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 ¶
XEncryptMsg 消息