Documentation
¶
Overview ¶
Package crypto provides AES-256-GCM encryption and decryption for sensitive data such as secret headers and webhook secrets. The encryption key is loaded from the SPARROW_ENCRYPTION_KEY environment variable (64 hex chars = 32 bytes).
When no encryption key is configured, Sparrow continues to work but any attempt to encrypt or decrypt will return an ErrNoEncryptionKey error.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoEncryptionKey = errors.New("crypto: encryption key not configured (set SPARROW_ENCRYPTION_KEY)")
ErrNoEncryptionKey is returned when encryption/decryption is attempted without a configured encryption key.
Functions ¶
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service provides encrypt/decrypt operations using AES-256-GCM. A nil *Service or one created without a key is valid — calls to Encrypt and Decrypt will return ErrNoEncryptionKey.
func NewService ¶
NewService creates a new crypto service from a 32-byte AES-256 key. Pass nil to create a no-op service that returns ErrNoEncryptionKey on use.
func (*Service) DecryptJSON ¶
DecryptJSON decrypts ciphertext and unmarshals the result into v.