Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Encrypt ¶
Encrypt encrypts plaintext with AES-256-GCM using the given 32-byte key. Returns nonce (12 bytes) || ciphertext || GCM tag (16 bytes).
func MarshalTokenInfo ¶
MarshalTokenInfo serializes TokenInfo to JSON.
Types ¶
type KeyringStore ¶
type KeyringStore struct{}
KeyringStore persists tokens in the system keyring (macOS Keychain, Linux Secret Service, Windows Credential Manager).
func (*KeyringStore) Available ¶
func (s *KeyringStore) Available() bool
Available returns true if the system keyring is accessible.
func (*KeyringStore) Delete ¶
func (s *KeyringStore) Delete(name string) error
type MachineStore ¶
type MachineStore struct {
// contains filtered or unexported fields
}
MachineStore encrypts tokens with a key derived from machine identity + random salt.
func NewMachineStore ¶
func NewMachineStore(configDir string) *MachineStore
NewMachineStore creates a MachineStore.
func (*MachineStore) Delete ¶
func (s *MachineStore) Delete(name string) error
type SSHAgentStore ¶
type SSHAgentStore struct {
// contains filtered or unexported fields
}
SSHAgentStore encrypts tokens using key material derived from an SSH agent signature.
func NewSSHAgentStore ¶
func NewSSHAgentStore(configDir string) (*SSHAgentStore, error)
NewSSHAgentStore creates an SSHAgentStore if an SSH agent is available.
func (*SSHAgentStore) Delete ¶
func (s *SSHAgentStore) Delete(name string) error
type TokenInfo ¶
type TokenInfo struct {
RefreshToken string `json:"refresh_token"`
AccessToken string `json:"access_token"`
ExpiresAt time.Time `json:"expires_at,omitempty"`
Scope string `json:"scope,omitempty"`
// Server is the origin (scheme://host:port) of the server the token was issued for; empty for tokens saved
// before this field existed.
Server string `json:"server,omitempty"`
// Sequence is only read to detect tokens of the legacy /auth/cli sign-in; never written.
Sequence string `json:"sequence,omitempty"`
}
TokenInfo holds the token data persisted across sessions.
func UnmarshalTokenInfo ¶
UnmarshalTokenInfo deserializes TokenInfo from JSON.
type TokenStore ¶
type TokenStore interface {
Load(name string) (TokenInfo, error)
Save(name string, ti TokenInfo) error
Delete(name string) error
}
TokenStore abstracts token persistence across backends.
func NewTokenStore ¶
func NewTokenStore(configDir string) TokenStore
NewTokenStore returns the best available token storage backend. Priority: system keyring > SSH agent > machine-bound encryption.