drewmccormack / ensembles

A synchronization framework for Core Data.
MIT License
1.63k stars 131 forks source link

Deleech if user copies data to different device #193

Open drewmccormack opened 9 years ago

drewmccormack commented 9 years ago

A corner case that could be problematic arises if a user transfers their data to a new device. If their old device is no longer used, there should not be a problem, but if both devices are used, they may be sharing the same Ensembles peer id.

This may not be a problem for iCloud, because the ubiquity token probably includes the device id, and would force a deleech. But for other backends, it would be good if Ensembles could detect this.

On iOS, the identifierForVendor in UIDevice could probably be tested to see if it has changed.

On the Mac, you can use the serial number or MAC address. Details here (with link) http://stackoverflow.com/questions/5868567/unique-identifier-of-a-mac

Note that on the Mac, you have to link with IOKit.

It would be important to not invalidate existing data. The device id could be stored in the event store metadata. If there is no device id present, add the current id, but don't fail.