Kagome
Polkadot Runtime Engine in C++17
key_type.hpp
Go to the documentation of this file.
1 
6 #ifndef KAGOME_CRYPTO_KEY_TYPE_HPP
7 #define KAGOME_CRYPTO_KEY_TYPE_HPP
8 
9 #include "outcome/outcome.hpp"
10 
11 namespace kagome::crypto {
12 
13  enum class KeyTypeError {
16  };
17 
21  using KeyTypeId = uint32_t;
22 
28  // clang-format off
29  KEY_TYPE_BABE = 0x65626162u, // BABE, sr25519
30  KEY_TYPE_GRAN = 0x6e617267u, // GRANDPA, ed25519
31  KEY_TYPE_ACCO = 0x6f636361u, // Account control [sr25519, ed25519, secp256k1]
32  KEY_TYPE_IMON = 0x6e6f6d69u, // I'm Online, sr25519
33  KEY_TYPE_AUDI = 0x69647561u, // Account discovery [sr25519, ed25519, secp256k1]
34  KEY_TYPE_LP2P = 0x7032706cu, // LibP2P
35  KEY_TYPE_ASGN = 0x6e677361u, // ASGN
36  KEY_TYPE_PARA = 0x61726170u, // PARA
37  // clang-format on
38  };
39 
45  std::string encodeKeyTypeIdToStr(KeyTypeId key_type_id);
46 
52  KeyTypeId decodeKeyTypeIdFromStr(std::string_view str);
53 
60 } // namespace kagome::crypto
61 
63 
64 #endif // KAGOME_CRYPTO_KEY_TYPE_HPP
uint32_t KeyTypeId
Key type identifier.
Definition: key_type.hpp:21
OUTCOME_HPP_DECLARE_ERROR(kagome::crypto, KeyTypeError)
std::string encodeKeyTypeIdToStr(KeyTypeId key_type_id)
makes string representation of KeyTypeId
Definition: key_type.cpp:29
bool isSupportedKeyType(KeyTypeId k)
checks whether key type value is supported
Definition: key_type.cpp:14
KeyTypeId decodeKeyTypeIdFromStr(std::string_view str)
restores KeyTypeId from its string representation
Definition: key_type.cpp:35