credentials

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package credentials persists and loads ~/.authio/credentials.toml.

File format (TOML-ish but parsed by hand to avoid an external dep):

[default]
api_key = "sk_live_..."
project_id = "proj_..."
api_url = "https://api.authio.com"
auth_core_url = "https://identity.authio.com"

File mode is 0600. We store profiles by name; "default" is the implicit profile when none is specified via --profile.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Profile

type Profile struct {
	APIKey      string
	ProjectID   string
	APIURL      string
	AuthCoreURL string
}

type Store

type Store struct {
	Path string
}

func DefaultStore

func DefaultStore() (*Store, error)

func (*Store) ActiveProfile

func (s *Store) ActiveProfile() string

ActiveProfile returns the profile selected via `authio env use`, defaulting to "default" when none has been chosen.

func (*Store) Load

func (s *Store) Load(profile string) (*Profile, error)

func (*Store) Names

func (s *Store) Names() ([]string, error)

Names returns the profile names present in the credentials file, with "default" first (when present) and the rest alphabetical. A missing file yields an empty slice and no error — callers treat "nothing configured" the same as "file absent".

func (*Store) Save

func (s *Store) Save(profile string, p Profile) error

func (*Store) SetActiveProfile

func (s *Store) SetActiveProfile(profile string) error

SetActiveProfile persists the chosen profile. The profile must already exist in the credentials file.

Jump to

Keyboard shortcuts

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