bump SDK version, better handling of card lost connection on pair/opensecurechannel
This commit is contained in:
parent
22611e5ada
commit
48c3e70180
|
@ -60,7 +60,7 @@ dependencies {
|
||||||
implementation 'androidx.navigation:navigation-ui-ktx:2.1.0'
|
implementation 'androidx.navigation:navigation-ui-ktx:2.1.0'
|
||||||
implementation 'androidx.security:security-crypto:1.0.0-alpha02'
|
implementation 'androidx.security:security-crypto:1.0.0-alpha02'
|
||||||
implementation 'org.bouncycastle:bcprov-jdk15on:1.64'
|
implementation 'org.bouncycastle:bcprov-jdk15on:1.64'
|
||||||
implementation 'com.github.status-im.status-keycard-java:android:3.0.1'
|
implementation 'com.github.status-im.status-keycard-java:android:3.0.2'
|
||||||
implementation 'com.github.walletconnect:kotlin-walletconnect-lib:0.9.4'
|
implementation 'com.github.walletconnect:kotlin-walletconnect-lib:0.9.4'
|
||||||
implementation 'com.journeyapps:zxing-android-embedded:4.0.0'
|
implementation 'com.journeyapps:zxing-android-embedded:4.0.0'
|
||||||
implementation 'com.google.zxing:core:3.4.0'
|
implementation 'com.google.zxing:core:3.4.0'
|
||||||
|
|
|
@ -7,35 +7,28 @@ 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 im.status.keycard.io.APDUException
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
|
|
||||||
class OpenSecureChannelCommand : CardCommand {
|
class OpenSecureChannelCommand : CardCommand {
|
||||||
private var pairingPassword: String? = null
|
private var pairingPassword: String? = null
|
||||||
|
|
||||||
private fun openSecureChannel(cmdSet: KeycardCommandSet): CardCommand.Result {
|
private fun openSecureChannel(cmdSet: KeycardCommandSet): CardCommand.Result {
|
||||||
try {
|
return runOnCard {
|
||||||
cmdSet.autoOpenSecureChannel()
|
cmdSet.autoOpenSecureChannel()
|
||||||
} catch (e: IOException) {
|
|
||||||
//TODO: must distinguish real IOException from card exception (to fix in SDK)
|
|
||||||
return CardCommand.Result.CANCEL
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return CardCommand.Result.OK
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun pair(activity: Activity, cmdSet: KeycardCommandSet): CardCommand.Result {
|
private fun pair(activity: Activity, cmdSet: KeycardCommandSet): CardCommand.Result {
|
||||||
if (pairingPassword != null) {
|
if (pairingPassword != null) {
|
||||||
try {
|
val res = runOnCard {
|
||||||
//TODO: must distinguish real IOException from card exception (to fix in SDK)
|
|
||||||
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()
|
||||||
return CardCommand.Result.OK
|
|
||||||
} catch(e: IOException) {
|
|
||||||
e.printStackTrace()
|
|
||||||
} finally {
|
|
||||||
pairingPassword = null
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pairingPassword = null
|
||||||
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
return promptPairingPassword(activity)
|
return promptPairingPassword(activity)
|
||||||
|
|
|
@ -10,7 +10,7 @@ buildscript {
|
||||||
|
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:3.5.2'
|
classpath 'com.android.tools.build:gradle:4.0.0'
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
// NOTE: Do not place your application dependencies here; they belong
|
// NOTE: Do not place your application dependencies here; they belong
|
||||||
// in the individual module build.gradle files
|
// in the individual module build.gradle files
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#Wed Oct 23 15:57:59 MSK 2019
|
#Tue Jun 02 10:32:00 MSK 2020
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-all.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
|
||||||
|
|
Loading…
Reference in New Issue