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
- func AddVaultKey(t testing.TB, file []byte, address string) []byte
- func Encrypt(t testing.TB, plaintext string, recipients ...string) []byte
- func EncryptWith(t testing.TB, plaintext string, opts Options, recipients ...string) []byte
- func EncryptWithRegex(t testing.TB, plaintext, regex string, recipients ...string) []byte
- type Options
Constants ¶
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
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 ¶
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
EncryptWith is Encrypt with the given settings.
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.