Documentation
¶
Overview ¶
Package auth manages credentials stored on disk.
Credentials are persisted as multiple KEY=VALUE entries in a single file at the path returned by config.CredentialsPath() (~/.config/jungi/credentials), with file permissions 0600 so that only the owning user can read it. No environment variables are read or written.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Registry = []Descriptor{
{
Key: "OPENROUTER_API_KEY",
Label: "OpenRouter API Key",
Description: "API key used to authenticate with the OpenRouter API.",
},
{
Key: "JUNGI_CONTROL_API_KEY",
Label: "Jungi Control API Key",
Description: "API key used to authenticate with the jungi control service.",
},
}
Registry lists every credential /credentials can set. It is the single source of truth the picker iterates; register additional credentials here to make them selectable.
Functions ¶
func APIKeyForProvider ¶ added in v0.2.0
func APIKeyForProvider() string
APIKeyForProvider returns the stored OpenRouter API key, or an empty string if none has been set. A missing key surfaces as an auth error on the first API call rather than falling back to anything else.
func All ¶
All returns every stored credential as a map. It returns an empty map and a nil error when the file does not exist.
func Delete ¶
Delete removes a single key from the credentials file, preserving all other entries. It is idempotent: deleting an absent key or a missing file is not an error.
func Get ¶
Get returns the value stored for key. It returns an empty string and a nil error when the file or the key is absent; all other I/O errors are propagated.
func JungiControlAPIKey ¶
JungiControlAPIKey returns the stored jungi control API key, or an empty string if none has been set.
func OpenRouterAPIKey ¶ added in v0.2.0
OpenRouterAPIKey returns the stored OpenRouter API key, or an empty string if none has been set.
Types ¶
type Descriptor ¶
type Descriptor struct {
// Key is the KEY=VALUE store key, e.g. "ANTHROPIC_API_KEY".
Key string
// Label is the human-readable name shown in the picker.
Label string
// Description gives additional context shown alongside the label.
Description string
}
Descriptor describes a single credential the /credentials picker can offer.
Source Files
¶
- auth.go