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, indexType 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" // TokenType - Bucket/type for auto-auth tokens TokenType = "token" // LeaseType - v2 Bucket/type for auth AND secret leases. // // This bucket stores keys in the same order they were created using // auto-incrementing keys and the fact that BoltDB stores keys in byte // slice order. This means when we iterate through this bucket during // restore, we will always restore parent tokens before their children, // allowing us to correctly attach child contexts to their parent's context. LeaseType = "lease" // 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, indexType string) error
Delete an index (token or lease) by key 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