If so, it is very easy:
- Upon app first launch you generate a Symmetric encryption key
- Store the Symmetric encryption key in Keychain - it is just 32 bytes, so you can save it as a data entry - with iCloud sync enabled - will only work if user has enabled keychain icloud sync in iOS
- Gather health data from end user Alice
- Encrypt Alices sensitive data using AES.GCM I linked to above
- Use encrypted data (send to Supabase)
- Later download data from Supabase, decrypt it by:
- … loading the Symmetric encryption key from Keychain
- And call AES.GCM.open using the encrypted data and the key
- Optionally you can allow user to manually export her encryption key