fix(android): prefer bootstrap auth on qr pairing

This commit is contained in:
Ayaan Zaidi
2026-04-08 21:08:32 +05:30
parent 911f9a104c
commit 11bd40fe8a
2 changed files with 4 additions and 4 deletions

View File

@@ -886,7 +886,7 @@ class GatewaySession(
explicitGatewayToken
?: if (
explicitPassword == null &&
(explicitBootstrapToken == null || storedToken != null)
explicitBootstrapToken == null
) {
storedToken
} else {

View File

@@ -111,7 +111,7 @@ class GatewaySessionInvokeTest {
}
@Test
fun connect_prefersStoredDeviceTokenOverBootstrapToken() = runBlocking {
fun connect_prefersBootstrapTokenOverStoredDeviceToken() = runBlocking {
val json = testJson()
val connected = CompletableDeferred<Unit>()
val connectAuth = CompletableDeferred<JsonObject?>()
@@ -148,8 +148,8 @@ class GatewaySessionInvokeTest {
awaitConnectedOrThrow(connected, lastDisconnect, server)
val auth = withTimeout(TEST_TIMEOUT_MS) { connectAuth.await() }
assertEquals("device-token", auth?.get("token")?.jsonPrimitive?.content)
assertNull(auth?.get("bootstrapToken"))
assertEquals("bootstrap-token", auth?.get("bootstrapToken")?.jsonPrimitive?.content)
assertNull(auth?.get("token"))
} finally {
shutdownHarness(harness, server)
}