SQLCipher: 'Configuration' has no member 'passphrase'

I am using the branch GRDB-4.0. I included the pod SQLCipher (4.1.0). Added the Preprocessor macro SQLITE_HAS_CODEC=1.

let configuration = Configuration()
configuration.passphrase = "secret"

However when I try to set up the passphrase for the configuration, I am getting the error "Value of type 'Configuration' has no member 'passphrase'". Is there anything different I need to do for SQLCipher. Help is highly appreciated.

Hello @pat1,

The GRDB-4.0 branch has recently changed the way to use SQLCipher, in order to accommodate for both SQLCipher 3 and 4.

To fix this error, mention in your podfile:

pod 'GRDB.swift/SQLCipher', git: 'https://github.com/groue/GRDB.swift.git', branch: 'GRDB-4.0'
pod 'SQLCipher', '~> 4.1'

And that's all. There is no need to manually set SQLITE_HAS_CODEC.

Further documentation is available in the Encryption chapter.


Hi @gwendal.roue. Thanks for that info and I was able to move forward with setup. I was using

pod 'GRDB.swift', :git => 'https://github.com/groue/GRDB.swift.git', :branch => 'GRDB-4.0'
1 Like

Because of project constraints, we could not move forward with cocoa pods (and could not use Package Manager as well). I had to include them manually. I do not see any documentation yet for 4.0 (or may be not looking at the right place). I was able to manually incorporate yours and run the app. However I could not invoke the code pertaining to the encryption. I tried setting up the flags/preprocessor definition based on the podspec. I could not leverage the instructions for 3.7. Hope you can guide me in the right direction.

This is a great library which simplified our code base.  Kudos to you and the team.

You have been looking at the correct place (the Encryption chapter in GRDB-4.0 branch).

Manual installation of SQLCipher is no longer available in GRDB 4. The reason for this is that SQLCipher, since its own version 4, no longer ships any Xcode project that one can embed. There has been an attempt at recreating this Xcode project inside GRDB itself, but it was aborted.

Net result:

  • Manual installation of GRDB+SQLCipher is no longer a ready-made installation method.
  • CocoaPods is the only ready-made solution.
  • GRDB is no longer tied to a specific SQLCipher version (and this is good news for both GRDB users and maintainers).

We may restore support for manual installation of GRDB+SQLCipher in the future. Nobody I know is currently working on this contribution.

GRDB will use SQLCipher with the following setup:

  1. GRDB is compiled with both the SQLITE_HAS_CODEC and GRDBCIPHER flags set.
  2. GRDB is not linked with the system SQLite library.
  3. The SQLCipher library is available in a module named "SQLCipher".

Step 1 will instruct GRDB to enable SQLCipher apis.
Step 2 will avoid any conflict between SQLCipher and SQLite.
Step 3 allows GRDB to import SQLCipher under the expected name.

I'm not sure I know how to achieve this setup in your project.

Many thanks Pat :-)