secret

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package secret provides AES-256-GCM encrypted project secrets management. Secrets are stored in .cloop/secrets.enc and protected by a passphrase supplied via the CLOOP_SECRET_KEY environment variable or prompted at runtime.

Index

Constants

View Source
const (

	// EnvPassphraseKey is the environment variable that holds the passphrase.
	EnvPassphraseKey = "CLOOP_SECRET_KEY"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store holds the decrypted set of secrets in memory.

func Open

func Open(workDir string) (*Store, error)

Open loads and decrypts the secrets store from workDir. If the file does not exist, an empty store is returned. The passphrase is read from CLOOP_SECRET_KEY; an error is returned if it is absent and the file exists.

func (*Store) Delete

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

Delete removes key from the store. Returns false if the key was not found.

func (*Store) EnvLines

func (s *Store) EnvLines() []string

EnvLines returns KEY=value pairs for every secret, suitable for os/exec Env.

func (*Store) Get

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

Get returns the plain-text value for key and whether it was found.

func (*Store) InjectIntoPrompt

func (s *Store) InjectIntoPrompt(prompt string) string

InjectIntoPrompt replaces {{KEY}} placeholders in prompt with the corresponding secret values. Unknown placeholders are left intact.

func (*Store) Keys

func (s *Store) Keys() []string

Keys returns the sorted list of secret keys.

func (*Store) Len

func (s *Store) Len() int

Len returns the number of secrets in the store.

func (*Store) Save

func (s *Store) Save() error

Save encrypts and writes the store to disk. A new random salt is generated on each save (providing forward secrecy for the encryption layer).

func (*Store) Set

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

Set stores key=value in the store (not persisted until Save is called).

Jump to

Keyboard shortcuts

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