Documentation
¶
Index ¶
Constants ¶
View Source
const ( // KeySize is the size of the encryption key in bytes (32 bytes = 256 bits) KeySize = 32 // NonceSize is the size of the nonce for GCM mode (12 bytes is recommended) NonceSize = 12 // SaltSize is the size of the salt for key derivation (32 bytes) SaltSize = 32 // Iterations is the number of iterations for PBKDF2 Iterations = 100000 )
Variables ¶
This section is empty.
Functions ¶
func GeneratePassword ¶
GeneratePassword generates a random password for encryption
func ValidatePassword ¶
ValidatePassword validates a password meets minimum requirements
Types ¶
type EncryptedData ¶
type EncryptedData struct {
Salt []byte `json:"salt"`
Nonce []byte `json:"nonce"`
Ciphertext []byte `json:"ciphertext"`
}
EncryptedData represents encrypted data with metadata
type Encryptor ¶
type Encryptor struct {
// contains filtered or unexported fields
}
Encryptor handles encryption and decryption operations
func NewEncryptor ¶
NewEncryptor creates a new encryptor with the given password
func (*Encryptor) Decrypt ¶
func (e *Encryptor) Decrypt(data *EncryptedData) ([]byte, error)
Decrypt decrypts encrypted data using AES-256-GCM
func (*Encryptor) DecryptString ¶
DecryptString decrypts a base64-encoded string
Click to show internal directories.
Click to hide internal directories.