crypt

package
v1.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Crypter

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

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