/*package*/ static void serializeSeedEncryptableItem(DeterministicSeed seed, Protos.Key.Builder proto) { // The seed can be missing if we have not derived it yet from the mnemonic. // This will not normally happen once all the wallets are on the latest code that caches // the seed. if (seed.isEncrypted() && seed.getEncryptedSeedData() != null) { EncryptedData data = seed.getEncryptedSeedData(); proto.getEncryptedDeterministicSeedBuilder() .setEncryptedPrivateKey(ByteString.copyFrom(data.encryptedBytes)) .setInitialisationVector(ByteString.copyFrom(data.initialisationVector)); // We don't allow mixing of encryption types at the moment. checkState(seed.getEncryptionType() == Protos.Wallet.EncryptionType.ENCRYPTED_SCRYPT_AES); } else { final byte[] secret = seed.getSeedBytes(); if (secret != null) proto.setDeterministicSeed(ByteString.copyFrom(secret)); } }
/*package*/ static void serializeSeedEncryptableItem(DeterministicSeed seed, Protos.Key.Builder proto) { // The seed can be missing if we have not derived it yet from the mnemonic. // This will not normally happen once all the wallets are on the latest code that caches // the seed. if (seed.isEncrypted() && seed.getEncryptedSeedData() != null) { EncryptedData data = seed.getEncryptedSeedData(); proto.getEncryptedDeterministicSeedBuilder() .setEncryptedPrivateKey(ByteString.copyFrom(data.encryptedBytes)) .setInitialisationVector(ByteString.copyFrom(data.initialisationVector)); // We don't allow mixing of encryption types at the moment. checkState(seed.getEncryptionType() == Protos.Wallet.EncryptionType.ENCRYPTED_SCRYPT_AES); } else { final byte[] secret = seed.getSeedBytes(); if (secret != null) proto.setDeterministicSeed(ByteString.copyFrom(secret)); } }
/*package*/ static void serializeSeedEncryptableItem(DeterministicSeed seed, Protos.Key.Builder proto) { // The seed can be missing if we have not derived it yet from the mnemonic. // This will not normally happen once all the wallets are on the latest code that caches // the seed. if (seed.isEncrypted() && seed.getEncryptedSeedData() != null) { EncryptedData data = seed.getEncryptedSeedData(); proto.getEncryptedDeterministicSeedBuilder() .setEncryptedPrivateKey(ByteString.copyFrom(data.encryptedBytes)) .setInitialisationVector(ByteString.copyFrom(data.initialisationVector)); // We don't allow mixing of encryption types at the moment. checkState(seed.getEncryptionType() == Protos.Wallet.EncryptionType.ENCRYPTED_SCRYPT_AES); } else { final byte[] secret = seed.getSeedBytes(); if (secret != null) proto.setDeterministicSeed(ByteString.copyFrom(secret)); } }
/*package*/ static void serializeSeedEncryptableItem(DeterministicSeed seed, Protos.Key.Builder proto) { // The seed can be missing if we have not derived it yet from the mnemonic. // This will not normally happen once all the wallets are on the latest code that caches // the seed. if (seed.isEncrypted() && seed.getEncryptedSeedData() != null) { EncryptedData data = seed.getEncryptedSeedData(); proto.getEncryptedDeterministicSeedBuilder() .setEncryptedPrivateKey(ByteString.copyFrom(data.encryptedBytes)) .setInitialisationVector(ByteString.copyFrom(data.initialisationVector)); // We don't allow mixing of encryption types at the moment. checkState(seed.getEncryptionType() == Protos.Wallet.EncryptionType.ENCRYPTED_SCRYPT_AES); } else { final byte[] secret = seed.getSeedBytes(); if (secret != null) proto.setDeterministicSeed(ByteString.copyFrom(secret)); } }