Désiré Werner Menrath 171d420d78 fix(encryption): Refactor locking mechanism to correctly handle encryption
This commit addresses a critical bug where toggling the lock state on items (recipes, notes, shopping lists) only changed a boolean flag without performing any encryption or decryption. This led to crashes when trying to access supposedly locked items, as the app would attempt to decrypt plaintext data.

The following changes have been made:

- The `FileEncryptor` now includes a check to prevent crashes on invalid data.
- The `toggleRecipeLock` function in `RecipesViewModel` (and its equivalents for notes and shopping lists) has been refactored to accept a `SecretKey`.
- The function now performs encryption when locking and decryption when unlocking.
- A migration path is included to handle items that were "locked" under the old, buggy mechanism. When unlocking these items, the app will detect the decryption failure, assume the data is plaintext, and correctly unlock the item.
- The UI in `MainActivity` has been updated to always use the biometric prompt to retrieve the necessary key for both locking and unlocking, ensuring the key is available for the cryptographic operations.
- The fix has been consistently applied to Recipes, Notes, and Shopping Lists for uniform behavior.
2025-10-18 23:33:34 +02:00
Description
Noteshop is a versatile and privacy-focused application for managing your notes, shopping lists, and recipes all in one place. It is designed to be simple, efficient, and fully under your control
2.4 MiB
Languages
Kotlin 98%
Python 2%