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

secrets

package
v0.66.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package secrets resolves the credential references config holds in place of credentials themselves.

A reference is appkit/secret's prefixed form — "env:NAME", "file:/path", or "op://<vault>/<item>/<field>" for 1Password, which this package registers. Config therefore names where a secret lives, never the secret, which is what keeps a dotfiles-managed settings.yaml free of credentials.

References resolve once, at load. A rotated secret needs a relaunch; that is the right trade for a source that may prompt for biometric approval, which nothing should do per request.

Index

Constants

View Source
const OnePasswordPrefix = "op"

OnePasswordPrefix is the scheme of a 1Password secret reference, the value 1Password's own UI offers under "Copy Secret Reference".

Variables

View Source
var ErrNoOnePassword = errors.New("secrets: the 1Password CLI (op) was not found")
View Source
var KnownPrefixes = []string{"env", "file", OnePasswordPrefix}

KnownPrefixes is what a reference may name: appkit/secret's two built-ins plus ours. It is the vocabulary a config error quotes back.

Functions

func HasKnownPrefix

func HasKnownPrefix(ref string) bool

HasKnownPrefix reports whether ref names a source rather than being a literal secret pasted into config.

func Resolve

func Resolve(ref string) (string, error)

Resolve reads the secret a reference names. An unprefixed value resolves to itself, so callers that must not accept a literal check HasKnownPrefix first.

Types

This section is empty.

Jump to

Keyboard shortcuts

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