auth

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddSiteToList

func AddSiteToList(store CredentialStore, alias string) error

AddSiteToList adds a site alias to the sites list if not already present.

func DeleteSite

func DeleteSite(store CredentialStore, alias string) error

DeleteSite removes all credentials for the given site alias.

func GetDefaultSite

func GetDefaultSite(store CredentialStore) (string, error)

GetDefaultSite returns the default site alias.

func ListSites

func ListSites(store CredentialStore) ([]string, error)

ListSites returns all configured site aliases.

func RemoveSiteFromList

func RemoveSiteFromList(store CredentialStore, alias string) error

RemoveSiteFromList removes a site alias from the sites list.

func SaveSite

func SaveSite(store CredentialStore, alias string, creds SiteCredentials) error

SaveSite stores credentials for the given site alias.

func SetDefaultSite

func SetDefaultSite(store CredentialStore, alias string) error

SetDefaultSite sets the default site alias.

Types

type BoidCLIStore added in v0.6.0

type BoidCLIStore struct{}

BoidCLIStore implements CredentialStore by shelling out to `boid secret`.

This is meant for atl running as a boid host_command, inside the boid daemon container: the daemon's own UNIX socket (which `boid secret ...` dials by default via XDG_RUNTIME_DIR) is a trusted transport with no auth layer at all for anything running inside that same container, so no credential handoff of its own is needed here — the `boid` subprocess just talks to the daemon it's colocated with. Neither the OS keyring nor pass(1) work in that environment (no desktop session, no GPG key), which is why this backend exists as a third option rather than trying to make either of those fit.

Unlike KeyringStore/PassStore, this backend is never auto-selected by NewStore — see its doc comment for why an explicit opt-in is required.

func NewBoidCLIStore added in v0.6.0

func NewBoidCLIStore() (*BoidCLIStore, error)

NewBoidCLIStore creates a BoidCLIStore if the boid binary is available on PATH.

func (*BoidCLIStore) Delete added in v0.6.0

func (b *BoidCLIStore) Delete(key string) error

func (*BoidCLIStore) Get added in v0.6.0

func (b *BoidCLIStore) Get(key string) (string, error)

func (*BoidCLIStore) Set added in v0.6.0

func (b *BoidCLIStore) Set(key, value string) error

type CredentialStore

type CredentialStore interface {
	Set(key, value string) error
	Get(key string) (string, error)
	Delete(key string) error
}

CredentialStore defines an interface for storing and retrieving credentials.

func NewStore

func NewStore() (CredentialStore, error)

NewStore returns a CredentialStore, trying keyring first, then falling back to pass. In sandbox environments (SANDBOX env var set), keyring probe is skipped.

ATL_CRED_BACKEND=boid-cli selects BoidCLIStore unconditionally, ahead of both. This requires an explicit opt-in rather than auto-detecting `boid` on PATH: an operator's own workstation commonly has boid installed too, and silently preferring it there would divert `atl configure` away from the keyring/pass credentials that workstation already relies on. The var is meant to be set only in the one place BoidCLIStore actually applies — a boid host_command's env declaration for atl (host_commands.yaml on the boid daemon side) — never globally.

type KeyringStore

type KeyringStore struct{}

KeyringStore implements CredentialStore using the OS keyring.

func (*KeyringStore) Delete

func (k *KeyringStore) Delete(key string) error

func (*KeyringStore) Get

func (k *KeyringStore) Get(key string) (string, error)

func (*KeyringStore) Probe

func (k *KeyringStore) Probe() error

Probe tests whether the keyring is available by writing and deleting a test entry.

func (*KeyringStore) Set

func (k *KeyringStore) Set(key, value string) error

type PassStore

type PassStore struct {
	// contains filtered or unexported fields
}

PassStore implements CredentialStore using pass(1).

func NewPassStore

func NewPassStore() (*PassStore, error)

NewPassStore creates a PassStore if pass is available on the system.

func (*PassStore) Delete

func (p *PassStore) Delete(key string) error

func (*PassStore) Get

func (p *PassStore) Get(key string) (string, error)

func (*PassStore) Set

func (p *PassStore) Set(key, value string) error

type SiteCredentials

type SiteCredentials struct {
	BaseURL     string
	Email       string
	APIToken    string
	BBAPIToken  string // Bitbucket API Token (optional, used instead of APIToken for Bitbucket)
	BBWorkspace string // Bitbucket Workspace slug (optional, restricts workspace usage)
}

SiteCredentials holds authentication information for an Atlassian site.

func LoadSite

func LoadSite(store CredentialStore, alias string) (SiteCredentials, error)

LoadSite loads credentials for the given site alias.

Jump to

Keyboard shortcuts

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