mirror of
https://github.com/status-im/react-native-status-keycard.git
synced 2025-02-28 20:10:28 +00:00
update sdk
This commit is contained in:
parent
2b075b6e8f
commit
42e4142b18
@ -39,5 +39,5 @@ repositories {
|
|||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'com.facebook.react:react-native:+'
|
implementation 'com.facebook.react:react-native:+'
|
||||||
implementation 'com.github.status-im:hardwallet-lite-android:735ccd8'
|
implementation 'com.github.status-im:hardwallet-lite-android:c749e5a'
|
||||||
}
|
}
|
||||||
|
BIN
android/src/main/assets/wallet.cap
Normal file → Executable file
BIN
android/src/main/assets/wallet.cap
Normal file → Executable file
Binary file not shown.
@ -39,6 +39,10 @@ public class SmartCard extends BroadcastReceiver implements CardListener {
|
|||||||
private CardChannel cardChannel;
|
private CardChannel cardChannel;
|
||||||
private static final String TAG = "SmartCard";
|
private static final String TAG = "SmartCard";
|
||||||
|
|
||||||
|
private static final String WALLET_PATH = "m/44'/0'/0'/0/0";
|
||||||
|
private static final String WHISPER_PATH = "m/43'/60'/1581'/0'/0";
|
||||||
|
private static final String ENCRYPTION_PATH = "m/43'/60'/1581'/1'/0";
|
||||||
|
|
||||||
public SmartCard(Activity activity, ReactContext reactContext) {
|
public SmartCard(Activity activity, ReactContext reactContext) {
|
||||||
this.cardManager = new CardManager();
|
this.cardManager = new CardManager();
|
||||||
this.cardManager.setCardListener(this);
|
this.cardManager.setCardListener(this);
|
||||||
@ -254,7 +258,7 @@ public class SmartCard extends BroadcastReceiver implements CardListener {
|
|||||||
cmdSet.verifyPIN(pin).checkOK();
|
cmdSet.verifyPIN(pin).checkOK();
|
||||||
Log.i(TAG, "pin verified");
|
Log.i(TAG, "pin verified");
|
||||||
|
|
||||||
byte[] key = cmdSet.exportKey(WalletAppletCommandSet.EXPORT_KEY_P1_ANY, true).checkOK().getData();
|
byte[] key = cmdSet.exportCurrentKey(true).checkOK().getData();
|
||||||
|
|
||||||
return Hex.toHexString(key);
|
return Hex.toHexString(key);
|
||||||
}
|
}
|
||||||
@ -272,34 +276,32 @@ public class SmartCard extends BroadcastReceiver implements CardListener {
|
|||||||
cmdSet.verifyPIN(pin).checkOK();
|
cmdSet.verifyPIN(pin).checkOK();
|
||||||
Log.i(TAG, "pin verified");
|
Log.i(TAG, "pin verified");
|
||||||
|
|
||||||
String walletPath = "m/44'/0'/0'/0/0";
|
|
||||||
cmdSet.deriveKey(walletPath).checkOK();
|
|
||||||
Log.i(TAG, "Derived " + walletPath);
|
|
||||||
|
|
||||||
byte[] tlv = cmdSet.exportKey(WalletAppletCommandSet.EXPORT_KEY_P1_ANY, true).checkOK().getData();
|
cmdSet.deriveKey(WALLET_PATH).checkOK();
|
||||||
|
Log.i(TAG, "Derived " + WALLET_PATH);
|
||||||
|
|
||||||
|
byte[] tlv = cmdSet.exportCurrentKey(true).checkOK().getData();
|
||||||
BIP32KeyPair walletKeyPair = BIP32KeyPair.fromTLV(tlv);
|
BIP32KeyPair walletKeyPair = BIP32KeyPair.fromTLV(tlv);
|
||||||
|
|
||||||
// String whisperPath = "m/43'/60'/1581'/0'/0";
|
|
||||||
String whisperPath = "m/43'/60'/1581'/0/1073741824'";
|
|
||||||
cmdSet.deriveKey(whisperPath).checkOK();
|
|
||||||
Log.i(TAG, "Derived " + whisperPath);
|
|
||||||
|
|
||||||
byte[] tlv2 = cmdSet.exportKey(WalletAppletCommandSet.EXPORT_KEY_P1_HIGH, false).checkOK().getData();
|
cmdSet.deriveKey(WHISPER_PATH).checkOK();
|
||||||
|
Log.i(TAG, "Derived " + WHISPER_PATH);
|
||||||
|
|
||||||
|
byte[] tlv2 = cmdSet.exportCurrentKey(false).checkOK().getData();
|
||||||
BIP32KeyPair whisperKeyPair = BIP32KeyPair.fromTLV(tlv2);
|
BIP32KeyPair whisperKeyPair = BIP32KeyPair.fromTLV(tlv2);
|
||||||
|
|
||||||
// String dbPath = "m/43'/60'/1581'/1'/0";
|
|
||||||
String dbPath = "m/43'/60'/1581'/0/1073741825'";
|
|
||||||
cmdSet.deriveKey(dbPath).checkOK();
|
|
||||||
Log.i(TAG, "Derived " + dbPath);
|
|
||||||
|
|
||||||
byte[] tlv3 = cmdSet.exportKey(WalletAppletCommandSet.EXPORT_KEY_P1_HIGH, false).checkOK().getData();
|
cmdSet.deriveKey(ENCRYPTION_PATH).checkOK();
|
||||||
BIP32KeyPair dbKeyPair = BIP32KeyPair.fromTLV(tlv3);
|
Log.i(TAG, "Derived " + ENCRYPTION_PATH);
|
||||||
|
|
||||||
|
byte[] tlv3 = cmdSet.exportCurrentKey(false).checkOK().getData();
|
||||||
|
BIP32KeyPair encryptionKeyPair = BIP32KeyPair.fromTLV(tlv3);
|
||||||
|
|
||||||
WritableMap data = Arguments.createMap();
|
WritableMap data = Arguments.createMap();
|
||||||
data.putString("wallet-address", Hex.toHexString(walletKeyPair.toEthereumAddress()));
|
data.putString("wallet-address", Hex.toHexString(walletKeyPair.toEthereumAddress()));
|
||||||
data.putString("whisper-public-key", Hex.toHexString(whisperKeyPair.getPublicKey()));
|
data.putString("whisper-public-key", Hex.toHexString(whisperKeyPair.getPublicKey()));
|
||||||
data.putString("whisper-private-key", Hex.toHexString(whisperKeyPair.getPrivateKey()));
|
data.putString("whisper-private-key", Hex.toHexString(whisperKeyPair.getPrivateKey()));
|
||||||
data.putString("db-public-key", Hex.toHexString(dbKeyPair.getPublicKey()));
|
data.putString("encryption-public-key", Hex.toHexString(encryptionKeyPair.getPublicKey()));
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -323,35 +325,30 @@ public class SmartCard extends BroadcastReceiver implements CardListener {
|
|||||||
cmdSet.loadKey(keyPair);
|
cmdSet.loadKey(keyPair);
|
||||||
log("keypair loaded to card");
|
log("keypair loaded to card");
|
||||||
|
|
||||||
String walletPath = "m/44'/0'/0'/0/0";
|
cmdSet.deriveKey(WALLET_PATH).checkOK();
|
||||||
cmdSet.deriveKey(walletPath).checkOK();
|
Log.i(TAG, "Derived " + WALLET_PATH);
|
||||||
Log.i(TAG, "Derived " + walletPath);
|
|
||||||
|
|
||||||
byte[] tlv = cmdSet.exportKey(WalletAppletCommandSet.EXPORT_KEY_P1_ANY, true).checkOK().getData();
|
byte[] tlv = cmdSet.exportCurrentKey(true).checkOK().getData();
|
||||||
BIP32KeyPair walletKeyPair = BIP32KeyPair.fromTLV(tlv);
|
BIP32KeyPair walletKeyPair = BIP32KeyPair.fromTLV(tlv);
|
||||||
|
|
||||||
// String whisperPath = "m/43'/60'/1581'/0'/0";
|
cmdSet.deriveKey(WHISPER_PATH).checkOK();
|
||||||
String whisperPath = "m/43'/60'/1581'/0/1073741824'";
|
Log.i(TAG, "Derived " + WHISPER_PATH);
|
||||||
cmdSet.deriveKey(whisperPath).checkOK();
|
|
||||||
Log.i(TAG, "Derived " + whisperPath);
|
|
||||||
|
|
||||||
byte[] tlv2 = cmdSet.exportKey(WalletAppletCommandSet.EXPORT_KEY_P1_HIGH, false).checkOK().getData();
|
byte[] tlv2 = cmdSet.exportCurrentKey(false).checkOK().getData();
|
||||||
BIP32KeyPair whisperKeyPair = BIP32KeyPair.fromTLV(tlv2);
|
BIP32KeyPair whisperKeyPair = BIP32KeyPair.fromTLV(tlv2);
|
||||||
|
|
||||||
// String dbPath = "m/43'/60'/1581'/1'/0";
|
cmdSet.deriveKey(ENCRYPTION_PATH).checkOK();
|
||||||
String dbPath = "m/43'/60'/1581'/0/1073741825'";
|
Log.i(TAG, "Derived " + ENCRYPTION_PATH);
|
||||||
cmdSet.deriveKey(dbPath).checkOK();
|
|
||||||
Log.i(TAG, "Derived " + dbPath);
|
|
||||||
|
|
||||||
byte[] tlv3 = cmdSet.exportKey(WalletAppletCommandSet.EXPORT_KEY_P1_HIGH, false).checkOK().getData();
|
byte[] tlv3 = cmdSet.exportCurrentKey(false).checkOK().getData();
|
||||||
BIP32KeyPair dbKeyPair = BIP32KeyPair.fromTLV(tlv3);
|
BIP32KeyPair encryptionKeyPair = BIP32KeyPair.fromTLV(tlv3);
|
||||||
|
|
||||||
WritableMap data = Arguments.createMap();
|
WritableMap data = Arguments.createMap();
|
||||||
data.putString("wallet-address", Hex.toHexString(walletKeyPair.toEthereumAddress()));
|
data.putString("wallet-address", Hex.toHexString(walletKeyPair.toEthereumAddress()));
|
||||||
data.putString("whisper-address", Hex.toHexString(whisperKeyPair.toEthereumAddress()));
|
data.putString("whisper-address", Hex.toHexString(whisperKeyPair.toEthereumAddress()));
|
||||||
data.putString("whisper-public-key", Hex.toHexString(whisperKeyPair.getPublicKey()));
|
data.putString("whisper-public-key", Hex.toHexString(whisperKeyPair.getPublicKey()));
|
||||||
data.putString("whisper-private-key", Hex.toHexString(whisperKeyPair.getPrivateKey()));
|
data.putString("whisper-private-key", Hex.toHexString(whisperKeyPair.getPrivateKey()));
|
||||||
data.putString("db-public-key", Hex.toHexString(dbKeyPair.getPublicKey()));
|
data.putString("encryption-public-key", Hex.toHexString(encryptionKeyPair.getPublicKey()));
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user