libkazv
Loading...
Searching...
No Matches
keys.hpp
Go to the documentation of this file.
1/******************************************************************************
2 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
3 */
4
5#pragma once
6
7#include "basejob.hpp"
10
11namespace Kazv::Api {
12
17class UploadKeysJob : public BaseJob {
18public:
19
20
21
22class JobResponse : public Response
23{
24
25public:
27 bool success() const;
28
29 // Result properties
30
31
32
33
38immer::map<std::string, int> oneTimeKeyCounts() const;
39
40};
41 static constexpr auto needsAuth() {
42 return true
43 ;
44 }
45
46
47// Construction/destruction
48
78 explicit UploadKeysJob(std::string serverUrl
79 , std::string _accessToken
80 ,
81 std::optional<DeviceKeys> deviceKeys = std::nullopt, JsonWrap oneTimeKeys = {}, JsonWrap fallbackKeys = {}
82 );
83
84
85 static BaseJob::Query buildQuery(
86 );
87
88 static BaseJob::Body buildBody(std::optional<DeviceKeys> deviceKeys, JsonWrap oneTimeKeys, JsonWrap fallbackKeys);
89
90
91
92
93
94 UploadKeysJob withData(JsonWrap j) &&;
95 UploadKeysJob withData(JsonWrap j) const &;
96 };
98 }
99 namespace nlohmann
100 {
101 using namespace Kazv;
102 using namespace Kazv::Api;
103
104 }
105
106 namespace Kazv::Api
107 {
108
113class QueryKeysJob : public BaseJob {
114public:
115 // Inner data structures
116
121 {
123 std::optional<std::string> deviceDisplayName;
124
125 };
126
130 {
134 std::optional<UnsignedDeviceInfo> unsignedData;
135
136 };
137
138
139
140class JobResponse : public Response
141{
142
143public:
145 bool success() const;
146
147 // Result properties
148
149
150
151
159immer::map<std::string, JsonWrap> failures() const;
160
161
167immer::map<std::string, immer::map<std::string, DeviceInformation>> deviceKeys() const;
168
169
176immer::map<std::string, CrossSigningKey> masterKeys() const;
177
178
183immer::map<std::string, CrossSigningKey> selfSigningKeys() const;
184
185
191immer::map<std::string, CrossSigningKey> userSigningKeys() const;
192
193};
194 static constexpr auto needsAuth() {
195 return true
196 ;
197 }
198
199
200// Construction/destruction
201
219 explicit QueryKeysJob(std::string serverUrl
220 , std::string _accessToken
221 ,
222 immer::map<std::string, immer::array<std::string>> deviceKeys , std::optional<int> timeout = std::nullopt, std::optional<std::string> token = std::nullopt
223 );
224
225
227 );
228
229 static BaseJob::Body buildBody(immer::map<std::string, immer::array<std::string>> deviceKeys, std::optional<int> timeout, std::optional<std::string> token);
230
231
232
233
234
236 QueryKeysJob withData(JsonWrap j) const &;
237 };
239 }
240 namespace nlohmann
241 {
242 using namespace Kazv;
243 using namespace Kazv::Api;
244 template<>
245 struct adl_serializer<QueryKeysJob::UnsignedDeviceInfo> {
246
247 static void to_json(json& jo, const QueryKeysJob::UnsignedDeviceInfo &pod)
248 {
249 if (! jo.is_object()) { jo = json::object(); }
250
251
252
253 addToJsonIfNeeded(jo, "device_display_name"s, pod.deviceDisplayName);
254 }
255
256 static void from_json(const json &jo, QueryKeysJob::UnsignedDeviceInfo& result)
257 {
258
259 if (jo.contains("device_display_name"s)) {
260 result.deviceDisplayName = jo.at("device_display_name"s);
261 }
262
263 }
264
265};
266 template<>
267 struct adl_serializer<QueryKeysJob::DeviceInformation> {
268
269 static void to_json(json& jo, const QueryKeysJob::DeviceInformation &pod)
270 {
271 if (! jo.is_object()) { jo = json::object(); }
272 jo = static_cast<const DeviceKeys &>(pod);
273 //nlohmann::to_json(jo, static_cast<const DeviceKeys &>(pod));
274
275
276 addToJsonIfNeeded(jo, "unsigned"s, pod.unsignedData);
277 }
278
279 static void from_json(const json &jo, QueryKeysJob::DeviceInformation& result)
280 {
281 static_cast<DeviceKeys &>(result) = jo;
282 //nlohmann::from_json(jo, static_cast<const DeviceKeys &>(result));
283 if (jo.contains("unsigned"s)) {
284 result.unsignedData = jo.at("unsigned"s);
285 }
286
287 }
288
289};
290 }
291
292 namespace Kazv::Api
293 {
294
299class ClaimKeysJob : public BaseJob {
300public:
301
302
303
304class JobResponse : public Response
305{
306
307public:
309 bool success() const;
310
311 // Result properties
312
313
314
315
323immer::map<std::string, JsonWrap> failures() const;
324
325
334immer::map<std::string, immer::map<std::string, JsonWrap>> oneTimeKeys() const;
335
336};
337 static constexpr auto needsAuth() {
338 return true
339 ;
340 }
341
342
343// Construction/destruction
344
355 explicit ClaimKeysJob(std::string serverUrl
356 , std::string _accessToken
357 ,
358 immer::map<std::string, immer::map<std::string, std::string>> oneTimeKeys , std::optional<int> timeout = std::nullopt
359 );
360
361
363 );
364
365 static BaseJob::Body buildBody(immer::map<std::string, immer::map<std::string, std::string>> oneTimeKeys, std::optional<int> timeout);
366
367
368
369
370
372 ClaimKeysJob withData(JsonWrap j) const &;
373 };
375 }
376 namespace nlohmann
377 {
378 using namespace Kazv;
379 using namespace Kazv::Api;
380
381 }
382
383 namespace Kazv::Api
384 {
385
399public:
400
401
402
403class JobResponse : public Response
404{
405
406public:
408 bool success() const;
409
410 // Result properties
411
412
413
414
417immer::array<std::string> changed() const;
418
419
423immer::array<std::string> left() const;
424
425};
426 static constexpr auto needsAuth() {
427 return true
428 ;
429 }
430
431
432// Construction/destruction
433
449 explicit GetKeysChangesJob(std::string serverUrl
450 , std::string _accessToken
451 ,
452 std::string from , std::string to
453 );
454
455
457 std::string from, std::string to);
458
459 static BaseJob::Body buildBody(std::string from, std::string to);
460
461
462
463
464
467 };
469 }
470 namespace nlohmann
471 {
472 using namespace Kazv;
473 using namespace Kazv::Api;
474
475 }
476
477 namespace Kazv::Api
478 {
479
480} // namespace Kazv::Api
bool success() const
Definition keys.cpp:301
immer::map< std::string, JsonWrap > failures() const
If any remote homeservers could not be reached, they are recorded here.
Definition keys.cpp:312
immer::map< std::string, immer::map< std::string, JsonWrap > > oneTimeKeys() const
One-time keys for the queried devices.
Definition keys.cpp:323
Claim one-time encryption keys.
Definition keys.hpp:299
static BaseJob::Query buildQuery()
Definition keys.cpp:236
static BaseJob::Body buildBody(immer::map< std::string, immer::map< std::string, std::string > > oneTimeKeys, std::optional< int > timeout)
Definition keys.cpp:244
ClaimKeysJob withData(JsonWrap j) &&
Definition keys.cpp:284
static constexpr auto needsAuth()
Definition keys.hpp:337
immer::array< std::string > left() const
The Matrix User IDs of all users who may have left all the end-to-end encrypted rooms they previously...
Definition keys.cpp:416
bool success() const
Definition keys.cpp:395
immer::array< std::string > changed() const
The Matrix User IDs of all users who updated their device identity keys.
Definition keys.cpp:405
Query users with recent device key updates.
Definition keys.hpp:398
static constexpr auto needsAuth()
Definition keys.hpp:426
static BaseJob::Body buildBody(std::string from, std::string to)
Definition keys.cpp:346
GetKeysChangesJob withData(JsonWrap j) &&
Definition keys.cpp:378
static BaseJob::Query buildQuery(std::string from, std::string to)
Definition keys.cpp:335
immer::map< std::string, immer::map< std::string, DeviceInformation > > deviceKeys() const
Information on the queried devices.
Definition keys.cpp:191
immer::map< std::string, CrossSigningKey > userSigningKeys() const
Information on the user-signing key of the user making the request, if they queried their own device ...
Definition keys.cpp:224
immer::map< std::string, CrossSigningKey > selfSigningKeys() const
Information on the self-signing keys of the queried users.
Definition keys.cpp:213
immer::map< std::string, CrossSigningKey > masterKeys() const
Information on the master cross-signing keys of the queried users.
Definition keys.cpp:202
immer::map< std::string, JsonWrap > failures() const
If any remote homeservers could not be reached, they are recorded here.
Definition keys.cpp:180
bool success() const
Definition keys.cpp:170
Download device identity keys.
Definition keys.hpp:113
static BaseJob::Query buildQuery()
Definition keys.cpp:103
static constexpr auto needsAuth()
Definition keys.hpp:194
QueryKeysJob withData(JsonWrap j) &&
Definition keys.cpp:153
static BaseJob::Body buildBody(immer::map< std::string, immer::array< std::string > > deviceKeys, std::optional< int > timeout, std::optional< std::string > token)
Definition keys.cpp:111
bool success() const
Definition keys.cpp:80
immer::map< std::string, int > oneTimeKeyCounts() const
For each key algorithm, the number of unclaimed one-time keys of that type currently held on the serv...
Definition keys.cpp:91
Upload end-to-end encryption keys.
Definition keys.hpp:17
static BaseJob::Body buildBody(std::optional< DeviceKeys > deviceKeys, JsonWrap oneTimeKeys, JsonWrap fallbackKeys)
Definition keys.cpp:21
static constexpr auto needsAuth()
Definition keys.hpp:41
UploadKeysJob withData(JsonWrap j) &&
Definition keys.cpp:63
static BaseJob::Query buildQuery()
Definition keys.cpp:13
Definition basejob.hpp:94
Definition basejob.hpp:68
::Kazv::Body Body
Definition basejob.hpp:103
Definition jsonwrap.hpp:23
Definition location.hpp:10
Definition location.hpp:10
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition types.hpp:80
nlohmann::json json
Definition jsonwrap.hpp:20
Definition location.hpp:27
Device identity keys.
Definition device_keys.hpp:13
Returns the current devices and identity keys for the given users.
Definition keys.hpp:130
std::optional< UnsignedDeviceInfo > unsignedData
Additional data added to the device key information by intermediate servers, and not covered by the s...
Definition keys.hpp:134
Additional data added to the device key information by intermediate servers, and not covered by the s...
Definition keys.hpp:121
std::optional< std::string > deviceDisplayName
The display name which the user set on the device.
Definition keys.hpp:123
Definition basejob.hpp:49
static void to_json(json &jo, const QueryKeysJob::DeviceInformation &pod)
Definition keys.hpp:269
static void from_json(const json &jo, QueryKeysJob::DeviceInformation &result)
Definition keys.hpp:279
static void to_json(json &jo, const QueryKeysJob::UnsignedDeviceInfo &pod)
Definition keys.hpp:247
static void from_json(const json &jo, QueryKeysJob::UnsignedDeviceInfo &result)
Definition keys.hpp:256