Compare commits
11
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c5ff7a9814 | ||
|
|
1a8bc23e5e | ||
|
|
9b69907006 | ||
|
|
39921f7387 | ||
|
|
1a11d833ef | ||
|
|
4d59476a2b | ||
|
|
a722c49350 | ||
|
|
9ef9c165bf | ||
|
|
8a6d07868d | ||
|
|
c9a5e1d04d | ||
|
|
e859e3c48b |
@@ -1,6 +1,6 @@
|
||||
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="im.status.ethereum.keycard">
|
||||
package="com.reactlibrary">
|
||||
|
||||
</manifest>
|
||||
|
||||
|
||||
@@ -176,20 +176,6 @@ public class RNStatusKeycardModule extends ReactContextBaseJavaModule implements
|
||||
}).start();
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void factoryReset(final Promise promise) {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
promise.resolve(smartCard.factoryReset());
|
||||
} catch (IOException | APDUException e) {
|
||||
Log.d(TAG, e.getMessage());
|
||||
promise.reject(e);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void deriveKey(final String path, final String pin, final Promise promise) {
|
||||
new Thread(new Runnable() {
|
||||
@@ -355,36 +341,6 @@ public class RNStatusKeycardModule extends ReactContextBaseJavaModule implements
|
||||
}).start();
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void changePairingPassword(final String pin, final String pairingPassword, final Promise promise) {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
smartCard.changePairingPassword(pin, pairingPassword);
|
||||
promise.resolve(true);
|
||||
} catch (IOException | APDUException e) {
|
||||
Log.d(TAG, e.getMessage());
|
||||
promise.reject(e);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void changePUK(final String pin, final String puk, final Promise promise) {
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
smartCard.changePUK(pin, puk);
|
||||
promise.resolve(true);
|
||||
} catch (IOException | APDUException e) {
|
||||
Log.d(TAG, e.getMessage());
|
||||
promise.reject(e);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@ReactMethod
|
||||
public void changePin(final String currentPin, final String newPin, final Promise promise) {
|
||||
new Thread(new Runnable() {
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.nfc.NfcAdapter;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.EventLog;
|
||||
import android.util.Log;
|
||||
|
||||
@@ -27,7 +28,6 @@ import java.util.Iterator;
|
||||
import im.status.keycard.applet.RecoverableSignature;
|
||||
import im.status.keycard.globalplatform.GlobalPlatformCommandSet;
|
||||
import im.status.keycard.io.APDUException;
|
||||
import im.status.keycard.io.APDUResponse;
|
||||
import im.status.keycard.io.CardChannel;
|
||||
import im.status.keycard.io.CardListener;
|
||||
import im.status.keycard.android.NFCCardManager;
|
||||
@@ -206,22 +206,6 @@ public class SmartCard extends BroadcastReceiver implements CardListener {
|
||||
log("seed loaded to card");
|
||||
}
|
||||
|
||||
public boolean tryDefaultPairing(KeycardCommandSet cmdSet, String instanceUID, WritableMap cardInfo) throws IOException {
|
||||
try {
|
||||
cmdSet.autoPair("KeycardDefaultPairing");
|
||||
|
||||
Pairing pairing = cmdSet.getPairing();
|
||||
pairings.put(instanceUID, pairing.toBase64());
|
||||
cardInfo.putString("new-pairing", pairing.toBase64());
|
||||
|
||||
openSecureChannel(cmdSet);
|
||||
return true;
|
||||
} catch(APDUException e) {
|
||||
Log.i(TAG, "autoOpenSecureChannel failed: " + e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public WritableMap getApplicationInfo() throws IOException, APDUException {
|
||||
KeycardCommandSet cmdSet = new KeycardCommandSet(this.cardChannel);
|
||||
ApplicationInfo info = new ApplicationInfo(cmdSet.select().checkOK().getData());
|
||||
@@ -242,25 +226,23 @@ public class SmartCard extends BroadcastReceiver implements CardListener {
|
||||
|
||||
Boolean isPaired = false;
|
||||
|
||||
if (!pairings.containsKey(instanceUID)) {
|
||||
isPaired = tryDefaultPairing(cmdSet, instanceUID, cardInfo);
|
||||
} else {
|
||||
if (pairings.containsKey(instanceUID)) {
|
||||
try {
|
||||
openSecureChannel(cmdSet);
|
||||
isPaired = true;
|
||||
} catch(APDUException e) {
|
||||
isPaired = tryDefaultPairing(cmdSet, instanceUID, cardInfo);
|
||||
Log.i(TAG, "autoOpenSecureChannel failed: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
if (isPaired) {
|
||||
ApplicationStatus status = new ApplicationStatus(cmdSet.getStatus(KeycardCommandSet.GET_STATUS_P1_APPLICATION).checkOK().getData());
|
||||
if (isPaired) {
|
||||
ApplicationStatus status = new ApplicationStatus(cmdSet.getStatus(KeycardCommandSet.GET_STATUS_P1_APPLICATION).checkOK().getData());
|
||||
|
||||
Log.i(TAG, "PIN retry counter: " + status.getPINRetryCount());
|
||||
Log.i(TAG, "PUK retry counter: " + status.getPUKRetryCount());
|
||||
Log.i(TAG, "PIN retry counter: " + status.getPINRetryCount());
|
||||
Log.i(TAG, "PUK retry counter: " + status.getPUKRetryCount());
|
||||
|
||||
cardInfo.putInt("pin-retry-counter", status.getPINRetryCount());
|
||||
cardInfo.putInt("puk-retry-counter", status.getPUKRetryCount());
|
||||
cardInfo.putInt("pin-retry-counter", status.getPINRetryCount());
|
||||
cardInfo.putInt("puk-retry-counter", status.getPUKRetryCount());
|
||||
}
|
||||
}
|
||||
|
||||
cardInfo.putBoolean("has-master-key?", info.hasMasterKey());
|
||||
@@ -275,29 +257,6 @@ public class SmartCard extends BroadcastReceiver implements CardListener {
|
||||
return cardInfo;
|
||||
}
|
||||
|
||||
public WritableMap factoryReset() throws IOException, APDUException {
|
||||
GlobalPlatformCommandSet cmdSet = new GlobalPlatformCommandSet(this.cardChannel);
|
||||
cmdSet.select().checkOK();
|
||||
Log.i(TAG, "ISD selected");
|
||||
|
||||
cmdSet.openSecureChannel();
|
||||
Log.i(TAG, "SecureChannel opened");
|
||||
|
||||
cmdSet.deleteKeycardInstance().checkSW(APDUResponse.SW_OK, APDUResponse.SW_REFERENCED_DATA_NOT_FOUND);
|
||||
Log.i(TAG, "Keycard applet instance deleted");
|
||||
|
||||
cmdSet.installKeycardApplet().checkOK();
|
||||
Log.i(TAG, "Keycard applet instance re-installed");
|
||||
|
||||
ApplicationInfo info = new ApplicationInfo(new KeycardCommandSet(this.cardChannel).select().checkOK().getData());
|
||||
Log.i(TAG, "Selecting the newly installed Keycard applet succeeded");
|
||||
|
||||
WritableMap cardInfo = Arguments.createMap();
|
||||
cardInfo.putBoolean("initialized?", info.isInitializedCard());
|
||||
|
||||
return cardInfo;
|
||||
}
|
||||
|
||||
public void deriveKey(final String path, final String pin) throws IOException, APDUException {
|
||||
KeycardCommandSet cmdSet = authenticatedCommandSet(pin);
|
||||
|
||||
@@ -446,24 +405,10 @@ public class SmartCard extends BroadcastReceiver implements CardListener {
|
||||
return 3;
|
||||
}
|
||||
|
||||
public void changePairingPassword(final String pin, final String pairingPassword) throws IOException, APDUException {
|
||||
KeycardCommandSet cmdSet = authenticatedCommandSet(pin);
|
||||
|
||||
cmdSet.changePairingPassword(pairingPassword);
|
||||
Log.i(TAG, "pairing password changed");
|
||||
}
|
||||
|
||||
public void changePUK(final String pin, final String puk) throws IOException, APDUException {
|
||||
KeycardCommandSet cmdSet = authenticatedCommandSet(pin);
|
||||
|
||||
cmdSet.changePUK(puk);
|
||||
Log.i(TAG, "puk changed");
|
||||
}
|
||||
|
||||
public void changePin(final String currentPin, final String newPin) throws IOException, APDUException {
|
||||
KeycardCommandSet cmdSet = authenticatedCommandSet(currentPin);
|
||||
|
||||
cmdSet.changePIN(newPin);
|
||||
cmdSet.changePIN(0, newPin);
|
||||
Log.i(TAG, "pin changed");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package im.status.ethereum.keycard;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.util.Base64;
|
||||
|
||||
import static android.util.Base64.NO_PADDING;
|
||||
@@ -28,8 +29,9 @@ public class SmartCardSecrets {
|
||||
this.pairingPassword = pairingPassword;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public static SmartCardSecrets generate(final String userPin) throws NoSuchAlgorithmException, InvalidKeySpecException {
|
||||
String pairingPassword = "KeycardDefaultPairing";
|
||||
String pairingPassword = randomToken(5);
|
||||
long pinNumber = randomLong(PIN_BOUND);
|
||||
long pukNumber = randomLong(PUK_BOUND);
|
||||
|
||||
|
||||
+11
-68
@@ -20,11 +20,11 @@ class SmartCard {
|
||||
|
||||
func initialize(channel: CardChannel, pin: String, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) throws -> Void {
|
||||
let puk = self.randomPUK()
|
||||
let pairingPassword = "KeycardDefaultPairing"
|
||||
let pairingPassword = self.randomPairingPassword();
|
||||
|
||||
let cmdSet = KeycardCommandSet(cardChannel: channel)
|
||||
try cmdSet.select().checkOK()
|
||||
try cmdSet.initialize(pin: pin, puk: puk, pairingPassword: pairingPassword).checkOK()
|
||||
try cmdSet.initialize(pin: pin, puk: puk, pairingPassword: pairingPassword).checkOK();
|
||||
|
||||
resolve(["pin": pin, "puk": puk, "password": pairingPassword])
|
||||
}
|
||||
@@ -89,29 +89,6 @@ class SmartCard {
|
||||
resolve(true)
|
||||
}
|
||||
|
||||
func factoryReset(channel: CardChannel, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) throws -> Void {
|
||||
let cmdSet: GlobalPlatformCommandSet = GlobalPlatformCommandSet(cardChannel: channel);
|
||||
try cmdSet.select().checkOK()
|
||||
os_log("ISD selected")
|
||||
|
||||
try cmdSet.openSecureChannel()
|
||||
os_log("SecureChannel opened")
|
||||
|
||||
try cmdSet.deleteKeycardInstance().checkSW(StatusWord.ok, StatusWord.referencedDataNotFound)
|
||||
os_log("Keycard applet instance deleted")
|
||||
|
||||
try cmdSet.installKeycardInstance().checkOK()
|
||||
os_log("Keycard applet instance re-installed")
|
||||
|
||||
let info = try ApplicationInfo(KeycardCommandSet(cardChannel: channel).select().checkOK().data)
|
||||
os_log("Selecting the newly installed Keycard applet succeeded")
|
||||
|
||||
var cardInfo = [String: Any]()
|
||||
cardInfo["initialized?"] = info.initializedCard
|
||||
|
||||
resolve(cardInfo)
|
||||
}
|
||||
|
||||
func getApplicationInfo(channel: CardChannel, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) throws -> Void {
|
||||
let cmdSet = KeycardCommandSet(cardChannel: channel)
|
||||
let info = try ApplicationInfo(cmdSet.select().checkOK().data)
|
||||
@@ -129,21 +106,19 @@ class SmartCard {
|
||||
try openSecureChannel(cmdSet: cmdSet)
|
||||
isPaired = true
|
||||
} catch let error as CardError {
|
||||
isPaired = try tryDefaultPairing(cmdSet: cmdSet, cardInfo: &cardInfo)
|
||||
os_log("autoOpenSecureChannel failed: %@", String(describing: error));
|
||||
} catch let error as StatusWord {
|
||||
isPaired = try tryDefaultPairing(cmdSet: cmdSet, cardInfo: &cardInfo)
|
||||
os_log("autoOpenSecureChannel failed: %@", String(describing: error));
|
||||
}
|
||||
} else {
|
||||
isPaired = try tryDefaultPairing(cmdSet: cmdSet, cardInfo: &cardInfo)
|
||||
}
|
||||
|
||||
if (isPaired) {
|
||||
let status = try ApplicationStatus(cmdSet.getStatus(info: GetStatusP1.application.rawValue).checkOK().data);
|
||||
os_log("PIN retry counter: %d", status.pinRetryCount)
|
||||
os_log("PUK retry counter: %d", status.pukRetryCount)
|
||||
if (isPaired) {
|
||||
let status = try ApplicationStatus(cmdSet.getStatus(info: GetStatusP1.application.rawValue).checkOK().data);
|
||||
os_log("PIN retry counter: %d", status.pinRetryCount)
|
||||
os_log("PUK retry counter: %d", status.pukRetryCount)
|
||||
|
||||
cardInfo["pin-retry-counter"] = status.pinRetryCount
|
||||
cardInfo["puk-retry-counter"] = status.pukRetryCount
|
||||
cardInfo["pin-retry-counter"] = status.pinRetryCount
|
||||
cardInfo["puk-retry-counter"] = status.pukRetryCount
|
||||
}
|
||||
}
|
||||
|
||||
cardInfo["paired?"] = isPaired
|
||||
@@ -268,20 +243,6 @@ class SmartCard {
|
||||
resolve(3)
|
||||
}
|
||||
|
||||
func changePairingPassword(channel: CardChannel, pin: String, pairingPassword: String, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) throws -> Void {
|
||||
let cmdSet = try authenticatedCommandSet(channel: channel, pin: pin)
|
||||
try cmdSet.changePairingPassword(pairingPassword: pairingPassword).checkOK()
|
||||
os_log("pairing password changed")
|
||||
resolve(true)
|
||||
}
|
||||
|
||||
func changePUK(channel: CardChannel, pin: String, puk: String, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) throws -> Void {
|
||||
let cmdSet = try authenticatedCommandSet(channel: channel, pin: pin)
|
||||
try cmdSet.changePUK(puk: puk).checkOK()
|
||||
os_log("puk changed")
|
||||
resolve(true)
|
||||
}
|
||||
|
||||
func changePin(channel: CardChannel, currentPin: String, newPin: String, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) throws -> Void {
|
||||
let cmdSet = try authenticatedCommandSet(channel: channel, pin: currentPin)
|
||||
try cmdSet.changePIN(pin: newPin).checkOK()
|
||||
@@ -371,24 +332,6 @@ class SmartCard {
|
||||
return cmdSet
|
||||
}
|
||||
|
||||
func tryDefaultPairing(cmdSet: KeycardCommandSet, cardInfo: inout [String: Any]) throws -> Bool {
|
||||
do {
|
||||
try cmdSet.autoPair(password: "KeycardDefaultPairing")
|
||||
let pairing = Data(cmdSet.pairing!.bytes).base64EncodedString()
|
||||
self.pairings[bytesToHex(cmdSet.info!.instanceUID)] = pairing
|
||||
cardInfo["new-pairing"] = pairing
|
||||
|
||||
try openSecureChannel(cmdSet: cmdSet)
|
||||
return true
|
||||
} catch let error as CardError {
|
||||
os_log("autoOpenSecureChannel failed: %@", String(describing: error));
|
||||
} catch let error as StatusWord {
|
||||
os_log("autoOpenSecureChannel failed: %@", String(describing: error));
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
func openSecureChannel(cmdSet: KeycardCommandSet) throws -> Void {
|
||||
if let pairingBase64 = self.pairings[bytesToHex(cmdSet.info!.instanceUID)] {
|
||||
cmdSet.pairing = try base64ToPairing(pairingBase64)
|
||||
|
||||
@@ -12,7 +12,6 @@ RCT_EXTERN_METHOD(generateMnemonic:(NSString *)words resolve:(RCTPromiseResolveB
|
||||
RCT_EXTERN_METHOD(generateAndLoadKey:(NSString *)mnemonic pin:(NSString *)pin resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(saveMnemonic:(NSString *)mnemonic pin:(NSString *)pin resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(getApplicationInfo:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(factoryReset:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(deriveKey:(NSString *)path pin:(NSString *)pin resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(exportKey:(NSString *)pin resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(exportKeyWithPath:(NSString *)pin path:(NSString *)path resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
@@ -24,8 +23,6 @@ RCT_EXTERN_METHOD(signPinless:(NSString *)hash resolve:(RCTPromiseResolveBlock)r
|
||||
RCT_EXTERN_METHOD(installApplet:(RCTPromiseResolveBlock)resolve reject: (RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(installAppletAndInitCard:(String *)pin resolve: (RCTPromiseResolveBlock)resolve reject: (RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(verifyPin:(NSString *)pin resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(changePairingPassword:(NSString *)pin pairingPassword:(NSString *)pairingPassword resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(changePUK:(NSString *)pin puk:(NSString *)puk resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(changePin:(NSString *)currentPin newPin:(NSString *)newPin resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(unblockPin:(NSString *)puk newPin:(NSString *)newPin resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
RCT_EXTERN_METHOD(unpair:(NSString *)pin resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
|
||||
|
||||
+2
-27
@@ -9,18 +9,8 @@ class StatusKeycard: RCTEventEmitter {
|
||||
var cardChannel: CardChannel? = nil
|
||||
var nfcStartPrompt: String = "Hold your iPhone near a Status Keycard."
|
||||
|
||||
private var _keycardController: Any? = nil
|
||||
|
||||
@available(iOS 13.0, *)
|
||||
private var keycardController: KeycardController? {
|
||||
get {
|
||||
return _keycardController as? KeycardController
|
||||
}
|
||||
|
||||
set(kc) {
|
||||
_keycardController = kc
|
||||
}
|
||||
}
|
||||
private(set) lazy var keycardController: KeycardController? = nil
|
||||
|
||||
@objc
|
||||
func nfcIsSupported(_ resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
|
||||
@@ -68,11 +58,6 @@ class StatusKeycard: RCTEventEmitter {
|
||||
keycardInvokation(reject) { [unowned self] channel in try self.smartCard.saveMnemonic(channel: channel, mnemonic: mnemonic, pin: pin, resolve: resolve, reject: reject) }
|
||||
}
|
||||
|
||||
@objc
|
||||
func factoryReset(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
||||
keycardInvokation(reject) { [unowned self] channel in try self.smartCard.factoryReset(channel: channel, resolve: resolve, reject: reject) }
|
||||
}
|
||||
|
||||
@objc
|
||||
func getApplicationInfo(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
||||
keycardInvokation(reject) { [unowned self] channel in try self.smartCard.getApplicationInfo(channel: channel, resolve: resolve, reject: reject) }
|
||||
@@ -133,16 +118,6 @@ class StatusKeycard: RCTEventEmitter {
|
||||
keycardInvokation(reject) { [unowned self] channel in try self.smartCard.verifyPin(channel: channel, pin: pin, resolve: resolve, reject: reject) }
|
||||
}
|
||||
|
||||
@objc
|
||||
func changePairingPassword(_ pin: String, pairingPassword: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
||||
keycardInvokation(reject) { [unowned self] channel in try self.smartCard.changePairingPassword(channel: channel, pin: pin, pairingPassword: pairingPassword, resolve: resolve, reject: reject) }
|
||||
}
|
||||
|
||||
@objc
|
||||
func changePUK(_ pin: String, puk: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
||||
keycardInvokation(reject) { [unowned self] channel in try self.smartCard.changePUK(channel: channel, pin: pin, puk: puk, resolve: resolve, reject: reject) }
|
||||
}
|
||||
|
||||
@objc
|
||||
func changePin(_ currentPin: String, newPin: String, resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) -> Void {
|
||||
keycardInvokation(reject) { [unowned self] channel in try self.smartCard.changePin(channel: channel, currentPin: currentPin, newPin: newPin, resolve: resolve, reject: reject) }
|
||||
@@ -209,7 +184,7 @@ class StatusKeycard: RCTEventEmitter {
|
||||
let nsError = error as NSError
|
||||
if nsError.code == 200 && nsError.domain == "NFCError" {
|
||||
self.sendEvent(withName: "keyCardOnNFCUserCancelled", body: nil)
|
||||
} else if (nsError.code == 201 || nsError.code == 203) && (nsError.domain == "NFCError") {
|
||||
} else if nsError.code == 201 && nsError.domain == "NFCError" {
|
||||
self.sendEvent(withName: "keyCardOnNFCTimeout", body: nil)
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "react-native-status-keycard",
|
||||
"homepage": "https://keycard.status.im/",
|
||||
"version": "2.5.38",
|
||||
"description": "React Native library to interact with Status Keycard using NFC connection",
|
||||
"version": "2.5.33",
|
||||
"description": "React Native library to interact with Status Keycard using NFC connection (Android only)",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
|
||||
Reference in New Issue
Block a user