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 {
12 struct CrossSigningKey
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
Kazv::Api::CrossSigningKey::userId
std::string userId
The ID of the user the key belongs to.
Definition: cross_signing_key.hpp:20
nlohmann::adl_serializer< CrossSigningKey >::to_json
static void to_json(json &jo, const CrossSigningKey &pod)
Definition: cross_signing_key.hpp:39
Kazv::Api::CrossSigningKey::usage
immer::array< std::string > usage
What the key is used for.
Definition: cross_signing_key.hpp:23
types.hpp
Kazv::Api::CrossSigningKey
Cross signing key.
Definition: cross_signing_key.hpp:14
Kazv::Api::CrossSigningKey::signatures
JsonWrap signatures
Signatures of the key, calculated using the process described at Signing JSON.
Definition: cross_signing_key.hpp:33
nlohmann
Definition: location.hpp:26
Kazv
Definition: location.hpp:10
nlohmann::adl_serializer< CrossSigningKey >::from_json
static void from_json(const json &jo, CrossSigningKey &result)
Definition: cross_signing_key.hpp:53
Kazv::json
nlohmann::json json
Definition: jsonwrap.hpp:20
Kazv::Api
Definition: location.hpp:10
Kazv::addToJsonIfNeeded
void addToJsonIfNeeded(json &j, std::string name, T &&arg)
Definition: types.hpp:69
Kazv::JsonWrap
Definition: jsonwrap.hpp:22
Kazv::Api::CrossSigningKey::keys
immer::map< std::string, std::string > keys
The public key.
Definition: cross_signing_key.hpp:28