Versions in this module Expand all Collapse all v0 v0.3.0 Aug 26, 2026 Changes in this version + const DefaultAudience + var ErrAccountLocked = errors.New("authit/superuser: account locked") + var ErrAlreadyBootstrapped = errors.New("authit/superuser: at least one superuser already exists") + var ErrCannotDeactivateSelf = errors.New("authit/superuser: cannot deactivate your own account") + var ErrInactive = errors.New("authit/superuser: account is not active") + var ErrInvalidCredentials = errors.New("authit/superuser: invalid credentials") + var ErrInvalidToken = errors.New("authit/superuser: invalid or expired token") + type Claims struct + Email string + func (c Claims) HasAudience(aud string) bool + type Config struct + AccessTokenTTL time.Duration + Audience string + AuditLogger audit.Logger + FailedLoginWindow time.Duration + ImpersonationTTL time.Duration + MaxFailedLoginAttempts int + RefreshTokenTTL time.Duration + type Service struct + func NewService(stores Stores, signer authitjwt.Signer, cfg Config) (*Service, error) + func (s *Service) Authenticate(ctx context.Context, email, password, userAgent, ipAddress string) (TokenPair, error) + func (s *Service) Bootstrap(ctx context.Context, email, password, displayName string) (store.Superuser, error) + func (s *Service) CreateSuperuser(ctx context.Context, email, password, displayName, createdByID string) (store.Superuser, error) + func (s *Service) Deactivate(ctx context.Context, callerID, targetID string) error + func (s *Service) Impersonate(ctx context.Context, superuserID, targetUserID, targetUserEmail string) (string, error) + func (s *Service) ListSuperusers(ctx context.Context) ([]store.Superuser, error) + func (s *Service) Logout(ctx context.Context, refreshToken string) error + func (s *Service) Refresh(ctx context.Context, refreshToken, userAgent, ipAddress string) (TokenPair, error) + func (s *Service) Verify(token string) (Claims, error) + type Stores struct + Lockouts store.LockoutStore + RefreshTokens store.SuperuserRefreshTokenStore + Superusers store.SuperuserStore + type TokenPair struct + AccessToken string + ExpiresAt time.Time + RefreshToken string v0.2.0 Aug 25, 2026