verify req key

This commit is contained in:
withchao
2023-03-21 19:20:54 +08:00
parent 119f8bf820
commit 97608e47cd
5 changed files with 123 additions and 3 deletions
+28
View File
@@ -0,0 +1,28 @@
package mw
import (
"fmt"
"github.com/OpenIMSDK/Open-IM-Server/pkg/common/config"
"testing"
)
func TestCheck(t *testing.T) {
config.Config.Secret = "123456"
args := []string{"1", "2", "3"}
key := genReqKey(args)
fmt.Println("key:", key)
err := verifyReqKey(args, key)
fmt.Println(err)
args = []string{"4", "5", "6"}
key = genReqKey(args)
fmt.Println("key:", key)
err = verifyReqKey(args, key)
fmt.Println(err)
}