Kagome
Polkadot Runtime Engine in C++17
session_keys.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CRYPTO_SESSION_KEYS_HPP
7 #define KAGOME_CRYPTO_SESSION_KEYS_HPP
8 
9 #include "common/blob.hpp"
11 #include "network/types/roles.hpp"
12 
13 namespace kagome::crypto {
14 
15  class CryptoStore;
16  struct Ed25519Keypair;
17  struct Sr25519Keypair;
18 
19  // hardcoded keys order for polkadot
20  // otherwise it could be read from chainspec palletSession/keys
21  // nevertheless they are hardcoded in polkadot
22  // https://github.com/paritytech/polkadot/blob/634520cd3cf4b2b850db807daaaa32e480099981/node/service/src/chain_spec.rs#L230
29 
30  class SessionKeys {
31  std::shared_ptr<Sr25519Keypair> babe_key_pair_;
32  std::shared_ptr<Ed25519Keypair> gran_key_pair_;
33  std::shared_ptr<Sr25519Keypair> para_key_pair_;
34  std::shared_ptr<Sr25519Keypair> audi_key_pair_;
36  std::shared_ptr<CryptoStore> store_;
37 
38  public:
39  SessionKeys(std::shared_ptr<CryptoStore> store,
40  const network::Roles &roles);
41 
45  const std::shared_ptr<Sr25519Keypair> &getBabeKeyPair();
46 
50  const std::shared_ptr<Ed25519Keypair> &getGranKeyPair();
51 
55  const std::shared_ptr<Sr25519Keypair> &getParaKeyPair();
56 
60  const std::shared_ptr<Sr25519Keypair> &getAudiKeyPair();
61  };
62 } // namespace kagome::crypto
63 
64 #endif // KAGOME_CRYPTO_SESSION_KEYS_HPP
const std::shared_ptr< Sr25519Keypair > & getBabeKeyPair()
const std::shared_ptr< Ed25519Keypair > & getGranKeyPair()
const std::shared_ptr< Sr25519Keypair > & getParaKeyPair()
const std::shared_ptr< Sr25519Keypair > & getAudiKeyPair()
std::shared_ptr< Sr25519Keypair > para_key_pair_
std::shared_ptr< Ed25519Keypair > gran_key_pair_
std::shared_ptr< CryptoStore > store_
std::shared_ptr< Sr25519Keypair > audi_key_pair_
constexpr KnownKeyTypeId polkadot_key_order[6]
std::shared_ptr< Sr25519Keypair > babe_key_pair_
SessionKeys(std::shared_ptr< CryptoStore > store, const network::Roles &roles)