authconfig

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Dir

func Dir() (string, error)

Dir returns the config directory path ($HOME/.config/dune).

func HashAPIKey added in v0.1.6

func HashAPIKey(apiKey string) string

HashAPIKey returns the hex-encoded SHA-256 hash of an API key.

func Path

func Path() (string, error)

Path returns the full path to the config file.

func ResetDirFunc

func ResetDirFunc()

ResetDirFunc restores the default config directory function.

func Save

func Save(cfg *Config) error

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

func SetDirFunc(fn func() (string, error))

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.

func Load

func Load() (*Config, error)

Load reads and parses the config file. Returns nil, nil if the file does not exist.

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.

Jump to

Keyboard shortcuts

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