diff options
author | Hubert Chathi <hubert@uhoreg.ca> | 2019-02-06 17:57:10 -0500 |
---|---|---|
committer | Hubert Chathi <hubert@uhoreg.ca> | 2019-02-06 17:57:10 -0500 |
commit | 82486371738a130322f3a1829bc4b49f79c1a3e4 (patch) | |
tree | 58bd97eb0df9acc2c23cd2b52dd706b11506ff58 /synapse/rest/client | |
parent | return proper error codes for some 404s (diff) | |
download | synapse-82486371738a130322f3a1829bc4b49f79c1a3e4.tar.xz |
add new endpoint to update backup versions
Diffstat (limited to 'synapse/rest/client')
-rw-r--r-- | synapse/rest/client/v2_alpha/room_keys.py | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/synapse/rest/client/v2_alpha/room_keys.py b/synapse/rest/client/v2_alpha/room_keys.py index ab3f1bd21a..1c39d2af1c 100644 --- a/synapse/rest/client/v2_alpha/room_keys.py +++ b/synapse/rest/client/v2_alpha/room_keys.py @@ -380,6 +380,39 @@ class RoomKeysVersionServlet(RestServlet): ) defer.returnValue((200, {})) + @defer.inlineCallbacks + def on_PUT(self, request, version): + """ + Update the information about a given version of the user's room_keys backup. + + POST /room_keys/version/12345 HTTP/1.1 + Content-Type: application/json + { + "algorithm": "m.megolm_backup.v1", + "auth_data": { + "public_key": "abcdefg", + "signatures": { + "ed25519:something": "hijklmnop" + } + } + } + + HTTP/1.1 200 OK + Content-Type: application/json + {} + """ + requester = yield self.auth.get_user_by_req(request, allow_guest=False) + user_id = requester.user.to_string() + info = parse_json_object_from_request(request) + + if version is None: + raise SynapseError(400, "No version specified to update", Codes.MISSING_PARAM) + + yield self.e2e_room_keys_handler.update_version( + user_id, version, info + ) + defer.returnValue((200, {})) + def register_servlets(hs, http_server): RoomKeysServlet(hs).register(http_server) |