derivation key using the address class

This commit is contained in:
henry 2018-01-09 23:08:11 -04:00
parent 9212af8141
commit aacf9c50f6
2 changed files with 10 additions and 8 deletions

View file

@ -60,9 +60,9 @@ public class BitsharesAccountManager implements CryptoAccountManager, CryptoNetI
GrapheneAccount grapheneAccount = (GrapheneAccount) account; GrapheneAccount grapheneAccount = (GrapheneAccount) account;
boolean created = BitsharesFaucetApiGenerator.registerBitsharesAccount(grapheneAccount.getName(), boolean created = BitsharesFaucetApiGenerator.registerBitsharesAccount(grapheneAccount.getName(),
new Address(grapheneAccount.getOwnerKey(context),"BTS").toString(), new Address(ECKey.fromPublicOnly(grapheneAccount.getOwnerKey(context).getPubKey()),"BTS").toString(),
new Address(grapheneAccount.getActiveKey(context),"BTS").toString(), new Address(ECKey.fromPublicOnly(grapheneAccount.getActiveKey(context).getPubKey()),"BTS").toString(),
new Address(grapheneAccount.getMemoKey(context),"BTS").toString(),GrapheneApiGenerator.faucetUrl); new Address(ECKey.fromPublicOnly(grapheneAccount.getMemoKey(context).getPubKey()),"BTS").toString(),GrapheneApiGenerator.faucetUrl);
if(created) { if(created) {
GrapheneAccount fetch = this.getAccountInfoByName(grapheneAccount.getName()); GrapheneAccount fetch = this.getAccountInfoByName(grapheneAccount.getName());

View file

@ -75,7 +75,7 @@ public class GrapheneAccount extends CryptoNetAccount {
new ChildNumber(0, true)); new ChildNumber(0, true));
DeterministicKey address = HDKeyDerivation.deriveChildKey(permission, DeterministicKey address = HDKeyDerivation.deriveChildKey(permission,
new ChildNumber(0, false)); new ChildNumber(0, false));
return address; return ECKey.fromPrivate(address.getPrivKeyBytes());
} }
} }
@ -98,8 +98,9 @@ public class GrapheneAccount extends CryptoNetAccount {
new ChildNumber(0, true)); new ChildNumber(0, true));
DeterministicKey permission = HDKeyDerivation.deriveChildKey(accountIndexKey, DeterministicKey permission = HDKeyDerivation.deriveChildKey(accountIndexKey,
new ChildNumber(1, true)); new ChildNumber(1, true));
return HDKeyDerivation.deriveChildKey(permission, DeterministicKey address = HDKeyDerivation.deriveChildKey(permission,
new ChildNumber(0, true)); //TODO implement multiple Address and accounts new ChildNumber(0, false)); //TODO implement multiple Address and accounts
return ECKey.fromPrivate(address.getPrivKeyBytes());
} }
} }
@ -122,8 +123,9 @@ public class GrapheneAccount extends CryptoNetAccount {
new ChildNumber(0, true)); new ChildNumber(0, true));
DeterministicKey permission = HDKeyDerivation.deriveChildKey(accountIndexKey, DeterministicKey permission = HDKeyDerivation.deriveChildKey(accountIndexKey,
new ChildNumber(3, true)); new ChildNumber(3, true));
return HDKeyDerivation.deriveChildKey(permission, DeterministicKey address = HDKeyDerivation.deriveChildKey(permission,
new ChildNumber(0, true)); //TODO implement multiple Address and accounts new ChildNumber(0, false)); //TODO implement multiple Address and accounts
return ECKey.fromPrivate(address.getPrivKeyBytes());
} }
} }
} }