libkazv
cross_signing_key.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 "types.hpp"
8 
9 
10 namespace Kazv::Api {
13 {
14 
16  std::string userId;
17 
19  immer::array<std::string> usage;
20 
24  immer::map<std::string, std::string> keys;
25 
30 };
31 
32 }
33 namespace nlohmann
34 {
35 using namespace Kazv;
36 using namespace Kazv::Api;
37 template<>
38 struct adl_serializer<CrossSigningKey> {
39  static void to_json(json& jo, const CrossSigningKey &pod)
40  {
41  if (! jo.is_object()) { jo = json::object(); }
42 
43 
44  jo["user_id"s] = pod.userId;
45 
46  jo["usage"s] = pod.usage;
47 
48  jo["keys"s] = pod.keys;
49 
50 
51  addToJsonIfNeeded(jo, "signatures"s, pod.signatures);
52  }
53  static void from_json(const json &jo, CrossSigningKey& result)
54  {
55 
56  if (jo.contains("user_id"s)) {
57  result.userId = jo.at("user_id"s);
58  }
59  if (jo.contains("usage"s)) {
60  result.usage = jo.at("usage"s);
61  }
62  if (jo.contains("keys"s)) {
63  result.keys = jo.at("keys"s);
64  }
65  if (jo.contains("signatures"s)) {
66  result.signatures = jo.at("signatures"s);
67  }
68 
69  }
70 };
71  }
72 
73  namespace Kazv::Api
74  {
75 } // namespace Kazv::Api
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
Cross signing key.
Definition: cross_signing_key.hpp:13
immer::map< std::string, std::string > keys
The public key.
Definition: cross_signing_key.hpp:24
std::string userId
The ID of the user the key belongs to.
Definition: cross_signing_key.hpp:16
immer::array< std::string > usage
What the key is used for.
Definition: cross_signing_key.hpp:19
JsonWrap signatures
Signatures of the key, calculated using the process described at Signing JSON.
Definition: cross_signing_key.hpp:29
static void to_json(json &jo, const CrossSigningKey &pod)
Definition: cross_signing_key.hpp:39
static void from_json(const json &jo, CrossSigningKey &result)
Definition: cross_signing_key.hpp:53