testsops

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2022 License: MIT Imports: 7 Imported by: 0

README

This package was developed by Silicon Ally while working on a project for Adventure Scientists. Many thanks to Adventure Scientists for supporting our open source mission!

testsops

GoDoc

testsops is a simple package for testing libraries that use Mozilla's sops tool for encryption. Specifically, this package can be used for testing libraries that make use of sops' decrypt package. See testsops_test.go for an example.

How does it work?

In normal usage, a sops-encrypted file uses a key stored in a cloud KMS system, but that's impractical for local testing. However, sops also supports GPG + age, the latter of which we use in testsops. When a file is requested a be encrypted, a new age identity is created and used to encrypt the file. To decrypt, the client points sops at the age key.txt file via the SOPS_AGE_KEY_FILE env var.

Documentation

Overview

Package testsops is a package for testing the functionality of tooling that decrypts SOPS-encrypted data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	KeyPath               string
	EncryptedContentsPath string
}

func EncryptEnv

func EncryptEnv(t *testing.T, contents string, opts ...Option) Config

func EncryptFile

func EncryptFile(t *testing.T, fn string, opts ...Option) Config

func EncryptIni

func EncryptIni(t *testing.T, contents string, opts ...Option) Config

func EncryptJSON

func EncryptJSON(t *testing.T, contents string, opts ...Option) Config

func EncryptYAML

func EncryptYAML(t *testing.T, contents string, opts ...Option) Config

type Option

type Option func(*options)

func WithSOPSBinary

func WithSOPSBinary(sopsPath string) Option

WithSOPSBinary specifies the path of the `sops` executable to use for encryption. If unspecified, defaults to looking in $PATH with exec.LookPath.

Jump to

Keyboard shortcuts

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