mirror of
https://github.com/status-im/keycard-connect.git
synced 2025-01-09 10:42:28 +00:00
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.PAIRING_ACTIVITY_PASSWORD
|
||||||
import im.status.keycard.connect.data.REQ_INTERACTIVE_SCRIPT
|
import im.status.keycard.connect.data.REQ_INTERACTIVE_SCRIPT
|
||||||
import im.status.keycard.connect.ui.PairingActivity
|
import im.status.keycard.connect.ui.PairingActivity
|
||||||
|
import java.lang.Exception
|
||||||
|
|
||||||
class OpenSecureChannelCommand : CardCommand {
|
class OpenSecureChannelCommand : CardCommand {
|
||||||
private var pairingPassword: String? = null
|
private var pairingPassword: String? = null
|
||||||
@ -19,10 +20,13 @@ class OpenSecureChannelCommand : CardCommand {
|
|||||||
|
|
||||||
private fun pair(activity: Activity, cmdSet: KeycardCommandSet): CardCommand.Result {
|
private fun pair(activity: Activity, cmdSet: KeycardCommandSet): CardCommand.Result {
|
||||||
if (pairingPassword != null) {
|
if (pairingPassword != null) {
|
||||||
val res = runOnCard {
|
val res = try {
|
||||||
cmdSet.autoPair(pairingPassword)
|
cmdSet.autoPair(pairingPassword)
|
||||||
Registry.pairingManager.putPairing(cmdSet.applicationInfo.instanceUID, cmdSet.pairing)
|
Registry.pairingManager.putPairing(cmdSet.applicationInfo.instanceUID, cmdSet.pairing)
|
||||||
cmdSet.autoOpenSecureChannel()
|
cmdSet.autoOpenSecureChannel()
|
||||||
|
CardCommand.Result.OK
|
||||||
|
} catch(e: Exception) {
|
||||||
|
CardCommand.Result.RETRY
|
||||||
}
|
}
|
||||||
|
|
||||||
pairingPassword = null
|
pairingPassword = null
|
||||||
|
@ -5,7 +5,6 @@ import android.os.Bundle
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.core.widget.doAfterTextChanged
|
import androidx.core.widget.doAfterTextChanged
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
import im.status.keycard.connect.Registry
|
import im.status.keycard.connect.Registry
|
||||||
|
@ -5,7 +5,6 @@ import android.os.Bundle
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.core.widget.doAfterTextChanged
|
import androidx.core.widget.doAfterTextChanged
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
import im.status.keycard.connect.Registry
|
import im.status.keycard.connect.Registry
|
||||||
|
@ -5,13 +5,11 @@ import android.os.Bundle
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.core.widget.doAfterTextChanged
|
import androidx.core.widget.doAfterTextChanged
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
import im.status.keycard.connect.Registry
|
import im.status.keycard.connect.Registry
|
||||||
import im.status.keycard.connect.card.ChangePairingPasswordCommand
|
import im.status.keycard.connect.card.ChangePairingPasswordCommand
|
||||||
import im.status.keycard.connect.card.scriptWithAuthentication
|
import im.status.keycard.connect.card.scriptWithAuthentication
|
||||||
import im.status.keycard.connect.data.isValidPUK
|
|
||||||
|
|
||||||
class ChangePairingPasswordActivity : NoNFCActivity() {
|
class ChangePairingPasswordActivity : NoNFCActivity() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
@ -9,7 +9,6 @@ import android.util.Base64.NO_PADDING
|
|||||||
import android.util.Base64.NO_WRAP
|
import android.util.Base64.NO_WRAP
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
import im.status.keycard.connect.data.INIT_ACTIVITY_PAIRING
|
import im.status.keycard.connect.data.INIT_ACTIVITY_PAIRING
|
||||||
import im.status.keycard.connect.data.INIT_ACTIVITY_PIN
|
import im.status.keycard.connect.data.INIT_ACTIVITY_PIN
|
||||||
|
@ -6,7 +6,6 @@ import android.content.pm.ActivityInfo
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
import im.status.keycard.connect.data.*
|
import im.status.keycard.connect.data.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -7,7 +7,6 @@ import android.view.View
|
|||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.core.widget.doAfterTextChanged
|
import androidx.core.widget.doAfterTextChanged
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
import im.status.keycard.connect.Registry
|
import im.status.keycard.connect.Registry
|
||||||
|
@ -7,7 +7,6 @@ import android.view.View
|
|||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.core.widget.doAfterTextChanged
|
import androidx.core.widget.doAfterTextChanged
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
import im.status.keycard.connect.Registry
|
import im.status.keycard.connect.Registry
|
||||||
|
@ -7,7 +7,6 @@ import android.os.Bundle
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import androidx.core.widget.doAfterTextChanged
|
import androidx.core.widget.doAfterTextChanged
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
import im.status.keycard.connect.data.PAIRING_ACTIVITY_PASSWORD
|
import im.status.keycard.connect.data.PAIRING_ACTIVITY_PASSWORD
|
||||||
|
@ -5,7 +5,6 @@ import android.content.pm.ActivityInfo
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.CheckBox
|
import android.widget.CheckBox
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
import im.status.keycard.connect.Registry
|
import im.status.keycard.connect.Registry
|
||||||
import im.status.keycard.connect.card.ReinstallCommand
|
import im.status.keycard.connect.card.ReinstallCommand
|
||||||
|
@ -4,7 +4,6 @@ import android.content.pm.ActivityInfo
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
import im.status.keycard.connect.data.MNEMONIC_PHRASE
|
import im.status.keycard.connect.data.MNEMONIC_PHRASE
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import android.content.pm.ActivityInfo
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
import im.status.keycard.connect.data.SIGN_TEXT_MESSAGE
|
import im.status.keycard.connect.data.SIGN_TEXT_MESSAGE
|
||||||
|
|
||||||
|
@ -5,7 +5,6 @@ import android.content.pm.ActivityInfo
|
|||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
|
||||||
import im.status.keycard.connect.R
|
import im.status.keycard.connect.R
|
||||||
import im.status.keycard.connect.data.SIGN_TX_AMOUNT
|
import im.status.keycard.connect.data.SIGN_TX_AMOUNT
|
||||||
import im.status.keycard.connect.data.SIGN_TX_CURRENCY
|
import im.status.keycard.connect.data.SIGN_TX_CURRENCY
|
||||||
|
Loading…
x
Reference in New Issue
Block a user