fix: use []byte for jwt key
All checks were successful
Build and Deploy Go App / build (push) Successful in 5m59s
Build and Deploy Go App / deploy (push) Successful in 35s

This commit is contained in:
nihonium 2025-12-04 08:27:22 +03:00
parent 85a3c3ef10
commit 79a716cf55
Signed by: nihonium
GPG key ID: 0251623741027CFC

View file

@ -53,7 +53,7 @@ func (s Server) generateTokens(userID string) (accessToken string, refreshToken
"exp": time.Now().Add(15 * time.Minute).Unix(), "exp": time.Now().Add(15 * time.Minute).Unix(),
} }
at := jwt.NewWithClaims(jwt.SigningMethodHS256, accessClaims) at := jwt.NewWithClaims(jwt.SigningMethodHS256, accessClaims)
accessToken, err = at.SignedString(s.JwtPrivateKey) accessToken, err = at.SignedString([]byte(s.JwtPrivateKey))
if err != nil { if err != nil {
return "", "", "", err return "", "", "", err
} }
@ -63,7 +63,7 @@ func (s Server) generateTokens(userID string) (accessToken string, refreshToken
"exp": time.Now().Add(7 * 24 * time.Hour).Unix(), "exp": time.Now().Add(7 * 24 * time.Hour).Unix(),
} }
rt := jwt.NewWithClaims(jwt.SigningMethodHS256, refreshClaims) rt := jwt.NewWithClaims(jwt.SigningMethodHS256, refreshClaims)
refreshToken, err = rt.SignedString(s.JwtPrivateKey) refreshToken, err = rt.SignedString([]byte(s.JwtPrivateKey))
if err != nil { if err != nil {
return "", "", "", err return "", "", "", err
} }