Versions in this module Expand all Collapse all v0 v0.0.16 Feb 11, 2026 v0.0.15 Feb 11, 2026 Changes in this version + func ValidateUserCodeFormat(format string) error + type CodeGenerator struct + func NewCodeGenerator(userCodeLength int, userCodeFormat string) *CodeGenerator + func (g *CodeGenerator) GenerateDeviceCode() (string, error) + func (g *CodeGenerator) GenerateUserCode() (string, error) + type Config struct + AllowedClients []string + CleanupInterval time.Duration + DeviceCodeExpiry time.Duration + Enabled bool + MaxPollAttempts int + PollingInterval int + UserCodeFormat string + UserCodeLength int + VerificationURI string + func DefaultConfig() Config + type Service struct + func NewService(repo *repo.DeviceCodeRepository, config Config) *Service + func (s *Service) AuthorizeDevice(ctx context.Context, userCode string, userID, sessionID xid.ID) error + func (s *Service) CleanupExpiredCodes(ctx context.Context) (int, error) + func (s *Service) CleanupOldConsumedCodes(ctx context.Context, olderThan time.Duration) (int, error) + func (s *Service) ConsumeDeviceCode(ctx context.Context, deviceCode string) error + func (s *Service) DenyDevice(ctx context.Context, userCode string) error + func (s *Service) GetConfig() Config + func (s *Service) GetDeviceCodeByDeviceCode(ctx context.Context, deviceCode string) (*schema.DeviceCode, error) + func (s *Service) GetDeviceCodeByUserCode(ctx context.Context, userCode string) (*schema.DeviceCode, error) + func (s *Service) InitiateDeviceAuthorization(ctx context.Context, clientID string, scope string, appID, envID xid.ID, ...) (*schema.DeviceCode, error) + func (s *Service) PollDeviceCode(ctx context.Context, deviceCode string) (*schema.DeviceCode, bool, error)