auth

package
v1.260328.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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.

View Source
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

func GetCredentials(profile string) (*config.Config, error)

GetCredentials returns credentials for a named profile.

func GetCredentialsWithSource

func GetCredentialsWithSource(profile string) (*config.Config, string, error)

GetCredentialsWithSource returns credentials for a named profile along with the source.

func GetDefaultCredentials

func GetDefaultCredentials() (*config.Config, error)

GetDefaultCredentials returns the default credentials.

func KeychainAvailable

func KeychainAvailable() (bool, error)

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

func RemoveCredentials(name string) error

RemoveCredentials removes a named credential.

func ResetInvalidBypassKeychainWarningsForTest added in v1.260325.0

func ResetInvalidBypassKeychainWarningsForTest()

ResetInvalidBypassKeychainWarningsForTest clears cached invalid-bypass warnings for tests.

func SetDefaultCredentials

func SetDefaultCredentials(name string) error

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

func StoreCredentials(name, keyID, issuerID, keyPath string) error

StoreCredentials stores credentials in the keychain when available.

func StoreCredentialsConfig

func StoreCredentialsConfig(name, keyID, issuerID, keyPath string) error

StoreCredentialsConfig stores credentials in the config file only.

func StoreCredentialsConfigAt

func StoreCredentialsConfigAt(name, keyID, issuerID, keyPath, configPath string) error

StoreCredentialsConfigAt stores credentials in the specified config file.

func ValidateKeyFile

func ValidateKeyFile(path string) error

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 DoctorMigrationHints struct {
	DetectedFiles     []string `json:"detectedFiles"`
	DetectedActions   []string `json:"detectedActions"`
	SuggestedCommands []string `json:"suggestedCommands"`
}

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 DoctorSummary struct {
	OK       int `json:"ok"`
	Info     int `json:"info"`
	Warnings int `json:"warnings"`
	Errors   int `json:"errors"`
}

type MigrationSuggestionResolverInput

type MigrationSuggestionResolverInput struct {
	AppIdentifier    string
	AppID            string
	MarketingVersion string
	NeedAppID        bool
	NeedVersionID    bool
	NeedBuildID      bool
}

type MigrationSuggestionResolverOutput

type MigrationSuggestionResolverOutput struct {
	AppID     string
	VersionID string
	BuildID   string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL