Skip to content

v1.1.0

Choose a tag to compare

@buckedunicorn buckedunicorn released this 28 May 18:12
· 2 commits to main since this release
v1.1.0
e4c67b9

πŸ“° 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: true in your PreferenceDefinition.
  • πŸ” AES-256-GCM used with secure nonce handling and base64 output.
  • 🌍 Use USERPREFS_ENCRYPTION_KEY environment 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.