secrets

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound indicates that a secret key does not exist.
	ErrNotFound = errors.New("secrets: not found")
	// ErrReadOnly indicates that the selected store does not support writes.
	ErrReadOnly = errors.New("secrets: read-only store")
	// ErrNotImplemented indicates that the requested backend is only a placeholder.
	ErrNotImplemented = errors.New("secrets: not implemented")
)

Functions

This section is empty.

Types

type CipherStore

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

CipherStore wraps a Store and encrypts values at rest.

func NewCipherStore

func NewCipherStore(store Store, key []byte) (*CipherStore, error)

NewCipherStore creates a store that encrypts values with AES-GCM.

func (*CipherStore) Delete

func (c *CipherStore) Delete(key string) error

func (*CipherStore) Get

func (c *CipherStore) Get(key string) ([]byte, error)

func (*CipherStore) Set

func (c *CipherStore) Set(key string, value []byte) error

type EnvStore

type EnvStore struct{}

EnvStore provides read-only access to environment variables.

func NewEnvStore

func NewEnvStore() *EnvStore

NewEnvStore creates a new environment-backed secret store.

func (*EnvStore) Delete

func (e *EnvStore) Delete(key string) error

Delete reports that environment-backed stores are read-only.

func (*EnvStore) Get

func (e *EnvStore) Get(key string) ([]byte, error)

Get returns the environment variable value for the provided key.

func (*EnvStore) Set

func (e *EnvStore) Set(key string, value []byte) error

Set reports that environment-backed stores are read-only.

type FallbackStore

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

FallbackStore tries the primary store first, then falls back to secondary.

func NewFallbackStore

func NewFallbackStore(primary, secondary Store) *FallbackStore

NewFallbackStore creates a store that tries primary first, then falls back to secondary.

func (*FallbackStore) Delete

func (f *FallbackStore) Delete(key string) error

func (*FallbackStore) Get

func (f *FallbackStore) Get(key string) ([]byte, error)

func (*FallbackStore) Set

func (f *FallbackStore) Set(key string, value []byte) error

type MemoryStore

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

MemoryStore is a thread-safe in-memory store intended for tests and ephemeral use.

func NewMemoryStore

func NewMemoryStore() *MemoryStore

NewMemoryStore creates a new in-memory store.

func (*MemoryStore) Delete

func (s *MemoryStore) Delete(key string) error

Delete removes a secret from the in-memory store.

func (*MemoryStore) Get

func (s *MemoryStore) Get(key string) ([]byte, error)

Get returns a copy of the stored secret value.

func (*MemoryStore) Set

func (s *MemoryStore) Set(key string, value []byte) error

Set stores a copy of the provided secret value.

type PrefixStore

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

PrefixStore adds a namespace prefix to keys.

func NewPrefixStore

func NewPrefixStore(store Store, prefix string) *PrefixStore

NewPrefixStore wraps a Store and prepends the given prefix to all keys.

func (*PrefixStore) Delete

func (p *PrefixStore) Delete(key string) error

func (*PrefixStore) Get

func (p *PrefixStore) Get(key string) ([]byte, error)

func (*PrefixStore) Set

func (p *PrefixStore) Set(key string, value []byte) error

type Store

type Store interface {
	Set(key string, value []byte) error
	Get(key string) ([]byte, error)
	Delete(key string) error
}

Store is the shared contract for secret backends.

type VaultStore

type VaultStore struct{}

VaultStore is a placeholder for an external secret manager implementation.

func NewVaultStore

func NewVaultStore() *VaultStore

NewVaultStore creates a placeholder Vault-backed store.

func (*VaultStore) Delete

func (v *VaultStore) Delete(key string) error

Delete reports that the placeholder Vault store is not implemented yet.

func (*VaultStore) Get

func (v *VaultStore) Get(key string) ([]byte, error)

Get reports that the placeholder Vault store is not implemented yet.

func (*VaultStore) Set

func (v *VaultStore) Set(key string, value []byte) error

Set reports that the placeholder Vault store is not implemented yet.

Jump to

Keyboard shortcuts

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