Documentation
¶
Overview ¶
Package auth handles credential storage and retrieval for Mush.
Credentials are sourced in the following priority order:
- Environment variable: MUSHER_API_KEY
- OS Keyring (macOS Keychain, Windows Credential Manager, Linux Secret Service)
- Config file fallback: ~/.config/mush/credentials (for non-interactive environments)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StoreAPIKey ¶
StoreAPIKey stores the API key in the OS keyring. Falls back to file storage if keyring is unavailable.
Types ¶
type CredentialSource ¶
type CredentialSource string
CredentialSource indicates where credentials were found.
const ( SourceEnv CredentialSource = "environment variable" SourceKeyring CredentialSource = "keyring" SourceFile CredentialSource = "config file" SourceNone CredentialSource = "" )
Credential source constants identify where credentials were loaded from.
func GetCredentials ¶
func GetCredentials() (source CredentialSource, apiKey string)
GetCredentials returns the API key and its source. Returns empty strings if no credentials are found.