Documentation

Index

Constants

View Source
const NonceSize = 12

Variables

This section is empty.

Functions

This section is empty.

Types

type Cryptor

type Cryptor interface {
	Encryptor
	Decryptor
}

func NewCryptor

func NewCryptor(keyManager KeyManager, prng io.Reader) Cryptor

type Decryptor

type Decryptor interface {
	Decrypt(encrypted Encrypted) ([]byte, error)
}

type Encrypted

type Encrypted struct {
	Nonce      []byte
	KeyLabel   string
	CipherText []byte
}

type EncryptionConfig

type EncryptionConfig struct {
	ActiveKeyLabel string            `json:"active_key_label"`
	EncryptionKeys map[string]string `json:"encryption_keys"`
}

func (*EncryptionConfig) Parse

func (ef *EncryptionConfig) Parse() (Key, []Key, error)

type Encryptor

type Encryptor interface {
	Encrypt(plaintext []byte) (Encrypted, error)
}

type Key

type Key interface {
	Label() string
	Block() cipher.Block
}

func NewKey

func NewKey(label, phrase string) (Key, error)

type KeyManager

type KeyManager interface {
	EncryptionKey() Key
	DecryptionKey(label string) Key
}

func NewKeyManager

func NewKeyManager(encryptionKey Key, decryptionKeys []Key) (KeyManager, error)

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.