Documentation
¶
Index ¶
- Variables
- func Decrypt(ciphertext string) (string, error)
- func DecryptSettingValue(key string, value string) (string, error)
- func Encrypt(plaintext string) (string, error)
- func EncryptSettingValue(key string, value string) (string, error)
- func Init(rawSecret string)
- func IsEncrypted(s string) bool
- func IsSensitiveSetting(key string) bool
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func Decrypt ¶
Decrypt reverses Encrypt. Values without the "enc:" prefix are returned as-is (legacy unencrypted data).
func DecryptSettingValue ¶
DecryptSettingValue decrypts the value if it carries the "enc:" prefix. Non-sensitive keys, empty values, and legacy plaintext pass through unchanged.
func Encrypt ¶
Encrypt returns the AES-GCM ciphertext as a base64 string prefixed with "enc:". If plaintext is empty or the key was never initialized, the plaintext is returned unchanged so callers can treat empty and legacy values transparently.
func EncryptSettingValue ¶
EncryptSettingValue encrypts the value if the key is in the sensitive list and the encryption key has been initialised. Non-sensitive keys and empty values pass through unchanged.
func Init ¶
func Init(rawSecret string)
Init derives a 256-bit AES key from the raw secret and stores it for the process lifetime. Call once at startup; subsequent calls are no-ops.
func IsEncrypted ¶
IsEncrypted reports whether the value carries the "enc:" prefix.
func IsSensitiveSetting ¶
IsSensitiveSetting reports whether the given setting key should be encrypted.
Types ¶
This section is empty.