Compare commits

..

3 Commits

Author SHA1 Message Date
zhaoxiaorong
f1310d093e fix 2025-02-11 13:19:07 +08:00
zhaoxiaorong
fd967b8c1d fix 2025-02-11 13:11:30 +08:00
zhaoxiaorong
8d8ec866cd GenerateTokenAes 获取JwtSecretLen 2025-02-11 11:56:48 +08:00

View File

@@ -21,13 +21,13 @@ var (
JwtSecretLen int
)
func New(token string) {
JwtSecret = []byte(token)
func New(secret string) {
JwtSecret = []byte(secret)
JwtSecretLen = len(env.Runtime.JwtSecretKey)
}
func GenerateTokenAes(id uint, identity, client, role string, owner any, extend map[string]string) (string, error) {
if (JwtSecretLen == 16 || JwtSecretLen == 24 || JwtSecretLen == 32) == false {
if !(JwtSecretLen == 16 || JwtSecretLen == 24 || JwtSecretLen == 32) {
return "", errcode.ErrJWTSecretKey
}
expireTime := time.Now().Add(vars.JwtExpireDay)