Crypto feature

The crypto feature adds AES-256-GCM authenticated encryption helpers. Use it to encrypt sensitive fields before storage or transport.

What it provides

File Purpose
internal/ports/cipher.go Encrypt / Decrypt interface
internal/adapters/crypto/aesgcm_cipher.go AES-256-GCM implementation using a config-driven secret key

Tech stack

Library Purpose Documentation
crypto/aes AES encryption (stdlib) pkg.go.dev/crypto/aes
crypto/cipher GCM mode (stdlib) pkg.go.dev/crypto/cipher

Learning resources

Notes

  • Generate a strong 256-bit key: openssl rand -base64 32
  • The secret key is loaded from configuration (via the cipher.secret_key config field).
  • No external dependencies are required — it uses Go’s standard library.