credentials

package
v0.1.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath(environment map[string]string) (string, error)

Types

type Backend

type Backend interface {
	Load(baseURL string) (Credential, error)
	Save(credential Credential) error
	Delete(baseURL string) error
	Hosts() ([]string, error)
}

Backend is the credential storage contract. The file store is the only implementation today; a keychain backend would satisfy the same interface. Load and Delete are keyed by the normalized Control Plane base URL so a login to a second host never overwrites the first.

type Credential

type Credential struct {
	BaseURL      string `json:"-"`
	Token        string `json:"token"`
	AccountEmail string `json:"account_email,omitempty"`
	ExpiresAt    string `json:"expires_at,omitempty"`
}

Credential is one Control Plane token bound to the normalized base URL it was issued for. Tokens for different hosts never share an entry.

type Store

type Store struct {
	Path string
}

Store is the owner-only JSON file backend.

func (Store) Delete

func (s Store) Delete(baseURL string) error

Delete removes one host's credential. The file is removed once it holds no credentials at all. A missing entry is not an error.

func (Store) Hosts

func (s Store) Hosts() ([]string, error)

Hosts lists the normalized base URLs with a stored credential, sorted.

func (Store) Load

func (s Store) Load(baseURL string) (Credential, error)

Load returns the credential stored for baseURL, or fs.ErrNotExist when the file or that host's entry is absent.

func (Store) Save

func (s Store) Save(credential Credential) error

Save stores the credential under its base URL, keeping every other host's entry. A version 1 file is rewritten as version 2 on the way through.

Jump to

Keyboard shortcuts

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