Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encrypt profiles stored to iCloud #436

Merged
merged 2 commits into from
Dec 17, 2023
Merged

Conversation

keeshux
Copy link
Member

@keeshux keeshux commented Dec 17, 2023

Now possible with iOS 15 target, but from:

https://developer.apple.com/documentation/cloudkit/encrypting_user_data

The encrypted fields can’t have indexes because the server can’t read the fields. The encrypted fields also have to be newly introduced to an existing record or a new record. You can’t convert existing unencrypted fields in the CloudKit schema.

Therefore it must be a new field. As to Core Data:

https://developer.apple.com/documentation/coredata/nsattributedescription/3746827-allowscloudencryption

Set this property to true to store the attribute’s value in an encrypted form in iCloud. Only use this property with new attributes. Core Data doesn’t support encrypting attributes that already exist in your CloudKit schema, or attributes that represent relationships between entities.

TL;DR Add new encryptedJSON field with fallback to json.

Going forward, persist profiles encrypted to the CloudKit container. Conversely, read from the encrypted field if any, falling back to the plain JSON field. This is a requirement until full migration is implemented.

WARNING: the change is NOT backward compatible, as it would defeat the purpose. That is, once the profile is stored encrypted, the old plain profile is erased and its content won't be readable by older versions of the app.

Write encrypted going forward, read with fallback to plain.

Change is NOT backward compatible, it would defeat the purpose.
@keeshux keeshux self-assigned this Dec 17, 2023
@keeshux keeshux added the enhancement New feature or request label Dec 17, 2023
@keeshux keeshux added this to the Version for Apple TV milestone Dec 17, 2023
@keeshux keeshux merged commit 38b06b6 into master Dec 17, 2023
1 check passed
@keeshux keeshux deleted the feature/enable-cloudkit-encryption branch December 17, 2023 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant