memory

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package memory provides an in-memory vault implementation. This is primarily useful for testing and development.

Usage:

v := memory.New()
v.Set(ctx, "my-secret", &vault.Secret{Value: "secret-value"})
secret, err := v.Get(ctx, "my-secret")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

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

Provider implements vault.Vault with in-memory storage.

func New

func New() *Provider

New creates a new in-memory provider.

func NewWithSecrets

func NewWithSecrets(secrets map[string]string) *Provider

NewWithSecrets creates a new in-memory provider pre-populated with secrets.

func (*Provider) Capabilities

func (p *Provider) Capabilities() vault.Capabilities

Capabilities returns the provider capabilities.

func (*Provider) Clear

func (p *Provider) Clear()

Clear removes all secrets from memory.

func (*Provider) Close

func (p *Provider) Close() error

Close marks the provider as closed.

func (*Provider) Count

func (p *Provider) Count() int

Count returns the number of secrets stored.

func (*Provider) Delete

func (p *Provider) Delete(ctx context.Context, path string) error

Delete removes a secret from memory.

func (*Provider) Exists

func (p *Provider) Exists(ctx context.Context, path string) (bool, error)

Exists checks if a secret exists in memory.

func (*Provider) Get

func (p *Provider) Get(ctx context.Context, path string) (*vault.Secret, error)

Get retrieves a secret from memory.

func (*Provider) List

func (p *Provider) List(ctx context.Context, prefix string) ([]string, error)

List returns all secret paths matching the prefix.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

func (*Provider) Set

func (p *Provider) Set(ctx context.Context, path string, secret *vault.Secret) error

Set stores a secret in memory.

Jump to

Keyboard shortcuts

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