wxop

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CBCEncryptor

type CBCEncryptor struct {
	// contains filtered or unexported fields
}

CBCEncryptor 加解密核心类

func (*CBCEncryptor) Decrypt

func (p *CBCEncryptor) Decrypt(text, appid string) ([]byte, error)

Decrypt 解密

func (*CBCEncryptor) Encrypt

func (p *CBCEncryptor) Encrypt(text, appid string) (string, error)

Encrypt 加密

type EncryptResult

type EncryptResult struct {
	Encrypt      string `xml:"Encrypt" json:"Encrypt"`
	MsgSignature string `xml:"MsgSignature" json:"MsgSignature"`
	Timestamp    string `xml:"Timestamp" json:"Timestamp"`
	Nonce        string `xml:"Nonce" json:"Nonce"`
}

type Event

type Event struct {
	Token          string
	EncodingAESKey string
	Signature      string
	Timestamp      string
	Nonce          string
	Body           string
}

type EventHandler

type EventHandler func(input string) error

EventHandler 授权回调函数

type EventKind

type EventKind string
const (
	EventKindComponentVerifyTicket EventKind = "component_verify_ticket"
	EventKindAuthorized            EventKind = "authorized"
	EventKindUpdateAuthorized      EventKind = "updateauthorized"
	EventKindUnAuthorized          EventKind = "unauthorized"
)

type EventProcessor

type EventProcessor interface {
	Process(data []byte) (string, error) // 预处理
}

type Lib

type Lib interface {
	HandleEvent(event *Event, handlers map[EventKind]EventHandler) error // 处理授权事件
	GetAuthUrl(client, redirectUrl string, authType int) (string, error) // 获取授权链接
	GetComponentAccessToken() (string, error)                            // 获取第三方平台AccessToken
}

func New

func New(appId, appSecret string, redisProvider intf.RedisProvider) Lib

type PKCS7Encoder

type PKCS7Encoder struct {
	BlockSize int
}

PKCS7Encoder PKCS7填充

func (*PKCS7Encoder) Decode

func (p *PKCS7Encoder) Decode(decrypted []byte) []byte

Decode PKCS7去除填充

func (*PKCS7Encoder) Encode

func (p *PKCS7Encoder) Encode(text []byte) []byte

Encode PKCS7填充

type WXBizMsgCrypt

type WXBizMsgCrypt struct {
	// contains filtered or unexported fields
}

WXBizMsgCrypt 微信消息加解密主类

func NewWXBizMsgCrypt

func NewWXBizMsgCrypt(appId, token, encodingAESKey string) (*WXBizMsgCrypt, error)

NewWXBizMsgCrypt 创建WXBizMsgCrypt实例

func (*WXBizMsgCrypt) DecryptMsg

func (w *WXBizMsgCrypt) DecryptMsg(msgSignature, timestamp, nonce, body string) ([]byte, error)

DecryptMsg 解密消息

func (*WXBizMsgCrypt) EncryptMsg

func (w *WXBizMsgCrypt) EncryptMsg(replyMsg, nonce string, timestamp ...string) (*EncryptResult, error)

EncryptMsg 加密消息

type XMLParse

type XMLParse struct{}

XMLParse XML解析和生成

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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