crypto

package
v0.0.0-...-bf98737 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MagicPrefix = "envx"
	KeySize     = 32 // 256-bit key
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AESEncryptor

type AESEncryptor struct{}

AESEncryptor implements the Encryptor interface using AES-GCM

func NewAESEncryptor

func NewAESEncryptor() *AESEncryptor

NewAESEncryptor creates a new AES encryptor

func (*AESEncryptor) Decrypt

func (e *AESEncryptor) Decrypt(ciphertext string, key []byte) (string, error)

Decrypt decrypts a ciphertext string using AES-GCM decryption

func (*AESEncryptor) Encrypt

func (e *AESEncryptor) Encrypt(plaintext string, key []byte) (string, error)

Encrypt encrypts a plaintext string using AES-GCM encryption

func (*AESEncryptor) IsEncrypted

func (e *AESEncryptor) IsEncrypted(value string) bool

IsEncrypted checks if a value appears to be encrypted

type Encryptor

type Encryptor interface {
	Encrypt(plaintext string, key []byte) (string, error)
	Decrypt(ciphertext string, key []byte) (string, error)
	IsEncrypted(value string) bool
}

Encryptor defines the interface for encryption operations

Jump to

Keyboard shortcuts

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