Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,21 @@
package com.amplifyframework.logging.cloudwatch.db

import android.content.Context
import net.sqlcipher.database.SQLiteDatabase
import net.sqlcipher.database.SQLiteOpenHelper
import net.zetetic.database.sqlcipher.SQLiteDatabase
import net.zetetic.database.sqlcipher.SQLiteOpenHelper

internal class CloudWatchDatabaseHelper(context: Context) :
SQLiteOpenHelper(context, DATABASE_NAME, null, DATABASE_VERSION) {
internal class CloudWatchDatabaseHelper(context: Context, databasePassphrase: String) :
SQLiteOpenHelper(
context,
DATABASE_NAME,
databasePassphrase,
null,
DATABASE_VERSION,
0,
null,
null,
false
) {

companion object {
internal const val DATABASE_NAME = "amplify.logging.cloudwatch.db"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import java.util.UUID
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import net.sqlcipher.database.SQLiteQueryBuilder
import net.zetetic.database.sqlcipher.SQLiteQueryBuilder

internal class CloudWatchLoggingDatabase(
private val context: Context,
Expand All @@ -44,7 +44,7 @@ internal class CloudWatchLoggingDatabase(
}
private val database by lazy {
System.loadLibrary("sqlcipher")
CloudWatchDatabaseHelper(context).getWritableDatabase(getDatabasePassphrase())
CloudWatchDatabaseHelper(context, getDatabasePassphrase()).writableDatabase
}
private val basePath = "cloudwatchlogevents"
private val contentUri: Uri
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/
package com.amplifyframework.logging.cloudwatch.db

import net.sqlcipher.database.SQLiteDatabase
import net.zetetic.database.sqlcipher.SQLiteDatabase

internal class LogEventTable {
companion object {
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ subprojects {
allow("BSD-2-Clause")
allow("CC0-1.0")
allowUrl("https://developer.android.com/studio/terms.html")
allowDependency("net.zetetic", "android-database-sqlcipher", "4.5.4") {
allowDependency("net.zetetic", "sqlcipher-android", "4.6.1") {
because("BSD style License")
}
allowDependency("org.jetbrains", "annotations", "16.0.1") {
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ okhttp = "5.0.0-alpha.11"
robolectric = "4.7"
rxjava = "3.0.6"
slf4j = "2.0.6"
sqlcipher = "4.5.4"
sqlcipher = "4.6.1"
tensorflow = "2.0.0"
uuid = "4.0.1"
totp = "1.0.1"
Expand Down Expand Up @@ -102,7 +102,7 @@ oauth2 = { module = "com.google.auth:google-auth-library-oauth2-http", version.r
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "okhttp" }
rxjava = { module = "io.reactivex.rxjava3:rxjava", version.ref = "rxjava" }
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j"}
sqlcipher= { module = "net.zetetic:android-database-sqlcipher", version.ref = "sqlcipher" }
sqlcipher= { module = "net.zetetic:sqlcipher-android", version.ref = "sqlcipher" }
tensorflow = { module = "org.tensorflow:tensorflow-lite", version.ref="tensorflow" }
uuidgen = { module = "com.fasterxml.uuid:java-uuid-generator", version.ref="uuid" }

Expand Down
Loading