@Test public void serializeUnencryptedNormal() throws Exception { List<Protos.Key> keys = nxtAccount.serializeKeychainToProtobuf(); NxtFamilyKey nxtKey = NxtFamilyKey.fromProtobuf(keys); NxtFamilyWallet newWallet; newWallet = new NxtFamilyWallet(nxtKey, NXT); }
newPocket = new WalletPocketHD(rootKey, coinType, getKeyCrypter(), key); } else if (coinType instanceof NxtFamily) { newPocket = new NxtFamilyWallet(rootKey, coinType, getKeyCrypter(), key); } else { throw new UnsupportedCoinTypeException(coinType);
pocket = new NxtFamilyWallet(walletProto.getId(), rootKey, coinType); } else { pocket = new NxtFamilyWallet(rootKey, coinType);
@Before public void setup() throws MnemonicException, UnreadableWalletException { DeterministicSeed seed = new DeterministicSeed(recoveryPhrase, null, "", 0); DeterministicKey masterKey = HDKeyDerivation.createMasterPrivateKey(seed.getSeedBytes()); hierarchy = new DeterministicHierarchy(masterKey); wallet = new Wallet(recoveryPhrase); nxtAccount = (NxtFamilyWallet)wallet.createAccount(NXT, null); otherAccount = new NxtFamilyWallet(hierarchy.get(NXT.getBip44Path(1), false, true), NXT); }
@Test public void testSerializeKeychainToProtobuf() throws UnreadableWalletException { List<Protos.Key> keys = nxtAccount.serializeKeychainToProtobuf(); NxtFamilyKey newKey = NxtFamilyKey.fromProtobuf(keys); NxtFamilyWallet newWallet = new NxtFamilyWallet(newKey, NXT); assertEquals(Convert.toHexString(nxtAccount.getPublicKey()), Convert.toHexString(newWallet.getPublicKey())); assertEquals(nxtAccount.getPublicKeyMnemonic(), newWallet.getPublicKeyMnemonic()); assertEquals(nxtAccount.getId(), newWallet.getId()); }
@Test public void testEncryptedNxtFamilyKey() throws UnreadableWalletException { nxtAccount.encrypt(crypter, aesKey); List<Protos.Key> keys = nxtAccount.serializeKeychainToProtobuf(); NxtFamilyKey newKey = NxtFamilyKey.fromProtobuf(keys, crypter); NxtFamilyWallet newWallet = new NxtFamilyWallet(newKey, NXT); assertEquals(Convert.toHexString(nxtAccount.getPublicKey()), Convert.toHexString(newWallet.getPublicKey())); assertEquals(nxtAccount.getPublicKeyMnemonic(), newWallet.getPublicKeyMnemonic()); assertEquals(nxtAccount.getId(), newWallet.getId()); } }