aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/definitions/third_party_signed.h
blob: 526545d0c6b43f4da2ad70a4faf49d762640befe (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
44
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#pragma once

#include "converters.h"

namespace Quotient {
/// A signature of an ``m.third_party_invite`` token to prove that this user
/// owns a third party identity which has been invited to the room.
struct ThirdPartySigned {
    /// The Matrix ID of the user who issued the invite.
    QString sender;

    /// The Matrix ID of the invitee.
    QString mxid;

    /// The state key of the m.third_party_invite event.
    QString token;

    /// A signatures object containing a signature of the entire signed object.
    QHash<QString, QHash<QString, QString>> signatures;
};

template <>
struct JsonObjectConverter<ThirdPartySigned> {
    static void dumpTo(QJsonObject& jo, const ThirdPartySigned& pod)
    {
        addParam<>(jo, QStringLiteral("sender"), pod.sender);
        addParam<>(jo, QStringLiteral("mxid"), pod.mxid);
        addParam<>(jo, QStringLiteral("token"), pod.token);
        addParam<>(jo, QStringLiteral("signatures"), pod.signatures);
    }
    static void fillFrom(const QJsonObject& jo, ThirdPartySigned& pod)
    {
        fromJson(jo.value("sender"_ls), pod.sender);
        fromJson(jo.value("mxid"_ls), pod.mxid);
        fromJson(jo.value("token"_ls), pod.token);
        fromJson(jo.value("signatures"_ls), pod.signatures);
    }
};

} // namespace Quotient