util

package
v0.0.0-...-3b54ddd Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(token, aesKey, appId string, msgSignature, timestamp, nonce string, data []byte) (bs []byte, err error)

func Encrypt

func Encrypt(token, aesKey, appId string, replyMsg []byte) (bs []byte, err error)

func Get

func Get(url string) (rsp []byte, err error)

func GetData

func GetData(key string) (value interface{}, ok bool)

func Post

func Post(url string, body []byte) (rsp []byte, err error)

func SaveData

func SaveData(key string, value interface{}, expiresIn int64)

func StorgeData

func StorgeData()

Types

type Crypt

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

func NewCrypt

func NewCrypt(token string, aesKey string, appid string) (c *Crypt, err error)

func (*Crypt) Decrypt

func (c *Crypt) Decrypt(msgSignature, timestamp, nonce string, data []byte) (bs []byte, err error)

解密 msgSignature 签名, timestamp 时间戳, nonce 随机, dataMap 要解密的文本 bs 返回的是解密后的xml格式的字符串

func (*Crypt) Encrypt

func (c *Crypt) Encrypt(replyMsg []byte) (bs []byte, err error)

加密 replyMsg 公众平台待回复用户的消息,xml格式的字符串, bs 包括msg_signature, timestamp, nonce, encrypt的xml格式的字符串.

type Data

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

Jump to

Keyboard shortcuts

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