crypto

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDefaultEncrypter

func InitDefaultEncrypter(key string) error

InitDefaultEncrypter initializes the global encrypter.

Types

type Encrypter

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

Encrypter providing AES-256-GCM crypto.

var (
	// DefaultEncrypter is a global encrypter used by transparently encrypted fields.
	DefaultEncrypter *Encrypter
)

func NewEncrypter

func NewEncrypter(key string) (*Encrypter, error)

NewEncrypter creates a new encrypter with the given 32-byte key.

func (*Encrypter) Decrypt

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

Decrypt decrypts the given base64 encoded ciphertext.

func (*Encrypter) Encrypt

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

Encrypt encrypts the given plaintext and returns a base64 encoded string.

Jump to

Keyboard shortcuts

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