From 3a6f4635b03e39942bd4a7b097fe858f7f434c0e Mon Sep 17 00:00:00 2001 From: henry Date: Sun, 8 Apr 2018 22:18:51 -0400 Subject: [PATCH] Added seedType to validator --- .../manager/BitsharesAccountManager.java | 2 ++ .../crystalwallet/manager/FileBackupManager.java | 2 +- .../ValidateImportBitsharesAccountRequest.java | 11 +++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/cy/agorise/crystalwallet/manager/BitsharesAccountManager.java b/app/src/main/java/cy/agorise/crystalwallet/manager/BitsharesAccountManager.java index 1c4ab74..55ae8db 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/manager/BitsharesAccountManager.java +++ b/app/src/main/java/cy/agorise/crystalwallet/manager/BitsharesAccountManager.java @@ -251,6 +251,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI for(PublicKey activeKey : prop.owner.getKeyAuthList()){ if((new Address(activeKey.getKey(),"BTS")).toString().equals(bk.getPublicAddress("BTS").toString())){ System.out.println("Mnemonic brainkey correct"); + importRequest.setSeedType(SeedType.BRAINKEY); importRequest.setMnemonicIsCorrect(true); return; } @@ -259,6 +260,7 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI for(PublicKey activeKey : prop.active.getKeyAuthList()){ if((new Address(activeKey.getKey(),"BTS")).toString().equals(new Address(ECKey.fromPublicOnly(bip39.getBitsharesActiveKey(0).getPubKey())).toString())){ System.out.println("Mnemonic BIP39 correct"); + importRequest.setSeedType(SeedType.BIP39); importRequest.setMnemonicIsCorrect(true); return; } diff --git a/app/src/main/java/cy/agorise/crystalwallet/manager/FileBackupManager.java b/app/src/main/java/cy/agorise/crystalwallet/manager/FileBackupManager.java index 2195b68..e2db201 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/manager/FileBackupManager.java +++ b/app/src/main/java/cy/agorise/crystalwallet/manager/FileBackupManager.java @@ -243,7 +243,7 @@ public class FileBackupManager implements FileServiceRequestsListener { } else { AccountSeed seed = new AccountSeed(); seed.setName(validatorRequest.getAccountName()); - seed.setType(SeedType.BRAINKEY); // TODO change to use other types + seed.setType(validatorRequest.getSeedType()); seed.setMasterSeed(validatorRequest.getMnemonic()); long idSeed = accountSeedDao.insertAccountSeed(seed); if(idSeed >= 0) { diff --git a/app/src/main/java/cy/agorise/crystalwallet/requestmanagers/ValidateImportBitsharesAccountRequest.java b/app/src/main/java/cy/agorise/crystalwallet/requestmanagers/ValidateImportBitsharesAccountRequest.java index 20c8f3e..7a8419d 100644 --- a/app/src/main/java/cy/agorise/crystalwallet/requestmanagers/ValidateImportBitsharesAccountRequest.java +++ b/app/src/main/java/cy/agorise/crystalwallet/requestmanagers/ValidateImportBitsharesAccountRequest.java @@ -1,6 +1,7 @@ package cy.agorise.crystalwallet.requestmanagers; import cy.agorise.crystalwallet.enums.CryptoCoin; +import cy.agorise.crystalwallet.enums.SeedType; /** * Imports a bitsahres accounts, @@ -30,6 +31,8 @@ public class ValidateImportBitsharesAccountRequest extends CryptoNetInfoRequest */ private Boolean mnemonicIsCorrect; + private SeedType seedType; + public ValidateImportBitsharesAccountRequest(String accountName, String mnemonic){ super(CryptoCoin.BITSHARES); this.accountName = accountName; @@ -75,4 +78,12 @@ public class ValidateImportBitsharesAccountRequest extends CryptoNetInfoRequest public void setMnemonic(String mnemonic) { this.mnemonic = mnemonic; } + + public SeedType getSeedType() { + return seedType; + } + + public void setSeedType(SeedType seedType) { + this.seedType = seedType; + } }