spike(desktop): Phase 0 feasibility probes + findings
Adds the throwaway Phase-0 spike (Development Plan §6.3) that answers
whether Incido can become a Compose Multiplatform desktop app without
abandoning ObjectBox, its crypto layer, or its UI layer. All six
questions came back PASS; findings live in tools/DESKTOP_FEASIBILITY.md.
:spike:data-jvm ObjectBox kapt codegen + native runtime on a plain
JVM, DataStore Preferences without a Context, and
the app's own EncryptedKeyCodec round-tripping.
:spike:compose-jvm Compose Desktop rendering the app's real theme
layer + core:domain, plus jpackage packaging.
Additive only: nothing outside spike/ depends on these, and the Android
build is untouched (assembleDebug verified green).
This commit is contained in:
1 parent
f87ca17ded
commit
8b66e82acb
20 files changed
+1822
No files matched your search
@@ -1,56 +0,0 @@
|
||||
package org.incido.data
|
||||
|
||||
import android.content.Context
|
||||
import io.objectbox.BoxStore
|
||||
import org.incido.data.entity.MyObjectBox
|
||||
|
||||
/**
|
||||
* Singleton holder for the process-wide [BoxStore]. Initialised once from
|
||||
* the Application/Activity context.
|
||||
*
|
||||
* v0.3.5.0 — the open-source ObjectBox 4.0.3 distribution does not
|
||||
* expose a public `encryptionKey(byte[])` builder method (that is
|
||||
* ObjectBox Sync / Pro only), so the store file itself is opened
|
||||
* unencrypted. At-rest protection is instead done one layer up:
|
||||
* note content and attachment blobs are field-encrypted with
|
||||
* AES-256-GCM by `NoteRepositoryImpl` / `NoteCryptoService` using the
|
||||
* Keystore-wrapped key managed by `ObjectBoxKeyProvider`. The
|
||||
* `encryptionKey` parameter is kept for forward compatibility with a
|
||||
* commercial ObjectBox build but remains a no-op here.
|
||||
*/
|
||||
object ObjectBoxStore {
|
||||
@Volatile
|
||||
private var instance: BoxStore? = null
|
||||
|
||||
/**
|
||||
* Initialise the singleton [BoxStore]. Idempotent — repeated calls
|
||||
* return the existing instance.
|
||||
*
|
||||
* @param context application context
|
||||
* @param encryptionKey reserved for future ObjectBox-native at-rest
|
||||
* encryption (OSS 4.0.3 doesn't expose the API — currently a
|
||||
* no-op; see class KDoc for the field-encryption approach).
|
||||
*/
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
fun init(context: Context, encryptionKey: ByteArray? = null): BoxStore =
|
||||
instance ?: synchronized(this) {
|
||||
instance ?: MyObjectBox.builder()
|
||||
.androidContext(context.applicationContext)
|
||||
.build()
|
||||
.also { instance = it }
|
||||
}
|
||||
|
||||
/**
|
||||
* Close + drop the singleton. Reserved for future use when
|
||||
* toggling encryption requires re-opening the store with a new key.
|
||||
*/
|
||||
fun reset() {
|
||||
synchronized(this) {
|
||||
instance?.close()
|
||||
instance = null
|
||||
}
|
||||
}
|
||||
|
||||
fun get(): BoxStore =
|
||||
instance ?: error("ObjectBoxStore not initialised — call init(context) first")
|
||||
}
|
||||
Reference in new issue
Block a user