Documentation
¶
Index ¶
Constants ¶
const DefaultSecretPath = "secret/data/console"
Default path for secrets if not configured.
Variables ¶
var ( ErrSecretNotFound = errors.New("secret not found") ErrUnexpectedDataFormat = errors.New("unexpected secret data format") ErrKeyNotFound = errors.New("key not found in secret") ErrValueNotString = errors.New("value is not a string") )
Sentinel errors for secret operations.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements the security.Storager interface for HashiCorp Vault.
func NewClient ¶
NewClient creates a new Vault Client instance. For production: pass config to create a new API client. For testing: use WithClient option to inject a mock client.
func (*Client) DeleteKeyValue ¶
DeleteKeyValue deletes a value from Vault. If the key contains "/", it deletes the entire secret at {basePath}/{key}. Otherwise, it removes the key from {basePath}/keys.
func (*Client) GetKeyValue ¶
GetKeyValue reads a value from Vault. If the key contains "/", it's treated as a separate path: {basePath}/{key} with data stored under "value". Otherwise, it's stored in {basePath}/keys with the key as a field name.
func (*Client) GetObject ¶
GetObject retrieves a map of string values from a path-based secret. The key must contain "/" to specify the path: {basePath}/{key}.
func (*Client) SetKeyValue ¶
SetKeyValue writes a value to Vault. If the key contains "/", it's treated as a separate path: {basePath}/{key} with data stored under "value". Otherwise, it's stored in {basePath}/keys with the key as a field name.
type ObjectStorager ¶
type ObjectStorager interface {
security.Storager
GetObject(key string) (map[string]string, error)
SetObject(key string, data map[string]string) error
}
ObjectStorager extends security.Storager with object storage capabilities. This allows storing structured data (like certificates) as proper JSON objects in Vault.
type Option ¶
type Option func(*Client)
Option is a functional option for configuring the Client.
func WithClient ¶
WithClient sets a pre-configured Vault API client (useful for testing).