secrets

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func OpenLocal

func OpenLocal(base64Key string) (*secrets.Keeper, error)

OpenLocal returns an inmemory Keeper based on a provided key.

The scheme for the base64 key should look like: 'base64key://' The URL hostname must be a base64-encoded key, of length 32 bytes when decoded.

func OpenSecretKeeper

func OpenSecretKeeper(ctx context.Context, path, cloudProvider string, localBase64Key string) (*secrets.Keeper, error)

OpenSecretKeeper returns a Go Cloud Development Kit (Go CDK) Keeper object which can be used to encrypt and decrypt byte slices and stored in various services. Checkout https://gocloud.dev/ref/secrets/ for more details.

func TestKeeper added in v0.5.0

func TestKeeper(t *testing.T) *secrets.Keeper

Types

type StringKeeper

type StringKeeper struct {
	// contains filtered or unexported fields
}

StringKeeper wraps a secrets.Keeper but accepts and returns strings, which are easier to store in a database or pass around. Encrypted and decryptable values must be in base64.StdEncoding format.

func NewStringKeeper

func NewStringKeeper(keeper *secrets.Keeper, timeout time.Duration) *StringKeeper

func TestStringKeeper

func TestStringKeeper(t *testing.T) *StringKeeper

func (*StringKeeper) Close

func (str *StringKeeper) Close() error

func (*StringKeeper) DecryptString

func (str *StringKeeper) DecryptString(in string) (string, error)

DecryptString accepts a base64.StdEncoding string and returns the plaintext decrypted version

func (*StringKeeper) EncryptString

func (str *StringKeeper) EncryptString(in string) (string, error)

EncryptString accepts a string a returns the base64.StdEncoding encoding of its encrypted contents

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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