aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions/device_keys.h
blob: 8ebe11255cd0248c6dcbd7d79348becd63682287 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#pragma once

#include "converters.h"

#include <QtCore/QHash>

namespace QMatrixClient
{
    // Data structures

    /// Device identity keys
    struct DeviceKeys
    {
        /// The ID of the user the device belongs to. Must match the user ID used
        /// when logging in.
        QString userId;
        /// The ID of the device these keys belong to. Must match the device ID used
        /// when logging in.
        QString deviceId;
        /// The encryption algorithms supported by this device.
        QStringList algorithms;
        /// Public identity keys. The names of the properties should be in the
        /// format ``<algorithm>:<device_id>``. The keys themselves should be
        /// encoded as specified by the key algorithm.
        QHash<QString, QString> keys;
        /// Signatures for the device key object. A map from user ID, to a map from
        /// ``<algorithm>:<device_id>`` to the signature.
        /// 
        /// The signature is calculated using the process described at `Signing
        /// JSON`_.
        QHash<QString, QHash<QString, QString>> signatures;
    };
    template <> struct JsonObjectConverter<DeviceKeys>
    {
        static void dumpTo(QJsonObject& jo, const DeviceKeys& pod);
        static void fillFrom(const QJsonObject& jo, DeviceKeys& pod);
    };

} // namespace QMatrixClient
>"Initialized event type" << matrixTypeId << "with id" << id; return id; } QString EventTypeRegistry::getMatrixType(event_type_t typeId) { return typeId < get().eventTypes.size() ? get().eventTypes[typeId] : QString(); } Event::Event(Type type, const QJsonObject& json) : _type(type), _json(json) { if (!json.contains(ContentKeyL) && !json.value(UnsignedKeyL).toObject().contains(RedactedCauseKeyL)) { qCWarning(EVENTS) << "Event without 'content' node"; qCWarning(EVENTS) << formatJson << json; } } Event::Event(Type type, event_mtype_t matrixType, const QJsonObject& contentJson) : Event(type, basicEventJson(matrixType, contentJson)) {} Event::~Event() = default; QString Event::matrixType() const { return fullJson()[TypeKeyL].toString(); } QByteArray Event::originalJson() const { return QJsonDocument(_json).toJson(); } const QJsonObject Event::contentJson() const { return fullJson()[ContentKeyL].toObject(); } const QJsonObject Event::unsignedJson() const { return fullJson()[UnsignedKeyL].toObject(); } void Event::dumpTo(QDebug dbg) const { dbg << QJsonDocument(contentJson()).toJson(QJsonDocument::Compact); }