aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/cross_signing.h
blob: 6cea73e68e63f812d6bd8d8c8da8dee842368b49 (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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#pragma once

#include "csapi/definitions/auth_data.h"
#include "csapi/definitions/cross_signing_key.h"

#include "jobs/basejob.h"

namespace Quotient {

/*! \brief Upload cross-signing keys.
 *
 * Publishes cross-signing keys for the user.
 *
 * This API endpoint uses the [User-Interactive Authentication
 * API](/client-server-api/#user-interactive-authentication-api).
 */
class QUOTIENT_API UploadCrossSigningKeysJob : public BaseJob {
public:
    /*! \brief Upload cross-signing keys.
     *
     * \param masterKey
     *   Optional. The user\'s master key.
     *
     * \param selfSigningKey
     *   Optional. The user\'s self-signing key. Must be signed by
     *   the accompanying master key, or by the user\'s most recently
     *   uploaded master key if no master key is included in the
     *   request.
     *
     * \param userSigningKey
     *   Optional. The user\'s user-signing key. Must be signed by
     *   the accompanying master key, or by the user\'s most recently
     *   uploaded master key if no master key is included in the
     *   request.
     *
     * \param auth
     *   Additional authentication information for the
     *   user-interactive authentication API.
     */
    explicit UploadCrossSigningKeysJob(
        const Omittable<CrossSigningKey>& masterKey = none,
        const Omittable<CrossSigningKey>& selfSigningKey = none,
        const Omittable<CrossSigningKey>& userSigningKey = none,
        const Omittable<AuthenticationData>& auth = none);
};

/*! \brief Upload cross-signing signatures.
 *
 * Publishes cross-signing signatures for the user.  The request body is a
 * map from user ID to key ID to signed JSON object.
 */
class QUOTIENT_API UploadCrossSigningSignaturesJob : public BaseJob {
public:
    /*! \brief Upload cross-signing signatures.
     *
     * \param signatures
     *   The signatures to be published.
     */
    explicit UploadCrossSigningSignaturesJob(
        const QHash<QString, QHash<QString, QJsonObject>>& signatures);

    // Result properties

    /// A map from user ID to key ID to an error for any signatures
    /// that failed.  If a signature was invalid, the `errcode` will
    /// be set to `M_INVALID_SIGNATURE`.
    QHash<QString, QHash<QString, QJsonObject>> failures() const
    {
        return loadFromJson<QHash<QString, QHash<QString, QJsonObject>>>(
            "failures"_ls);
    }
};

} // namespace Quotient