Files
auth-service/internal/config/token.go

23 lines
572 B
Go

package config
import "time"
type TokenConfig struct {
AccessToken TokenSettings `yaml:"accessToken" json:"accessToken"`
RefreshToken TokenSettings `yaml:"refreshToken" json:"refreshToken"`
}
type TokenSettings struct {
TTLInMinutes int `yaml:"TTL-in-min" json:"TTL-in-min"`
SecretWord string `yaml:"secretWord" json:"secretWord"`
}
// Методы для удобства
func (t *TokenSettings) GetTTL() time.Duration {
return time.Duration(t.TTLInMinutes) * time.Minute
}
func (t *TokenSettings) GetSecretBytes() []byte {
return []byte(t.SecretWord)
}