Description
Currently, stitch uses standard SQLite drivers which do not provide built-in encryption. For many KMP applications, data-at-rest encryption is a critical requirement. This task involves researching and implementing a standardized way to enable encryption across Android, iOS, JVM, and potentially Web.
Technical Analysis
Room 3 KMP relies on the SQLiteDriver interface. To support encryption, we need to:
- Identify suitable
SQLCipher or similar wrappers that satisfy the SQLiteDriver interface for each platform.
- Provide a unified API in
StitchRoomConfig to pass a passphrase or encryption configuration.
Proposed Implementation
- Encryption DSL:
stitchRoom(context) {
encryption {
passphrase = "secure-key"
// Optional configuration like cipher type
}
}
- Platform Bridges: Implement factory functions for encrypted drivers.
- Android: Use
SQLCipher via androidx.sqlite.db.SupportSQLiteOpenHelper.
- iOS: Use a native SQLCipher wrapper.
- JVM: Use
sqlite-jdbc with encryption support.
Goals
- Research library compatibility (e.g.,
SQLCipher, Kermit-SQLite? etc.) for KMP.
- Implement
enableEncryption(passphrase) in StitchRoomConfig.
- Provide platform-specific implementations for encrypted drivers.
Description
Currently,
stitchuses standard SQLite drivers which do not provide built-in encryption. For many KMP applications, data-at-rest encryption is a critical requirement. This task involves researching and implementing a standardized way to enable encryption across Android, iOS, JVM, and potentially Web.Technical Analysis
Room 3 KMP relies on the
SQLiteDriverinterface. To support encryption, we need to:SQLCipheror similar wrappers that satisfy theSQLiteDriverinterface for each platform.StitchRoomConfigto pass a passphrase or encryption configuration.Proposed Implementation
stitchRoom(context) { encryption { passphrase = "secure-key" // Optional configuration like cipher type } }SQLCipherviaandroidx.sqlite.db.SupportSQLiteOpenHelper.sqlite-jdbcwith encryption support.Goals
SQLCipher,Kermit-SQLite? etc.) for KMP.enableEncryption(passphrase)inStitchRoomConfig.