Thread
#multiplatform
    a

    Anamika Trivedi

    1 month ago
    Hi guys! Has anyone performed database encryption with SQLDelight? Are there any links with good documentation?
    kpgalligan

    kpgalligan

    1 month ago
    Example of sqldelight with sqlcipher. This really needs a blog post to explain, but the code config is here: https://github.com/touchlab-lab/KaMPKit-encrypted/blob/main/shared/src/iosMain/kotlin/co/touchlab/kampkit/KoinIOS.kt#L38
    SQLCipher is added in the gradle config, although you can also do that directly in xcode. Here’s the gradle version:
    cocoapods {
            summary = "Common library for the KaMP starter kit"
            homepage = "<https://github.com/touchlab/KaMPKit>"
            framework {
                isStatic = false // SwiftUI preview requires dynamic framework
            }
            ios.deploymentTarget = "12.4"
            podfile = project.file("../ios/Podfile")
            pod("SQLCipher") {
                version = "~> 4.5"
            }
        }
    Focus on the
    pod("SQLCipher")
    section…
    Finally, you need to get your secret encryption key in there somehow. That’s true of any encrypted database. We have it right in the code, which is definitely not how you should do that. https://github.com/touchlab-lab/KaMPKit-encrypted/blob/main/shared/src/iosMain/kotlin/co/touchlab/kampkit/KoinIOS.kt#L39
    e

    eygraber

    1 month ago
    I've had it working in Android for a few years now and it works great (sorry I don't have code to share at the moment). The only real issue I've seen with it is that some users, some of the time, crash because the .so isn't found. I don't think this is specific to SqlCipher or SqlDelight though