secret

package
v0.1.1-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package secret handles credential resolution including OS keyring integration.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsKeyringRef

func IsKeyringRef(s string) bool

IsKeyringRef reports whether s is a keyring reference.

func Resolve

func Resolve(raw string, opts Options) (string, *errors.XError)

Resolve resolves a secret value following the order defined in docs/config.md:

  1. keyring:<service>/<account> → read from the keyring
  2. otherwise, if plaintext and plaintext is allowed → return as-is
  3. otherwise → return an error

Note: TTY interactive input is not implemented at this layer (left to the cmd layer).

Types

type KeyringAPI

type KeyringAPI interface {
	Get(service, account string) (string, error)
	Set(service, account, value string) error
	Delete(service, account string) error
}

KeyringAPI is a minimal abstraction over the OS keyring for testability and cross-platform support. service corresponds to the keyring service name; account corresponds to the user/account.

type Options

type Options struct {
	AllowPlaintext bool       // whether to allow plaintext secrets (default false)
	Keyring        KeyringAPI // injectable keyring implementation (nil uses default)
}

Options controls secret resolution behavior.

Jump to

Keyboard shortcuts

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