diff --git a/modules/Makefile.am b/modules/Makefile.am index 759e40202..572415ebe 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -396,7 +396,8 @@ federation_federation_event_auth_la_SOURCES = federation/event_auth.cc federation_federation_query_auth_la_SOURCES = federation/query_auth.cc federation_federation_publicrooms_la_SOURCES = federation/publicrooms.cc federation_federation_user_devices_la_SOURCES = federation/user_devices.cc -federation_federation_user_keys_la_SOURCES = federation/user_keys.cc +federation_federation_user_keys_query_la_SOURCES = federation/user_keys_query.cc +federation_federation_user_keys_claim_la_SOURCES = federation/user_keys_claim.cc federation_federation_federation_la_SOURCES = federation/federation.cc federation_module_LTLIBRARIES = \ @@ -420,7 +421,8 @@ federation_module_LTLIBRARIES = \ federation/federation_query_auth.la \ federation/federation_publicrooms.la \ federation/federation_user_devices.la \ - federation/federation_user_keys.la \ + federation/federation_user_keys_query.la \ + federation/federation_user_keys_claim.la \ federation/federation_federation.la \ ### diff --git a/modules/federation/user_keys_claim.cc b/modules/federation/user_keys_claim.cc new file mode 100644 index 000000000..067a7b6ae --- /dev/null +++ b/modules/federation/user_keys_claim.cc @@ -0,0 +1,49 @@ +// Matrix Construct +// +// Copyright (C) Matrix Construct Developers, Authors & Contributors +// Copyright (C) 2016-2019 Jason Volk +// +// 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. + +using namespace ircd; + +mapi::header +IRCD_MODULE +{ + "Federation 21 :End-to-End Encryption" +}; + +resource +user_keys_claim_resource +{ + "/_matrix/federation/v1/user/keys/claim", + { + "federation user keys claim", + } +}; + +static resource::response +post__user_keys_claim(client &client, + const resource::request &request); + +resource::method +user_keys_claim__post +{ + user_keys_claim_resource, "POST", post__user_keys_claim, + { + user_keys_claim__post.VERIFY_ORIGIN + } +}; + +resource::response +post__user_keys_claim(client &client, + const resource::request &request) +{ + return resource::response + { + client, http::NOT_FOUND + }; +} diff --git a/modules/federation/user_keys.cc b/modules/federation/user_keys_query.cc similarity index 80% rename from modules/federation/user_keys.cc rename to modules/federation/user_keys_query.cc index b2dbc01f3..5e20272ef 100644 --- a/modules/federation/user_keys.cc +++ b/modules/federation/user_keys_query.cc @@ -1,7 +1,7 @@ // Matrix Construct // // Copyright (C) Matrix Construct Developers, Authors & Contributors -// Copyright (C) 2016-2018 Jason Volk +// Copyright (C) 2016-2019 Jason Volk // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -16,15 +16,6 @@ IRCD_MODULE "Federation 21 :End-to-End Encryption" }; -resource -user_keys_claim_resource -{ - "/_matrix/federation/v1/user/keys/claim", - { - "federation user keys claim", - } -}; - resource user_keys_query_resource { @@ -34,12 +25,15 @@ user_keys_query_resource } }; -static resource::response -post__user_keys_query(client &client, - const resource::request &request); +static bool +_query_user_device(client &client, + const resource::request &request, + const m::user::id &user_id, + const string_view &device_id, + json::stack::object &out); static resource::response -post__user_keys_claim(client &client, +post__user_keys_query(client &client, const resource::request &request); resource::method @@ -51,32 +45,6 @@ user_keys_query__post } }; -resource::method -user_keys_claim__post -{ - user_keys_claim_resource, "POST", post__user_keys_claim, - { - user_keys_claim__post.VERIFY_ORIGIN - } -}; - -resource::response -post__user_keys_claim(client &client, - const resource::request &request) -{ - return resource::response - { - client, http::NOT_FOUND - }; -} - -static bool -_query_user_device(client &client, - const resource::request &request, - const m::user::id &user_id, - const string_view &device_id, - json::stack::object &out); - resource::response post__user_keys_query(client &client, const resource::request &request)