Documentation
¶
Index ¶
- Constants
- Variables
- func NewWXDataCrypt(appId string, sessionKey string) *wxDataCrypt
- type EncryptedData
- type UserInfo
- type WXAuthorization
- type WXLogin
- func (wx *WXLogin) Check(rawData, signature, session_key string) bool
- func (wx *WXLogin) Code2Session(code string) (wxa *WXAuthorization, err error)
- func (wx *WXLogin) DecryptPhoneNumber(encryptedData, iv, sessionKey string) (wpn *WXPhoneNumber, err error)
- func (wx *WXLogin) DecryptUserInfo(encryptedData, iv, sessionKey string) (wxu *EncryptedData, err error)
- func (wx *WXLogin) GetUserInfo(accessToken, openid string) (wxu *EncryptedData, err error)
- func (wx *WXLogin) Login(encryptedData, iv, code string) (wxu *WXUserInfo, err error)
- type WXPhoneNumber
- type WXUserInfo
Constants ¶
View Source
const ( ReturnErrCodeKey = "errcode" ReturnErrMsgKey = "errmsg" ReturnOpenIDKey = "openid" ReturnSessionKey = "session_key" )
Variables ¶
View Source
var ( ErrLoginParamError = errors.New("wxLogin param error") ErrEncryptedDataError = errors.New("encryptedData errors") )
Functions ¶
func NewWXDataCrypt ¶
Types ¶
type EncryptedData ¶
type EncryptedData struct { OpenId string `json:"openId"` NickName string `json:"nickName"` Gender byte `json:"gender"` City string `json:"city"` Province string `json:"province"` Country string `json:"country"` AvatarUrl string `json:"avatarUrl"` UnionId string `json:"unionId"` }
加密数据
type UserInfo ¶
type UserInfo struct { NickName string `json:"nickName"` Gender byte `json:"gender"` City string `json:"city"` Province string `json:"province"` Country string `json:"country"` Language string `json:"language"` AvatarUrl string `json:"avatarUrl"` }
微信用户信息
type WXAuthorization ¶
type WXLogin ¶
func (*WXLogin) Code2Session ¶
func (wx *WXLogin) Code2Session(code string) (wxa *WXAuthorization, err error)
临时登录凭证code
func (*WXLogin) DecryptPhoneNumber ¶
func (wx *WXLogin) DecryptPhoneNumber(encryptedData, iv, sessionKey string) (wpn *WXPhoneNumber, err error)
加密数据( encryptedData )进行解密
func (*WXLogin) DecryptUserInfo ¶
func (wx *WXLogin) DecryptUserInfo(encryptedData, iv, sessionKey string) (wxu *EncryptedData, err error)
用户信息加密数据( encryptedData )进行解密
func (*WXLogin) GetUserInfo ¶
func (wx *WXLogin) GetUserInfo(accessToken, openid string) (wxu *EncryptedData, err error)
type WXPhoneNumber ¶
type WXUserInfo ¶
type WXUserInfo struct { Userinfo EncryptedData `json:"userinfo"` SessionKey string `json:"skey"` //会话密钥 }
Click to show internal directories.
Click to hide internal directories.