15 #include <nlohmann/json.hpp>
17 #include <boost/container_hash/hash.hpp>
45 j = nlohmann::json::object({
60 auto rd = std::random_device{};
62 std::generate(ret.begin(), ret.end(), [&] { return rd(); });
68 auto rd = std::random_device{};
70 std::generate(ret.begin(), ret.end(), [&] { return rd(); });
75 namespace CryptoConstants
77 inline const std::string
ed25519{
"ed25519"};
81 inline const std::string
olmAlgo{
"m.olm.v1.curve25519-aes-sha2"};
82 inline const std::string
megOlmAlgo{
"m.megolm.v1.aes-sha2"};
88 template<>
struct hash<
Kazv::KeyOfGroupSession>
92 boost::hash_combine(seed, k.roomId);
93 boost::hash_combine(seed, k.sessionId);
98 template<>
struct hash<
Kazv::KeyOfOutboundSession>
101 std::size_t seed = 0;
102 boost::hash_combine(seed, k.userId);
103 boost::hash_combine(seed, k.deviceId);
const std::string ed25519
Definition: crypto-util.hpp:77
const std::string curve25519
Definition: crypto-util.hpp:78
const std::string olmAlgo
Definition: crypto-util.hpp:81
const std::string megOlmAlgo
Definition: crypto-util.hpp:82
const std::string signedCurve25519
Definition: crypto-util.hpp:79
Definition: location.hpp:10
ByteArray genRandom(int len)
Definition: crypto-util.hpp:58
std::string RandomData
Definition: crypto-util.hpp:35
nlohmann::json json
Definition: jsonwrap.hpp:20
RandomData genRandomData(int len)
Definition: crypto-util.hpp:66
void to_json(nlohmann::json &j, const KeyOfGroupSession &k)
Definition: crypto-util.hpp:43
void from_json(const nlohmann::json &j, KeyOfGroupSession &k)
Definition: crypto-util.hpp:37
std::vector< unsigned char > ByteArray
Definition: crypto-util.hpp:21
Definition: clientutil.hpp:213
Definition: crypto-util.hpp:24
std::string sessionId
Definition: crypto-util.hpp:26
std::string roomId
Definition: crypto-util.hpp:25
friend bool operator==(const KeyOfGroupSession &a, const KeyOfGroupSession &b)=default
Definition: crypto-util.hpp:52
std::string userId
Definition: crypto-util.hpp:53
std::string deviceId
Definition: crypto-util.hpp:54
friend bool operator==(const KeyOfOutboundSession &a, const KeyOfOutboundSession &b)=default
The tag to indicate that a constructor should use user-provided random data.
Definition: crypto-util.hpp:33
std::size_t operator()(const Kazv::KeyOfGroupSession &k) const noexcept
Definition: crypto-util.hpp:90
std::size_t operator()(const Kazv::KeyOfOutboundSession &k) const noexcept
Definition: crypto-util.hpp:100