encryptor

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(value string) (string, error)

func DecryptBind

func DecryptBind(data string) string

func Encrypt

func Encrypt(value string) (string, error)

func EncryptBind

func EncryptBind(data string) string

func GenKey

func GenKey() []byte

func SetKey

func SetKey(value []byte)

Types

type Encryptor

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

Encryptor contains info to encrypt/decrypt sensitive data

func New

func New(key []byte) (*Encryptor, error)

New creates Encryptor using key.

func (*Encryptor) Decrypt

func (e *Encryptor) Decrypt(ciphertext []byte) ([]byte, error)

Decrypt performs XChacha20Poly1305 decryption using saved key.

func (*Encryptor) Encrypt

func (e *Encryptor) Encrypt(data []byte) ([]byte, error)

Encrypt performs XChacha20Poly1305 encryption using saved key.

Jump to

Keyboard shortcuts

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