summary refs log tree commit diff
path: root/include
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-06-27 21:24:25 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-06-28 16:17:39 +0300
commit1d6746e4c97c132214bba374ab22e08711ac4c97 (patch)
tree3b9866626e10f5928a9f41dcdfde66bc8a42812c /include
parentState that encrypted attachments aren't supported (#352) (diff)
downloadnheko-1d6746e4c97c132214bba374ab22e08711ac4c97.tar.xz
Upgrade matrix-structs & mtxclient
Diffstat (limited to 'include')
-rw-r--r--include/Olm.hpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/include/Olm.hpp b/include/Olm.hpp

index eb7f9061..58568081 100644 --- a/include/Olm.hpp +++ b/include/Olm.hpp
@@ -10,26 +10,13 @@ constexpr auto OLM_ALGO = "m.olm.v1.curve25519-aes-sha2"; namespace olm { -struct OlmCipherContent -{ - std::string body; - uint8_t type; -}; - -inline void -from_json(const nlohmann::json &obj, OlmCipherContent &msg) -{ - msg.body = obj.at("body"); - msg.type = obj.at("type"); -} - struct OlmMessage { std::string sender_key; std::string sender; using RecipientKey = std::string; - std::map<RecipientKey, OlmCipherContent> ciphertext; + std::map<RecipientKey, mtx::events::msg::OlmCipherContent> ciphertext; }; inline void @@ -43,8 +30,9 @@ from_json(const nlohmann::json &obj, OlmMessage &msg) msg.sender = obj.at("sender"); msg.sender_key = obj.at("content").at("sender_key"); - msg.ciphertext = - obj.at("content").at("ciphertext").get<std::map<std::string, OlmCipherContent>>(); + msg.ciphertext = obj.at("content") + .at("ciphertext") + .get<std::map<std::string, mtx::events::msg::OlmCipherContent>>(); } mtx::crypto::OlmClient * @@ -54,7 +42,8 @@ void handle_to_device_messages(const std::vector<nlohmann::json> &msgs); boost::optional<json> -try_olm_decryption(const std::string &sender_key, const OlmCipherContent &content); +try_olm_decryption(const std::string &sender_key, + const mtx::events::msg::OlmCipherContent &content); void handle_olm_message(const OlmMessage &msg); @@ -68,7 +57,7 @@ create_inbound_megolm_session(const std::string &sender, void handle_pre_key_olm_message(const std::string &sender, const std::string &sender_key, - const OlmCipherContent &content); + const mtx::events::msg::OlmCipherContent &content); mtx::events::msg::Encrypted encrypt_group_message(const std::string &room_id,