CWallet class
[novacoin.git] / src / keystore.h
1 // Copyright (c) 2009-2011 Satoshi Nakamoto & Bitcoin developers
2 // Distributed under the MIT/X11 software license, see the accompanying
3 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
4 #ifndef BITCOIN_KEYSTORE_H
5 #define BITCOIN_KEYSTORE_H
6
7 class CKeyStore
8 {
9 public:
10     std::map<std::vector<unsigned char>, CPrivKey> mapKeys;
11     mutable CCriticalSection cs_mapKeys;
12     virtual bool AddKey(const CKey& key);
13     bool HaveKey(const std::vector<unsigned char> &vchPubKey) const
14     {
15         return (mapKeys.count(vchPubKey) > 0);
16     }
17     CPrivKey GetPrivKey(const std::vector<unsigned char> &vchPubKey) const
18     {
19         std::map<std::vector<unsigned char>, CPrivKey>::const_iterator mi = mapKeys.find(vchPubKey);
20         if (mi != mapKeys.end())
21             return (*mi).second;
22     }
23     std::vector<unsigned char> GenerateNewKey();
24 };
25
26 #endif