Files
web-terminal/android/host-registry/build.gradle.kts
Yaojia Wang 9114630c3a feat(android): access-token support — same frozen contract as iOS
Android could not connect at all once the server set WEBTERM_TOKEN. Hand-written
Cookie header on every request and on the WS upgrade (no CookieJar, matching the
frozen decision), POST /auth pairing probe, Keystore-backed storage, and a 401
upgrade as a terminal state with no reconnect loop.
2026-07-30 12:45:27 +02:00

66 lines
2.9 KiB
Plaintext

// ─────────────────────────────────────────────────────────────────────────────
// :host-registry (A12) — Host list + LastSessionStore behind interfaces, backed by
// Jetpack DataStore (Preferences). Mirrors the iOS HostRegistry package: storage
// lives behind an interface (HostStore / LastSessionStore), the immutable list
// transforms (upserting/removing) are shared helpers that never mutate, and the
// in-memory doubles double as JVM-testable fakes for the AW4 ViewModel tests.
//
// Android-framework-bound (DataStore needs a Context/File), so DataStore-backed
// stores are exercised in androidTest (compile here, run on device — no emulator).
// The pure logic (Host list transforms, in-memory doubles, HostCodec at-rest
// reconstruct/drop-invalid) is covered by plain JVM JUnit5 unit tests.
//
// AGP 9 has built-in Kotlin → apply ONLY com.android.library (adding
// org.jetbrains.kotlin.android errors). The serialization compiler plugin is added
// via its alias and composes with the built-in Kotlin compilation (PersistedHost
// is @Serializable — the at-rest DTO).
// ─────────────────────────────────────────────────────────────────────────────
plugins {
id("com.android.library")
alias(libs.plugins.kotlin.serialization)
}
android {
namespace = "wang.yaojia.webterm.hostregistry"
compileSdk = 36
defaultConfig {
minSdk = 29
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}
kotlin {
jvmToolchain(17)
}
dependencies {
api(project(":wire-protocol"))
implementation(libs.kotlinx.serialization.json)
implementation(libs.kotlinx.coroutines.core)
implementation(libs.androidx.datastore.preferences)
// Tink AEAD encrypts the per-host access-token blob at rest under an AndroidKeystore-wrapped
// master key (B5 / ios-completion §1.1). A SEPARATE keyset from :client-tls-android's cert store —
// different secrets, different lifecycles, and no module edge to the TLS half.
implementation(libs.tink.android)
testImplementation(libs.bundles.unit.test)
testRuntimeOnly(libs.junit.platform.launcher)
androidTestImplementation(libs.androidx.test.ext.junit)
androidTestImplementation(libs.androidx.test.core)
androidTestImplementation(libs.androidx.test.runner)
}
// Local (JVM) unit tests run on the JUnit 5 platform, matching the pure modules
// and the :app design-token tests.
tasks.withType<Test>().configureEach {
useJUnitPlatform()
}