sops

package module
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: MPL-2.0 Imports: 11 Imported by: 0

README

sops-wrapper

Integrated library wrapper for Mozilla SOPS, ideal for run encryption/decryption on apps and web services, without need to install the official binary.

Usage

import "github.com/jfxdev/sops-wrapper"

cypher := sops.NewCypher()

keys := []entities.EncryptionKey{
    {
        ID:       "arn:aws:kms:us-east-2:XXXXXXXXXXXX:key/YYYYYYYY-YYYY-YYYYY-YYYY-YYYYYYYYYYY",
        Platform: "aws/kms",
        Role:     "arn:aws:iam::XXXXXXXXXXXX:role/your-aws-role",
        Context:  map[string]string{"context": "sops"},
    }
x}

result, err := cypher.Encrypt(body, sops.EncryptionConfig{
		Keys:              keys,
		UnencryptedSuffix: "",
		EncryptedSuffix:   "",
		UnencryptedRegex:  "",
		EncryptedRegex:    "^(data)$",
		ShamirThreshold:   3,
		Format:            "yaml",
})

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cypher

type Cypher interface {
	Decrypt(content []byte, config string) ([]byte, error)
	Encrypt(data []byte, config EncryptionConfig) ([]byte, error)
}

func NewCypher

func NewCypher() Cypher

type EncryptionConfig

type EncryptionConfig struct {
	Format            string
	Keys              []entities.EncryptionKey
	UnencryptedSuffix string
	EncryptedSuffix   string
	UnencryptedRegex  string
	EncryptedRegex    string
	ShamirThreshold   int
}

Directories

Path Synopsis
aws
gcp

Jump to

Keyboard shortcuts

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