From a49c7892515ddbbb8797132188a7608152137154 Mon Sep 17 00:00:00 2001 From: Andrew Morgan Date: Sun, 31 May 2020 20:57:26 +0100 Subject: [PATCH] Encryption support is required --- config.py | 1 - main.py | 23 +++++++++-------------- sample.config.yaml | 5 ----- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/config.py b/config.py index 36f8033..b72b3ed 100644 --- a/config.py +++ b/config.py @@ -61,7 +61,6 @@ class Config(object): self.device_id = self._get_cfg(["matrix", "device_id"], required=True) self.device_name = self._get_cfg(["matrix", "device_name"], default="nio-template") self.homeserver_url = self._get_cfg(["matrix", "homeserver_url"], required=True) - self.enable_encryption = self._get_cfg(["matrix", "enable_encryption"], default=False) self.command_prefix = self._get_cfg(["command_prefix"], default="!c") + " " diff --git a/main.py b/main.py index 6fea30c..19b3cfa 100644 --- a/main.py +++ b/main.py @@ -41,7 +41,7 @@ async def main(): max_limit_exceeded=0, max_timeouts=0, store_sync_tokens=True, - encryption_enabled=config.enable_encryption, + encryption_enabled=True, ) # Initialize the matrix client @@ -73,19 +73,14 @@ async def main(): logger.error(f"Failed to login: %s", login_response.message) return False except LocalProtocolError as e: - # There's an edge case here where the user enables encryption but hasn't installed - # the correct C dependencies. In that case, a LocalProtocolError is raised on login. - # Warn the user if these conditions are met. - if config.enable_encryption: - logger.fatal( - "Failed to login and encryption is enabled. Have you installed the correct dependencies? " - "https://github.com/poljar/matrix-nio#installation" - ) - return False - else: - # We don't know why this was raised. Throw it at the user - logger.fatal("Error logging in: %s", e) - return False + # There's an edge case here where the user hasn't installed the correct C + # dependencies. In that case, a LocalProtocolError is raised on login. + logger.fatal( + "Failed to login. Have you installed the correct dependencies? " + "https://github.com/poljar/matrix-nio#installation " + "Error: %s", e + ) + return False # Login succeeded! diff --git a/sample.config.yaml b/sample.config.yaml index bfb16f4..1606b7f 100644 --- a/sample.config.yaml +++ b/sample.config.yaml @@ -18,11 +18,6 @@ matrix: device_id: ABCDEFGHIJ # What to name the logged in device device_name: nio-template - # End-to-end encryption support - # - # Enabling this requires installing the matrix-nio encryption dependencies - # as described here: https://github.com/poljar/matrix-nio#installation - enable_encryption: true storage: # The path to the database