working sub

This commit is contained in:
2026-03-05 12:21:32 +03:00
parent 205d9cf8b0
commit 951f3ab482
6 changed files with 65 additions and 14 deletions

View File

@@ -7,13 +7,14 @@ import (
"net/http"
"os"
"strings"
"time"
"github.com/golang-jwt/jwt/v5"
)
func encodeURL(user User) string {
token := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
"id": user.ID, "name": user.Username, "pass": user.Password,
"id": user.ID, "name": user.Username, "pass": user.Password, "iat": time.Now().Unix(),
})
tokenString, err := token.SignedString([]byte(os.Getenv("JWT_SECRET")))
if err != nil {