Debian Codegraph @

mtxclient/include/mtx/events/encryption.hpp

raw symbols SCIP
1 #pragma once
2
3 /// @file
4 /// @brief The event enabling encryption in a room.
5
6 #if __has_include(<nlohmann/json_fwd.hpp>)
7 #include <nlohmann/json_fwd.hpp>
8 #else
9 #include <nlohmann/json.hpp>
10 #endif
11
12 namespace mtx {
13 namespace events {
14 namespace state {
15
16 //! Content of the `m.room.encryption` event.
17 //
18 //! A client can enable encryption to a room by sending this event.
19 struct Encryption
20 {
21 //! Defines which encryption algorithm should be used for encryption.
22 //! Currently only m.megolm.v1-aes-sha2 is permitted.
23 std::string algorithm = "m.megolm.v1.aes-sha2";
24 //! How long the session should be used before changing it. 604800000 (a week) is the
25 //! recommended default.
26 uint64_t rotation_period_ms = 604800000;
27 //! How many messages should be sent before changing the session. 100 is the recommended
28 //! default.
29 uint64_t rotation_period_msgs = 100;
30
31 friend void from_json(const nlohmann::json &obj, Encryption &encryption);
32 friend void to_json(nlohmann::json &obj, const Encryption &encryption);
33 };
34
35 } // namespace state
36 } // namespace events
37 } // namespace mtx