Encrypt data

If so, it is very easy:

  1. Upon app first launch you generate a Symmetric encryption key
  2. 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
  3. Gather health data from end user Alice
  4. Encrypt Alices sensitive data using AES.GCM I linked to above
  5. Use encrypted data (send to Supabase)
  6. Later download data from Supabase, decrypt it by:
  7. … loading the Symmetric encryption key from Keychain
  8. And call AES.GCM.open using the encrypted data and the key
  9. Optionally you can allow user to manually export her encryption key
1 Like