From aca11a20be8ac47be1011e4a0c91a8f5415a0ac6 Mon Sep 17 00:00:00 2001 From: Marten Rebane Date: Wed, 2 Sep 2026 12:04:33 +0300 Subject: [PATCH] Fix showing SSL error message with NFC --- .../main/kotlin/ee/ria/DigiDoc/exceptions/NFCError.kt | 4 ++++ .../kotlin/ee/ria/DigiDoc/viewmodel/NFCViewModel.kt | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/app/src/main/kotlin/ee/ria/DigiDoc/exceptions/NFCError.kt b/app/src/main/kotlin/ee/ria/DigiDoc/exceptions/NFCError.kt index 25880619f..233119d41 100644 --- a/app/src/main/kotlin/ee/ria/DigiDoc/exceptions/NFCError.kt +++ b/app/src/main/kotlin/ee/ria/DigiDoc/exceptions/NFCError.kt @@ -59,6 +59,10 @@ sealed class NFCError { override val message: Int, ) : NFCError() + data class InvalidSslHandshake( + override val message: Int, + ) : NFCError() + data class NoLockFound( override val message: Int, ) : NFCError() diff --git a/app/src/main/kotlin/ee/ria/DigiDoc/viewmodel/NFCViewModel.kt b/app/src/main/kotlin/ee/ria/DigiDoc/viewmodel/NFCViewModel.kt index d867c92c8..0a579798e 100644 --- a/app/src/main/kotlin/ee/ria/DigiDoc/viewmodel/NFCViewModel.kt +++ b/app/src/main/kotlin/ee/ria/DigiDoc/viewmodel/NFCViewModel.kt @@ -779,6 +779,11 @@ class NFCViewModel errorLog(logTag, "Unable to sign with NFC - Unable to create proxy connection with host", e) } + private fun showSslHandshakeError(e: Exception) { + _errorState.update { NFCError.InvalidSslHandshake(R.string.invalid_ssl_handshake) } + errorLog(logTag, "Unable to sign with NFC - Failed to create SSL connection with host", e) + } + private fun showNoLockFoundError(e: Exception) { _errorState.update { NFCError.NoLockFound(R.string.no_lock_found) } errorLog(logTag, "Unable to decrypt with NFC - No lock found with certificate key", e) @@ -882,6 +887,11 @@ class NFCViewModel true } + message.contains("Failed to create ssl connection with host") -> { + showSslHandshakeError(ex) + true + } + message.contains("Too Many Requests") -> { setErrorState(SessionStatusResponseProcessStatus.TOO_MANY_REQUESTS) true