libQuotient
A Qt library for building matrix clients
key_backup_data.h
Go to the documentation of this file.
1 // THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
2 
3 #pragma once
4 
5 #include <Quotient/converters.h>
6 
7 namespace Quotient {
8 //! The key data
9 struct QUOTIENT_API KeyBackupData {
10  //! The index of the first message in the session that the key can decrypt.
11  int firstMessageIndex;
12 
13  //! The number of times this key has been forwarded via key-sharing between devices.
14  int forwardedCount;
15 
16  //! Whether the device backing up the key verified the device that the key
17  //! is from.
18  bool isVerified;
19 
20  //! Algorithm-dependent data. See the documentation for the backup
21  //! algorithms in [Server-side key backups](/client-server-api/#server-side-key-backups) for
22  //! more information on the expected format of the data.
23  QJsonObject sessionData;
24 };
25 
26 template <>
27 struct JsonObjectConverter<KeyBackupData> {
28  static void dumpTo(QJsonObject& jo, const KeyBackupData& pod)
29  {
30  addParam<>(jo, "first_message_index"_L1, pod.firstMessageIndex);
31  addParam<>(jo, "forwarded_count"_L1, pod.forwardedCount);
32  addParam<>(jo, "is_verified"_L1, pod.isVerified);
33  addParam<>(jo, "session_data"_L1, pod.sessionData);
34  }
35  static void fillFrom(const QJsonObject& jo, KeyBackupData& pod)
36  {
37  fillFromJson(jo.value("first_message_index"_L1), pod.firstMessageIndex);
38  fillFromJson(jo.value("forwarded_count"_L1), pod.forwardedCount);
39  fillFromJson(jo.value("is_verified"_L1), pod.isVerified);
40  fillFromJson(jo.value("session_data"_L1), pod.sessionData);
41  }
42 };
43 
44 } // namespace Quotient