aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions/cross_signing_key.h
diff options
context:
space:
mode:
authorarawaaa <77910862+arawaaa@users.noreply.github.com>2021-12-27 17:35:28 -0600
committerGitHub <noreply@github.com>2021-12-27 17:35:28 -0600
commit7ec3ba834dd313c4408622da30e04cdc6f4cf7c7 (patch)
tree679d7dc5939a229ad46676cd1d7aeaea7a25abce /lib/csapi/definitions/cross_signing_key.h
parent17bf4d180297c7e87363e179b8afa79ddb15dca7 (diff)
parent674e984e459375974f619d0e778d43a2cc928dc3 (diff)
downloadlibquotient-7ec3ba834dd313c4408622da30e04cdc6f4cf7c7.tar.gz
libquotient-7ec3ba834dd313c4408622da30e04cdc6f4cf7c7.zip
Merge branch 'dev' into pinned
Diffstat (limited to 'lib/csapi/definitions/cross_signing_key.h')
-rw-r--r--lib/csapi/definitions/cross_signing_key.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/csapi/definitions/cross_signing_key.h b/lib/csapi/definitions/cross_signing_key.h
new file mode 100644
index 00000000..0cec8161
--- /dev/null
+++ b/lib/csapi/definitions/cross_signing_key.h
@@ -0,0 +1,47 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#pragma once
+
+#include "converters.h"
+
+namespace Quotient {
+/// Cross signing key
+struct CrossSigningKey {
+ /// The ID of the user the key belongs to.
+ QString userId;
+
+ /// What the key is used for.
+ QStringList usage;
+
+ /// The public key. The object must have exactly one property, whose name
+ /// is in the form `<algorithm>:<unpadded_base64_public_key>`, and whose
+ /// value is the unpadded base64 public key.
+ QHash<QString, QString> keys;
+
+ /// Signatures of the key, calculated using the process described at
+ /// [Signing JSON](/appendices/#signing-json). Optional for the master key.
+ /// Other keys must be signed by the user\'s master key.
+ QJsonObject signatures;
+};
+
+template <>
+struct JsonObjectConverter<CrossSigningKey> {
+ static void dumpTo(QJsonObject& jo, const CrossSigningKey& pod)
+ {
+ addParam<>(jo, QStringLiteral("user_id"), pod.userId);
+ addParam<>(jo, QStringLiteral("usage"), pod.usage);
+ addParam<>(jo, QStringLiteral("keys"), pod.keys);
+ addParam<IfNotEmpty>(jo, QStringLiteral("signatures"), pod.signatures);
+ }
+ static void fillFrom(const QJsonObject& jo, CrossSigningKey& pod)
+ {
+ fromJson(jo.value("user_id"_ls), pod.userId);
+ fromJson(jo.value("usage"_ls), pod.usage);
+ fromJson(jo.value("keys"_ls), pod.keys);
+ fromJson(jo.value("signatures"_ls), pod.signatures);
+ }
+};
+
+} // namespace Quotient