secrets

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsTokenKey added in v0.7.1

func IsTokenKey(key string) bool

IsTokenKey reports whether a keyring key is an olk token entry.

func ItemLabel added in v1.14.0

func ItemLabel(key string) string

ItemLabel is the human-readable name a stored key gets in the OS credential store, e.g. "olk token for someone@example.com".

func TokenKey

func TokenKey(email string) string

TokenKey returns the canonical keyring key for a given email address. Format: olk:token:<email>

Types

type KeyringStore

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

KeyringStore implements Store using the keyring library for cross-platform credential storage (macOS Keychain, Linux Secret Service, Windows WinCred).

func NewKeyringStore

func NewKeyringStore() (*KeyringStore, error)

NewKeyringStore creates a new KeyringStore backed by the OS credential manager.

func (*KeyringStore) Delete

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

Delete removes the entry for the given key.

func (*KeyringStore) Get

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

Get retrieves the value stored under the given key.

func (*KeyringStore) Keys

func (s *KeyringStore) Keys() ([]string, error)

Keys returns all keys currently stored in the keyring.

func (*KeyringStore) Set

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

Set stores a value under the given key. The item carries a label and a description because macOS shows the label in its access prompt: without one the dialog reads `olk wants to access key "" in your keychain`, which gives the person no way to tell which account or purpose is being asked about.

On macOS the name in that prompt is the item's access-control entry, which the keychain creates from the label when the item is first added and never changes on update, so the name only reaches items created after this label existed. Recreating an older item is not an option: the keychain lets only the application that created an item delete it, and a rebuilt or re-signed binary is a different application (error -25244). Signing out and back in recreates the item with the name.

type Store

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

Store defines the interface for credential storage.

Jump to

Keyboard shortcuts

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