Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
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") // ErrNotConfigured indicates that the selected store is missing required settings. ErrNotConfigured = errors.New("secrets: not configured") // ErrInvalidKey indicates that a secret key cannot be represented safely. ErrInvalidKey = errors.New("secrets: invalid key") // ErrInsecureVaultAddress indicates that a Vault address would send secrets over an unsafe channel. ErrInsecureVaultAddress = errors.New("secrets: vault address must use https") // ErrNotImplemented is kept for compatibility with older releases. // Deprecated: VaultStore now returns ErrNotConfigured when setup is incomplete. 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
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.
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
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.
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
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 VaultOption ¶ added in v1.2.0
type VaultOption func(*VaultStore)
VaultOption configures a VaultStore.
func WithVaultAddress ¶ added in v1.2.0
func WithVaultAddress(addr string) VaultOption
WithVaultAddress sets the Vault base URL.
func WithVaultClient ¶ added in v1.2.0
func WithVaultClient(client *http.Client) VaultOption
WithVaultClient sets the HTTP client.
func WithVaultMount ¶ added in v1.2.0
func WithVaultMount(mount string) VaultOption
WithVaultMount sets the KV v2 mount name.
func WithVaultToken ¶ added in v1.2.0
func WithVaultToken(token string) VaultOption
WithVaultToken sets the Vault token.
type VaultStore ¶
type VaultStore struct {
// contains filtered or unexported fields
}
VaultStore stores secrets in a HashiCorp Vault KV v2 mount.
func NewVaultStore ¶
func NewVaultStore(opts ...VaultOption) *VaultStore
NewVaultStore creates a Vault-backed store.
func (*VaultStore) Delete ¶
func (v *VaultStore) Delete(key string) error
Delete removes a secret from Vault.