change client to user

This commit is contained in:
2026-04-03 19:33:26 +02:00
parent 8d97e28dde
commit bd1168aef7
8 changed files with 212 additions and 213 deletions
+2 -2
View File
@@ -11,10 +11,10 @@ import (
const tokenSecret = "tmp" // TODO delete in production
const tokenExpiration = time.Hour
func TokenCreate(clientId uint32) (string, error) {
func TokenCreate(userId uint32) (string, error) {
now := time.Now()
signedToken, err := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.RegisteredClaims{
Subject: strconv.FormatUint(uint64(clientId), 10),
Subject: strconv.FormatUint(uint64(userId), 10),
IssuedAt: jwt.NewNumericDate(now),
ExpiresAt: jwt.NewNumericDate(now.Add(tokenExpiration)),
}).SignedString([]byte(tokenSecret))