keychain

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package keychain keeps small secrets in the operating system's credential store: the Windows Credential Manager, the macOS Keychain, or the Secret Service (GNOME Keyring, KWallet) on Linux. When there is no usable store (a container, a server with no desktop session) every function returns ErrUnavailable and the caller falls back to a file with owner-only permissions. SESHAT_KEYCHAIN=off turns the store off. See internal/keychain.

Index

Constants

View Source
const EnvDisable = keychain.EnvDisable

EnvDisable turns the operating system store off (value "off", "0" or "false").

View Source
const Service = keychain.Service

Service is the name every item is stored under.

Variables

View Source
var (
	// ErrNotFound means the store works and holds no item of that name.
	ErrNotFound = keychain.ErrNotFound
	// ErrUnavailable means there is no usable store: disabled, absent, locked or too slow to answer.
	ErrUnavailable = keychain.ErrUnavailable
)

Functions

func Delete

func Delete(account string) error

Delete removes the item stored under account; a missing item is not an error.

func Enabled

func Enabled() bool

Enabled reports whether this process may use the operating system store.

func Get

func Get(account string) (string, error)

Get returns the secret stored under account, ErrNotFound when there is none, ErrUnavailable when there is no usable store.

func Set

func Set(account, value string) error

Set stores value under account.

func UseForTesting

func UseForTesting() (restore func())

UseForTesting installs an in-memory store and turns the package on, and returns the function that restores the previous state, so that tests of the packages that call this one never touch the real store.

Types

This section is empty.

Jump to

Keyboard shortcuts

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