credentials

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package credentials manages CLI authentication tokens stored in the user's config directory (~/.config/pbflags/credentials.yaml).

Lookup order:

  1. PBFLAGS_TOKEN environment variable (wins if set)
  2. ~/.config/pbflags/credentials.yaml
  3. No token (unauthenticated)

The credentials file is created with 0600 permissions and the package refuses to read files that are group- or world-readable.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Path

func Path() (string, error)

Path returns the full path to the credentials file.

func Remove

func Remove() error

Remove deletes the credentials file if it exists.

func Save

func Save(creds Credentials) error

Save writes credentials to ~/.config/pbflags/credentials.yaml with 0600 permissions, creating the directory if needed.

Types

type Credentials

type Credentials struct {
	Token string `yaml:"token"`
	Actor string `yaml:"actor,omitempty"`
}

Credentials holds stored authentication details.

func Load

func Load() (Credentials, error)

Load returns the active credentials using the lookup order: PBFLAGS_TOKEN env var, then credentials.yaml file. Returns a zero Credentials (no error) if neither source is available.

Jump to

Keyboard shortcuts

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