encryptor

package
v0.0.0-...-e163d20 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Encryptor

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

Encryptor holds the encryption key and pre-initialized AEAD instance

func NewEncryptor

func NewEncryptor(key string) (*Encryptor, error)

NewEncryptor creates a new Encryptor instance with a given key. The key must be exactly 32 bytes long for chacha20poly1305.

func (*Encryptor) Decrypt

func (e *Encryptor) Decrypt(_ context.Context, ciphertext []byte) ([]byte, error)

Decrypt takes an encrypted string and returns the decrypted plaintext.

func (*Encryptor) Encrypt

func (e *Encryptor) Encrypt(_ context.Context, plaintext []byte) ([]byte, error)

Encrypt encrypts the plaintext non-deterministically and returns it encrypted

func (*Encryptor) EncryptDet

func (e *Encryptor) EncryptDet(_ context.Context, plaintext []byte) ([]byte, error)

EncryptDet encrypts the plaintext deterministically and returns it encrypted

Jump to

Keyboard shortcuts

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