Documentation
¶
Index ¶
- type Auth
- func (auth *Auth) CheckEncryptedData(encryptedMsgHash string) (result RspCheckEncryptedData, err error)
- func (auth *Auth) CheckEncryptedDataContext(ctx context2.Context, encryptedMsgHash string) (result RspCheckEncryptedData, err error)
- func (auth *Auth) CheckSession(signature, openID string) error
- func (auth *Auth) Code2Session(jsCode string) (result ResCode2Session, err error)
- func (auth *Auth) Code2SessionContext(ctx context2.Context, jsCode string) (result ResCode2Session, err error)
- func (auth *Auth) GetPaidUnionID(req *GetPaidUnionIDRequest) (string, error)
- func (auth *Auth) GetPhoneNumber(code string) (*GetPhoneNumberResponse, error)
- func (auth *Auth) GetPhoneNumberContext(ctx context2.Context, code string) (*GetPhoneNumberResponse, error)
- func (auth *Auth) GetPluginOpenPID(code string) (string, error)
- func (auth *Auth) GetUserEncryptKey(signature, openID string) (*GetUserEncryptKeyResponse, error)
- func (auth *Auth) ResetUserSessionKey(signature, openID string) (*ResetUserSessionKeyResponse, error)
- type GetPaidUnionIDRequest
- type GetPaidUnionIDResponse
- type GetPhoneNumberResponse
- type GetPluginOpenPIDRequest
- type GetPluginOpenPIDResponse
- type GetUserEncryptKeyResponse
- type KeyInfo
- type PhoneInfo
- type ResCode2Session
- type ResetUserSessionKeyResponse
- type RspCheckEncryptedData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Auth ¶
Auth 登录/用户信息
func (*Auth) CheckEncryptedData ¶
func (auth *Auth) CheckEncryptedData(encryptedMsgHash string) (result RspCheckEncryptedData, err error)
CheckEncryptedData .检查加密信息是否由微信生成(当前只支持手机号加密数据),只能检测最近3天生成的加密数据
func (*Auth) CheckEncryptedDataContext ¶
func (auth *Auth) CheckEncryptedDataContext(ctx context2.Context, encryptedMsgHash string) (result RspCheckEncryptedData, err error)
CheckEncryptedDataContext .检查加密信息是否由微信生成(当前只支持手机号加密数据),只能检测最近3天生成的加密数据
func (*Auth) CheckSession ¶
CheckSession 检验登录态 see https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-login/checkSessionKey.html
func (*Auth) Code2Session ¶
func (auth *Auth) Code2Session(jsCode string) (result ResCode2Session, err error)
Code2Session 登录凭证校验。
func (*Auth) Code2SessionContext ¶
func (auth *Auth) Code2SessionContext(ctx context2.Context, jsCode string) (result ResCode2Session, err error)
Code2SessionContext 登录凭证校验。
func (*Auth) GetPaidUnionID ¶
func (auth *Auth) GetPaidUnionID(req *GetPaidUnionIDRequest) (string, error)
GetPaidUnionID 用户支付完成后,获取该用户的 UnionId,无需用户授权 see https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-info/basic-info/getPaidUnionid.html
func (*Auth) GetPhoneNumber ¶
func (auth *Auth) GetPhoneNumber(code string) (*GetPhoneNumberResponse, error)
GetPhoneNumber 小程序通过code获取用户手机号
func (*Auth) GetPhoneNumberContext ¶
func (auth *Auth) GetPhoneNumberContext(ctx context2.Context, code string) (*GetPhoneNumberResponse, error)
GetPhoneNumberContext 小程序通过code获取用户手机号
func (*Auth) GetPluginOpenPID ¶
GetPluginOpenPID 获取插件用户openPID see https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-info/basic-info/getPluginOpenPId.html
func (*Auth) GetUserEncryptKey ¶
func (auth *Auth) GetUserEncryptKey(signature, openID string) (*GetUserEncryptKeyResponse, error)
GetUserEncryptKey 获取用户encryptKey see https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-info/internet/getUserEncryptKey.html
func (*Auth) ResetUserSessionKey ¶
func (auth *Auth) ResetUserSessionKey(signature, openID string) (*ResetUserSessionKeyResponse, error)
ResetUserSessionKey 重置登录态 see https://developers.weixin.qq.com/miniprogram/dev/OpenApiDoc/user-login/ResetUserSessionKey.html
type GetPaidUnionIDRequest ¶
type GetPaidUnionIDRequest struct { OpenID string `json:"openid"` TransactionID string `json:"transaction_id,omitempty"` MchID string `json:"mch_id,omitempty"` OutTradeNo string `json:"out_trade_no,omitempty"` }
GetPaidUnionIDRequest 支付后获取UnionID请求
type GetPaidUnionIDResponse ¶
type GetPaidUnionIDResponse struct { util.CommonError UnionID string `json:"unionid"` }
GetPaidUnionIDResponse 支付后获取UnionID响应
type GetPhoneNumberResponse ¶
type GetPhoneNumberResponse struct { util.CommonError PhoneInfo PhoneInfo `json:"phone_info"` }
GetPhoneNumberResponse 新版获取用户手机号响应结构体
type GetPluginOpenPIDRequest ¶
type GetPluginOpenPIDRequest struct {
Code string `json:"code"`
}
GetPluginOpenPIDRequest 获取插件用户openPID请求
type GetPluginOpenPIDResponse ¶
type GetPluginOpenPIDResponse struct { util.CommonError OpenPID string `json:"openpid"` }
GetPluginOpenPIDResponse 获取插件用户openPID响应
type GetUserEncryptKeyResponse ¶
type GetUserEncryptKeyResponse struct { util.CommonError KeyInfoList []KeyInfo `json:"key_info_list"` }
GetUserEncryptKeyResponse 获取用户encryptKey响应
type KeyInfo ¶
type KeyInfo struct { EncryptKey string `json:"encrypt_key"` Version int64 `json:"version"` ExpireIn int64 `json:"expire_in"` Iv string `json:"iv"` CreateTime int64 `json:"create_time"` }
KeyInfo 用户最近三次的加密key
type PhoneInfo ¶
type PhoneInfo struct { PhoneNumber string `json:"phoneNumber"` // 用户绑定的手机号 PurePhoneNumber string `json:"purePhoneNumber"` // 没有区号的手机号 CountryCode string `json:"countryCode"` // 区号 WaterMark struct { Timestamp int64 `json:"timestamp"` AppID string `json:"appid"` } `json:"watermark"` // 数据水印 }
PhoneInfo 获取用户手机号内容
type ResCode2Session ¶
type ResCode2Session struct { util.CommonError OpenID string `json:"openid"` // 用户唯一标识 SessionKey string `json:"session_key"` // 会话密钥 UnionID string `json:"unionid"` // 用户在开放平台的唯一标识符,在满足UnionID下发条件的情况下会返回 }
ResCode2Session 登录凭证校验的返回结果
type ResetUserSessionKeyResponse ¶
type ResetUserSessionKeyResponse struct { util.CommonError OpenID string `json:"openid"` SessionKey string `json:"session_key"` }
ResetUserSessionKeyResponse 重置登录态响应
type RspCheckEncryptedData ¶
type RspCheckEncryptedData struct { util.CommonError Vaild bool `json:"vaild"` // 是否是合法的数据 CreateTime uint64 `json:"create_time"` // 加密数据生成的时间戳 }
RspCheckEncryptedData .