package
1.0.18
Repository: https://github.com/adamesong/go-util.git
Documentation: pkg.go.dev

# Functions

Deprecated: use (*SignVerifyOption)GetStrToSign instead.
Deprecated: use (*SignVerifyOption)GetTestSign instead.
GetValidStr 提供一个结构体的实例,得到用于生成签名的原始字符串 方法参考微信支付:https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=4_3 1.参数以字典序排序 2.如果参数的值为空不参与签名 3.参数名和参数值区分大小写 3.参数之间以&连接,is the original value instead of url encoded value,不要转为url encoded value。 4.除本package的结构体外,任意结构体都可用于签名,只需结构体中参与签名的参数名加tag: sign:"partner_code" 5.sign参数不参与签名,仅将生成的签名与该sign值做校验 例如:valid_string = partner_code=xxx&time=xxx&nonce_str=xxx&credential_code=xxx 例如,提供struct{ PartnerCode string `sign:"partner_code"` Time string `sign:"time"` // UTC毫秒时间戳,取当前UTC时间的毫秒数时间戳,Long类型,5分钟内有效 NonceStr string `sign:"nonce_str"` CredentialCode string `sign:"credential_code"` 注意:struct中的各项都需要是string.
使用HMAC-SHA256算法,传入as(AppSecret)计算签名 sign = base64(HmacSHA256(as,strToSign)) appSecret: 分配给app或web的密钥,以此作为加密的key。.
签名规则(与下面的func的签名结果不同) 1.
签名规则(与下面的func的签名结果不同) 1.
Deprecated: use (*SignVerifyOption)VerifySign instead.

# Constants

默认的签名有效期:.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
API请求时所带的用于计算签名的一次性随机字符串.

# Structs

SignBody 签名的body.
Signature Option 生成签名时所需的配置.
Signature Verification Option 验证签名所需的配置.