Help us shape the future of Go! Take the 2026 Go Developer Survey

secrets

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package secrets provides an encrypted secret store — AES-256-GCM over ~/.ladyM.

Security boundary: this store prevents plaintext-at-rest — cat-ing secrets.enc will not reveal key values. It does NOT protect against full ~/.ladyM exfiltration (the master key and ciphertext live in the same directory). This is the explicit trade-off for cross-platform, non-interactive operation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeriveAESKey

func DeriveAESKey(userKey string) []byte

DeriveAESKey derives a 32-byte AES key from a user-supplied string via HKDF-SHA256 (salt=None, info="ladym-master-key"), matching the Python cryptography backend. The user's raw passphrase is never persisted.

func Dir

func Dir() string

Dir returns the default ~/.ladyM directory (resolved at call time).

Types

type Store

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

Store is the encrypted secret store.

func NewStore

func NewStore(dir string) *Store

NewStore returns a Store rooted at dir (defaults to ~/.ladyM).

func (*Store) Get

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

Get returns the decrypted value for name, or "" when absent.

func (*Store) HasMasterKey

func (s *Store) HasMasterKey() bool

HasMasterKey reports whether master.key exists.

func (*Store) ListNames

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

ListNames returns the sorted stored key names (values never echoed).

func (*Store) MasterKeyPath

func (s *Store) MasterKeyPath() string

MasterKeyPath returns the path to master.key (for display/diagnostics only).

func (*Store) Remove

func (s *Store) Remove(name string) (bool, error)

Remove deletes name; returns false when absent.

func (*Store) ResetMasterKey

func (s *Store) ResetMasterKey(newKey string) error

ResetMasterKey re-encrypts every secret under a new master key.

func (*Store) Set

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

Set stores name=value (encrypted at rest).

func (*Store) SetMasterKey

func (s *Store) SetMasterKey(key string) ([]byte, error)

SetMasterKey writes the master key (deriving from key, or a random key when key is empty). Refuses when secrets.enc already has entries.

Jump to

Keyboard shortcuts

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