Documentation
¶
Overview ¶
Package config stores the CLI's credentials and endpoint on disk.
Everything the CLI needs to make an authenticated request — the panel host, the OAuth client id and the tokens the device flow returned — lives in a single credentials.json under the user's config dir, written 0600.
Index ¶
Constants ¶
View Source
const ( // DefaultHost is the hosted Kilden panel. Override at login with --host // (self-hosters) or the KILDEN_HOST environment variable. DefaultHost = "https://app.kilden.io" // DefaultClientID is the well-known PUBLIC OAuth client the panel seeds // with `php artisan passport:cli-client`. A public client carries no // secret, so shipping its id in the binary is expected, not a leak. DefaultClientID = "9c3f6a10-1b2c-4d5e-8f90-a1b2c3d4e5f6" )
Variables ¶
View Source
var ErrNotLoggedIn = errors.New("not signed in — run `kd login`")
ErrNotLoggedIn is returned when no credentials are stored yet.
Functions ¶
Types ¶
type Credentials ¶
type Credentials struct {
Host string `json:"host"`
ClientID string `json:"client_id"`
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token"`
TokenType string `json:"token_type"`
Expiry time.Time `json:"expiry"`
Scopes string `json:"scopes,omitempty"`
}
Credentials is the persisted session.
func Load ¶
func Load() (*Credentials, error)
Load reads the stored credentials, or ErrNotLoggedIn if none exist.
func (*Credentials) Save ¶
func (c *Credentials) Save() error
Save writes the credentials back, creating the config dir if needed.
Click to show internal directories.
Click to hide internal directories.