27 lines
465 B
Go
27 lines
465 B
Go
package auth
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/golang-jwt/jwt/v5"
|
|
)
|
|
|
|
type Config struct {
|
|
Secret string
|
|
Issuer string
|
|
AccessTokenExpiry time.Duration
|
|
RefreshTokenExpiry time.Duration
|
|
}
|
|
|
|
type Claims struct {
|
|
Username string `json:"username"`
|
|
TokenType string `json:"type"`
|
|
jwt.RegisteredClaims
|
|
}
|
|
|
|
// Typescript: interface
|
|
type TokenPair struct {
|
|
AccessToken string `json:"access_token"`
|
|
RefreshToken string `json:"refresh_token"`
|
|
}
|