keyring

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package keyring stores API keys. It prefers the OS keychain and falls back to an obfuscated file when no keychain is available — common in containers and WSL.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStore

type FileStore struct {
	Dir string
}

The fallback when no OS keychain exists. Encrypted to stop casual disclosure; file mode 0600 is the real control.

func (*FileStore) Delete

func (f *FileStore) Delete(profile string) error

func (*FileStore) Get

func (f *FileStore) Get(profile string) (string, error)

func (*FileStore) Name

func (f *FileStore) Name() string

func (*FileStore) Set

func (f *FileStore) Set(profile, key string) error

type OSKeyring

type OSKeyring struct{}

func (OSKeyring) Delete

func (OSKeyring) Delete(profile string) error

func (OSKeyring) Get

func (OSKeyring) Get(profile string) (string, error)

func (OSKeyring) Name

func (OSKeyring) Name() string

func (OSKeyring) Set

func (OSKeyring) Set(profile, key string) error

type Store

type Store interface {
	Set(profile, key string) error
	Get(profile string) (string, error)
	Delete(profile string) error
	Name() string
}

Store is the credential backend. Name() is surfaced by whoami so the user can always tell where their key actually lives.

func Open

func Open() (store Store, warn string, err error)

Returns the OS keychain when it works, otherwise the file fallback. warn is non-empty when the fallback was selected without opting in.

Jump to

Keyboard shortcuts

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