Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HashAPIKey ¶ added in v0.1.6
HashAPIKey returns the hex-encoded SHA-256 hash of an API key.
func ResetDirFunc ¶
func ResetDirFunc()
ResetDirFunc restores the default config directory function.
func Save ¶
Save writes the config to disk, creating the directory (0700) and file (0600) as needed.
func SaveIdentity ¶ added in v0.1.6
func SaveIdentity(id *UserIdentity) error
SaveIdentity writes the user identity cache to disk.
func SetDirFunc ¶
SetDirFunc overrides the config directory function (for testing).
Types ¶
type Config ¶
type Config struct {
APIKey string `yaml:"api_key"`
SimAPIKey string `yaml:"sim_api_key,omitempty"`
Telemetry *bool `yaml:"telemetry,omitempty"`
}
Config holds the persisted CLI configuration.
type UserIdentity ¶ added in v0.1.6
type UserIdentity struct {
CustomerID string `yaml:"customer_id"` // e.g. "user_123" or "team_456"
APIKeyHash string `yaml:"api_key_hash"` // SHA-256 of the API key for cache invalidation
}
UserIdentity holds the cached identity resolved from the API key.
func LoadIdentity ¶ added in v0.1.6
func LoadIdentity() (*UserIdentity, error)
LoadIdentity reads the cached user identity. Returns nil, nil if the file does not exist.
Click to show internal directories.
Click to hide internal directories.