Documentation
¶
Overview ¶
Package helper universal tool package
Index ¶
- Constants
- func CallbackSign(_ context.Context, token string, data any) string
- func CheckSign(timestamp, nonce, body, signature, pubKeyStr string) (bool, error)
- func GenSign(method, url, timestamp, nonce, body string, key []byte, keyType config.Secret) (sign string, err error)
- func GetCurrTS() int64
- func LcFirst(str string) string
- func OrderParam(p map[string]string, bizKey string) (returnStr string)
- func ParsePrivateKey(privateKeyDecoded []byte, keyType config.Secret) (*rsa.PrivateKey, error)
- func PemToRSAPublicKey(pemKeyStr string) (*rsa.PublicKey, error)
- func Query(params map[string]interface{}) string
- func RSADecrypt(privateKey string, ciphertext []byte) ([]byte, error)
- func RSADecryptBase64(privateKey string, cryptoText string) ([]byte, error)
- func RandomStr(n int) string
- func RequestSign(_ context.Context, data interface{}, salt string) string
- func SliceChunk(src []string, chunkSize int) (chunks [][]string)
- func Template(source string, data map[string]interface{}) string
- func UcFirst(str string) string
Constants ¶
const ( // OtherSettleParams 其他分账方参数 (Other settle params) OtherSettleParams = "other_settle_params" // AppID 小程序 appID (Applets appID) AppID = "app_id" // ThirdPartyID 代小程序进行该笔交易调用的第三方平台服务商 id (The id of the third-party platform service provider that calls the transaction on behalf of the Applets) ThirdPartyID = "thirdparty_id" // Sign 签名 (sign) Sign = "sign" // Timestamp 时间戳 (timestamp) Timestamp = "timestamp" // Nonce 随机字符串 (nonce) Nonce = "nonce" // Msg 消息体 (msg) Msg = "msg" )
Variables ¶
This section is empty.
Functions ¶
func CallbackSign ¶ added in v0.0.6
CallbackSign 担保支付回调签名算法 参数:"strArr" 所有字段(验证时注意不包含 sign 签名本身,不包含空字段与 type 常量字段)内容与平台上配置的 token 返回:签名字符串
CallbackSign Guaranteed payment callback signature algorithm Param: "strArr" The content of all fields (note that the sign signature itself is not included during verification, and does not include empty fields and type constant fields) content and the token configured on the platform Return: signature string
func GenSign ¶
func GenSign(method, url, timestamp, nonce, body string, key []byte, keyType config.Secret) (sign string, err error)
GenSign 生成签名
func OrderParam ¶ added in v0.0.3
OrderParam order params
func ParsePrivateKey ¶ added in v0.1.0
ParsePrivateKey parses private key bytes to rsa privateKey
func PemToRSAPublicKey ¶
PemToRSAPublicKey pem to rsa public key
func RSADecrypt ¶ added in v0.0.3
RSADecrypt 数据解密
func RSADecryptBase64 ¶ added in v0.0.3
RSADecryptBase64 Base64 解码后再次进行 RSA 解密
func RequestSign ¶ added in v0.0.6
RequestSign Guaranteed Payment Request Signature Algorithm Param: "paramsMap" all request parameters Return: signature string
func SliceChunk ¶ added in v0.0.3
SliceChunk 用于将字符串切片分块
Types ¶
This section is empty.