1/******************************************************************************
2 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
3 */
4
5#pragma once
6
7#include <Quotient/converters.h>
8
9namespace Quotient {
10/// Device identity keys
11struct DeviceKeys {
12 /// The ID of the user the device belongs to. Must match the user ID used
13 /// when logging in.
14 QString userId;
15
16 /// The ID of the device these keys belong to. Must match the device ID used
17 /// when logging in.
18 QString deviceId;
19
20 /// The encryption algorithms supported by this device.
21 QStringList algorithms;
22
23 /// Public identity keys. The names of the properties should be in the
24 /// format `<algorithm>:<device_id>`. The keys themselves should be
25 /// encoded as specified by the key algorithm.
26 QHash<QString, QString> keys;
27
28 /// Signatures for the device key object. A map from user ID, to a map from
29 /// `<algorithm>:<device_id>` to the signature.
30 ///
31 /// The signature is calculated using the process described at [Signing
32 /// JSON](/appendices/#signing-json).
33 QHash<QString, QHash<QString, QString>> signatures;
34};
35
36template <>
37struct JsonObjectConverter<DeviceKeys> {
38 static void dumpTo(QJsonObject& jo, const DeviceKeys& pod)
39 {
40 addParam<>(container&: jo, QStringLiteral("user_id"), value: pod.userId);
41 addParam<>(container&: jo, QStringLiteral("device_id"), value: pod.deviceId);
42 addParam<>(container&: jo, QStringLiteral("algorithms"), value: pod.algorithms);
43 addParam<>(container&: jo, QStringLiteral("keys"), value: pod.keys);
44 addParam<>(container&: jo, QStringLiteral("signatures"), value: pod.signatures);
45 }
46 static void fillFrom(const QJsonObject& jo, DeviceKeys& pod)
47 {
48 fillFromJson(jv: jo.value(key: "user_id"_ls), pod&: pod.userId);
49 fillFromJson(jv: jo.value(key: "device_id"_ls), pod&: pod.deviceId);
50 fillFromJson(jv: jo.value(key: "algorithms"_ls), pod&: pod.algorithms);
51 fillFromJson(jv: jo.value(key: "keys"_ls), pod&: pod.keys);
52 fillFromJson(jv: jo.value(key: "signatures"_ls), pod&: pod.signatures);
53 }
54};
55
56} // namespace Quotient
57