0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-29 10:12:39 +01:00

modules/s_node: Move functions called my m_event back to libircd for now; tweak module order.

This commit is contained in:
Jason Volk 2019-06-22 19:18:37 -06:00
parent 8c7b265916
commit 7dffdf12e0
2 changed files with 49 additions and 55 deletions

View file

@ -176,14 +176,14 @@ ircd::m::module_names
{
"vm",
"s_conf",
"s_node",
"s_keys",
"s_dns",
"s_fetch",
"s_keys",
"s_command",
"s_control",
"s_listen",
"s_feds",
"s_node",
"m_events",
"m_rooms",
"m_user",
@ -2350,6 +2350,53 @@ ircd::m::node::node(const string_view &node_id)
rfc3986::valid_remote(node_id);
}
void
ircd::m::node::key(const string_view &key_id,
const ed25519_closure &closure)
const
{
key(key_id, key_closure{[&closure]
(const string_view &keyb64)
{
const ed25519::pk pk
{
[&keyb64](auto &buf)
{
b64decode(buf, unquote(keyb64));
}
};
closure(pk);
}});
}
void
ircd::m::node::key(const string_view &key_id,
const key_closure &closure)
const
{
m::keys::get(node_id, key_id, [&closure, &key_id]
(const json::object &keys)
{
const json::object &vks
{
keys.at("verify_keys")
};
const json::object &vkk
{
vks.at(key_id)
};
const string_view &key
{
vkk.at("key")
};
closure(key);
});
}
/// Generates a node-room ID into buffer; see room_id() overload.
ircd::m::id::room::buf
ircd::m::node::room_id()

View file

@ -82,56 +82,3 @@ ircd::m::my(const node &node)
{
return my_host(node.node_id);
}
//
// node::node
//
void
IRCD_MODULE_EXPORT
ircd::m::node::key(const string_view &key_id,
const ed25519_closure &closure)
const
{
key(key_id, key_closure{[&closure]
(const string_view &keyb64)
{
const ed25519::pk pk
{
[&keyb64](auto &buf)
{
b64decode(buf, unquote(keyb64));
}
};
closure(pk);
}});
}
void
IRCD_MODULE_EXPORT
ircd::m::node::key(const string_view &key_id,
const key_closure &closure)
const
{
m::keys::get(node_id, key_id, [&closure, &key_id]
(const json::object &keys)
{
const json::object &vks
{
keys.at("verify_keys")
};
const json::object &vkk
{
vks.at(key_id)
};
const string_view &key
{
vkk.at("key")
};
closure(key);
});
}