Help us shape the future of Go! Take the 2026 Go Developer Survey

keychain

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultService = "jamf-cli"

DefaultService is the keychain service name used by jamf-cli.

Variables

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

ErrNotFound is returned when a keychain item does not exist.

Functions

func KeychainRef

func KeychainRef(profile, field string) string

KeychainRef builds a keychain: reference string for use in config files. Example: KeychainRef("prod", "client-secret") returns "keychain:jamf-cli/prod/client-secret"

func ParseRef

func ParseRef(value string) (service, account string)

ParseRef parses a keychain reference value into service and account. The input is the portion after the "keychain:" prefix.

Format: "service/account/subkey" or just "account/subkey" If the value contains exactly two slashes, the first segment is the service. Otherwise DefaultService is used and the entire value is the account.

Examples:

"jamf-cli/prod/client-secret" -> service="jamf-cli", account="prod/client-secret"
"prod/client-secret"             -> service="jamf-cli", account="prod/client-secret"

func WriteError added in v1.19.0

func WriteError(item string, err error) error

WriteError wraps a failed keychain write (Store.Set) with actionable, OS-specific guidance. The underlying go-keyring backends shell out to the system credential store and surface only the process exit code (e.g. macOS "exit status 154"), discarding the descriptive message — so on its own the raw error tells the user nothing about how to fix it. item is a short, human-readable label for what was being stored (e.g. "client ID").

Types

type Store

type Store interface {
	Get(service, account string) (string, error)
	Set(service, account, secret string) error
	Delete(service, account string) error
}

Store provides access to the system keychain.

func New

func New() Store

New returns a Store backed by the system keychain.

Jump to

Keyboard shortcuts

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