File tree Expand file tree Collapse file tree
main/java/to/bitkit/repositories
test/java/to/bitkit/repositories Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -206,9 +206,7 @@ class PubkyRepo @Inject constructor(
206206 ): InitResult = withContext(ioDispatcher) {
207207 if (storedSecretKeyHex.isNullOrEmpty()) {
208208 if (! savedSessionSecret.isNullOrEmpty()) {
209- Logger .warn(" Skipped re-sign-in recovery, no secret key available" , context = TAG )
210- runCatching { keychain.delete(Keychain .Key .PAYKIT_SESSION .name) }
211- notifyBackupStateChanged()
209+ Logger .warn(" Skipped re-sign-in recovery, keeping saved session" , context = TAG )
212210 InitResult .RestorationFailed
213211 } else {
214212 InitResult .NoSession
@@ -223,8 +221,6 @@ class PubkyRepo @Inject constructor(
223221 InitResult .Restored (publicKey)
224222 }.getOrElse {
225223 Logger .error(" Failed re-sign-in recovery" , it, context = TAG )
226- runCatching { keychain.delete(Keychain .Key .PAYKIT_SESSION .name) }
227- notifyBackupStateChanged()
228224 InitResult .RestorationFailed
229225 }
230226 }
Original file line number Diff line number Diff line change @@ -465,7 +465,7 @@ class PubkyRepoTest : BaseUnitTest() {
465465 }
466466
467467 @Test
468- fun `initialize should delete stale saved session when re-sign-in is unavailable` () = test {
468+ fun `initialize should keep saved session when re-sign-in is unavailable` () = test {
469469 val session = " stale_session"
470470 whenever(keychain.loadString(Keychain .Key .PAYKIT_SESSION .name)).thenReturn(session)
471471 whenever(keychain.loadString(Keychain .Key .PUBKY_SECRET_KEY .name)).thenReturn(null )
@@ -475,7 +475,7 @@ class PubkyRepoTest : BaseUnitTest() {
475475
476476 assertTrue(sut.sessionRestorationFailed.value)
477477 assertFalse(sut.isAuthenticated.value)
478- verifyBlocking(keychain) { delete(Keychain .Key .PAYKIT_SESSION .name) }
478+ verifyBlocking(keychain, never() ) { delete(Keychain .Key .PAYKIT_SESSION .name) }
479479 }
480480
481481 @Test
You can’t perform that action at this time.
0 commit comments