secrets

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package secrets is an interface for encrypting and decrypting secrets

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecryptOption

type DecryptOption func(*DecryptOptions)

DecryptOption sets DecryptOptions

func SenderPublicKey

func SenderPublicKey(key []byte) DecryptOption

SenderPublicKey is the Public Key of the Secrets that encrypted this message

type DecryptOptions

type DecryptOptions struct {
	SenderPublicKey []byte
}

DecryptOptions can be passed to Secrets.Decrypt

type EncryptOption

type EncryptOption func(*EncryptOptions)

EncryptOption Sets EncryptOptions

func RecipientPublicKey

func RecipientPublicKey(key []byte) EncryptOption

RecipientPublicKey is the Public Key of the Secrets that will decrypt this message

type EncryptOptions

type EncryptOptions struct {
	RecipientPublicKey []byte
}

EncryptOptions can be passed to Secrets.Encrypt

type Option

type Option func(*Options)

Option sets options

func Key

func Key(k []byte) Option

Key sets the symmetric secret key

func PrivateKey

func PrivateKey(key []byte) Option

PrivateKey sets the asymmetric Private Key of this codec

func PublicKey

func PublicKey(key []byte) Option

PublicKey sets the asymmetric Public Key of this codec

type Options

type Options struct {
	// Key is a symmetric key for encoding
	Key []byte
	// Private key for decoding
	PrivateKey []byte
	// Public key for encoding
	PublicKey []byte
	// Context for other opts
	Context context.Context
}

type Secrets

type Secrets interface {
	// Initialise options
	Init(...Option) error
	// Return the options
	Options() Options
	// Decrypt a value
	Decrypt([]byte, ...DecryptOption) ([]byte, error)
	// Encrypt a value
	Encrypt([]byte, ...EncryptOption) ([]byte, error)
	// Secrets implementation
	String() string
}

Secrets encrypts or decrypts arbitrary data. The data should be as small as possible

Directories

Path Synopsis
Package box is an asymmetric implementation of config/secrets using nacl/box
Package box is an asymmetric implementation of config/secrets using nacl/box
Package secretbox is a config/secrets implementation that uses nacl/secretbox to do symmetric encryption / verification
Package secretbox is a config/secrets implementation that uses nacl/secretbox to do symmetric encryption / verification

Jump to

Keyboard shortcuts

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