This commit is contained in:
eson
2023-08-28 14:21:06 +08:00
parent 2830ea8724
commit bde9e98f62
26 changed files with 43 additions and 35 deletions

View File

@@ -141,7 +141,7 @@ func BenchmarkJWT(b *testing.B) {
for i := 0; i < b.N; i++ {
claims := &jwt.StandardClaims{
ExpiresAt: time.Now().Unix() + 1020213021,
ExpiresAt: time.Now().UTC().Unix() + 1020213021,
Issuer: "test",
}

View File

@@ -2,10 +2,10 @@ package basic
import (
"crypto/sha256"
"encoding/base64"
"fusenapi/utils/auth"
"log"
"testing"
"time"
)
func TestRequestParse(t *testing.T) {
@@ -17,7 +17,9 @@ func TestHash(t *testing.T) {
a := "fs12345678"
h := sha256.New()
h.Write([]byte(a))
s := base64.RawURLEncoding.EncodeToString(h.Sum(nil))
s := "5JlPincPavgw0X/Fmj15xLId5vOEtdarc6hR1XlBx80="
log.Println(auth.GenerateJwtTokenUint64(auth.StringToHash(s), 421231233, time.Now().UTC().Unix(), 39, 0))
key := auth.StringToHash(s)
log.Println(key)
// log.Println(auth.GenerateJwtTokenUint64(auth.StringToHash(s), 400000000, time.Now().UTC().Unix(), 39, 0))