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

Stick with backwards compat #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

n8fr8
Copy link
Member

@n8fr8 n8fr8 commented Sep 27, 2019

I couldn't make the cipher migration for SQLCipher 4 to work with an existing larger IOCipher instance. The easier solution for now is to set the v3 compatibility mode.

@eighthave
Copy link
Member

Why do this here? Why not in the app?

@n8fr8
Copy link
Member Author

n8fr8 commented Sep 27, 2019

You can't issue PRAGMA commands from the IOCipher interface. There is no way to inject custom SQL commands when you mount the volume.

@eighthave
Copy link
Member

eighthave commented Sep 27, 2019 via email

@n8fr8
Copy link
Member Author

n8fr8 commented Sep 28, 2019

I need the 64-bit builds unfortunately. For now, I will just use my own v3 compat flag. I will think about modifying the API to support the ability to issue custom PRAGMA in the mount process.

@eighthave
Copy link
Member

eighthave commented Sep 30, 2019 via email

@n8fr8
Copy link
Member Author

n8fr8 commented Sep 30, 2019

The proper migration still requires using a PRAGMA command. It would be nice to have a way for IOCipher instances to migrate without requiring to use the SQLCipher API to mount, etc. Adding a way to call PRAGMA would make that possible.

What happened in my case was it would always return a failure code instantly. I migrated my standard SQLCipher database without an issue. What makes IOCipher different possible is that we use a different SQL page size, and also my IOCipher volume was 400MB.

For now, since I need to ship an important update to keanu, I am just building my own compat v3 version of IOCipher which works fine, but we should def figure this out for others.

@eighthave
Copy link
Member

eighthave commented Sep 30, 2019 via email

@abeluck
Copy link
Member

abeluck commented Sep 30, 2019

What would a proper fix here look like?

  • IOCipher detects version of database and sqlcipher runtime
  • Provides an isMigrationNeeded method for devs
  • Throws a MigrationNeededException when sqlcipher runtime and database version mismatch
  • Provides a migrate() method for devs

Additionally we should also provide a way to tweak the compatibility settings (option 2 in this post), perhaps a new mount method like mountWithCompatibility

(also, I think this issue belongs in iocipher not libslfs)

@eighthave
Copy link
Member

eighthave commented Sep 30, 2019 via email

@chrisballinger
Copy link
Member

Feel free to build off of this, ideally it should be configurable: ChatSecure@4456f8a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants