danicoin/src/WalletLegacy/WalletLegacySerializer.h

43 lines
1.3 KiB
C
Raw Normal View History

// Copyright (c) 2011-2016 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#pragma once
#include <vector>
#include <ostream>
#include <istream>
#include "crypto/hash.h"
#include "crypto/chacha8.h"
2015-05-27 12:08:46 +00:00
namespace CryptoNote {
2015-07-30 15:22:07 +00:00
class AccountBase;
class ISerializer;
}
namespace CryptoNote {
class WalletUserTransactionsCache;
2015-07-30 15:22:07 +00:00
class WalletLegacySerializer {
public:
2015-07-30 15:22:07 +00:00
WalletLegacySerializer(CryptoNote::AccountBase& account, WalletUserTransactionsCache& transactionsCache);
void serialize(std::ostream& stream, const std::string& password, bool saveDetailed, const std::string& cache);
void deserialize(std::istream& stream, const std::string& password, std::string& cache);
private:
2015-05-27 12:08:46 +00:00
void saveKeys(CryptoNote::ISerializer& serializer);
void loadKeys(CryptoNote::ISerializer& serializer);
2015-07-30 15:22:07 +00:00
Crypto::chacha8_iv encrypt(const std::string& plain, const std::string& password, std::string& cipher);
void decrypt(const std::string& cipher, std::string& plain, Crypto::chacha8_iv iv, const std::string& password);
2015-07-30 15:22:07 +00:00
CryptoNote::AccountBase& account;
WalletUserTransactionsCache& transactionsCache;
const uint32_t walletSerializationVersion;
};
} //namespace CryptoNote