From 6dd47e7a53832804e552222323a8e793c65ff829 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Damir=20Jeli=C4=87?= Date: Fri, 3 May 2019 14:01:01 +0200 Subject: [PATCH] pantalaimon: Rename accept_sas to confirm sas. --- pantalaimon/client.py | 2 +- pantalaimon/daemon.py | 8 ++++---- pantalaimon/panctl.py | 12 ++++++++---- pantalaimon/ui.py | 6 +++--- 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/pantalaimon/client.py b/pantalaimon/client.py index a529abe..cb2d11e 100644 --- a/pantalaimon/client.py +++ b/pantalaimon/client.py @@ -147,7 +147,7 @@ class PanClient(AsyncClient): response = await self.to_device(message) return message, response - async def accept_sas(self, message): + async def confirm_sas(self, message): user_id = message.user_id device_id = message.device_id diff --git a/pantalaimon/daemon.py b/pantalaimon/daemon.py index 864ced4..37ef48a 100755 --- a/pantalaimon/daemon.py +++ b/pantalaimon/daemon.py @@ -34,7 +34,7 @@ from pantalaimon.ui import ( DeviceUnverifyMessage, ExportKeysMessage, ImportKeysMessage, - DeviceAcceptSasMessage, + DeviceConfirmSasMessage, InfoMessage ) @@ -141,7 +141,7 @@ class ProxyDaemon: if isinstance( message, (DeviceVerifyMessage, DeviceUnverifyMessage, - DeviceAcceptSasMessage) + DeviceConfirmSasMessage) ): client = self.pan_clients.get(message.pan_user, None) @@ -167,8 +167,8 @@ class ProxyDaemon: await self._verify_device(client, device) elif isinstance(message, DeviceUnverifyMessage): await self._unverify_device(client, device) - elif isinstance(message, DeviceAcceptSasMessage): - await client.accept_sas(message) + elif isinstance(message, DeviceConfirmSasMessage): + await client.confirm_sas(message) elif isinstance(message, ExportKeysMessage): client = self.pan_clients.get(message.pan_user, None) diff --git a/pantalaimon/panctl.py b/pantalaimon/panctl.py index 6f937e1..d9a250e 100644 --- a/pantalaimon/panctl.py +++ b/pantalaimon/panctl.py @@ -89,7 +89,8 @@ class PanCtl: "list-users", "export-keys", "import-keys", - "accept-verification" + "accept-verification", + "confirm-verification" ] def __attrs_post_init__(self): @@ -199,14 +200,14 @@ class PanCtl: dbus_interface="org.pantalaimon.control" ) - def accept_sas(self, args): + def confirm_sas(self, args): try: pan_user, user, device = args except ValueError: print("Invalid arguments for command") return - self.devices.accept_sas( + self.devices.confirm_sas( pan_user, user, device, @@ -244,8 +245,11 @@ class PanCtl: self.import_keys(args) elif command == "accept-verification": + pass + + elif command == "confirm-verification": args = words[1:] - self.accept_sas(args) + self.confirm_sas(args) else: print(f"Unknown command {command}.") diff --git a/pantalaimon/ui.py b/pantalaimon/ui.py index 550bdb3..951be66 100644 --- a/pantalaimon/ui.py +++ b/pantalaimon/ui.py @@ -70,7 +70,7 @@ class DeviceUnverifyMessage(_VerificationMessage): @attr.s -class DeviceAcceptSasMessage(_VerificationMessage): +class DeviceConfirmSasMessage(_VerificationMessage): pass @@ -135,8 +135,8 @@ class Devices(dbus.service.Object): @dbus.service.method("org.pantalaimon.devices", in_signature="sss") - def accept_sas(self, pan_user, user_id, device_id): - message = DeviceAcceptSasMessage(pan_user, user_id, device_id) + def confirm_sas(self, pan_user, user_id, device_id): + message = DeviceConfirmSasMessage(pan_user, user_id, device_id) self.queue.put(message) return