SQLCipher Encryption Not Applied to Room Database for iOS

I’m using SQLCipher in a Kotlin Multiplatform (KMP) library to encrypt my Room database, for android, it’s working fine but for iOS, the database file remains unencrypted. When I inspect the file, I see:
00000000: 5351 4c69 7465 2066 6f72 6d61 7420 3300 SQLite format 3.

Here’s my implementation:

Room.databaseBuilder<MyDatabase>(
    name = filePath
)
  .setDriver(createEncryptedDriver(filePath, encryptionKey))
  .fallbackToDestructiveMigration(true)
  .setQueryCoroutineContext(Dispatchers.IO)
  .build()

private fun createEncryptedDriver(dbPath: String, encryptionKey: String): SQLiteDriver {
    val driver = NativeSQLiteDriver()
    val connection = driver.open(dbPath)
    connection.execSQL("PRAGMA key = '$encryptionKey';")
    return driver
}

Is there something I’m missing in configuring encryption for SQLCipher in iOS?

Hello @MoeJoeMJ

SQLCipher does not currently support iOS through Kotlin Multi Platform. SQLCipher is a native library, and thus requires special building and linking to be used on each platform. That is the reason why you are not seeing an encrypted file on iOS. Please see this post for some additional details:

I’ve also replied back to your private support email about the same.

Hello Stephen,
Are you saying that SQLCipher isn’t supported for KMP at all? I’ve seen people use it with SQLDelight in KMP, for example: GitHub - touchlab-lab/KaMPKitSQLCipher

Thanks,
Manoj

I failed to notice the quoted discussion’s question. My bad.