Documentation ¶
Index ¶
- Constants
- func GetAvoidLoginSignature(timestamp, secret string) string
- func GetSignature(timestamp, secret string, ticket string) string
- func RandomString(length int) string
- type DingTalkCrypto
- func (c *DingTalkCrypto) CreateSignature(token, encrypt, timestamp, nonce string) string
- func (c *DingTalkCrypto) Decrypt(encrypt, sign, timestamp, nonce string) (string, error)
- func (c *DingTalkCrypto) DecryptToByte(encrypt, sign, timestamp, nonce string) ([]byte, error)
- func (c *DingTalkCrypto) Encrypt(msg string) (*DingTalkEncrypt, error)
- func (c *DingTalkCrypto) GetEncryptMsgDetail(msg, timestamp, nonce string) (string, string, error)
- func (c *DingTalkCrypto) RandomString(length int) string
- func (c *DingTalkCrypto) VerificationSignature(encrypt, sign, timestamp, nonce string) bool
- type DingTalkEncrypt
Constants ¶
View Source
const (
AesEncodeKeyLength = 43
)
Variables ¶
This section is empty.
Functions ¶
func GetAvoidLoginSignature ¶
GetAvoidLoginSignature 个人免登场景的签名计算方法 https://developers.dingtalk.com/document/app/signature-calculation-for-logon-free-scenarios-1
func GetSignature ¶
GetSignature 第三方访问接口的签名计算方法 https://developers.dingtalk.com/document/app/signature-calculation-method-for-third-party-access-interfaces-1
Types ¶
type DingTalkCrypto ¶
type DingTalkCrypto struct { // 签名 token Token string // 小程序的key SuiteKey string // 加密 aes_key AESKey []byte Block cipher.Block }
func (*DingTalkCrypto) CreateSignature ¶
func (c *DingTalkCrypto) CreateSignature(token, encrypt, timestamp, nonce string) string
CreateSignature 数据签名
func (*DingTalkCrypto) Decrypt ¶
func (c *DingTalkCrypto) Decrypt(encrypt, sign, timestamp, nonce string) (string, error)
Decrypt 解密
func (*DingTalkCrypto) DecryptToByte ¶
func (c *DingTalkCrypto) DecryptToByte(encrypt, sign, timestamp, nonce string) ([]byte, error)
func (*DingTalkCrypto) Encrypt ¶
func (c *DingTalkCrypto) Encrypt(msg string) (*DingTalkEncrypt, error)
Encrypt 加密
func (*DingTalkCrypto) GetEncryptMsgDetail ¶
func (c *DingTalkCrypto) GetEncryptMsgDetail(msg, timestamp, nonce string) (string, string, error)
func (*DingTalkCrypto) RandomString ¶
func (c *DingTalkCrypto) RandomString(length int) string
RandomString 随机字符串
func (*DingTalkCrypto) VerificationSignature ¶
func (c *DingTalkCrypto) VerificationSignature(encrypt, sign, timestamp, nonce string) bool
VerificationSignature 验证数据签名
type DingTalkEncrypt ¶
type DingTalkEncrypt struct { // 加密体 Encrypt string `json:"encrypt,omitempty"` // 签名 Sign string `json:"msg_signature,omitempty"` // 时间戳 Timestamp string `json:"timeStamp,omitempty"` // 随机字符串 Nonce string `json:"nonce,omitempty"` }
DingTalkEncrypt 钉钉事件回调加密
func NewDingTalkEncrypt ¶
func NewDingTalkEncrypt(encrypt, sign, timestamp, nonce string) *DingTalkEncrypt
NewDingTalkEncrypt 钉钉返回体
Click to show internal directories.
Click to hide internal directories.