Skip to content

Add KMP Encryption Support #55

Description

@teogor

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:

  1. Identify suitable SQLCipher or similar wrappers that satisfy the SQLiteDriver interface for each platform.
  2. Provide a unified API in StitchRoomConfig to pass a passphrase or encryption configuration.

Proposed Implementation

  1. Encryption DSL:
    stitchRoom(context) {
      encryption {
        passphrase = "secure-key"
        // Optional configuration like cipher type
      }
    }
  2. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions