aboutsummaryrefslogtreecommitdiff
path: root/clientapi/routing/routing.go
diff options
context:
space:
mode:
authorKegsay <kegan@matrix.org>2020-07-15 12:02:34 +0100
committerGitHub <noreply@github.com>2020-07-15 12:02:34 +0100
commit9dd2ed7f6513e8fa677dee8d7dafa33f9c7afdfc (patch)
tree5c09582128d156aa2b6629cdaae626b44357b48d /clientapi/routing/routing.go
parentb4c07995d68dbeffa2161920cb4cd61ea2be8389 (diff)
Implement key uploads (#1202)
* Add storage layer for postgres/sqlite * Return OTK counts when inserting new keys * Hook up the key DB and make a test pass * Convert postgres queries to be sqlite queries * Blacklist test due to requiring rejected events * Unbreak tests * Update blacklist
Diffstat (limited to 'clientapi/routing/routing.go')
-rw-r--r--clientapi/routing/routing.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/clientapi/routing/routing.go b/clientapi/routing/routing.go
index 965a46d2..4879ddaa 100644
--- a/clientapi/routing/routing.go
+++ b/clientapi/routing/routing.go
@@ -31,6 +31,7 @@ import (
"github.com/matrix-org/dendrite/internal/config"
"github.com/matrix-org/dendrite/internal/httputil"
"github.com/matrix-org/dendrite/internal/transactions"
+ keyserverAPI "github.com/matrix-org/dendrite/keyserver/api"
roomserverAPI "github.com/matrix-org/dendrite/roomserver/api"
userapi "github.com/matrix-org/dendrite/userapi/api"
"github.com/matrix-org/dendrite/userapi/storage/accounts"
@@ -62,6 +63,7 @@ func Setup(
transactionsCache *transactions.Cache,
federationSender federationSenderAPI.FederationSenderInternalAPI,
stateAPI currentstateAPI.CurrentStateInternalAPI,
+ keyAPI keyserverAPI.KeyInternalAPI,
extRoomsProvider api.ExtraPublicRoomsProvider,
) {
userInteractiveAuth := auth.NewUserInteractive(accountDB.GetAccountByPassword, cfg)
@@ -705,7 +707,12 @@ func Setup(
// Supplying a device ID is deprecated.
r0mux.Handle("/keys/upload/{deviceID}",
httputil.MakeAuthAPI("keys_upload", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse {
- return UploadKeys(req)
+ return UploadKeys(req, keyAPI, device)
+ }),
+ ).Methods(http.MethodPost, http.MethodOptions)
+ r0mux.Handle("/keys/upload",
+ httputil.MakeAuthAPI("keys_upload", userAPI, func(req *http.Request, device *userapi.Device) util.JSONResponse {
+ return UploadKeys(req, keyAPI, device)
}),
).Methods(http.MethodPost, http.MethodOptions)
}