crypto

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// NOOP represents no crypto
	NOOP = "NOOP"
	// AES256 represents AES256 encryption
	AES256 = "AES256"
)

Variables

This section is empty.

Functions

func Decrypt added in v0.12.0

func Decrypt(bytes []byte) ([]byte, error)

Decrypt decrypts the provided bytes using the globally configured codec

func Encrypt added in v0.12.0

func Encrypt(bytes []byte) ([]byte, error)

Encrypt encrypts the provided bytes using the globally configured codec

func InitializeGlobalCodec added in v0.12.0

func InitializeGlobalCodec(codec Codec) error

InitializeGlobalCodec may be called once and only once to inject an object that implements the Codec interface into a "global" (package-scoped) variable. Additional invocations of this function will return an error.

Types

type Codec

type Codec interface {
	Encrypt([]byte) ([]byte, error)
	Decrypt([]byte) ([]byte, error)
}

Codec is an interface to be implemented by any type that can encrypt and decrypt values

type Config added in v0.12.0

type Config struct {
	EncryptionScheme string `envconfig:"ENCRYPTION_SCHEME" default:"AES256"`
}

Config represents configuration options for the global codec

func GetConfigFromEnvironment added in v0.12.0

func GetConfigFromEnvironment() (Config, error)

GetConfigFromEnvironment returns configuration derived from environment variables

func NewConfigWithDefaults added in v0.12.0

func NewConfigWithDefaults() Config

NewConfigWithDefaults returns a Config object with default values already applied. Callers are then free to set custom values for the remaining fields and/or override default values.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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