Documentation
¶
Index ¶
- Variables
- func GetCredentials(profile string) (*config.Config, error)
- func GetCredentialsWithSource(profile string) (*config.Config, string, error)
- func GetDefaultCredentials() (*config.Config, error)
- func KeychainAvailable() (bool, error)
- func LoadPrivateKey(path string) (*ecdsa.PrivateKey, error)
- func LoadPrivateKeyFromPEM(data []byte) (*ecdsa.PrivateKey, error)
- func RemoveAllCredentials() error
- func RemoveCredentials(name string) error
- func ResetInvalidBypassKeychainWarningsForTest()
- func SetDefaultCredentials(name string) error
- func ShouldBypassKeychain() bool
- func StoreCredentials(name, keyID, issuerID, keyPath string) error
- func StoreCredentialsConfig(name, keyID, issuerID, keyPath string) error
- func StoreCredentialsConfigAt(name, keyID, issuerID, keyPath, configPath string) error
- func ValidateKeyFile(path string) error
- type Credential
- type Credentials
- type CredentialsWarning
- type DoctorCheck
- type DoctorMigrationHints
- type DoctorOptions
- type DoctorReport
- type DoctorSection
- type DoctorStatus
- type DoctorSummary
- type MigrationSuggestionResolver
- type MigrationSuggestionResolverInput
- type MigrationSuggestionResolverOutput
Constants ¶
This section is empty.
Variables ¶
var ErrDefaultCredentialsNotFound = errors.New("default credentials not found")
ErrDefaultCredentialsNotFound indicates that stored credentials exist, but no default selection resolves for the current no-profile lookup.
var ErrKeychainAccessDenied = errors.New("keychain access denied")
ErrKeychainAccessDenied is returned when a keychain backend is available but access is explicitly denied (e.g. user clicked "Deny" on the prompt).
This is distinct from keychain being unavailable (`keyring.ErrNoAvailImpl`).
Functions ¶
func GetCredentials ¶
GetCredentials returns credentials for a named profile.
func GetCredentialsWithSource ¶
GetCredentialsWithSource returns credentials for a named profile along with the source.
func GetDefaultCredentials ¶
GetDefaultCredentials returns the default credentials.
func KeychainAvailable ¶
KeychainAvailable reports whether a system keychain backend is available.
func LoadPrivateKey ¶
func LoadPrivateKey(path string) (*ecdsa.PrivateKey, error)
LoadPrivateKey loads the private key from the file
func LoadPrivateKeyFromPEM ¶
func LoadPrivateKeyFromPEM(data []byte) (*ecdsa.PrivateKey, error)
LoadPrivateKeyFromPEM loads an ECDSA private key from PEM bytes.
func RemoveAllCredentials ¶
func RemoveAllCredentials() error
RemoveAllCredentials removes all stored credentials
func RemoveCredentials ¶
RemoveCredentials removes a named credential.
func ResetInvalidBypassKeychainWarningsForTest ¶ added in v1.260325.0
func ResetInvalidBypassKeychainWarningsForTest()
ResetInvalidBypassKeychainWarningsForTest clears cached invalid-bypass warnings for tests.
func SetDefaultCredentials ¶
SetDefaultCredentials sets the default profile name for credential resolution.
func ShouldBypassKeychain ¶
func ShouldBypassKeychain() bool
ShouldBypassKeychain reports whether keychain usage is disabled via env.
func StoreCredentials ¶
StoreCredentials stores credentials in the keychain when available.
func StoreCredentialsConfig ¶
StoreCredentialsConfig stores credentials in the config file only.
func StoreCredentialsConfigAt ¶
StoreCredentialsConfigAt stores credentials in the specified config file.
func ValidateKeyFile ¶
ValidateKeyFile validates that the private key file exists and is valid
Types ¶
type Credential ¶
type Credential struct {
Name string `json:"name"`
KeyID string `json:"key_id"`
IssuerID string `json:"issuer_id"`
PrivateKeyPath string `json:"private_key_path"`
PrivateKeyPEM string `json:"-"`
IsDefault bool `json:"is_default"`
Source string `json:"source,omitempty"`
SourcePath string `json:"source_path,omitempty"`
MetadataNeedsBackfill bool `json:"-"`
MetadataModifiedAt time.Time `json:"-"`
}
Credential represents stored API credentials
func ListCredentialSummaries ¶
func ListCredentialSummaries() ([]Credential, error)
ListCredentialSummaries lists stored credentials without reading key material when the active keyring backend exposes non-secret metadata.
func ListCredentials ¶
func ListCredentials() ([]Credential, error)
ListCredentials lists all stored credentials from all sources. Credentials are merged from keychain and config, with keychain taking precedence when the same name exists in both sources.
type Credentials ¶
type Credentials struct {
DefaultKey string `json:"default_key"`
Keys []Credential `json:"keys"`
}
Credentials stores multiple credentials
type CredentialsWarning ¶
type CredentialsWarning struct {
// contains filtered or unexported fields
}
CredentialsWarning indicates that some credential sources could not be read. Credentials returned alongside the warning are still usable.
func (*CredentialsWarning) Error ¶
func (w *CredentialsWarning) Error() string
func (*CredentialsWarning) Unwrap ¶
func (w *CredentialsWarning) Unwrap() error
type DoctorCheck ¶
type DoctorCheck struct {
Status DoctorStatus `json:"status"`
Message string `json:"message"`
Recommendation string `json:"recommendation,omitempty"`
FixApplied bool `json:"fix_applied,omitempty"`
}
type DoctorMigrationHints ¶
type DoctorOptions ¶
type DoctorOptions struct {
Fix bool
}
type DoctorReport ¶
type DoctorReport struct {
Sections []DoctorSection `json:"sections"`
Summary DoctorSummary `json:"summary"`
Recommendations []string `json:"recommendations,omitempty"`
Migration *DoctorMigrationHints `json:"migration,omitempty"`
}
func Doctor ¶
func Doctor(options DoctorOptions) DoctorReport
func DoctorWithMigrationResolver ¶
func DoctorWithMigrationResolver(options DoctorOptions, resolver MigrationSuggestionResolver) DoctorReport
type DoctorSection ¶
type DoctorSection struct {
Title string `json:"title"`
Checks []DoctorCheck `json:"checks"`
}
type DoctorStatus ¶
type DoctorStatus string
const ( DoctorOK DoctorStatus = "ok" DoctorWarn DoctorStatus = "warn" DoctorFail DoctorStatus = "fail" DoctorInfo DoctorStatus = "info" )
type DoctorSummary ¶
type MigrationSuggestionResolver ¶
type MigrationSuggestionResolver func(input MigrationSuggestionResolverInput) MigrationSuggestionResolverOutput