6 #ifndef KAGOME_KEY_CACHE_HPP 7 #define KAGOME_KEY_CACHE_HPP 10 #include <unordered_map> 11 #include <unordered_set> 25 template <
typename CryptoSuite>
35 BOOST_ASSERT(
suite_ !=
nullptr);
42 session_key_ =
suite_->composeKeypair(pubkey, privkey);
44 cache_.emplace(std::move(pubkey), std::move(privkey));
55 std::unordered_set<PublicKey> keys;
56 for (
auto &&[k, v] :
cache_) {
63 auto it =
cache_.find(key);
65 return suite_->composeKeypair(it->first, it->second);
73 std::unordered_map<PublicKey, PrivateKey>
cache_;
78 #endif // KAGOME_KEY_CACHE_HPP std::optional< Keypair > session_key_
KeyCache(KeyTypeId type, std::shared_ptr< CryptoSuite > suite)
std::unordered_map< PublicKey, PrivateKey > cache_
typename kagome::crypto::Sr25519Suite::Seed Seed
std::shared_ptr< CryptoSuite > suite_
uint32_t KeyTypeId
Key type identifier.
std::optional< Keypair > const & getSessionKey() const noexcept
typename kagome::crypto::Sr25519Suite::Keypair Keypair
typename kagome::crypto::Sr25519Suite::PublicKey PublicKey
void insert(PublicKey pubkey, PrivateKey privkey)
std::optional< Keypair > searchKeypair(const PublicKey &key) const
std::unordered_set< PublicKey > getPublicKeys() const
typename kagome::crypto::Sr25519Suite::PrivateKey PrivateKey