8 #include <unordered_set> 10 #include <boost/endian/arithmetic.hpp> 15 static const std::unordered_set<KeyTypeId> supported_types = {
26 return supported_types.count(k) > 0;
30 const auto *p =
reinterpret_cast<const char *
>(&key_type_id);
31 std::string res(p, p +
sizeof(
KeyTypeId));
40 if (reinterpret_cast<uintptr_t>(str.data())
41 % std::alignment_of_v<KeyTypeId> == 0) {
44 memcpy(&res, str.data(),
sizeof(
KeyTypeId));
57 return "key type is not supported";
59 return "key type id is not supported";
61 return "Unknown KeyTypeError";
OUTCOME_CPP_DEFINE_CATEGORY(kagome::crypto, KeyTypeError, e)
uint32_t KeyTypeId
Key type identifier.
std::string encodeKeyTypeIdToStr(KeyTypeId key_type_id)
makes string representation of KeyTypeId
bool isSupportedKeyType(KeyTypeId k)
checks whether key type value is supported
KeyTypeId decodeKeyTypeIdFromStr(std::string_view str)
restores KeyTypeId from its string representation