secrets

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 8 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 stores tool secrets in the OS keyring (macOS Keychain or Linux Secret Service) under service "toolshed", account "<group>/<KEY>".

Secrets never go into Claude Code or Codex config files: tools that need them are registered as `toolshed exec <id>`, which reads the keyring and execs the real server with the values in its environment.

Index

Constants

View Source
const DisableEnv = "TOOLSHED_NO_KEYRING"

DisableEnv, when non-empty, turns the keyring off: secrets are then written into the client config as plain env vars. For CI and headless machines.

Variables

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

ErrNotFound is returned by Get when no value is stored.

View Source
var Service = "toolshed"

Service is the keyring service name. Overridable at build time:

-ldflags "-X github.com/bartdegoede/toolshed/internal/secrets.Service=acme"

Functions

func Available

func Available() bool

Available reports whether the OS keyring works, memoized per process.

The probe is a read, not a write: on macOS a write against a machine with no default keychain pops a modal "Keychain Not Found" dialog. Reads don't, but they also don't detect that state, so on macOS we first check that the default keychain file exists.

func Delete

func Delete(group, key string) error

Delete removes a secret; deleting a missing secret is not an error.

func Get

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

Get returns a stored secret.

func Set

func Set(group, key, value string) error

Set stores a secret.

func UseMockForTest

func UseMockForTest(avail bool)

UseMockForTest swaps in an in-memory keyring and sets Available.

Types

This section is empty.

Jump to

Keyboard shortcuts

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