Files
Authentication/models/jwt.go
T
2025-11-25 15:12:31 +08:00

33 lines
926 B
Go

package models
import (
"time"
"github.com/golang-jwt/jwt/v5"
)
type AccessToken struct {
Email string `json:"email"`
SessionID string `json:"session_id"`
Exp int64 `json:"exp"`
jwt.RegisteredClaims
}
type JWTSession struct {
ID string `json:"id" db:"id"`
UserID string `json:"user_id" db:"user_id"`
RefreshTokenHash string `json:"refresh_token_hash" db:"refresh_token_hash"`
UserAgent string `json:"user_agent" db:"user_agent"`
IPAddress string `json:"ip_address" db:"ip_address"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
ExpiresAt time.Time `json:"expires_at" db:"expires_at"`
IsRevoked bool `json:"is_revoked" db:"is_revoked"`
}
type ExpiredSession struct {
ID string
UserID string
RefreshTokenHash string
}