bump SDK version, better handling of card lost connection on pair/opensecurechannel

This commit is contained in:
Michele Balistreri 2020-06-02 10:46:54 +03:00
parent 22611e5ada
commit 48c3e70180
No known key found for this signature in database
GPG Key ID: E9567DA33A4F791A
4 changed files with 10 additions and 17 deletions

View File

@ -60,7 +60,7 @@ dependencies {
implementation 'androidx.navigation:navigation-ui-ktx:2.1.0'
implementation 'androidx.security:security-crypto:1.0.0-alpha02'
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.journeyapps:zxing-android-embedded:4.0.0'
implementation 'com.google.zxing:core:3.4.0'

View File

@ -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.REQ_INTERACTIVE_SCRIPT
import im.status.keycard.connect.ui.PairingActivity
import im.status.keycard.io.APDUException
import java.io.IOException
class OpenSecureChannelCommand : CardCommand {
private var pairingPassword: String? = null
private fun openSecureChannel(cmdSet: KeycardCommandSet): CardCommand.Result {
try {
return runOnCard {
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 {
if (pairingPassword != null) {
try {
//TODO: must distinguish real IOException from card exception (to fix in SDK)
val res = runOnCard {
cmdSet.autoPair(pairingPassword)
Registry.pairingManager.putPairing(cmdSet.applicationInfo.instanceUID, cmdSet.pairing)
cmdSet.autoOpenSecureChannel()
return CardCommand.Result.OK
} catch(e: IOException) {
e.printStackTrace()
} finally {
pairingPassword = null
}
pairingPassword = null
return res
}
return promptPairingPassword(activity)

View File

@ -10,7 +10,7 @@ buildscript {
}
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"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files

View File

@ -1,6 +1,6 @@
#Wed Oct 23 15:57:59 MSK 2019
#Tue Jun 02 10:32:00 MSK 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
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