How radumarias/ciphershell-kotlin works
Project Type and Purpose
• This is a Kotlin Multiplatform GUI application (“ciphershell-kotlin”) that provides a desktop and Android front-end for the Rust-based rencfs encryption engine.
• It uses a small Java-bridge wrapper (in the rencfsWrapper module) to call into native Rust code, and Compose Multiplatform for UI, along with SQLDelight for local vault persistence.
High-Level Modules (Top-Level Components)
a. Native Engine
• Rust library (rencfs) compiled for multiple OS/ABI targets.
b. JNI/Java Bridge
• Module: rencfsWrapper — loads the Rust library via JNI and exposes Kotlin-friendly APIs.
c. Multiplatform Core
• Module: rencfsMultiplatform
• Contains common code:
– UI (Compose Composable screens, navigation, theme)
– Domain (use cases for vault creation, selection, walkthrough)
– Data layer (SQLDelight schema, DAO, repository)
– DI modules (platform-agnostic Koin/Dagger style setup)
d. Platform Hosts
• rencfsAndroid — Android application:
– AndroidManifest, Activities, resource files
– Platform DI (AndroidModule.kt)
– Platform-specific drivers (SQLDelight Android driver)
• rencfsDesktop — Desktop application (JVM):
– Main entrypoint, Window hosting Compose
– Platform DI (DesktopModule.kt)
– SQLDelight JDBC driver
e. Build Orchestration
• Root Gradle scripts, settings.gradle.kts, CI workflows
Component Relationships and Data Flows
• UI Layer (Compose screens in commonMain) emits user events (e.g., “Create vault”).
• Events route through navigation handlers to appropriate screen Composable.
• Composables call UseCase interfaces (e.g., OnCreateVaultUseCaseImpl).
• UseCases talk to the VaultRepository (common interface).
• For actual encryption I/O: VaultRepository calls into rencfsWrapper APIs (brown hexagon).
• The Rust engine reads/writes encrypted data on disk.
• Results bubble back through wrapper → repository → UseCase → UI, updating Compose UIState.
Architectural Patterns and Design Principles
• Clean separation of concerns: UI / Domain / Data / Native integration
• Dependency Injection (DI) modules per platform (AndroidModule, DesktopModule) plus common modules (UIModule, VaultModule, SQLDelightModule) for wiring.
• Single source of truth for UI state (unidirectional data flow in Compose).
• Kotlin Multiplatform: share business logic and UI definitions across Android and Desktop.
• SQLDelight: type-safe data layer with separate drivers per platform.
• JNI Bridge: clear boundary between managed Kotlin code and native Rust code.