summary refs log tree commit diff
path: root/src/Olm.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/Olm.h')
-rw-r--r--src/Olm.h17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/Olm.h b/src/Olm.h

index 322affa1..3400f993 100644 --- a/src/Olm.h +++ b/src/Olm.h
@@ -40,21 +40,8 @@ struct OlmMessage std::map<RecipientKey, mtx::events::msg::OlmCipherContent> ciphertext; }; -inline void -from_json(const nlohmann::json &obj, OlmMessage &msg) -{ - if (obj.at("type") != "m.room.encrypted") - throw std::invalid_argument("invalid type for olm message"); - - if (obj.at("content").at("algorithm") != OLM_ALGO) - throw std::invalid_argument("invalid algorithm for olm message"); - - 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, mtx::events::msg::OlmCipherContent>>(); -} +void +from_json(const nlohmann::json &obj, OlmMessage &msg); mtx::crypto::OlmClient * client();