From 8d8ec866cdc7aea11b02e75bc9fd5a6a973dc601 Mon Sep 17 00:00:00 2001 From: zhaoxiaorong Date: Tue, 11 Feb 2025 11:56:48 +0800 Subject: [PATCH] =?UTF-8?q?GenerateTokenAes=20=E8=8E=B7=E5=8F=96JwtSecretL?= =?UTF-8?q?en?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crypto/encipher/encipher.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/encipher/encipher.go b/crypto/encipher/encipher.go index 90a80a5..f4f1b80 100644 --- a/crypto/encipher/encipher.go +++ b/crypto/encipher/encipher.go @@ -27,7 +27,8 @@ func New(token string) { } func GenerateTokenAes(id uint, identity, client, role string, owner any, extend map[string]string) (string, error) { - if (JwtSecretLen == 16 || JwtSecretLen == 24 || JwtSecretLen == 32) == false { + JwtSecretLen = len(env.Runtime.JwtSecretKey) + if JwtSecretLen == 16 || JwtSecretLen == 24 || JwtSecretLen == 32 { return "", errcode.ErrJWTSecretKey } expireTime := time.Now().Add(vars.JwtExpireDay)