wx

package
v0.0.0-...-3311072 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

Client wx Client

func (*Client) CheckFinger

func (c *Client) CheckFinger(finger structs.FingerRequest, accessToken string) (*structs.FingerResponse, error)

CheckFinger ...

func (*Client) DecryptPhoneNumber

func (c *Client) DecryptPhoneNumber(ssk, data, iv string) (phone PhoneNumber, err error)

DecryptPhoneNumber decrypt phone number

func (*Client) DecryptUserInfo

func (c *Client) DecryptUserInfo(rawData, encryptedData, signature, iv, ssk string) (ui UserInfo, err error)

DecryptUserInfo decrypt the user information

func (*Client) GetAccessToken

func (c *Client) GetAccessToken(appID string, secret string) (string, error)

GetAccessToken ...

func (*Client) GetWXQrCode

func (c *Client) GetWXQrCode(token string, scene string) (image.Image, error)

GetWXQrCode get WeChat qr code

func (*Client) WXLogin

func (c *Client) WXLogin(appID string, secret string, code string) (lres LoginResponse, err error)

WXLogin get the login data

type ClientCfg

type ClientCfg struct {
	Enabled bool
	AppID   string
	Secret  string
	Name    string
	Env     string
}

ClientCfg ...

type GetWXQRCodeRequest

type GetWXQRCodeRequest struct {
	Scene     string      `json:"scene"`
	Width     int64       `json:"width"`
	AutoColor bool        `json:"auto_color"`
	LineColor interface{} `json:"line_color"`
	IsHyaLine bool        `json:"is_hyaline"`
}

GetWXQRCodeRequest ...

type IWXClient

type IWXClient interface {
	WXLogin(appID string, secret string, code string) (lres LoginResponse, err error)
	DecryptUserInfo(rawData, encryptedData, signature, iv, ssk string) (ui UserInfo, err error)
	DecryptPhoneNumber(ssk, data, iv string) (phone PhoneNumber, err error)
	CheckFinger(finger structs.FingerRequest, accessToken string) (*structs.FingerResponse, error)
	GetWXQrCode(token string, scene string) (image.Image, error)
	GetAccessToken(appID string, secret string) (string, error)
}

IWXClient defines the wx client interface

func NewWXBackend

func NewWXBackend(config *ClientCfg) (IWXClient, error)

NewWXBackend returns a handle to the agent endpoints

type LoginResponse

type LoginResponse struct {
	OpenID     string `json:"openid"`
	SessionKey string `json:"session_key"`
	UnionID    string `json:"unionid"`
}

LoginResponse defines the login response

type PhoneNumber

type PhoneNumber struct {
	PhoneNumber     string    `json:"phoneNumber"`
	PurePhoneNumber string    `json:"purePhoneNumber"`
	CountryCode     string    `json:"countryCode"`
	Watermark       watermark `json:"watermark"`
}

PhoneNumber defines the phone number

type Response

type Response struct {
	ErrCode int    `json:"errcode"`
	ErrMsg  string `json:"errmsg"`
}

Response defines the struct of wx base data

type UserInfo

type UserInfo struct {
	OpenID    string    `json:"openId"`
	Nickname  string    `json:"nickName"`
	Gender    int       `json:"gender"`
	Province  string    `json:"province"`
	Language  string    `json:"language"`
	Country   string    `json:"country"`
	City      string    `json:"city"`
	Avatar    string    `json:"avatarUrl"`
	UnionID   string    `json:"unionId"`
	Watermark watermark `json:"watermark"`
}

UserInfo defines the user information

Directories

Path Synopsis
Package mock_wx is a generated GoMock package.
Package mock_wx is a generated GoMock package.

Jump to

Keyboard shortcuts

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