codec

package
v1.0.1003 Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBoxProvider

func NewBoxProvider(storage interfaces.KeyStorage, options ...BoxApply) interfaces.Encryption

func NewDefaultProvider

func NewDefaultProvider(key []byte) interfaces.Encryption

func NewDefaultStorage

func NewDefaultStorage(fileLoc string, inMem bool, log loggerInterfaces.Logger) listener.KeyStorage

func NewSecretBoxProvider

func NewSecretBoxProvider(key string) interfaces.Encryption

Types

type Apply

type Apply interface {
	// contains filtered or unexported methods
}

func WithKeyStorage

func WithKeyStorage(keyStorage interfaces.KeyStorage) Apply

func WithName

func WithName(name string) Apply

func WithOptionBypassMarshall

func WithOptionBypassMarshall(bypass bool) Apply

type BadgerStorage

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

func (*BadgerStorage) Debugf

func (c *BadgerStorage) Debugf(val string, arg ...interface{})

func (*BadgerStorage) Errorf

func (c *BadgerStorage) Errorf(val string, arg ...interface{})

func (*BadgerStorage) Get

func (c *BadgerStorage) Get(id string) (response *listenerProto.DefaultStorageItem, err error)

func (*BadgerStorage) Infof

func (c *BadgerStorage) Infof(val string, arg ...interface{})

func (*BadgerStorage) Set

func (c *BadgerStorage) Set(id string, clientPublicKey []byte, serverPair encrypt.BoxKeyPair, alive time.Duration) error

func (*BadgerStorage) Warningf

func (c *BadgerStorage) Warningf(val string, arg ...interface{})

type Box

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

func (*Box) Decrypt

func (c *Box) Decrypt(data []byte) (res []byte, err error)

func (*Box) Encrypt

func (c *Box) Encrypt(data []byte) (res []byte, err error)

type BoxApply

type BoxApply interface {
	// contains filtered or unexported methods
}

func BoxWithAnonymous

func BoxWithAnonymous(anonymous bool) BoxApply

func BoxWithIgnoreRequest

func BoxWithIgnoreRequest(ignore bool) BoxApply

func BoxWithPairKeys

func BoxWithPairKeys(privateKey, publicKey string) BoxApply

type DefaultProvider

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

func (*DefaultProvider) Decrypt

func (c *DefaultProvider) Decrypt(data []byte) (res []byte, err error)

func (*DefaultProvider) Encrypt

func (c *DefaultProvider) Encrypt(data []byte) (res []byte, err error)

type Encryption

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

func NewEncryptionCodec

func NewEncryptionCodec(provider interfaces.Encryption, options ...Apply) *Encryption

func (*Encryption) Marshal

func (c *Encryption) Marshal(v interface{}) ([]byte, error)

func (*Encryption) Name

func (c *Encryption) Name() string

func (*Encryption) Unmarshal

func (c *Encryption) Unmarshal(data []byte, v interface{}) error

type SecretBox

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

func (*SecretBox) Decrypt

func (c *SecretBox) Decrypt(data []byte) (res []byte, err error)

func (*SecretBox) Encrypt

func (c *SecretBox) Encrypt(data []byte) (res []byte, err error)

Jump to

Keyboard shortcuts

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