feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
Adds the Android product alongside the existing Linux TUI, in one repo.
SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).
android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.
Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.
Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00
|
|
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
|
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
|
alias(libs.plugins.android.application)
|
|
|
|
|
alias(libs.plugins.kotlin.android)
|
|
|
|
|
alias(libs.plugins.kotlin.compose)
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-12 00:54:17 -04:00
|
|
|
fun envOrNull(name: String): String? =
|
|
|
|
|
System.getenv(name)?.takeIf { it.isNotBlank() }
|
|
|
|
|
|
feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
Adds the Android product alongside the existing Linux TUI, in one repo.
SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).
android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.
Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.
Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00
|
|
|
android {
|
|
|
|
|
namespace = "com.siriusdevops.onionwire"
|
|
|
|
|
compileSdk = 36
|
|
|
|
|
|
|
|
|
|
// Same ABI selection as :sdk. JNA ships libjnidispatch.so for several ABIs;
|
|
|
|
|
// without this filter the APK carries native code for ABIs we never built
|
|
|
|
|
// our Rust lib for.
|
|
|
|
|
val onionwireAbis: List<String> = (findProperty("onionwire.abis") as String?)
|
|
|
|
|
?.split(',')?.map(String::trim)?.filter(String::isNotEmpty)
|
|
|
|
|
?: listOf("arm64-v8a")
|
|
|
|
|
|
|
|
|
|
defaultConfig {
|
|
|
|
|
applicationId = "com.siriusdevops.onionwire"
|
|
|
|
|
minSdk = 26
|
|
|
|
|
targetSdk = 36
|
2026-09-12 00:54:17 -04:00
|
|
|
// CI/local release scripts override both via -P. Committed values are
|
|
|
|
|
// the offline default and match the first automated tag (v0.1.0 → 100).
|
|
|
|
|
versionCode = (findProperty("onionwire.versionCode") as String?)?.toIntOrNull() ?: 100
|
|
|
|
|
versionName = (findProperty("onionwire.versionName") as String?) ?: "0.1.0"
|
feat(android): wrap the store passphrase in the Android Keystore
Typing the passphrase on every launch was the v1 posture. It stays the
fallback, but it is no longer required: on first unlock the passphrase can be
remembered (checkbox, on by default) and is stored as an AES-256-GCM blob
wrapped by a key that never leaves the Android Keystore.
- crypto/StoreSecret.kt: the OWSEAL1 envelope (magic + IV + ciphertext + GCM
tag) and the wipe helpers. No android.* imports, so the code that runs on a
device is the code the unit tests exercise, with a JVM AES key standing in
for the Keystore key.
- crypto/KeystorePassphraseCipher.kt: AES-256-GCM key under alias
`onionwire.store`, StrongBox requested first (API 28+) with a graceful
fallback on ProviderException (StrongBoxUnavailableException is one), and an
honest KeyInfo-backed report of where the key actually lives.
setUserAuthenticationRequired(false) stays the default on purpose.
- crypto/StoredPassphraseStore.kt: ciphertext only, at
filesDir/secrets/store-passphrase.bin, written tmp+rename. A failed decrypt
reports Unavailable and does NOT delete the blob.
- WireViewModel: unlock(passphrase, remember), unlockStored(),
forgetStoredPassphrase(); the secret CharArray is zeroed in `finally`; the
Keystore probe runs off the main thread at ViewModel construction.
- UnlockScreen: one-tap when a stored blob exists, the typed passphrase is
dropped from Compose state as soon as it is handed over and is never put in
saved instance state; "Forget stored passphrase" deletes blob and key.
- androidTest: the device-only half (AndroidKeyStore, StrongBox, KeyInfo),
which cannot run in the unit-test JVM.
Verified: ./gradlew :app:assembleDebug and :app:testDebugUnitTest green,
25 tests / 0 failures (11 new StoreSecretTest, 9 new StoredPassphraseStoreTest).
2026-09-12 13:01:25 -04:00
|
|
|
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
Adds the Android product alongside the existing Linux TUI, in one repo.
SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).
android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.
Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.
Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00
|
|
|
ndk {
|
|
|
|
|
abiFilters += onionwireAbis
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-09-12 00:54:17 -04:00
|
|
|
signingConfigs {
|
|
|
|
|
create("release") {
|
|
|
|
|
val ksPath = envOrNull("ANDROID_KEYSTORE_FILE")
|
|
|
|
|
if (ksPath != null) {
|
|
|
|
|
storeFile = file(ksPath)
|
|
|
|
|
storePassword = envOrNull("ANDROID_KEYSTORE_PASSWORD")
|
|
|
|
|
?: error("ANDROID_KEYSTORE_PASSWORD is required when ANDROID_KEYSTORE_FILE is set")
|
|
|
|
|
keyAlias = envOrNull("ANDROID_KEY_ALIAS")
|
|
|
|
|
?: error("ANDROID_KEY_ALIAS is required when ANDROID_KEYSTORE_FILE is set")
|
|
|
|
|
keyPassword = envOrNull("ANDROID_KEY_PASSWORD")
|
|
|
|
|
?: error("ANDROID_KEY_PASSWORD is required when ANDROID_KEYSTORE_FILE is set")
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
Adds the Android product alongside the existing Linux TUI, in one repo.
SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).
android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.
Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.
Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00
|
|
|
buildTypes {
|
|
|
|
|
debug {
|
|
|
|
|
// Sideload / device-test builds. Signed with the standard debug key.
|
|
|
|
|
applicationIdSuffix = ".debug"
|
|
|
|
|
versionNameSuffix = "-debug"
|
|
|
|
|
}
|
|
|
|
|
release {
|
|
|
|
|
// Deliberately NOT minified in this card: there is no on-device
|
|
|
|
|
// crash-deobfuscation story yet, and shipping R8 without testing
|
|
|
|
|
// the JNI/uniffi surface on a real device is how you get a
|
|
|
|
|
// mysterious UnsatisfiedLinkError in the field.
|
|
|
|
|
// Enable together with mapping-file upload; keeps already exist in
|
|
|
|
|
// :sdk/consumer-rules.pro.
|
|
|
|
|
isMinifyEnabled = false
|
|
|
|
|
isShrinkResources = false
|
2026-09-12 00:54:17 -04:00
|
|
|
// Repo-owned release keystore via ANDROID_KEYSTORE_* env (Forgejo
|
|
|
|
|
// secrets in CI, ~/.android/onionwire-release.env locally). CI sets
|
|
|
|
|
// ONIONWIRE_REQUIRE_RELEASE_KEY=true and fails closed if missing —
|
|
|
|
|
// the debug keystore is per-machine and would break in-place upgrades.
|
|
|
|
|
val requireReleaseKey =
|
|
|
|
|
(findProperty("onionwire.requireReleaseKey") as String?) == "true" ||
|
|
|
|
|
envOrNull("ONIONWIRE_REQUIRE_RELEASE_KEY") == "true"
|
|
|
|
|
val releaseSigning = signingConfigs.getByName("release")
|
|
|
|
|
val releaseStore = releaseSigning.storeFile
|
|
|
|
|
signingConfig = when {
|
|
|
|
|
releaseStore != null && releaseStore.isFile -> releaseSigning
|
|
|
|
|
requireReleaseKey -> error(
|
|
|
|
|
"Release keystore required but ANDROID_KEYSTORE_FILE is missing or not a file"
|
|
|
|
|
)
|
|
|
|
|
else -> {
|
|
|
|
|
logger.warn(
|
|
|
|
|
"No ANDROID_KEYSTORE_FILE; signing the release APK with the debug keystore. " +
|
|
|
|
|
"CI must not do this — in-place upgrades will break."
|
|
|
|
|
)
|
|
|
|
|
signingConfigs.getByName("debug")
|
|
|
|
|
}
|
|
|
|
|
}
|
feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
Adds the Android product alongside the existing Linux TUI, in one repo.
SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).
android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.
Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.
Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
compileOptions {
|
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
|
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
buildFeatures {
|
|
|
|
|
compose = true
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
packaging {
|
|
|
|
|
resources {
|
|
|
|
|
excludes += "/META-INF/{AL2.0,LGPL2.1}"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
kotlin {
|
|
|
|
|
compilerOptions {
|
|
|
|
|
jvmTarget.set(JvmTarget.JVM_17)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
|
implementation(project(":sdk"))
|
|
|
|
|
|
|
|
|
|
implementation(libs.androidx.core.ktx)
|
|
|
|
|
implementation(libs.androidx.activity.compose)
|
|
|
|
|
implementation(libs.androidx.lifecycle.runtime.compose)
|
|
|
|
|
implementation(libs.androidx.lifecycle.viewmodel.compose)
|
|
|
|
|
implementation(libs.androidx.navigation.compose)
|
|
|
|
|
|
|
|
|
|
implementation(platform(libs.compose.bom))
|
|
|
|
|
implementation(libs.compose.ui)
|
|
|
|
|
implementation(libs.compose.ui.graphics)
|
|
|
|
|
implementation(libs.compose.ui.tooling.preview)
|
|
|
|
|
implementation(libs.compose.material3)
|
|
|
|
|
|
|
|
|
|
debugImplementation(libs.compose.ui.tooling)
|
2026-09-10 23:14:43 -04:00
|
|
|
|
|
|
|
|
testImplementation(libs.junit)
|
|
|
|
|
testImplementation(libs.kotlinx.coroutines.test)
|
feat(android): wrap the store passphrase in the Android Keystore
Typing the passphrase on every launch was the v1 posture. It stays the
fallback, but it is no longer required: on first unlock the passphrase can be
remembered (checkbox, on by default) and is stored as an AES-256-GCM blob
wrapped by a key that never leaves the Android Keystore.
- crypto/StoreSecret.kt: the OWSEAL1 envelope (magic + IV + ciphertext + GCM
tag) and the wipe helpers. No android.* imports, so the code that runs on a
device is the code the unit tests exercise, with a JVM AES key standing in
for the Keystore key.
- crypto/KeystorePassphraseCipher.kt: AES-256-GCM key under alias
`onionwire.store`, StrongBox requested first (API 28+) with a graceful
fallback on ProviderException (StrongBoxUnavailableException is one), and an
honest KeyInfo-backed report of where the key actually lives.
setUserAuthenticationRequired(false) stays the default on purpose.
- crypto/StoredPassphraseStore.kt: ciphertext only, at
filesDir/secrets/store-passphrase.bin, written tmp+rename. A failed decrypt
reports Unavailable and does NOT delete the blob.
- WireViewModel: unlock(passphrase, remember), unlockStored(),
forgetStoredPassphrase(); the secret CharArray is zeroed in `finally`; the
Keystore probe runs off the main thread at ViewModel construction.
- UnlockScreen: one-tap when a stored blob exists, the typed passphrase is
dropped from Compose state as soon as it is handed over and is never put in
saved instance state; "Forget stored passphrase" deletes blob and key.
- androidTest: the device-only half (AndroidKeyStore, StrongBox, KeyInfo),
which cannot run in the unit-test JVM.
Verified: ./gradlew :app:assembleDebug and :app:testDebugUnitTest green,
25 tests / 0 failures (11 new StoreSecretTest, 9 new StoredPassphraseStoreTest).
2026-09-12 13:01:25 -04:00
|
|
|
|
|
|
|
|
// Device-only: the AndroidKeyStore provider does not exist in the unit-test
|
|
|
|
|
// JVM. These run under `./gradlew :app:connectedDebugAndroidTest`.
|
|
|
|
|
androidTestImplementation(libs.junit)
|
|
|
|
|
androidTestImplementation(libs.androidx.test.ext.junit)
|
|
|
|
|
androidTestImplementation(libs.androidx.test.runner)
|
2026-09-13 15:27:57 -04:00
|
|
|
|
|
|
|
|
// QR code rendering for the wallet receive-address screen.
|
|
|
|
|
implementation(libs.zxing)
|
feat(android): SDK AAR (UniFFI) + Compose APK, Arti rustls feature split
Adds the Android product alongside the existing Linux TUI, in one repo.
SDK — crates/onionwire-sdk is a UniFFI facade over the very same `onionwire`
crate the TUI runs on. Identity, invite, friend upsert, send/receive, rotate
and wipe all delegate; no protocol is reimplemented, so an Android peer and a
Linux peer interoperate. It is its own Cargo workspace because Arti's TLS
backends are non-additive: the TUI keeps native-tls (OpenSSL), Android needs
rustls + static-sqlite (no OpenSSL, no system libsqlite3 in the NDK).
android/ — Gradle project. :sdk produces the AAR (Kotlin bindings generated at
build time + libonionwire_sdk.so via cargo-ndk), :app is a Kotlin/Compose/M3
messenger depending on :sdk only. minSdk 26, targetSdk/compileSdk 36,
INTERNET-only, data in filesDir, backups excluded.
Root Cargo.toml grows `native-tls` (default) and `rustls` features so exactly
one Arti TLS backend is selected per build graph. The default build is
unchanged: same backend, ratatui still a normal dependency, src/tui.rs
untouched.
Also: Store::self_fingerprint/set_petname + Node wrappers (additive only),
scripts/build-android-local.sh, README sections, .gitignore for local SDK paths.
2026-09-10 18:20:19 -04:00
|
|
|
}
|