Skip to content

Commit e5fc121

Browse files
committed
alipay v3 add api
1 parent d5d11fa commit e5fc121

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

wechat/v3/client.go

+18
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,24 @@ func (c *ClientV3) AutoVerifySign(autoRefresh ...bool) (err error) {
9292
return
9393
}
9494

95+
// wxPublicKeyContent:微信公钥证书文件内容[]byte
96+
// wxPublicKeyID:微信公钥证书ID
97+
func (c *ClientV3) AutoVerifySignByCert(wxPublicKeyContent []byte, wxPublicKeyID string) {
98+
pubKey, err := xpem.DecodePublicKey(wxPublicKeyContent)
99+
if err != nil {
100+
c.logger.Errorf("AutoVerifySignByCert(%s),err:%+v", wxPublicKeyContent, err)
101+
}
102+
if pubKey != nil {
103+
if len(c.SnCertMap) <= 0 {
104+
c.SnCertMap = make(map[string]*rsa.PublicKey)
105+
}
106+
c.SnCertMap[wxPublicKeyID] = pubKey
107+
c.wxPublicKey = pubKey
108+
c.WxSerialNo = wxPublicKeyID
109+
c.autoSign = true
110+
}
111+
}
112+
95113
// SetBodySize 设置http response body size(MB)
96114
func (c *ClientV3) SetBodySize(sizeMB int) {
97115
if sizeMB > 0 {

0 commit comments

Comments
 (0)