vault

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package vault stores secrets (passwords, key passphrases, tokens) encrypted with AES-256-GCM, each bound to its name. The key is derived with scrypt from $KOMANDO_VAULT_PASS when set (N=2^17, r=8, p=1: the OWASP minimum), otherwise from a random 32-byte key file (vault.key, mode 0600).

Index

Constants

View Source
const MinPassphrase = 15

MinPassphrase is the shortest passphrase doctor accepts without a warning.

Variables

View Source
var ErrNotFound = errors.New("secret not found")
View Source
var PassphraseN = 1 << 17

PassphraseN is the scrypt cost for passphrase vaults (OWASP Password Storage Cheat Sheet: N=2^17, r=8, p=1). Tests lower it.

View Source
var Refs = []string{
	"secret:NAME (komando's vault)",
	"env:VAR",
	"file:PATH",
	"op://VAULT/ITEM/FIELD (1Password Connect)",
	"bw://ITEM/FIELD (Bitwarden, Vaultwarden)",
	"kdbx:FILE#GROUP/ENTRY[#FIELD] (KeePass, KeePassXC)",
	"vault:PATH#FIELD (HashiCorp Vault or OpenBao, KV)",
	"aws-sm:NAME[#JSON_KEY] (AWS Secrets Manager)",
	"gcp-sm:NAME[@PROJECT] (Google Secret Manager)",
}

Refs are the kinds of secret reference komando understands, with an example each, for help texts and errors.

Functions

func Delete

func Delete(name string) error

func Get

func Get(name string) (string, error)

func Passphrase added in v0.2.0

func Passphrase() string

Passphrase returns $KOMANDO_VAULT_PASS and removes it from this process's environment, so programs komando starts (kubectl, credential plugins, VPN clients, docker) never inherit it.

func RefHelp added in v0.2.0

func RefHelp() string

RefHelp is the hint for an invalid reference.

func Resolve

func Resolve(ref string) (string, error)

Resolve turns a reference into a value:

secret:<name>        -> komando's vault
env:<VAR>            -> environment variable
file:<path>          -> file contents (trailing newline trimmed)
op://v/item/field    -> 1Password Connect (OP_CONNECT_HOST, OP_CONNECT_TOKEN); the op CLI until it is removed
bw://item/field      -> Bitwarden or Vaultwarden, decrypted here (KOMANDO_BW_*)
kdbx:file#group/entry[#field] -> a KeePass file (KOMANDO_KDBX_PASSWORD / KOMANDO_KDBX_KEYFILE)
vault:path#field     -> HashiCorp Vault / OpenBao KV (VAULT_ADDR and a token, as the CLI uses them)
aws-sm:name[#key]    -> AWS Secrets Manager (the usual AWS credentials; a JSON key when given)
gcp-sm:name[@project]-> Google Secret Manager, latest version (application-default credentials)

komando talks to those services itself (internal/cloud); the login stays with the person and komando never stores the values.

func SelfEnv added in v0.2.0

func SelfEnv() []string

SelfEnv is the environment for komando's own background processes (`vpn serve`, `tunnel serve`), which need the vault.

func Set

func Set(name, value string) error

func ValidRef added in v0.2.0

func ValidRef(ref string) bool

ValidRef reports whether ref has a known form.

Types

type Info

type Info struct {
	Name      string    `json:"name"`
	UpdatedAt time.Time `json:"updated_at"`
}

func List

func List() ([]Info, error)

type Strength added in v0.2.0

type Strength struct {
	Mode       string `json:"mode"`
	ScryptN    int    `json:"scrypt_n"`
	ShortPass  bool   `json:"short_passphrase,omitempty"`
	OldKDF     bool   `json:"old_kdf,omitempty"`
	NoVaultYet bool   `json:"no_vault_yet,omitempty"`
}

Strength describes the vault's protection for `komando doctor`: the mode, the scrypt cost and, for a passphrase, whether it is long enough (NIST SP 800-63B asks for 15 characters when it is the only factor).

func Check added in v0.2.0

func Check() (Strength, error)

Jump to

Keyboard shortcuts

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