BOP的签名

This commit is contained in:
Yun
2024-11-04 12:10:36 +08:00
commit e26d03a35a
6 changed files with 205 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
package bopx_test
import (
"testing"
"code.yun.ink/pkg/bopx"
)
func TestGetSign(t *testing.T) {
params := map[string]interface{}{
"name": "huang",
"age": 18,
}
// delete(params, "platform_key")
// delete(params, "sign")
// delete(params, "key")
s := bopx.NewPlatform([]string{"platform_key", "sign", "key"}, "huangxinyun")
sign, err := s.GetSign(params)
if err != nil {
t.Error(err)
}
t.Log(sign)
params["sign"] = sign
err = s.VerifySign(params)
if err != nil {
t.Error(err)
}
}