1 | /****************************************************************************** |
2 | * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN |
3 | */ |
4 | |
5 | #pragma once |
6 | |
7 | #include <Quotient/converters.h> |
8 | |
9 | namespace Quotient { |
10 | /// Cross signing key |
11 | struct CrossSigningKey { |
12 | /// The ID of the user the key belongs to. |
13 | QString userId; |
14 | |
15 | /// What the key is used for. |
16 | QStringList usage; |
17 | |
18 | /// The public key. The object must have exactly one property, whose name |
19 | /// is in the form `<algorithm>:<unpadded_base64_public_key>`, and whose |
20 | /// value is the unpadded base64 public key. |
21 | QHash<QString, QString> keys; |
22 | |
23 | /// Signatures of the key, calculated using the process described at |
24 | /// [Signing JSON](/appendices/#signing-json). Optional for the master key. |
25 | /// Other keys must be signed by the user\'s master key. |
26 | QJsonObject signatures{}; |
27 | }; |
28 | |
29 | template <> |
30 | struct JsonObjectConverter<CrossSigningKey> { |
31 | static void dumpTo(QJsonObject& jo, const CrossSigningKey& pod) |
32 | { |
33 | addParam<>(container&: jo, QStringLiteral("user_id" ), value: pod.userId); |
34 | addParam<>(container&: jo, QStringLiteral("usage" ), value: pod.usage); |
35 | addParam<>(container&: jo, QStringLiteral("keys" ), value: pod.keys); |
36 | addParam<IfNotEmpty>(container&: jo, QStringLiteral("signatures" ), value: pod.signatures); |
37 | } |
38 | static void fillFrom(const QJsonObject& jo, CrossSigningKey& pod) |
39 | { |
40 | fillFromJson(jv: jo.value(key: "user_id"_ls ), pod&: pod.userId); |
41 | fillFromJson(jv: jo.value(key: "usage"_ls ), pod&: pod.usage); |
42 | fillFromJson(jv: jo.value(key: "keys"_ls ), pod&: pod.keys); |
43 | fillFromJson(jv: jo.value(key: "signatures"_ls ), pod&: pod.signatures); |
44 | } |
45 | }; |
46 | |
47 | } // namespace Quotient |
48 | |