Added seedType to validator

master
henry 2018-04-08 22:18:51 -04:00
parent 68fd9a749d
commit 3a6f4635b0
3 changed files with 14 additions and 1 deletions

View File

@ -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;
}

View File

@ -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) {

View File

@ -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;
}
}