Documentation
¶
Overview ¶
Package auth provides authentication-related business logic.
Index ¶
- type ConfigService
- func (s *ConfigService) EnsureConfig() (*domain.Config, bool, error)
- func (s *ConfigService) GetAPIKey() (string, error)
- func (s *ConfigService) GetClientID() (string, error)
- func (s *ConfigService) GetClientSecret() (string, error)
- func (s *ConfigService) GetOrgID() (string, error)
- func (s *ConfigService) GetStatus() (*domain.ConfigStatus, error)
- func (s *ConfigService) HasKeystoreCredentials() bool
- func (s *ConfigService) IsConfigured() bool
- func (s *ConfigService) ResetConfig() error
- func (s *ConfigService) SetupConfig(region, clientID, clientSecret, apiKey, orgID string) error
- func (s *ConfigService) UpdateCallbackPort(port int) error
- type GrantService
- func (s *GrantService) AddGrant(grantID, email string, provider domain.Provider, setDefault bool) error
- func (s *GrantService) FetchGrantFromNylas(ctx context.Context, grantID string) (*domain.Grant, error)
- func (s *GrantService) GetCurrentGrant(ctx context.Context) (*domain.GrantStatus, error)
- func (s *GrantService) GetDefaultGrantID() (string, error)
- func (s *GrantService) ListGrants(ctx context.Context) ([]domain.GrantStatus, error)
- func (s *GrantService) SwitchGrant(grantID string) error
- func (s *GrantService) SwitchGrantByEmail(email string) error
- func (s *GrantService) ValidateGrant(ctx context.Context, grantID string) (bool, error)
- type Service
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigService ¶
type ConfigService struct {
// contains filtered or unexported fields
}
ConfigService handles configuration operations.
func NewConfigService ¶
func NewConfigService(config ports.ConfigStore, secrets ports.SecretStore) *ConfigService
NewConfigService creates a new config service.
func (*ConfigService) EnsureConfig ¶
func (s *ConfigService) EnsureConfig() (*domain.Config, bool, error)
EnsureConfig ensures config exists, regenerating if necessary.
func (*ConfigService) GetAPIKey ¶
func (s *ConfigService) GetAPIKey() (string, error)
GetAPIKey retrieves the API key from keystore.
func (*ConfigService) GetClientID ¶
func (s *ConfigService) GetClientID() (string, error)
GetClientID retrieves the client ID from keystore.
func (*ConfigService) GetClientSecret ¶
func (s *ConfigService) GetClientSecret() (string, error)
GetClientSecret retrieves the client secret from keystore.
func (*ConfigService) GetOrgID ¶
func (s *ConfigService) GetOrgID() (string, error)
GetOrgID retrieves the organization ID from keystore.
func (*ConfigService) GetStatus ¶
func (s *ConfigService) GetStatus() (*domain.ConfigStatus, error)
GetStatus returns the current configuration status.
func (*ConfigService) HasKeystoreCredentials ¶
func (s *ConfigService) HasKeystoreCredentials() bool
HasKeystoreCredentials checks if credentials are stored in keystore.
func (*ConfigService) IsConfigured ¶
func (s *ConfigService) IsConfigured() bool
IsConfigured checks if the application is configured.
func (*ConfigService) ResetConfig ¶
func (s *ConfigService) ResetConfig() error
ResetConfig clears all configuration and secrets.
func (*ConfigService) SetupConfig ¶
func (s *ConfigService) SetupConfig(region, clientID, clientSecret, apiKey, orgID string) error
SetupConfig saves the initial configuration.
func (*ConfigService) UpdateCallbackPort ¶
func (s *ConfigService) UpdateCallbackPort(port int) error
UpdateCallbackPort updates the OAuth callback port.
type GrantService ¶
type GrantService struct {
// contains filtered or unexported fields
}
GrantService handles grant operations.
func NewGrantService ¶
func NewGrantService(client ports.NylasClient, grantStore ports.GrantStore, config ports.ConfigStore) *GrantService
NewGrantService creates a new grant service.
func (*GrantService) AddGrant ¶
func (s *GrantService) AddGrant(grantID, email string, provider domain.Provider, setDefault bool) error
AddGrant manually adds a grant to local storage.
func (*GrantService) FetchGrantFromNylas ¶
func (s *GrantService) FetchGrantFromNylas(ctx context.Context, grantID string) (*domain.Grant, error)
FetchGrantFromNylas fetches grant details directly from Nylas API.
func (*GrantService) GetCurrentGrant ¶
func (s *GrantService) GetCurrentGrant(ctx context.Context) (*domain.GrantStatus, error)
GetCurrentGrant returns the current (default) grant info.
func (*GrantService) GetDefaultGrantID ¶
func (s *GrantService) GetDefaultGrantID() (string, error)
GetDefaultGrantID returns the default grant ID.
func (*GrantService) ListGrants ¶
func (s *GrantService) ListGrants(ctx context.Context) ([]domain.GrantStatus, error)
ListGrants returns all grants with their status.
func (*GrantService) SwitchGrant ¶
func (s *GrantService) SwitchGrant(grantID string) error
SwitchGrant switches the default grant to the specified ID.
func (*GrantService) SwitchGrantByEmail ¶
func (s *GrantService) SwitchGrantByEmail(email string) error
SwitchGrantByEmail switches the default grant by email.
func (*GrantService) ValidateGrant ¶
ValidateGrant checks if a grant is valid.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles authentication operations.
func NewService ¶
func NewService( client ports.NylasClient, grantStore ports.GrantStore, config ports.ConfigStore, server ports.OAuthServer, browser ports.Browser, ) *Service
NewService creates a new auth service.