improve wrong pairing password handling
This commit is contained in:
parent
c575779b58
commit
5650f448ec
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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?) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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.*
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue