secretref

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	Resolve(ctx context.Context, ref Ref) (string, error)
}

Backend resolves a parsed secret reference into a plaintext value.

type EnvBackend

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

EnvBackend resolves env://VAR references.

func NewEnvBackend

func NewEnvBackend(lookup EnvLookup) *EnvBackend

func (*EnvBackend) Resolve

func (b *EnvBackend) Resolve(_ context.Context, ref Ref) (string, error)

type EnvLookup

type EnvLookup func(string) (string, bool)

type Error

type Error struct {
	Kind   ErrorKind
	Ref    string
	Detail string
	Err    error
}

Error is a typed secret reference error.

func (*Error) Error

func (e *Error) Error() string

func (*Error) Unwrap

func (e *Error) Unwrap() error

type ErrorKind

type ErrorKind string
const (
	KindInvalidRef         ErrorKind = "invalid_ref"
	KindNotFound           ErrorKind = "not_found"
	KindBackendUnavailable ErrorKind = "backend_unavailable"
)

type KeychainBackend

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

KeychainBackend resolves keychain://service/account references.

func NewKeychainBackend

func NewKeychainBackend() *KeychainBackend

NewKeychainBackend creates a keychain backend for the current platform.

func (*KeychainBackend) Resolve

func (b *KeychainBackend) Resolve(ctx context.Context, ref Ref) (string, error)

type Ref

type Ref struct {
	Raw    string
	Scheme string
	Path   string
}

Ref represents a parsed secret reference in the form <scheme>://<path>.

func Parse

func Parse(raw string) (Ref, error)

Parse parses a secret reference.

type Resolver

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

Resolver routes secret references by scheme.

func NewDefaultResolver

func NewDefaultResolver() *Resolver

NewDefaultResolver builds the baseline resolver with env:// and keychain:// support.

func NewResolver

func NewResolver(backends map[string]Backend) *Resolver

NewResolver creates a resolver from scheme backends.

func (*Resolver) Resolve

func (r *Resolver) Resolve(ctx context.Context, raw string) (string, error)

Resolve parses and resolves a secret reference.

Jump to

Keyboard shortcuts

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