Documentation
¶
Index ¶
- Variables
- func ResolveBackend() (string, string, error)
- type Credential
- type HostStore
- func (s *HostStore) DeleteCredential() error
- func (s *HostStore) DeleteEmail() error
- func (s *HostStore) DeleteToken() error
- func (s *HostStore) GetCredential() (Credential, error)
- func (s *HostStore) GetEmail() (string, error)
- func (s *HostStore) GetToken() (string, error)
- func (s *HostStore) Keys() ([]string, error)
- func (s *HostStore) SetCredential(cred Credential) error
- func (s *HostStore) SetEmail(email string) error
- func (s *HostStore) SetToken(token string) error
- type KeyringStore
- func (s *KeyringStore) DeleteCredential() error
- func (s *KeyringStore) DeleteEmail() error
- func (s *KeyringStore) DeleteToken() error
- func (s *KeyringStore) GetCredential() (Credential, error)
- func (s *KeyringStore) GetEmail() (string, error)
- func (s *KeyringStore) GetToken() (string, error)
- func (s *KeyringStore) HasToken() bool
- func (s *KeyringStore) Keys() ([]string, error)
- func (s *KeyringStore) SetCredential(cred Credential) error
- func (s *KeyringStore) SetEmail(email string) error
- func (s *KeyringStore) SetToken(token string) error
- type Store
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ResolveBackend ¶
ResolveBackend determines which keyring backend to use.
Types ¶
type Credential ¶
type Credential struct {
Token string `json:"token"`
Email string `json:"email,omitempty"`
CreatedAt time.Time `json:"created_at,omitempty"`
}
Credential holds stored authentication data.
type HostStore ¶ added in v0.1.3
type HostStore struct {
// contains filtered or unexported fields
}
HostStore wraps a keyring.Keyring and keys credentials by API host, so different API endpoints have separate credential storage.
func NewHostStore ¶ added in v0.1.3
NewHostStore creates a host-scoped credential store.
func (*HostStore) DeleteCredential ¶ added in v0.1.3
DeleteCredential removes credentials for this host. For the default host, also removes bare legacy keys to prevent the legacy fallback from resurrecting deleted credentials.
func (*HostStore) DeleteEmail ¶ added in v0.1.3
func (*HostStore) DeleteToken ¶ added in v0.1.3
func (*HostStore) GetCredential ¶ added in v0.1.3
func (s *HostStore) GetCredential() (Credential, error)
GetCredential retrieves the credential for this host. For the default host, falls back to bare legacy keys and backfills.
func (*HostStore) SetCredential ¶ added in v0.1.3
func (s *HostStore) SetCredential(cred Credential) error
SetCredential stores a credential under the host-scoped key.
type KeyringStore ¶
type KeyringStore struct {
// contains filtered or unexported fields
}
KeyringStore implements Store using OS keychain.
func (*KeyringStore) DeleteCredential ¶
func (s *KeyringStore) DeleteCredential() error
DeleteCredential removes all stored credentials.
func (*KeyringStore) DeleteEmail ¶
func (s *KeyringStore) DeleteEmail() error
DeleteEmail removes the stored email.
func (*KeyringStore) DeleteToken ¶
func (s *KeyringStore) DeleteToken() error
DeleteToken removes the stored token.
func (*KeyringStore) GetCredential ¶
func (s *KeyringStore) GetCredential() (Credential, error)
GetCredential retrieves the full credential.
func (*KeyringStore) GetEmail ¶
func (s *KeyringStore) GetEmail() (string, error)
GetEmail retrieves the stored email.
func (*KeyringStore) GetToken ¶
func (s *KeyringStore) GetToken() (string, error)
GetToken retrieves the stored authentication token.
func (*KeyringStore) HasToken ¶
func (s *KeyringStore) HasToken() bool
HasToken checks if a token is stored.
func (*KeyringStore) Keys ¶
func (s *KeyringStore) Keys() ([]string, error)
Keys returns all stored keys.
func (*KeyringStore) SetCredential ¶
func (s *KeyringStore) SetCredential(cred Credential) error
SetCredential stores a full credential (token + email + metadata).
func (*KeyringStore) SetEmail ¶
func (s *KeyringStore) SetEmail(email string) error
SetEmail stores the user's email.
func (*KeyringStore) SetToken ¶
func (s *KeyringStore) SetToken(token string) error
SetToken stores an authentication token.
type Store ¶
type Store interface {
SetCredential(cred Credential) error
GetCredential() (Credential, error)
DeleteCredential() error
SetToken(token string) error
GetToken() (string, error)
DeleteToken() error
SetEmail(email string) error
GetEmail() (string, error)
DeleteEmail() error
Keys() ([]string, error)
}
Store provides credential storage operations.
func OpenDefault ¶
OpenDefault opens the default keyring store (no host scoping).
func OpenForHost ¶ added in v0.1.3
OpenForHost opens a host-scoped keyring store.