Documentation
¶
Overview ¶
Package envstore is the per-app encrypted environment store (plan §5.5, M5). The whole env blob is AES-256-GCM at rest under the master key; every save is a new immutable version (auditable history + rollback). Secret-flagged values are write-only in the UI and only ever leave via the audited reveal endpoint. Mooring owns the live env: at deploy it renders a fresh 0600 --env-file from this store (plan: env-import "own vs import").
Index ¶
- Variables
- type Entry
- type Store
- func (s *Store) Current(project string) ([]Entry, int, error)
- func (s *Store) DeleteApp(ctx context.Context, project string) error
- func (s *Store) Get(project, key string) (Entry, bool, error)
- func (s *Store) Render(project string) (map[string]string, error)
- func (s *Store) Reveal(project, key string) (string, bool, error)
- func (s *Store) Rollback(ctx context.Context, project string, version int, actor string) (int, error)
- func (s *Store) Save(ctx context.Context, project string, entries []Entry, actor string) (int, error)
- func (s *Store) Versions(project string) ([]Version, error)
- type Version
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBadKey means an env key failed the name grammar. ErrBadKey = errors.New("envstore: invalid key (use letters, digits, underscore; not starting with a digit)") // ErrBadValue means a value contained NUL or a bare CR/LF. ErrBadValue = errors.New("envstore: value must not contain NUL or newlines") )
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Key string
Value secret.Redacted
Secret bool
// Enc marks how Value is encoded for storage. "" means a plain value; "b64"
// means Value is std-base64 and must be decoded before use (this is how
// multi-line secrets — generated PEM keypairs — survive the no-newline rule).
Enc string
}
Entry is one environment variable. Value is wrapped so it never logs in clear.
func (Entry) DecodedValue ¶
DecodedValue returns the entry's value with any storage encoding undone: a "b64" entry (a generated PEM keypair) decodes back to the raw PEM bytes.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store persists encrypted, versioned env blobs.
func (*Store) Current ¶
Current returns the latest version's entries (sorted by key) and its version number (0 if none yet).
func (*Store) DeleteApp ¶
DeleteApp removes ALL env versions (literals + encrypted secrets) for an app — the entire history, so no secret material survives. Used by the app-delete teardown.
func (*Store) Get ¶
Get returns one key's full entry, including its Enc marker (so a caller that writes the value to a file can decode it). Prefer this over Reveal for secret_files materialization.
func (*Store) Rollback ¶
func (s *Store) Rollback(ctx context.Context, project string, version int, actor string) (int, error)
Rollback re-saves a prior version's content as a NEW version (never a pointer flip — the history stays linear and auditable, plan philosophy).