mirror of
https://github.com/matrix-construct/construct
synced 2024-11-28 17:52:54 +01:00
modules/federation/user_keys_query: Add missing user_signing_keys on the loopback.
This commit is contained in:
parent
080748f0af
commit
d5df04a183
1 changed files with 51 additions and 0 deletions
|
@ -32,6 +32,11 @@ _query_user_device(client &,
|
|||
const string_view &device_id,
|
||||
json::stack::object &out);
|
||||
|
||||
static void
|
||||
_query_user_keys(client &,
|
||||
const m::resource::request &,
|
||||
json::stack &);
|
||||
|
||||
static void
|
||||
_query_self_keys(client &,
|
||||
const m::resource::request &,
|
||||
|
@ -72,6 +77,9 @@ post__user_keys_query(client &client,
|
|||
_query_device_keys(client, request, response);
|
||||
_query_master_keys(client, request, response);
|
||||
_query_self_keys(client, request, response);
|
||||
if(my_host(request.node_id))
|
||||
_query_user_keys(client, request, response);
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
@ -211,6 +219,49 @@ _query_self_keys(client &client,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
_query_user_keys(client &client,
|
||||
const m::resource::request &request,
|
||||
json::stack &out)
|
||||
{
|
||||
const json::object request_keys
|
||||
{
|
||||
request.at("device_keys")
|
||||
};
|
||||
|
||||
json::stack::object response_keys
|
||||
{
|
||||
out, "user_signing_keys"
|
||||
};
|
||||
|
||||
for(const auto &[user_id_, device_ids_] : request_keys)
|
||||
{
|
||||
const m::user::id &user_id
|
||||
{
|
||||
user_id_
|
||||
};
|
||||
|
||||
const m::user::room room
|
||||
{
|
||||
user_id
|
||||
};
|
||||
|
||||
const auto event_idx
|
||||
{
|
||||
room.get(std::nothrow, "ircd.device.signing.user", "")
|
||||
};
|
||||
|
||||
m::get(std::nothrow, event_idx, "content", [&response_keys, &user_id]
|
||||
(const json::object &content)
|
||||
{
|
||||
json::stack::member
|
||||
{
|
||||
response_keys, user_id, content
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
_query_user_device(client &client,
|
||||
const m::resource::request &request,
|
||||
|
|
Loading…
Reference in a new issue