/** * Returns the key chain found in the given list of keys. Used for unencrypted chains */ public static NxtFamilyKey fromProtobuf(List<Protos.Key> keys) throws UnreadableWalletException { return fromProtobuf(keys, null); }
@Test public void serializeUnencryptedNormal() throws Exception { List<Protos.Key> keys = nxtAccount.serializeKeychainToProtobuf(); NxtFamilyKey nxtKey = NxtFamilyKey.fromProtobuf(keys); NxtFamilyWallet newWallet; newWallet = new NxtFamilyWallet(nxtKey, NXT); }
rootKey = NxtFamilyKey.fromProtobuf(walletProto.getKeyList(), keyCrypter); } else { rootKey = NxtFamilyKey.fromProtobuf(walletProto.getKeyList());
@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()); } }