secrets

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: MIT Imports: 3 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

Overview

Package secrets abstracts credential storage. The system implementation uses the OS keyring via zalando/go-keyring (Secret Service over D-Bus on Linux, Keychain on macOS); an in-memory implementation is provided for tests.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("secret not found")

ErrNotFound is returned when a key is absent.

Functions

func PasswordKey

func PasswordKey(ctx string) string

PasswordKey is the keyring key holding a context's login password.

func TokenKey

func TokenKey(ctx string) string

TokenKey is the keyring key holding a context's session token or personal access token.

Types

type Memory

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

Memory is an in-memory Store for tests.

func NewMemory

func NewMemory() *Memory

NewMemory returns an empty in-memory store.

func (*Memory) Delete

func (s *Memory) Delete(key string) error

Delete removes key.

func (*Memory) Get

func (s *Memory) Get(key string) (string, error)

Get returns the value for key, or ErrNotFound.

func (*Memory) Set

func (s *Memory) Set(key, value string) error

Set stores value under key.

type Store

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

Store is the minimal credential store interface used by the rest of mmcli.

type SystemStore

type SystemStore struct{}

SystemStore talks to the OS keyring (Secret Service on Linux, Keychain on macOS).

func (SystemStore) Delete

func (SystemStore) Delete(key string) error

Delete removes key; absent keys are not an error.

func (SystemStore) Get

func (SystemStore) Get(key string) (string, error)

Get returns the value for key, or ErrNotFound.

func (SystemStore) Set

func (SystemStore) Set(key, value string) error

Set stores value under key.

Jump to

Keyboard shortcuts

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