libkazv
inbound-group-session.hpp
Go to the documentation of this file.
1 /*
2  * This file is part of libkazv.
3  * SPDX-FileCopyrightText: 2021 Tusooa Zhu <tusooa@kazv.moe>
4  * SPDX-License-Identifier: AGPL-3.0-or-later
5  */
6 
7 #pragma once
8 #include <libkazv-config.hpp>
9 
10 #include <memory>
11 
12 #include <maybe.hpp>
13 #include <event.hpp>
14 
15 #include "crypto-util.hpp"
16 
17 namespace Kazv
18 {
19  struct InboundGroupSessionPrivate;
20 
22  {
23  public:
24  explicit InboundGroupSession();
25  explicit InboundGroupSession(std::string sessionKey, std::string ed25519Key);
26 
32 
33  MaybeString decrypt(std::string message, std::string eventId, Timestamp originServerTs);
34 
35  bool valid() const;
36 
37  std::string ed25519Key() const;
38 
45  bool merge(InboundGroupSession &that);
46  private:
47  friend void to_json(nlohmann::json &j, const InboundGroupSession &s);
48  friend void from_json(const nlohmann::json &j, InboundGroupSession &s);
49  std::unique_ptr<InboundGroupSessionPrivate> m_d;
50  };
51 }
Definition: inbound-group-session.hpp:22
MaybeString decrypt(std::string message, std::string eventId, Timestamp originServerTs)
Definition: inbound-group-session.cpp:112
InboundGroupSession & operator=(const InboundGroupSession &that)
Definition: inbound-group-session.cpp:95
InboundGroupSession()
Definition: inbound-group-session.cpp:73
bool valid() const
Definition: inbound-group-session.cpp:107
bool merge(InboundGroupSession &that)
Try to merge this session with another session.
Definition: inbound-group-session.cpp:147
std::string ed25519Key() const
Definition: inbound-group-session.cpp:142
friend void from_json(const nlohmann::json &j, InboundGroupSession &s)
Definition: inbound-group-session.cpp:177
friend void to_json(nlohmann::json &j, const InboundGroupSession &s)
Definition: inbound-group-session.cpp:165
Definition: maybe.hpp:25
Definition: location.hpp:10
nlohmann::json json
Definition: jsonwrap.hpp:20
std::int_fast64_t Timestamp
Definition: event.hpp:18