15 #include <nlohmann/json.hpp>
17 #include <boost/container_hash/hash.hpp>
44 j = nlohmann::json::object({
70 auto rd = std::random_device{};
72 std::generate(ret.begin(), ret.end(), [&] { return rd(); });
78 auto rd = std::random_device{};
80 std::generate(ret.begin(), ret.end(), [&] { return rd(); });
85 namespace CryptoConstants
87 inline const std::string
ed25519{
"ed25519"};
91 inline const std::string
olmAlgo{
"m.olm.v1.curve25519-aes-sha2"};
92 inline const std::string
megOlmAlgo{
"m.megolm.v1.aes-sha2"};
98 template<>
struct hash<
Kazv::KeyOfGroupSession>
101 std::size_t seed = 0;
102 boost::hash_combine(seed, k.roomId);
103 boost::hash_combine(seed, k.sessionId);
108 template<>
struct hash<
Kazv::KeyOfOutboundSession>
111 std::size_t seed = 0;
112 boost::hash_combine(seed, k.userId);
113 boost::hash_combine(seed, k.deviceId);
const std::string ed25519
Definition: crypto-util.hpp:87
const std::string curve25519
Definition: crypto-util.hpp:88
const std::string olmAlgo
Definition: crypto-util.hpp:91
const std::string megOlmAlgo
Definition: crypto-util.hpp:92
const std::string signedCurve25519
Definition: crypto-util.hpp:89
Definition: location.hpp:10
ByteArray genRandom(int len)
Definition: crypto-util.hpp:68
std::string RandomData
Definition: crypto-util.hpp:34
nlohmann::json json
Definition: jsonwrap.hpp:20
RandomData genRandomData(int len)
Definition: crypto-util.hpp:76
bool operator==(BaseJob a, BaseJob b)
Definition: basejob.cpp:280
void to_json(nlohmann::json &j, const KeyOfGroupSession &k)
Definition: crypto-util.hpp:42
void from_json(const nlohmann::json &j, KeyOfGroupSession &k)
Definition: crypto-util.hpp:36
std::vector< unsigned char > ByteArray
Definition: crypto-util.hpp:21
Definition: clientutil.hpp:217
Definition: crypto-util.hpp:24
std::string sessionId
Definition: crypto-util.hpp:26
std::string roomId
Definition: crypto-util.hpp:25
Definition: crypto-util.hpp:57
std::string userId
Definition: crypto-util.hpp:58
std::string deviceId
Definition: crypto-util.hpp:59
The tag to indicate that a constructor should use user-provided random data.
Definition: crypto-util.hpp:32
std::size_t operator()(const Kazv::KeyOfGroupSession &k) const noexcept
Definition: crypto-util.hpp:100
std::size_t operator()(const Kazv::KeyOfOutboundSession &k) const noexcept
Definition: crypto-util.hpp:110