aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/keys.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/csapi/keys.h')
-rw-r--r--lib/csapi/keys.h73
1 files changed, 55 insertions, 18 deletions
diff --git a/lib/csapi/keys.h b/lib/csapi/keys.h
index 8f6c8cc9..53ba6495 100644
--- a/lib/csapi/keys.h
+++ b/lib/csapi/keys.h
@@ -4,6 +4,7 @@
#pragma once
+#include "csapi/definitions/cross_signing_key.h"
#include "csapi/definitions/device_keys.h"
#include "jobs/basejob.h"
@@ -25,8 +26,8 @@ public:
* \param oneTimeKeys
* One-time public keys for "pre-key" messages. The names of
* the properties should be in the format
- * ``<algorithm>:<key_id>``. The format of the key is determined
- * by the `key algorithm <#key-algorithms>`_.
+ * `<algorithm>:<key_id>`. The format of the key is determined
+ * by the [key algorithm](/client-server-api/#key-algorithms).
*
* May be absent if no new one-time keys are required.
*/
@@ -98,7 +99,7 @@ public:
///
/// If the homeserver could be reached, but the user or device
/// was unknown, no failure is recorded. Instead, the corresponding
- /// user or device is missing from the ``device_keys`` result.
+ /// user or device is missing from the `device_keys` result.
QHash<QString, QJsonObject> failures() const
{
return loadFromJson<QHash<QString, QJsonObject>>("failures"_ls);
@@ -107,13 +108,45 @@ public:
/// Information on the queried devices. A map from user ID, to a
/// map from device ID to device information. For each device,
/// the information returned will be the same as uploaded via
- /// ``/keys/upload``, with the addition of an ``unsigned``
+ /// `/keys/upload`, with the addition of an `unsigned`
/// property.
QHash<QString, QHash<QString, DeviceInformation>> deviceKeys() const
{
return loadFromJson<QHash<QString, QHash<QString, DeviceInformation>>>(
"device_keys"_ls);
}
+
+ /// Information on the master cross-signing keys of the queried users.
+ /// A map from user ID, to master key information. For each key, the
+ /// information returned will be the same as uploaded via
+ /// `/keys/device_signing/upload`, along with the signatures
+ /// uploaded via `/keys/signatures/upload` that the requesting user
+ /// is allowed to see.
+ QHash<QString, CrossSigningKey> masterKeys() const
+ {
+ return loadFromJson<QHash<QString, CrossSigningKey>>("master_keys"_ls);
+ }
+
+ /// Information on the self-signing keys of the queried users. A map
+ /// from user ID, to self-signing key information. For each key, the
+ /// information returned will be the same as uploaded via
+ /// `/keys/device_signing/upload`.
+ QHash<QString, CrossSigningKey> selfSigningKeys() const
+ {
+ return loadFromJson<QHash<QString, CrossSigningKey>>(
+ "self_signing_keys"_ls);
+ }
+
+ /// Information on the user-signing key of the user making the
+ /// request, if they queried their own device information. A map
+ /// from user ID, to user-signing key information. The
+ /// information returned will be the same as uploaded via
+ /// `/keys/device_signing/upload`.
+ QHash<QString, CrossSigningKey> userSigningKeys() const
+ {
+ return loadFromJson<QHash<QString, CrossSigningKey>>(
+ "user_signing_keys"_ls);
+ }
};
template <>
@@ -163,18 +196,17 @@ public:
///
/// If the homeserver could be reached, but the user or device
/// was unknown, no failure is recorded. Instead, the corresponding
- /// user or device is missing from the ``one_time_keys`` result.
+ /// user or device is missing from the `one_time_keys` result.
QHash<QString, QJsonObject> failures() const
{
return loadFromJson<QHash<QString, QJsonObject>>("failures"_ls);
}
/// One-time keys for the queried devices. A map from user ID, to a
- /// map from devices to a map from ``<algorithm>:<key_id>`` to the key
- /// object.
+ /// map from devices to a map from `<algorithm>:<key_id>` to the key object.
///
- /// See the `key algorithms <#key-algorithms>`_ section for information
- /// on the Key Object format.
+ /// See the [key algorithms](/client-server-api/#key-algorithms) section for
+ /// information on the Key Object format.
QHash<QString, QHash<QString, QVariant>> oneTimeKeys() const
{
return loadFromJson<QHash<QString, QHash<QString, QVariant>>>(
@@ -190,26 +222,28 @@ public:
* The server should include in the results any users who:
*
* * currently share a room with the calling user (ie, both users have
- * membership state ``join``); *and*
+ * membership state `join`); *and*
* * added new device identity keys or removed an existing device with
- * identity keys, between ``from`` and ``to``.
+ * identity keys, between `from` and `to`.
*/
class GetKeysChangesJob : public BaseJob {
public:
/*! \brief Query users with recent device key updates.
*
* \param from
- * The desired start point of the list. Should be the ``next_batch`` field
- * from a response to an earlier call to |/sync|. Users who have not
+ * The desired start point of the list. Should be the `next_batch` field
+ * from a response to an earlier call to
+ * [`/sync`](/client-server-api/#get_matrixclientr0sync). Users who have not
* uploaded new device identity keys since this point, nor deleted
* existing devices with identity keys since then, will be excluded
* from the results.
*
* \param to
- * The desired end point of the list. Should be the ``next_batch``
- * field from a recent call to |/sync| - typically the most recent
- * such call. This may be used by the server as a hint to check its
- * caches are up to date.
+ * The desired end point of the list. Should be the `next_batch`
+ * field from a recent call to
+ * [`/sync`](/client-server-api/#get_matrixclientr0sync) - typically the
+ * most recent such call. This may be used by the server as a hint to check
+ * its caches are up to date.
*/
explicit GetKeysChangesJob(const QString& from, const QString& to);
@@ -233,7 +267,10 @@ public:
/// The Matrix User IDs of all users who may have left all
/// the end-to-end encrypted rooms they previously shared
/// with the user.
- QStringList left() const { return loadFromJson<QStringList>("left"_ls); }
+ QStringList left() const
+ {
+ return loadFromJson<QStringList>("left"_ls);
+ }
};
} // namespace Quotient