keyring

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrNotFound

type ErrNotFound struct {
	Service string
	Account string
}

ErrNotFound is returned by Get when no entry exists.

func (*ErrNotFound) Error

func (e *ErrNotFound) Error() string

type Keyring

type Keyring interface {
	// Get returns the value stored under (service, account). Returns ErrNotFound if missing.
	Get(service, account string) (string, error)
	// Set stores a value under (service, account), creating or overwriting.
	Set(service, account, value string) error
}

Keyring abstracts OS keychain access for storing and retrieving key material.

type Memory

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

Memory is an in-process keyring for testing.

func NewMemory

func NewMemory() *Memory

NewMemory returns an empty in-memory keyring.

func (*Memory) Get

func (m *Memory) Get(service, account string) (string, error)

func (*Memory) Set

func (m *Memory) Set(service, account, value string) error

type OS

type OS struct{}

OS delegates to the platform keychain (macOS Keychain, Windows Credential Manager, Linux Secret Service via libsecret).

func NewOS

func NewOS() *OS

NewOS returns an OS-backed keyring.

func (*OS) Get

func (o *OS) Get(service, account string) (string, error)

func (*OS) Set

func (o *OS) Set(service, account, value string) error

Jump to

Keyboard shortcuts

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