2018-02-04 03:22:01 +01:00
|
|
|
// Matrix Construct
|
|
|
|
//
|
|
|
|
// Copyright (C) Matrix Construct Developers, Authors & Contributors
|
|
|
|
// Copyright (C) 2016-2018 Jason Volk <jason@zemos.net>
|
|
|
|
//
|
|
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
|
|
// copyright notice and this permission notice is present in all copies. The
|
|
|
|
// full license for this software is available in the LICENSE file.
|
2017-10-03 13:12:54 +02:00
|
|
|
|
|
|
|
using namespace ircd;
|
|
|
|
|
2018-03-05 18:56:10 +01:00
|
|
|
mapi::header
|
|
|
|
IRCD_MODULE
|
2017-10-03 13:12:54 +02:00
|
|
|
{
|
2018-03-05 18:56:10 +01:00
|
|
|
"Federation 2.2.1.1 :Publishing Keys"
|
2017-10-03 13:12:54 +02:00
|
|
|
};
|
|
|
|
|
2018-03-05 18:56:10 +01:00
|
|
|
resource
|
2017-10-03 13:12:54 +02:00
|
|
|
server_resource
|
|
|
|
{
|
2018-03-05 18:56:10 +01:00
|
|
|
"/_matrix/key/v2/server/",
|
2017-10-03 13:12:54 +02:00
|
|
|
{
|
2017-12-12 21:26:39 +01:00
|
|
|
"federation 2.2.1.1: Publishing Keys",
|
2017-10-03 13:12:54 +02:00
|
|
|
resource::DIRECTORY,
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
resource::response
|
|
|
|
handle_get(client &client,
|
|
|
|
const resource::request &request)
|
|
|
|
{
|
|
|
|
char key_id_buf[256];
|
|
|
|
const auto key_id
|
|
|
|
{
|
2019-08-17 20:58:46 +02:00
|
|
|
request.parv.size() > 0?
|
|
|
|
url::decode(key_id_buf, request.parv[0]):
|
|
|
|
string_view{}
|
2017-10-03 13:12:54 +02:00
|
|
|
};
|
|
|
|
|
2018-05-11 11:05:08 +02:00
|
|
|
m::keys::get(my_host(), key_id, [&client]
|
|
|
|
(const json::object &keys)
|
2017-10-03 13:12:54 +02:00
|
|
|
{
|
2018-05-11 11:05:08 +02:00
|
|
|
resource::response
|
|
|
|
{
|
|
|
|
client, http::OK, keys
|
|
|
|
};
|
2017-10-03 13:12:54 +02:00
|
|
|
});
|
|
|
|
|
2018-05-11 11:05:08 +02:00
|
|
|
return {};
|
2017-10-03 13:12:54 +02:00
|
|
|
}
|
|
|
|
|
2018-03-05 18:56:10 +01:00
|
|
|
resource::method
|
|
|
|
method_get
|
2017-10-03 13:12:54 +02:00
|
|
|
{
|
|
|
|
server_resource, "GET", handle_get
|
|
|
|
};
|