mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-01-09 06:37:55 -05:00
ui: Expose key imports from the dbus API.
This commit is contained in:
parent
2bb6ac7196
commit
e43b8c750c
@ -156,12 +156,25 @@ class ProxyDaemon:
|
||||
try:
|
||||
client.export_keys(path, message.passphrase)
|
||||
except OSError as e:
|
||||
logger.warn(f"Error exporint keys for {client.user_id} to "
|
||||
f"{path} {e}")
|
||||
logger.warn(f"Error exporting keys for {client.user_id} to"
|
||||
f" {path} {e}")
|
||||
pass
|
||||
|
||||
elif isinstance(message, ImportKeysMessage):
|
||||
pass
|
||||
client = self.pan_clients.get(message.pan_user, None)
|
||||
|
||||
if not client:
|
||||
return
|
||||
|
||||
path = os.path.abspath(message.file_path)
|
||||
logger.info(f"Importing keys from {path}")
|
||||
|
||||
try:
|
||||
client.import_keys(path, message.passphrase)
|
||||
except (OSError, EncryptionError) as e:
|
||||
logger.warn(f"Error importing keys for {client.user_id} "
|
||||
f"from {path} {e}")
|
||||
pass
|
||||
|
||||
def get_access_token(self, request):
|
||||
# type: (aiohttp.web.BaseRequest) -> str
|
||||
|
@ -150,6 +150,19 @@ class Control(dbus.service.Object):
|
||||
|
||||
return
|
||||
|
||||
@dbus.service.method("org.pantalaimon.control.import_keys",
|
||||
in_signature="sss")
|
||||
def import_keys(self, pan_user, filepath, passphrase):
|
||||
message = ImportKeysMessage(
|
||||
pan_user,
|
||||
filepath,
|
||||
passphrase
|
||||
)
|
||||
self.queue.put(message)
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
def glib_loop(receive_queue, send_queue, data_dir):
|
||||
DBusGMainLoop(set_as_default=True)
|
||||
|
Loading…
Reference in New Issue
Block a user