Repository navigation
v1.1.0
π° RELEASE NOTES (v1.1.0)
Release Notes β v1.1.0
π AES-256 Encryption for User Preferences
This release brings first-class support for encrypted user preferences. Use this to securely store sensitive user-specific settings such as API tokens, passwords, or any personal data.
Highlights
- β
Encrypt preferences by setting
Encrypted: truein yourPreferenceDefinition. - π AES-256-GCM used with secure nonce handling and base64 output.
- π Use
USERPREFS_ENCRYPTION_KEYenvironment variable for production configuration. - π§ͺ Secure test harness with
NewEncryptionAdapterWithKey()for key injection. - π§ Transparent encryption/decryption logic at Manager layer.
- β‘ Works seamlessly with memory or persistent storage and caching.
Example Usage
// Define a secure preference
err := mgr.DefinePreference(userprefs.PreferenceDefinition{
Key: "api_token",
Type: userprefs.StringType,
Encrypted: true,
})
# Environment setup
```shell
export USERPREFS_ENCRYPTION_KEY="your-secure-32-byte-key-here"New Components
β’ encryption.Manager: AES-256-GCM with nonce generation and base64 wrapping.
β’ EncryptionManager interface: Plug custom encryptors if needed.
β’ EncryptionAdapter: Bridge between encryption package and preference manager.
Examples Updated
β’ examples/encryption: CLI example of defining and using encrypted preferences.
β’ examples/webapp: Realistic web settings including encrypted credentials (GitHub, Slack, personal info).
Security Considerations
β’ π Use only cryptographically secure, random keys.
β’ π§ Rotate keys periodically (requires re-encryption).
β’ π Decrypted values are cached for performance β memory access controls are recommended in high-security environments.
βΈ»
TL;DR: With v1.1.0, encrypting user preferences is just a single flag away. You define it, and UserPrefs takes care of secure storage and retrieval for you.