crypt

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2025 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 AES256GCM added in v1.2.1

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

func (*AES256GCM) Decrypt added in v1.2.1

func (r *AES256GCM) Decrypt(payload string) ([]byte, error)

Decrypt decrypts the given base64 encoded payload, and returns the plaintext.

func (*AES256GCM) Encrypt added in v1.2.1

func (r *AES256GCM) Encrypt(plaintext []byte) (string, error)

Encrypt encrypts the given plaintext, and returns the base64 encoded payload.

type Crypter

type Crypter interface {
	Encrypt(plaintext []byte) (string, error)
	Decrypt(payload string) ([]byte, error)
}

func NewAES256GCM added in v1.2.1

func NewAES256GCM(key []byte) (Crypter, error)

NewAES256GCM returns a new AES256GCM crypt instance.

func NewXChacha20Poly1305

func NewXChacha20Poly1305(key []byte) (Crypter, error)

NewXChacha20Poly1305 returns a new XChacha20Poly1305 crypt instance.

type XChacha20Poly1305

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

func (*XChacha20Poly1305) Decrypt

func (r *XChacha20Poly1305) Decrypt(payload string) ([]byte, error)

Decrypt decrypts the given base64 encoded payload, and returns the plaintext.

func (*XChacha20Poly1305) Encrypt

func (r *XChacha20Poly1305) Encrypt(plaintext []byte) (string, error)

Encrypt encrypts the given plaintext, and returns the base64 encoded payload.

Jump to

Keyboard shortcuts

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