encryptor

package
v0.0.0-...-629ae5f Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package encryptor provides helpers for symmetric encryption.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AESEncrypter

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

AESEncrypter wraps AES-GCM operations.

func NewAESEncrypter

func NewAESEncrypter(hexKey string) (*AESEncrypter, error)

NewAESEncrypter constructs an AESEncrypter from a hex-encoded key.

func (*AESEncrypter) Decrypt

func (a *AESEncrypter) Decrypt(
	ciphertext []byte, nonce []byte) ([]byte, error)

Decrypt decrypts ciphertext with the provided nonce.

func (*AESEncrypter) DecryptFromJSON

func (a *AESEncrypter) DecryptFromJSON(enc json.RawMessage) ([]byte, error)

DecryptFromJSON expects base64 fields and returns decrypted bytes.

func (*AESEncrypter) Encrypt

func (a *AESEncrypter) Encrypt(plaintext []byte, nonce []byte) ([]byte, error)

Encrypt encrypts plaintext with the provided nonce.

func (*AESEncrypter) EncryptToJSON

func (a *AESEncrypter) EncryptToJSON(
	payload json.RawMessage) (json.RawMessage, error)

EncryptToJSON returns a JSON object with base64 nonce and cipher for payload.

Jump to

Keyboard shortcuts

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