initial commit

This commit is contained in:
m.zare
2026-04-10 18:25:21 +03:30
commit 77ca6c34a3
263 changed files with 34470 additions and 0 deletions

22
pkg/jwt/provider.go Normal file
View File

@@ -0,0 +1,22 @@
package jwt
import (
"time"
"base/config"
)
// NewTokenService creates a new JWT TokenService from config
func NewTokenService(cfg *config.AppConfig) TokenService {
secret := cfg.Server.JWTSecret
if secret == "" {
// Default secret if not configured (should be set in production)
secret = "default-secret-key-change-in-production"
}
// Default token expiration times
accessTokenExpiration := 24 * time.Hour
refreshTokenExpiration := 7 * 24 * time.Hour
return New(secret, accessTokenExpiration, refreshTokenExpiration)
}