Documentation
¶
Index ¶
- type Credentials
- type Manager
- func (m *Manager) AddDAV(password string) error
- func (m *Manager) Credentials() (*Credentials, error)
- func (m *Manager) DAVCredentials() (username, password string, err error)
- func (m *Manager) DAVUsername() (string, error)
- func (m *Manager) HasDAV() bool
- func (m *Manager) IsAuthenticated() bool
- func (m *Manager) Login(token string) error
- func (m *Manager) LoginWithMetadata(token, accountID, email string) error
- func (m *Manager) Logout() error
- func (m *Manager) Token() (string, error)
- func (m *Manager) UsingKeyring() bool
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Credentials ¶
type Credentials struct {
Token string `json:"token"`
AccountID string `json:"account_id,omitempty"`
UserEmail string `json:"user_email,omitempty"`
DAVUsername string `json:"dav_username,omitempty"` // For CalDAV/WebDAV Basic Auth
DAVPassword string `json:"dav_password,omitempty"` // Fastmail App Password
}
Credentials holds API token, DAV credentials, and metadata.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides authentication services.
func NewManager ¶
NewManager creates a new auth Manager.
func NewManagerWithStore ¶
NewManagerWithStore creates a Manager with a specific store (for testing).
func (*Manager) AddDAV ¶
AddDAV stores an App Password for CalDAV/WebDAV. Username is automatically taken from the stored UserEmail.
func (*Manager) Credentials ¶
func (m *Manager) Credentials() (*Credentials, error)
Credentials returns the stored credentials (for status display).
func (*Manager) DAVCredentials ¶
DAVCredentials returns the username and password for CalDAV/WebDAV Basic Auth. Priority: env FASTMAIL_DAV_PASSWORD > stored credentials.
func (*Manager) DAVUsername ¶
DAVUsername returns the username that would be used for DAV auth. Used to validate credentials before persisting them.
func (*Manager) HasDAV ¶
HasDAV returns true if CalDAV/WebDAV credentials are fully usable (both username and password are available).
func (*Manager) IsAuthenticated ¶
IsAuthenticated returns true if a token is available.
func (*Manager) Login ¶
Login stores a token after basic validation. Preserves existing DAV credentials if present.
func (*Manager) LoginWithMetadata ¶
LoginWithMetadata stores a token along with account metadata. Preserves existing DAV credentials if present.
func (*Manager) UsingKeyring ¶
UsingKeyring returns true if credentials are stored in the system keyring.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store handles credential storage with keyring + file fallback.
func (*Store) UsingKeyring ¶
UsingKeyring returns true if the store uses the system keyring.