Documentation ¶
Index ¶
- Constants
- func DBFileExists(path string) (bool, error)
- type BoltStorage
- func (b *BoltStorage) Clear() error
- func (b *BoltStorage) Close() error
- func (b *BoltStorage) Delete(id string) error
- func (b *BoltStorage) GetAutoAuthToken(ctx context.Context) ([]byte, error)
- func (b *BoltStorage) GetByType(ctx context.Context, indexType string) ([][]byte, error)
- func (b *BoltStorage) GetRetrievalToken() ([]byte, error)
- func (b *BoltStorage) Set(ctx context.Context, id string, plaintext []byte, indexType string) error
- func (b *BoltStorage) StoreRetrievalToken(token []byte) error
- type BoltStorageConfig
Constants ¶
const ( // DatabaseFileName - filename for the persistent cache file DatabaseFileName = "vault-agent-cache.db" // SecretLeaseType - Bucket/type for leases with secret info SecretLeaseType = "secret-lease" // AuthLeaseType - Bucket/type for leases with auth info AuthLeaseType = "auth-lease" // TokenType - Bucket/type for auto-auth tokens TokenType = "token" // AutoAuthToken - key for the latest auto-auth token AutoAuthToken = "auto-auth-token" // RetrievalTokenMaterial is the actual key or token in the key bucket RetrievalTokenMaterial = "retrieval-token-material" )
Variables ¶
This section is empty.
Functions ¶
func DBFileExists ¶
DBFileExists checks whether the vault agent cache file at `filePath` exists
Types ¶
type BoltStorage ¶
type BoltStorage struct {
// contains filtered or unexported fields
}
BoltStorage is a persistent cache using a bolt db. Items are organized with the version and bootstrapping items in the "meta" bucket, and tokens, auth leases, and secret leases in their own buckets.
func NewBoltStorage ¶
func NewBoltStorage(config *BoltStorageConfig) (*BoltStorage, error)
NewBoltStorage opens a new bolt db at the specified file path and returns it. If the db already exists the buckets will just be created if they don't exist.
func (*BoltStorage) Clear ¶
func (b *BoltStorage) Clear() error
Clear the boltdb by deleting all the token and lease buckets and recreating the schema/layout
func (*BoltStorage) Delete ¶
func (b *BoltStorage) Delete(id string) error
Delete an index (token or lease) by id from bolt storage
func (*BoltStorage) GetAutoAuthToken ¶
func (b *BoltStorage) GetAutoAuthToken(ctx context.Context) ([]byte, error)
GetAutoAuthToken retrieves the latest auto-auth token, and returns nil if non exists yet
func (*BoltStorage) GetRetrievalToken ¶
func (b *BoltStorage) GetRetrievalToken() ([]byte, error)
GetRetrievalToken retrieves a plaintext token from the KeyBucket, which will be used by the key manager to retrieve the encryption key, nil if none set
func (*BoltStorage) StoreRetrievalToken ¶
func (b *BoltStorage) StoreRetrievalToken(token []byte) error
StoreRetrievalToken sets plaintext token material in the RetrievalTokenBucket