libQuotient
A Qt library for building matrix clients
device_keys.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 //! Device identity keys
9 struct QUOTIENT_API DeviceKeys {
10  //! The ID of the user the device belongs to. Must match the user ID used
11  //! when logging in.
12  QString userId;
13 
14  //! The ID of the device these keys belong to. Must match the device ID used
15  //! when logging in.
16  QString deviceId;
17 
18  //! The encryption algorithms supported by this device.
19  QStringList algorithms;
20 
21  //! Public identity keys. The names of the properties should be in the
22  //! format `<algorithm>:<device_id>`. The keys themselves should be
23  //! encoded as specified by the key algorithm.
24  QHash<QString, QString> keys;
25 
26  //! Signatures for the device key object. A map from user ID, to a map from
27  //! `<algorithm>:<device_id>` to the signature.
28  //!
29  //! The signature is calculated using the process described at [Signing
30  //! JSON](/appendices/#signing-json).
31  QHash<UserId, QHash<QString, QString>> signatures;
32 };
33 
34 template <>
35 struct JsonObjectConverter<DeviceKeys> {
36  static void dumpTo(QJsonObject& jo, const DeviceKeys& pod)
37  {
38  addParam<>(jo, "user_id"_L1, pod.userId);
39  addParam<>(jo, "device_id"_L1, pod.deviceId);
40  addParam<>(jo, "algorithms"_L1, pod.algorithms);
41  addParam<>(jo, "keys"_L1, pod.keys);
42  addParam<>(jo, "signatures"_L1, pod.signatures);
43  }
44  static void fillFrom(const QJsonObject& jo, DeviceKeys& pod)
45  {
46  fillFromJson(jo.value("user_id"_L1), pod.userId);
47  fillFromJson(jo.value("device_id"_L1), pod.deviceId);
48  fillFromJson(jo.value("algorithms"_L1), pod.algorithms);
49  fillFromJson(jo.value("keys"_L1), pod.keys);
50  fillFromJson(jo.value("signatures"_L1), pod.signatures);
51  }
52 };
53 
54 } // namespace Quotient