vault

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsVaultRef

func IsVaultRef(value string) bool

IsVaultRef returns true if the value is a vault:// reference.

func ParseVaultRef

func ParseVaultRef(value string) (string, bool)

ParseVaultRef extracts the path from a vault:// reference. Returns the path portion (e.g. "providers/anthropic/primary") and true, or empty string and false if not a vault reference.

Types

type ChainVaultBackend added in v0.1.1

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

ChainVaultBackend tries multiple VaultStore backends in order. It implements VaultStore.

func NewChainVaultBackend added in v0.1.1

func NewChainVaultBackend(names []string, stores []VaultStore, log logger.Logger) *ChainVaultBackend

NewChainVaultBackend creates a ChainVaultBackend from ordered backends. names and stores must have the same length.

func (*ChainVaultBackend) Delete added in v0.1.1

func (c *ChainVaultBackend) Delete(path string) error

Delete removes a secret from the first backend.

func (*ChainVaultBackend) List added in v0.1.1

func (c *ChainVaultBackend) List() ([]string, error)

List returns all secret paths from the first backend.

func (*ChainVaultBackend) Resolve added in v0.1.1

func (c *ChainVaultBackend) Resolve(ref string) (string, error)

Resolve tries each backend in order until one succeeds. If all fail, returns an error with details of each failure.

func (*ChainVaultBackend) Set added in v0.1.1

func (c *ChainVaultBackend) Set(path string, value string) error

Set stores a secret using the first backend.

type EnvVaultBackend

type EnvVaultBackend struct{}

EnvVaultBackend resolves secrets from environment variables. Path mapping: vault://providers/{provider}/{key} -> TERN_VAULT_{PROVIDER}_{KEY}

func NewEnvVaultBackend

func NewEnvVaultBackend() *EnvVaultBackend

NewEnvVaultBackend creates a new EnvVaultBackend.

func (*EnvVaultBackend) Delete

func (b *EnvVaultBackend) Delete(path string) error

Delete removes a secret by unsetting the corresponding environment variable.

func (*EnvVaultBackend) List

func (b *EnvVaultBackend) List() ([]string, error)

List returns all secret paths by scanning environment variables with TERN_VAULT_ prefix.

func (*EnvVaultBackend) Resolve

func (b *EnvVaultBackend) Resolve(ref string) (string, error)

Resolve resolves a vault:// reference to the actual secret from environment variables.

func (*EnvVaultBackend) Set

func (b *EnvVaultBackend) Set(path string, value string) error

Set stores a secret by setting the corresponding environment variable.

type FileVaultBackend

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

func NewFileVaultBackend

func NewFileVaultBackend(filepath string) (*FileVaultBackend, error)

func (*FileVaultBackend) Delete

func (b *FileVaultBackend) Delete(path string) error

func (*FileVaultBackend) List

func (b *FileVaultBackend) List() ([]string, error)

func (*FileVaultBackend) Resolve

func (b *FileVaultBackend) Resolve(ref string) (string, error)

func (*FileVaultBackend) Set

func (b *FileVaultBackend) Set(path, value string) error

type KeyringVaultBackend

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

KeyringVaultBackend implements VaultStore using OS Keyring (Windows Credential Manager, macOS Keychain, Linux Secret Service). It is safe for concurrent use.

func NewKeyringVaultBackend

func NewKeyringVaultBackend(tenantID ...string) *KeyringVaultBackend

NewKeyringVaultBackend creates a backend scoped to the given tenant. If no tenantID is provided, "default" is used.

func (*KeyringVaultBackend) Delete

func (k *KeyringVaultBackend) Delete(path string) error

Delete removes a secret from the OS Keyring.

func (*KeyringVaultBackend) List

func (k *KeyringVaultBackend) List() ([]string, error)

List returns all stored secret paths from the key index.

func (*KeyringVaultBackend) Resolve

func (k *KeyringVaultBackend) Resolve(ref string) (string, error)

Resolve resolves a vault:// reference to the actual secret from OS Keyring.

func (*KeyringVaultBackend) ServiceName

func (k *KeyringVaultBackend) ServiceName() string

ServiceName returns the computed OS keyring service name (for testing).

func (*KeyringVaultBackend) Set

func (k *KeyringVaultBackend) Set(path string, value string) error

Set stores a secret at the given path in the OS Keyring.

type VaultStore

type VaultStore interface {
	// Resolve resolves a vault:// reference to the actual secret value.
	// Returns an error if the reference cannot be resolved.
	Resolve(ref string) (string, error)

	// Set stores a secret at the given path.
	Set(path string, value string) error

	// Delete removes a secret at the given path.
	Delete(path string) error

	// List returns all stored secret paths.
	List() ([]string, error)
}

VaultStore manages secret storage and retrieval.

Jump to

Keyboard shortcuts

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