improve wrong pairing password handling

This commit is contained in:
Michele Balistreri 2020-10-22 16:21:48 +02:00
parent c575779b58
commit 5650f448ec
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
13 changed files with 5 additions and 14 deletions

View File

@ -7,6 +7,7 @@ import im.status.keycard.connect.Registry
import im.status.keycard.connect.data.PAIRING_ACTIVITY_PASSWORD
import im.status.keycard.connect.data.REQ_INTERACTIVE_SCRIPT
import im.status.keycard.connect.ui.PairingActivity
import java.lang.Exception
class OpenSecureChannelCommand : CardCommand {
private var pairingPassword: String? = null
@ -19,10 +20,13 @@ class OpenSecureChannelCommand : CardCommand {
private fun pair(activity: Activity, cmdSet: KeycardCommandSet): CardCommand.Result {
if (pairingPassword != null) {
val res = runOnCard {
val res = try {
cmdSet.autoPair(pairingPassword)
Registry.pairingManager.putPairing(cmdSet.applicationInfo.instanceUID, cmdSet.pairing)
cmdSet.autoOpenSecureChannel()
CardCommand.Result.OK
} catch(e: Exception) {
CardCommand.Result.RETRY
}
pairingPassword = null

View File

@ -5,7 +5,6 @@ import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import androidx.core.widget.doAfterTextChanged
import im.status.keycard.connect.R
import im.status.keycard.connect.Registry

View File

@ -5,7 +5,6 @@ import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import androidx.core.widget.doAfterTextChanged
import im.status.keycard.connect.R
import im.status.keycard.connect.Registry

View File

@ -5,13 +5,11 @@ import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import androidx.core.widget.doAfterTextChanged
import im.status.keycard.connect.R
import im.status.keycard.connect.Registry
import im.status.keycard.connect.card.ChangePairingPasswordCommand
import im.status.keycard.connect.card.scriptWithAuthentication
import im.status.keycard.connect.data.isValidPUK
class ChangePairingPasswordActivity : NoNFCActivity() {
override fun onCreate(savedInstanceState: Bundle?) {

View File

@ -9,7 +9,6 @@ import android.util.Base64.NO_PADDING
import android.util.Base64.NO_WRAP
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.data.INIT_ACTIVITY_PAIRING
import im.status.keycard.connect.data.INIT_ACTIVITY_PIN

View File

@ -6,7 +6,6 @@ import android.content.pm.ActivityInfo
import android.os.Bundle
import android.view.View
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.data.*
import java.util.*

View File

@ -7,7 +7,6 @@ import android.view.View
import android.widget.Button
import android.widget.EditText
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.widget.doAfterTextChanged
import im.status.keycard.connect.R
import im.status.keycard.connect.Registry

View File

@ -7,7 +7,6 @@ import android.view.View
import android.widget.Button
import android.widget.EditText
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.widget.doAfterTextChanged
import im.status.keycard.connect.R
import im.status.keycard.connect.Registry

View File

@ -7,7 +7,6 @@ import android.os.Bundle
import android.view.View
import android.widget.Button
import android.widget.EditText
import androidx.appcompat.app.AppCompatActivity
import androidx.core.widget.doAfterTextChanged
import im.status.keycard.connect.R
import im.status.keycard.connect.data.PAIRING_ACTIVITY_PASSWORD

View File

@ -5,7 +5,6 @@ import android.content.pm.ActivityInfo
import android.os.Bundle
import android.view.View
import android.widget.CheckBox
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.Registry
import im.status.keycard.connect.card.ReinstallCommand

View File

@ -4,7 +4,6 @@ import android.content.pm.ActivityInfo
import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.data.MNEMONIC_PHRASE

View File

@ -5,7 +5,6 @@ import android.content.pm.ActivityInfo
import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.data.SIGN_TEXT_MESSAGE

View File

@ -5,7 +5,6 @@ import android.content.pm.ActivityInfo
import android.os.Bundle
import android.view.View
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import im.status.keycard.connect.R
import im.status.keycard.connect.data.SIGN_TX_AMOUNT
import im.status.keycard.connect.data.SIGN_TX_CURRENCY