mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 02:02:38 +01:00
modules: Start and identity service stub area.
This commit is contained in:
parent
9314bd7b5b
commit
7e8f3048d3
3 changed files with 135 additions and 0 deletions
|
@ -434,6 +434,21 @@ app_module_LTLIBRARIES = \
|
|||
app/app_register.la \
|
||||
###
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# /_matrix/identity/
|
||||
#
|
||||
|
||||
identity_moduledir = @moduledir@
|
||||
|
||||
identity_identity_v1_la_SOURCES = identity/v1.cc
|
||||
identity_identity_pubkey_la_SOURCES = identity/pubkey.cc
|
||||
|
||||
identity_module_LTLIBRARIES = \
|
||||
identity/identity_v1.la \
|
||||
identity/identity_pubkey.la \
|
||||
###
|
||||
|
||||
###############################################################################
|
||||
#
|
||||
# JavaScript
|
||||
|
|
77
modules/identity/pubkey.cc
Normal file
77
modules/identity/pubkey.cc
Normal file
|
@ -0,0 +1,77 @@
|
|||
// 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.
|
||||
|
||||
using namespace ircd;
|
||||
|
||||
mapi::header
|
||||
IRCD_MODULE
|
||||
{
|
||||
"Identity Service 7 :Key management"
|
||||
};
|
||||
|
||||
resource
|
||||
pubkey_resource
|
||||
{
|
||||
"/_matrix/identity/api/v1/pubkey/",
|
||||
{
|
||||
"7.1 Get the public key for the passed key ID.",
|
||||
resource::DIRECTORY
|
||||
}
|
||||
};
|
||||
|
||||
static resource::response
|
||||
handle_get(client &,
|
||||
const resource::request &);
|
||||
|
||||
resource::method
|
||||
method_get
|
||||
{
|
||||
pubkey_resource, "GET", handle_get
|
||||
};
|
||||
|
||||
resource::response
|
||||
handle_get(client &client,
|
||||
const resource::request &request)
|
||||
{
|
||||
if(request.parv.size() < 1)
|
||||
throw m::NEED_MORE_PARAMS
|
||||
{
|
||||
"keyId path parameter required"
|
||||
};
|
||||
|
||||
char buf[256];
|
||||
const string_view keyid
|
||||
{
|
||||
url::decode(buf, request.parv[0])
|
||||
};
|
||||
|
||||
const string_view algorithm
|
||||
{
|
||||
split(keyid, ':').first
|
||||
};
|
||||
|
||||
const string_view identifier
|
||||
{
|
||||
split(keyid, ':').second
|
||||
};
|
||||
|
||||
const string_view public_key
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
return resource::response
|
||||
{
|
||||
client, http::NOT_FOUND, json::members
|
||||
{
|
||||
{ "public_key", public_key }
|
||||
}
|
||||
};
|
||||
}
|
43
modules/identity/v1.cc
Normal file
43
modules/identity/v1.cc
Normal file
|
@ -0,0 +1,43 @@
|
|||
// 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.
|
||||
|
||||
using namespace ircd;
|
||||
|
||||
mapi::header
|
||||
IRCD_MODULE
|
||||
{
|
||||
"Identity Service 6 :Status Check"
|
||||
};
|
||||
|
||||
resource
|
||||
identity_resource
|
||||
{
|
||||
"/_matrix/identity/api/v1",
|
||||
{
|
||||
"Identity 6.1 :Checks that an identity server is available at this"
|
||||
" API endpoint."
|
||||
}
|
||||
};
|
||||
|
||||
static resource::response
|
||||
handle_get(client &client,
|
||||
const resource::request &request)
|
||||
{
|
||||
return resource::response
|
||||
{
|
||||
client, http::NOT_IMPLEMENTED
|
||||
};
|
||||
}
|
||||
|
||||
resource::method
|
||||
method_get
|
||||
{
|
||||
identity_resource, "GET", handle_get
|
||||
};
|
Loading…
Reference in a new issue