pantalaimon: Rename accept_sas to confirm sas.

This commit is contained in:
Damir Jelić 2019-05-03 14:01:01 +02:00
parent 90ec4e2e96
commit 6dd47e7a53
4 changed files with 16 additions and 12 deletions

View File

@ -147,7 +147,7 @@ class PanClient(AsyncClient):
response = await self.to_device(message) response = await self.to_device(message)
return message, response return message, response
async def accept_sas(self, message): async def confirm_sas(self, message):
user_id = message.user_id user_id = message.user_id
device_id = message.device_id device_id = message.device_id

View File

@ -34,7 +34,7 @@ from pantalaimon.ui import (
DeviceUnverifyMessage, DeviceUnverifyMessage,
ExportKeysMessage, ExportKeysMessage,
ImportKeysMessage, ImportKeysMessage,
DeviceAcceptSasMessage, DeviceConfirmSasMessage,
InfoMessage InfoMessage
) )
@ -141,7 +141,7 @@ class ProxyDaemon:
if isinstance( if isinstance(
message, message,
(DeviceVerifyMessage, DeviceUnverifyMessage, (DeviceVerifyMessage, DeviceUnverifyMessage,
DeviceAcceptSasMessage) DeviceConfirmSasMessage)
): ):
client = self.pan_clients.get(message.pan_user, None) client = self.pan_clients.get(message.pan_user, None)
@ -167,8 +167,8 @@ class ProxyDaemon:
await self._verify_device(client, device) await self._verify_device(client, device)
elif isinstance(message, DeviceUnverifyMessage): elif isinstance(message, DeviceUnverifyMessage):
await self._unverify_device(client, device) await self._unverify_device(client, device)
elif isinstance(message, DeviceAcceptSasMessage): elif isinstance(message, DeviceConfirmSasMessage):
await client.accept_sas(message) await client.confirm_sas(message)
elif isinstance(message, ExportKeysMessage): elif isinstance(message, ExportKeysMessage):
client = self.pan_clients.get(message.pan_user, None) client = self.pan_clients.get(message.pan_user, None)

View File

@ -89,7 +89,8 @@ class PanCtl:
"list-users", "list-users",
"export-keys", "export-keys",
"import-keys", "import-keys",
"accept-verification" "accept-verification",
"confirm-verification"
] ]
def __attrs_post_init__(self): def __attrs_post_init__(self):
@ -199,14 +200,14 @@ class PanCtl:
dbus_interface="org.pantalaimon.control" dbus_interface="org.pantalaimon.control"
) )
def accept_sas(self, args): def confirm_sas(self, args):
try: try:
pan_user, user, device = args pan_user, user, device = args
except ValueError: except ValueError:
print("Invalid arguments for command") print("Invalid arguments for command")
return return
self.devices.accept_sas( self.devices.confirm_sas(
pan_user, pan_user,
user, user,
device, device,
@ -244,8 +245,11 @@ class PanCtl:
self.import_keys(args) self.import_keys(args)
elif command == "accept-verification": elif command == "accept-verification":
pass
elif command == "confirm-verification":
args = words[1:] args = words[1:]
self.accept_sas(args) self.confirm_sas(args)
else: else:
print(f"Unknown command {command}.") print(f"Unknown command {command}.")

View File

@ -70,7 +70,7 @@ class DeviceUnverifyMessage(_VerificationMessage):
@attr.s @attr.s
class DeviceAcceptSasMessage(_VerificationMessage): class DeviceConfirmSasMessage(_VerificationMessage):
pass pass
@ -135,8 +135,8 @@ class Devices(dbus.service.Object):
@dbus.service.method("org.pantalaimon.devices", @dbus.service.method("org.pantalaimon.devices",
in_signature="sss") in_signature="sss")
def accept_sas(self, pan_user, user_id, device_id): def confirm_sas(self, pan_user, user_id, device_id):
message = DeviceAcceptSasMessage(pan_user, user_id, device_id) message = DeviceConfirmSasMessage(pan_user, user_id, device_id)
self.queue.put(message) self.queue.put(message)
return return