sopstest

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: GPL-3.0, LGPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sopstest writes sops encrypted files for tests, the way "sops --encrypt --encrypted-regex '^(data|binaryData)$'" writes them, so that no test depends on a sops binary or on a private key kept in the repository.

Index

Constants

View Source
const EncryptedRegex = "^(data|binaryData)$"

EncryptedRegex is the rule the documentation tells administrators to use.

Variables

This section is empty.

Functions

func AddVaultKey added in v0.3.0

func AddVaultKey(t testing.TB, file []byte, address string) []byte

AddVaultKey adds a HashiCorp Vault master key at address to the sops metadata of an encrypted file, the way anyone who can write the file can: the message authentication code does not cover the metadata. The data key it claims to hold is made up, so only a request to address shows that it was tried.

func Encrypt

func Encrypt(t testing.TB, plaintext string, recipients ...string) []byte

Encrypt encrypts a plaintext YAML document to the given age recipients and returns the file sops would have written.

func EncryptWith added in v0.3.0

func EncryptWith(t testing.TB, plaintext string, opts Options, recipients ...string) []byte

EncryptWith is Encrypt with the given settings.

func EncryptWithRegex

func EncryptWithRegex(t testing.TB, plaintext, regex string, recipients ...string) []byte

EncryptWithRegex is Encrypt with another encrypted_regex; an empty one encrypts every value, which is what sops does by default.

Types

type Options added in v0.3.0

type Options struct {
	// Regex is the encrypted_regex; an empty one encrypts every value.
	Regex string
	// MACOnlyEncrypted computes the message authentication code over the
	// encrypted values only, as "sops --mac-only-encrypted" does.
	MACOnlyEncrypted bool
}

Options are the settings of sops a test varies.

Jump to

Keyboard shortcuts

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