encryption

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decrypt

func Decrypt(encodedCiphertext string) ([]byte, error)

Decrypt takes a base64 encoded ciphertext string and returns the plaintext bytes

func Encrypt

func Encrypt(plaintext []byte) (string, error)

Encrypt takes plaintext and returns a base64 encoded string of the ciphertext

Types

type Encrypter

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

Encrypter represents an AEAD encrypter/decrypter

func Get

func Get() *Encrypter

func NewEncrypter

func NewEncrypter(key []byte) (*Encrypter, error)

NewEncrypter creates a new instance of Encrypter with the provided key

func (*Encrypter) Decrypt

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

Decrypt decrypts the provided ciphertext

func (*Encrypter) DecryptString

func (e *Encrypter) DecryptString(encodedCiphertext string) (string, error)

DecryptString decrypts a base64 encoded string

func (*Encrypter) DecryptStringHelper

func (e *Encrypter) DecryptStringHelper(encodedCiphertext string) ([]byte, error)

Helper function for DecryptString to keep method signatures consistent with package level functions

func (*Encrypter) Encrypt

func (e *Encrypter) Encrypt(plaintext []byte) ([]byte, error)

Encrypt encrypts the given plaintext

func (*Encrypter) EncryptString

func (e *Encrypter) EncryptString(plaintext string) (string, error)

EncryptString encrypts a string

Jump to

Keyboard shortcuts

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