diff options
author | Kegsay <kegan@matrix.org> | 2020-07-13 16:02:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-13 16:02:35 +0100 |
commit | 396219ef534093b45ad02cccc8ca9cf0f9742c40 (patch) | |
tree | 4cf4eaf0a31cc2a3e42a9bb8be7f7e4d4a17e982 /keyserver/keyserver.go | |
parent | 3178afde2c432d5886fa51e1eacfb1e770da39a6 (diff) |
Add boilerplate for key server APIs (#1196)
Also add a README which outilnes how things will work.
Diffstat (limited to 'keyserver/keyserver.go')
-rw-r--r-- | keyserver/keyserver.go | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/keyserver/keyserver.go b/keyserver/keyserver.go index bedc4dfb..3bb0e462 100644 --- a/keyserver/keyserver.go +++ b/keyserver/keyserver.go @@ -16,14 +16,19 @@ package keyserver import ( "github.com/gorilla/mux" - "github.com/matrix-org/dendrite/internal/config" - "github.com/matrix-org/dendrite/keyserver/routing" - userapi "github.com/matrix-org/dendrite/userapi/api" + "github.com/matrix-org/dendrite/keyserver/api" + "github.com/matrix-org/dendrite/keyserver/internal" + "github.com/matrix-org/dendrite/keyserver/inthttp" ) -// AddPublicRoutes registers HTTP handlers for CS API calls -func AddPublicRoutes( - router *mux.Router, cfg *config.Dendrite, userAPI userapi.UserInternalAPI, -) { - routing.Setup(router, cfg, userAPI) +// AddInternalRoutes registers HTTP handlers for the internal API. Invokes functions +// on the given input API. +func AddInternalRoutes(router *mux.Router, intAPI api.KeyInternalAPI) { + inthttp.AddRoutes(router, intAPI) +} + +// NewInternalAPI returns a concerete implementation of the internal API. Callers +// can call functions directly on the returned API or via an HTTP interface using AddInternalRoutes. +func NewInternalAPI() api.KeyInternalAPI { + return &internal.KeyInternalAPI{} } |