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
- type Store
- func (s *Store) Delete(key string) bool
- func (s *Store) EnvLines() []string
- func (s *Store) Get(key string) (string, bool)
- func (s *Store) InjectIntoPrompt(prompt string) string
- func (s *Store) Keys() []string
- func (s *Store) Len() int
- func (s *Store) Save() error
- func (s *Store) Set(key, value string)
Constants ¶
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 ¶
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) EnvLines ¶
EnvLines returns KEY=value pairs for every secret, suitable for os/exec Env.
func (*Store) InjectIntoPrompt ¶
InjectIntoPrompt replaces {{KEY}} placeholders in prompt with the corresponding secret values. Unknown placeholders are left intact.