From f602fadf800937fc1de92aa18c2e58c372eb1bed Mon Sep 17 00:00:00 2001 From: Michele Balistreri Date: Tue, 2 Mar 2021 13:27:59 +0300 Subject: [PATCH] removeKeyWithUnpair also unpairs others --- .../im/status/ethereum/keycard/SmartCard.java | 22 +++++++++++++++++-- ios/SmartCard.swift | 3 +++ package.json | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/android/src/main/java/im/status/ethereum/keycard/SmartCard.java b/android/src/main/java/im/status/ethereum/keycard/SmartCard.java index d9c4fb4..99bdaa7 100644 --- a/android/src/main/java/im/status/ethereum/keycard/SmartCard.java +++ b/android/src/main/java/im/status/ethereum/keycard/SmartCard.java @@ -568,8 +568,26 @@ public class SmartCard extends BroadcastReceiver implements CardListener { } public void removeKeyWithUnpair(final String pairingBase64, final String pin) throws IOException, APDUException { - removeKey(pairingBase64, pin); - unpair(pairingBase64, pin); + KeycardCommandSet cmdSet = new KeycardCommandSet(this.cardChannel); + cmdSet.select().checkOK(); + + Pairing pairing = new Pairing(pairingBase64); + cmdSet.setPairing(pairing); + + cmdSet.autoOpenSecureChannel(); + Log.i(TAG, "secure channel opened"); + + cmdSet.verifyPIN(pin).checkOK(); + Log.i(TAG, "pin verified"); + + cmdSet.removeKey(); + Log.i(TAG, "key removed"); + + cmdSet.unpairOthers(); + Log.i(TAG, "unpaired others"); + + cmdSet.autoUnpair(); + Log.i(TAG, "card unpaired"); } public void unpairAndDelete(final String pairingBase64, final String pin) throws IOException, APDUException { diff --git a/ios/SmartCard.swift b/ios/SmartCard.swift index 7a53cb8..29546c7 100644 --- a/ios/SmartCard.swift +++ b/ios/SmartCard.swift @@ -276,6 +276,9 @@ class SmartCard { try cmdSet.removeKey().checkOK() os_log("key removed") + try cmdSet.unpairOthers() + os_log("unpaired others") + try cmdSet.autoUnpair() os_log("card unpaired") diff --git a/package.json b/package.json index 24ffb1d..8aa34d0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "react-native-status-keycard", "homepage": "https://keycard.status.im/", - "version": "2.5.31", + "version": "2.5.32", "description": "React Native library to interact with Status Keycard using NFC connection (Android only)", "main": "index.js", "scripts": {