Kagome
Polkadot Runtime Engine in C++17
kagome::crypto::KeyCache< CryptoSuite > Class Template Reference

#include <key_cache.hpp>

Inheritance diagram for kagome::crypto::KeyCache< CryptoSuite >:
Collaboration diagram for kagome::crypto::KeyCache< CryptoSuite >:

Public Types

using PublicKey = typename CryptoSuite::PublicKey
 
using PrivateKey = typename CryptoSuite::PrivateKey
 
using Keypair = typename CryptoSuite::Keypair
 
using Seed = typename CryptoSuite::Seed
 

Public Member Functions

 KeyCache (KeyTypeId type, std::shared_ptr< CryptoSuite > suite)
 
void insert (PublicKey pubkey, PrivateKey privkey)
 
std::optional< Keypair > const & getSessionKey () const noexcept
 
std::unordered_set< PublicKeygetPublicKeys () const
 
std::optional< KeypairsearchKeypair (const PublicKey &key) const
 

Private Attributes

KeyTypeId type_
 
std::optional< Keypairsession_key_
 
std::unordered_map< PublicKey, PrivateKeycache_
 
std::shared_ptr< CryptoSuitesuite_
 

Detailed Description

template<typename CryptoSuite>
class kagome::crypto::KeyCache< CryptoSuite >

In-memory cache of keys belonging to the same crypto suite and the same key type

See also
crypto_suites.hpp
key_type.hpp

Definition at line 26 of file key_cache.hpp.

Member Typedef Documentation

template<typename CryptoSuite>
using kagome::crypto::KeyCache< CryptoSuite >::Keypair = typename CryptoSuite::Keypair

Definition at line 30 of file key_cache.hpp.

template<typename CryptoSuite>
using kagome::crypto::KeyCache< CryptoSuite >::PrivateKey = typename CryptoSuite::PrivateKey

Definition at line 29 of file key_cache.hpp.

template<typename CryptoSuite>
using kagome::crypto::KeyCache< CryptoSuite >::PublicKey = typename CryptoSuite::PublicKey

Definition at line 28 of file key_cache.hpp.

template<typename CryptoSuite>
using kagome::crypto::KeyCache< CryptoSuite >::Seed = typename CryptoSuite::Seed

Definition at line 31 of file key_cache.hpp.

Constructor & Destructor Documentation

template<typename CryptoSuite>
kagome::crypto::KeyCache< CryptoSuite >::KeyCache ( KeyTypeId  type,
std::shared_ptr< CryptoSuite suite 
)
inlineexplicit

Definition at line 33 of file key_cache.hpp.

Member Function Documentation

template<typename CryptoSuite>
std::unordered_set<PublicKey> kagome::crypto::KeyCache< CryptoSuite >::getPublicKeys ( ) const
inline

Definition at line 54 of file key_cache.hpp.

template<typename CryptoSuite>
std::optional<Keypair> const& kagome::crypto::KeyCache< CryptoSuite >::getSessionKey ( ) const
inlinenoexcept

Session keys are short-living keys used by the node

Definition at line 50 of file key_cache.hpp.

template<typename CryptoSuite>
void kagome::crypto::KeyCache< CryptoSuite >::insert ( PublicKey  pubkey,
PrivateKey  privkey 
)
inline

Definition at line 38 of file key_cache.hpp.

template<typename CryptoSuite>
std::optional<Keypair> kagome::crypto::KeyCache< CryptoSuite >::searchKeypair ( const PublicKey key) const
inline

Definition at line 62 of file key_cache.hpp.

Member Data Documentation

template<typename CryptoSuite>
std::unordered_map<PublicKey, PrivateKey> kagome::crypto::KeyCache< CryptoSuite >::cache_
private

Definition at line 73 of file key_cache.hpp.

template<typename CryptoSuite>
std::optional<Keypair> kagome::crypto::KeyCache< CryptoSuite >::session_key_
private

Definition at line 72 of file key_cache.hpp.

template<typename CryptoSuite>
std::shared_ptr<CryptoSuite> kagome::crypto::KeyCache< CryptoSuite >::suite_
private

Definition at line 74 of file key_cache.hpp.

template<typename CryptoSuite>
KeyTypeId kagome::crypto::KeyCache< CryptoSuite >::type_
private

Definition at line 71 of file key_cache.hpp.


The documentation for this class was generated from the following file: