summary refs log tree commit diff
path: root/synapse/handlers/device.py
diff options
context:
space:
mode:
authorHubert Chathi <hubert@uhoreg.ca>2020-07-27 16:48:32 -0400
committerHubert Chathi <hubert@uhoreg.ca>2020-07-27 16:48:32 -0400
commite60a99deb6ce7c83d693c0f17f620c2a072eee11 (patch)
tree21c08894f4c0333f0d17d647ebe7fcdad712bc47 /synapse/handlers/device.py
parentinitial version of dehydration (diff)
downloadsynapse-e60a99deb6ce7c83d693c0f17f620c2a072eee11.tar.xz
run black
Diffstat (limited to 'synapse/handlers/device.py')
-rw-r--r--synapse/handlers/device.py27
1 files changed, 20 insertions, 7 deletions
diff --git a/synapse/handlers/device.py b/synapse/handlers/device.py
index 614b10ca9e..0923466db4 100644
--- a/synapse/handlers/device.py
+++ b/synapse/handlers/device.py
@@ -492,12 +492,17 @@ class DeviceHandler(DeviceWorkerHandler):
             await self.store.mark_remote_user_device_list_as_unsubscribed(user_id)
 
     async def store_dehydrated_device(
-            self, user_id: str, device_data: str,
-            initial_device_display_name: Optional[str] = None) -> str:
+        self,
+        user_id: str,
+        device_data: str,
+        initial_device_display_name: Optional[str] = None,
+    ) -> str:
         device_id = await self.check_device_registered(
             user_id, None, initial_device_display_name,
         )
-        old_device_id = await self.store.store_dehydrated_device(user_id, device_id, device_data)
+        old_device_id = await self.store.store_dehydrated_device(
+            user_id, device_id, device_data
+        )
         if old_device_id is not None:
             await self.delete_device(user_id, old_device_id)
         return device_id
@@ -505,8 +510,12 @@ class DeviceHandler(DeviceWorkerHandler):
     async def get_dehydrated_device(self, user_id: str) -> Tuple[str, str]:
         return await self.store.get_dehydrated_device(user_id)
 
-    async def get_dehydration_token(self, user_id: str, device_id: str, login_submission: JsonDict) -> str:
-        return await self.store.create_dehydration_token(user_id, device_id, json.dumps(login_submission))
+    async def get_dehydration_token(
+        self, user_id: str, device_id: str, login_submission: JsonDict
+    ) -> str:
+        return await self.store.create_dehydration_token(
+            user_id, device_id, json.dumps(login_submission)
+        )
 
     async def rehydrate_device(self, token: str) -> dict:
         # FIXME: if can't find token, return 404
@@ -519,9 +528,13 @@ class DeviceHandler(DeviceWorkerHandler):
 
         if token_info["dehydrated"]:
             # create access token for dehydrated device
-            initial_display_name = None  # FIXME: get display name from login submission?
+            initial_display_name = (
+                None  # FIXME: get display name from login submission?
+            )
             device_id, access_token = await registration_handler.register_device(
-                token_info.get("user_id"), token_info.get("device_id"), initial_display_name
+                token_info.get("user_id"),
+                token_info.get("device_id"),
+                initial_display_name,
             )
 
             return {