-
Notifications
You must be signed in to change notification settings - Fork 749
SQLCipher support #1162
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
Closed
Closed
SQLCipher support #1162
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,12 @@ public final class SQLiteNormalizedCache { | |
| try self.createTableIfNeeded() | ||
| } | ||
|
|
||
| public init(db: Connection, shouldVacuumOnClear: Bool = false) throws { | ||
| self.shouldVacuumOnClear = shouldVacuumOnClear | ||
| self.db = db | ||
| try self.createTableIfNeeded() | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems like a reasonable addition in terms of allowing people to use SQLCipher or other extensions to SQLite.swift, though, so I do think we should keep this. Can you add some documentation to this initializer please? |
||
|
|
||
| private func recordCacheKey(forFieldCacheKey fieldCacheKey: CacheKey) -> CacheKey { | ||
| let components = fieldCacheKey.components(separatedBy: ".") | ||
| var updatedComponents = [String]() | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're not actually using anything from SQLite cipher inside our library, so I don't think this is necessary (and would add a couple of dependencies that could cause conflicts.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main problem is - it seems to be impossible to use it together with Apollo/SQLite.
SQLite.swift/SQLCipher- requires only this particular SQLite dependency.Mixing it together with
ss.dependency 'SQLite.swift', '~>0.12.2'results in not working SQLCipher layer. It is not going to cause any error, crash or compilation warning. Just DB is not going to encrypt at all.That is why I prepared separate dependency.
Please check this comment and the answer:
stephencelis/SQLite.swift#570 (comment)
This is the exact situation.
I was already trying to use
pod Apollo/SQLite'pod 'SQLCipher', '~>4.2.0'
'pod 'SQLite.swift/SQLCipher', '> 0.12.0'
together with this modified init
and DB is not encrypting.
@edit:
To avoid this dependency we would have to introduce SQLitenormalizedCache ... without SQLite in apollo dependencies to provide it from the outside with
Any thoughts how to resolve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oof, looking at the SQLitePodspec it looks like there's some additional
xcconfigs that get set up in order to make that work. Looking at theREADMEfor FMDB, another iOS SQLite lib, I see a similar caveat about how to set up the podspec.Looking at the tutorial on SQLCipher, there's a fairly blunt caveat about only using their SQLite 3:
Neither SQLite.swift nor FMDB support using this through anything other than CocoaPods, which is a big old red flag for me in terms of maintaining support on the Apollo side, which would be necessary if we were to add this to the library.
Honestly, at this point, it feels like we're pretzeling ourselves to make this work in a way that just doesn't make sense for the overwhelming majority of users. This is a major reason why
NormalizedCacheis a protocol: so that you can implement your own version of it if the one we provide is insufficient.