libQuotient
A Qt library for building matrix clients
cross_signing_key.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 //! Cross signing key
9 struct QUOTIENT_API CrossSigningKey {
10  //! The ID of the user the key belongs to.
11  QString userId;
12 
13  //! What the key is used for.
14  QStringList usage;
15 
16  //! The public key. The object must have exactly one property, whose name is
17  //! in the form `<algorithm>:<unpadded_base64_public_key>`, and whose value
18  //! is the unpadded base64 public key.
19  QHash<QString, QString> keys;
20 
21  //! Signatures of the key, calculated using the process described at [Signing
22  //! JSON](/appendices/#signing-json). Optional for the master key. Other keys must be signed by
23  //! the user\'s master key.
24  QJsonObject signatures{};
25 };
26 
27 template <>
28 struct JsonObjectConverter<CrossSigningKey> {
29  static void dumpTo(QJsonObject& jo, const CrossSigningKey& pod)
30  {
31  addParam<>(jo, "user_id"_L1, pod.userId);
32  addParam<>(jo, "usage"_L1, pod.usage);
33  addParam<>(jo, "keys"_L1, pod.keys);
34  addParam<IfNotEmpty>(jo, "signatures"_L1, pod.signatures);
35  }
36  static void fillFrom(const QJsonObject& jo, CrossSigningKey& pod)
37  {
38  fillFromJson(jo.value("user_id"_L1), pod.userId);
39  fillFromJson(jo.value("usage"_L1), pod.usage);
40  fillFromJson(jo.value("keys"_L1), pod.keys);
41  fillFromJson(jo.value("signatures"_L1), pod.signatures);
42  }
43 };
44 
45 } // namespace Quotient