cryptostruct

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 10 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt added in v0.2.0

func Decrypt(key string, data DecryptTransformer) (any, error)

func Encrypt added in v0.2.0

func Encrypt(key string, cryptoParams CryptoParams, data EncryptTransformer) (any, error)

Types

type CryptoParams

type CryptoParams struct {
	CipherSuite string `json:"cipherSuite" yaml:"cipherSuite" mapstructure:"cipherSuite"`
	Nonce       string `json:"nonce" yaml:"nonce" mapstructure:"nonce"`
}

func NewCryptoParams

func NewCryptoParams(cipherSuite string) (CryptoParams, error)

func (CryptoParams) GetCryptoConfig

func (p CryptoParams) GetCryptoConfig(masterKeyHex string) (sio.Config, error)

type DecryptTransformer

type DecryptTransformer interface {
	EncryptTransformer
	GetCryptoParams() CryptoParams
}

type Decrypter

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

func NewDecrypter

func NewDecrypter(masterKeyHex string, c TransformConfig) Decrypter

func (Decrypter) Transform

func (t Decrypter) Transform(r DecryptTransformer) (any, error)

type EncryptTransformer

type EncryptTransformer interface {
	GetTransformConfig() TransformConfig
}

type Encrypter

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

func NewEncrypter

func NewEncrypter(masterKeyHex string, p CryptoParams, c TransformConfig) Encrypter

func (Encrypter) Transform

func (t Encrypter) Transform(r any) (any, error)

type Tag

type Tag struct {
	Enabled bool
}

type TransformConfig

type TransformConfig struct {
	Decrypted any
	Encrypted any
}

Jump to

Keyboard shortcuts

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