vault

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package vault provides encrypted key-value secret storage using Badger (embedded KV store) with AES encryption and Argon2id password-based key derivation. Each workspace gets its own encrypted database.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Destroy

func Destroy(workspace string) error

Destroy removes the entire vault directory for a workspace.

func ExportEnvFormat

func ExportEnvFormat(store map[string]string) string

ExportEnvFormat returns key-value pairs as KEY=VALUE lines.

func ImportEnvFile

func ImportEnvFile(workspace, password, path string) error

ImportEnvFile reads a .env file and merges its key-value pairs into the vault.

func Init

func Init(workspace, password string) error

Init creates a new vault with an empty encrypted database.

func IsInitialized

func IsInitialized(workspace string) bool

IsInitialized checks whether a vault exists for the workspace.

func ParseEnvFile

func ParseEnvFile(data []byte) map[string]string

ParseEnvFile parses KEY=VALUE lines from .env file data.

func QuickDelete

func QuickDelete(workspace, password, key string) error

QuickDelete opens the vault, deletes a key, and closes.

func QuickGet

func QuickGet(workspace, password, key string) (string, error)

QuickGet opens the vault, reads a key, and closes.

func QuickList

func QuickList(workspace, password string) ([]string, error)

QuickList opens the vault, lists keys, and closes.

func QuickSet

func QuickSet(workspace, password, key, value string) error

QuickSet opens the vault, writes a key-value pair, and closes.

func ReplaceAll

func ReplaceAll(workspace, password string, store map[string]string) error

ReplaceAll opens the vault and replaces all entries with the given store. Existing entries not in the new store are deleted.

Types

type Store

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

Store wraps a Badger database for encrypted secret storage.

func Open

func Open(workspace, password string) (*Store, error)

Open decrypts and opens the vault database, returning a Store handle. The caller must call Close() when done.

func (*Store) All

func (s *Store) All() (map[string]string, error)

All returns all key-value pairs from the vault (excluding internal keys).

func (*Store) Close

func (s *Store) Close() error

Close closes the vault database.

func (*Store) Delete

func (s *Store) Delete(key string) error

Delete removes a key from the vault.

func (*Store) Get

func (s *Store) Get(key string) (string, error)

Get reads a single secret by key.

func (*Store) ImportEnvEntries

func (s *Store) ImportEnvEntries(entries map[string]string) error

ImportEnvEntries merges key-value pairs from a parsed .env map into the vault.

func (*Store) List

func (s *Store) List() ([]string, error)

List returns sorted key names from the vault (excluding internal keys).

func (*Store) Set

func (s *Store) Set(key, value string) error

Set writes a key-value pair to the vault.

Jump to

Keyboard shortcuts

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