I tried to keep the syncing as simple as possible. All data is first encrypted on the device using the user's key and then pushed and saved in the server db.
When you login from another device your data is fetched and decrypted and shown to you.
For most cases, the most recently edited copy is kept. However, if there's a conflict between 2 notes then a nice Git Conflict like UI is shown with both notes side by side and their differences highlighted.
When you login from another device your data is fetched and decrypted and shown to you.