Documentation
¶
Overview ¶
Package services contains business logic and service layer
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Claims ¶
type Claims struct {
jwt.RegisteredClaims
Subject string `json:"sub"`
}
Claims represents the JWT claims
type JWTService ¶
type JWTService struct {
// contains filtered or unexported fields
}
JWTService provides JWT token creation and verification
func NewJWTService ¶
func NewJWTService(privateKey *rsa.PrivateKey, publicKey *rsa.PublicKey, issuer string, expiryTime time.Duration) *JWTService
NewJWTService creates a new JWT service with the given keys
func (*JWTService) GenerateToken ¶
func (s *JWTService) GenerateToken(subject string) (string, error)
GenerateToken generates a new JWT token with the given subject
func (*JWTService) VerifyToken ¶
func (s *JWTService) VerifyToken(tokenString string) (*Claims, error)
VerifyToken verifies a JWT token and returns the claims if valid
Click to show internal directories.
Click to hide internal directories.