secrets

package
v0.8.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgeRecipientsFromKeyFile

func AgeRecipientsFromKeyFile(ageKeyFile string) ([]string, error)

AgeRecipientsFromKeyFile reads an age identity file and returns the corresponding recipient(s). It supports resolving ~/ in the path similarly to DecryptAndParse.

func DecryptAndParse

func DecryptAndParse(ctx context.Context, path string, opts SopsOptions) ([]string, error)

DecryptAndParse returns key=value pairs from a SOPS-encrypted dotenv file. Only dotenv format is supported. If no SOPS backends are configured, the file is treated as plaintext. This function is safe for concurrent use across multiple goroutines.

func EncryptDotenvFileWithSops

func EncryptDotenvFileWithSops(ctx context.Context, path string, ageRecipients []string, ageKeyFile string, pgpRecipients []string, pgpKeyringDir string, pgpUseAgent bool, pgpPinentryMode string, pgpPassphrase string) error

EncryptDotenvFileWithSops encrypts a plaintext dotenv file in-place using the system SOPS binary with provided recipients. Age recipients are passed with --age, PGP recipients are passed with --pgp. This function is safe for concurrent use across multiple goroutines.

Types

type SopsOptions added in v0.5.0

type SopsOptions struct {
	// Age
	AgeKeyFile    string
	AgeRecipients []string
	// PGP (GnuPG)
	PgpKeyringDir   string
	PgpUseAgent     bool
	PgpPinentryMode string // "default" | "loopback"
	PgpPassphrase   string // interpolated already; not logged
	PgpRecipients   []string
}

SopsOptions provides decryption/encryption settings for SOPS (age + pgp)

Jump to

Keyboard shortcuts

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