Documentation ¶
Index ¶
- Constants
- Variables
- func AESDecryptMsg(ciphertext []byte, aesKey []byte) (random, rawXMLMsg, appID []byte, err error)
- func AESEncryptMsg(random, rawXMLMsg []byte, appID string, aesKey []byte) (ciphertext []byte)
- func DecryptMsg(appID, encryptedMsg, aesKey string) (random, rawMsgXMLBytes []byte, err error)
- func EncryptMsg(random, rawXMLMsg []byte, appID, aesKey string) (encrtptMsg []byte, err error)
- func GetKey(parts ...string) string
- func MD5Sum(txt string) (sum string)
- func RandomStr(length int) string
- func Signature(params ...string) string
- type AccessToken
- type AccessTokenAccessAt
- type App
- type CheckUserAccessTokenArg
- type CheckUserAccessTokenReply
- type Config
- type CreateAppArg
- type CreateAppReply
- type DeleteAppArg
- type DeleteAppReply
- type GetAccessTokenArg
- type GetAccessTokenReply
- type GetAppArg
- type GetAppReply
- type GetAuthUrlArg
- type GetAuthUrlReply
- type GetUserAccessTokenArg
- type GetUserAccessTokenReply
- type GetUserInfoArg
- type GetUserInfoReply
- type RefreshAccessToken
- type RefreshUserAccessTokenArg
- type RefreshUserAccessTokenReply
- type UpdateAppArg
- type UpdateAppReply
- type Wechat
- func (this *Wechat) CheckUserAccessToken(arg *CheckUserAccessTokenArg) (reply *CheckUserAccessTokenReply, err error)
- func (this *Wechat) Close() error
- func (this *Wechat) CreateApp(arg *CreateAppArg) (*CreateAppReply, error)
- func (this *Wechat) DeleteApp(arg *DeleteAppArg) (*DeleteAppReply, error)
- func (this *Wechat) GetAccessToken(arg *GetAccessTokenArg) (*GetAccessTokenReply, error)
- func (this *Wechat) GetApp(arg *GetAppArg) (*GetAppReply, error)
- func (this *Wechat) GetAuthUrl(arg *GetAuthUrlArg) (*GetAuthUrlReply, error)
- func (this *Wechat) GetUserAccessToken(arg *GetUserAccessTokenArg) (reply *GetUserAccessTokenReply, err error)
- func (this *Wechat) GetUserInfo(arg *GetUserInfoArg) (reply *GetUserInfoReply, err error)
- func (this *Wechat) RefreshUserAccessToken(arg *RefreshUserAccessTokenArg) (reply *RefreshUserAccessTokenReply, err error)
- func (this *Wechat) UpdateApp(arg *UpdateAppArg) (*UpdateAppReply, error)
Constants ¶
View Source
const ( Prefix = "wechat" PrefixApp = "wechat/app" PrefixAccessToken = "wechat/accesstoken" PrefixRefreshAccessToken = "wechat/refreshaccesstoken" PrefixAccessAt = "wechat/accessat" PrefixLock = "lock" StateNormal = 0 // 正常 StateInvalid = 1 // 上报失效. 不能使用 StateNeedRefresh = 2 StateUpdatedDirectly = 3 // 手动更新的,更新检测版本 )
Variables ¶
View Source
var (
ErrAppNotFound = errors.New("app not found")
)
Functions ¶
func AESDecryptMsg ¶
AESDecryptMsg ciphertext = AES_Encrypt[random(16B) + msg_len(4B) + rawXMLMsg + appId] 参考:github.com/chanxuehong/wechat.v2
func AESEncryptMsg ¶
AESEncryptMsg ciphertext = AES_Encrypt[random(16B) + msg_len(4B) + rawXMLMsg + appId] 参考:github.com/chanxuehong/wechat.v2
func DecryptMsg ¶
DecryptMsg 消息解密
func EncryptMsg ¶
Types ¶
type AccessToken ¶
type AccessToken struct { AppId string `json:"appId,omitempty"` AccessToken string `json:"accessToken,omitempty"` Rev int64 `json:"-"` State int `json:"-"` ExpiresAt int64 `json:"expiresAt,omitempty"` }
func (*AccessToken) Clone ¶
func (this *AccessToken) Clone() *AccessToken
func (*AccessToken) Decode ¶
func (this *AccessToken) Decode(b []byte) error
func (*AccessToken) Encode ¶
func (this *AccessToken) Encode() []byte
func (*AccessToken) IsInvalid ¶
func (this *AccessToken) IsInvalid() bool
func (*AccessToken) IsNeedRefresh ¶
func (this *AccessToken) IsNeedRefresh() bool
type AccessTokenAccessAt ¶
func (*AccessTokenAccessAt) Decode ¶
func (this *AccessTokenAccessAt) Decode(b []byte) error
func (*AccessTokenAccessAt) Encode ¶
func (this *AccessTokenAccessAt) Encode() []byte
type CheckUserAccessTokenArg ¶
type CheckUserAccessTokenArg = api.CheckUserAccessTokenArg
type CheckUserAccessTokenReply ¶
type CheckUserAccessTokenReply = api.CheckUserAccessTokenReply
type Config ¶
type Config struct { ApiDomain string `json:"apiDomain,omitempty"` AccessAtUpdateTime int64 `json:"accessAtUpdateTime,omitempty"` DropAccessTokenNotUseTime int64 `json:"dropAccessTokenNotUseTime,omitempty"` EtcdCliName string `json:"etcdCliName,omitempty"` RestyCliName string `json:"restyCliName,omitempty"` Logger *logrus.Logger `json:"-"` EtcdCli *clientv3.Client `json:"-"` RestyCli *resty.Client `json:"-"` }
type CreateAppArg ¶
type CreateAppArg = App
type CreateAppReply ¶
type CreateAppReply struct{}
type DeleteAppArg ¶
type DeleteAppArg struct {
AppId string
}
type DeleteAppReply ¶
type DeleteAppReply struct{}
type GetAccessTokenArg ¶
type GetAccessTokenReply ¶
type GetAccessTokenReply = AccessToken
type GetAppReply ¶
type GetAppReply = App
type GetAuthUrlArg ¶
type GetAuthUrlArg = api.GetAuthUrlArg
type GetAuthUrlReply ¶
type GetAuthUrlReply = api.GetAuthUrlReply
type GetUserAccessTokenArg ¶
type GetUserAccessTokenArg = api.GetUserAccessTokenArg
type GetUserAccessTokenReply ¶
type GetUserAccessTokenReply = api.GetUserAccessTokenReply
type GetUserInfoArg ¶
type GetUserInfoArg = api.GetUserInfoArg
type GetUserInfoReply ¶
type GetUserInfoReply = api.GetUserInfoReply
type RefreshAccessToken ¶
func (*RefreshAccessToken) Decode ¶
func (this *RefreshAccessToken) Decode(b []byte) error
func (*RefreshAccessToken) Encode ¶
func (this *RefreshAccessToken) Encode() []byte
type RefreshUserAccessTokenArg ¶
type RefreshUserAccessTokenArg = api.RefreshUserAccessTokenArg
type RefreshUserAccessTokenReply ¶
type RefreshUserAccessTokenReply = api.RefreshUserAccessTokenReply
type UpdateAppArg ¶
type UpdateAppArg = App
type UpdateAppReply ¶
type UpdateAppReply struct{}
type Wechat ¶
type Wechat struct {
// contains filtered or unexported fields
}
func (*Wechat) CheckUserAccessToken ¶
func (this *Wechat) CheckUserAccessToken(arg *CheckUserAccessTokenArg) (reply *CheckUserAccessTokenReply, err error)
func (*Wechat) CreateApp ¶
func (this *Wechat) CreateApp(arg *CreateAppArg) (*CreateAppReply, error)
func (*Wechat) DeleteApp ¶
func (this *Wechat) DeleteApp(arg *DeleteAppArg) (*DeleteAppReply, error)
func (*Wechat) GetAccessToken ¶
func (this *Wechat) GetAccessToken(arg *GetAccessTokenArg) (*GetAccessTokenReply, error)
func (*Wechat) GetAuthUrl ¶
func (this *Wechat) GetAuthUrl(arg *GetAuthUrlArg) (*GetAuthUrlReply, error)
func (*Wechat) GetUserAccessToken ¶
func (this *Wechat) GetUserAccessToken(arg *GetUserAccessTokenArg) (reply *GetUserAccessTokenReply, err error)
func (*Wechat) GetUserInfo ¶
func (this *Wechat) GetUserInfo(arg *GetUserInfoArg) (reply *GetUserInfoReply, err error)
func (*Wechat) RefreshUserAccessToken ¶
func (this *Wechat) RefreshUserAccessToken(arg *RefreshUserAccessTokenArg) (reply *RefreshUserAccessTokenReply, err error)
func (*Wechat) UpdateApp ¶
func (this *Wechat) UpdateApp(arg *UpdateAppArg) (*UpdateAppReply, error)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.