improve getKeys() speed

This commit is contained in:
Dmitry Novotochinov 2019-03-11 12:52:18 +03:00
parent d6378e434f
commit 97de3e6066
No known key found for this signature in database
GPG Key ID: 43D1DAF5AD39C927
3 changed files with 4 additions and 16 deletions

View File

@ -23,7 +23,7 @@ import im.status.keycard.io.APDUException;
public class RNStatusKeycardModule extends ReactContextBaseJavaModule implements LifecycleEventListener {
private static final String TAG = "StatusKeycard";
private static final String CAP_FILENAME = "keycard.cap";
private static final String CAP_FILENAME = "keycard_v2.1.cap";
private SmartCard smartCard;
private final ReactApplicationContext reactContext;

View File

@ -298,25 +298,13 @@ public class SmartCard extends BroadcastReceiver implements CardListener {
cmdSet.verifyPIN(pin).checkOK();
Log.i(TAG, "pin verified");
cmdSet.deriveKey(WALLET_PATH).checkOK();
Log.i(TAG, "Derived " + WALLET_PATH);
byte[] tlv = cmdSet.exportCurrentKey(true).checkOK().getData();
byte[] tlv = cmdSet.exportKey(WALLET_PATH, true, true).checkOK().getData();
BIP32KeyPair walletKeyPair = BIP32KeyPair.fromTLV(tlv);
cmdSet.deriveKey(WHISPER_PATH).checkOK();
Log.i(TAG, "Derived " + WHISPER_PATH);
byte[] tlv2 = cmdSet.exportCurrentKey(false).checkOK().getData();
byte[] tlv2 = cmdSet.exportKey(WHISPER_PATH, false, false).checkOK().getData();
BIP32KeyPair whisperKeyPair = BIP32KeyPair.fromTLV(tlv2);
cmdSet.deriveKey(ENCRYPTION_PATH).checkOK();
Log.i(TAG, "Derived " + ENCRYPTION_PATH);
byte[] tlv3 = cmdSet.exportCurrentKey(false).checkOK().getData();
byte[] tlv3 = cmdSet.exportKey(ENCRYPTION_PATH, false, false).checkOK().getData();
BIP32KeyPair encryptionKeyPair = BIP32KeyPair.fromTLV(tlv3);
WritableMap data = Arguments.createMap();