mirror of
https://github.com/matrix-org/pantalaimon.git
synced 2025-01-09 14:39:34 -05:00
ui: Expose key imports from the dbus API.
This commit is contained in:
parent
2bb6ac7196
commit
e43b8c750c
@ -156,11 +156,24 @@ class ProxyDaemon:
|
|||||||
try:
|
try:
|
||||||
client.export_keys(path, message.passphrase)
|
client.export_keys(path, message.passphrase)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
logger.warn(f"Error exporint keys for {client.user_id} to "
|
logger.warn(f"Error exporting keys for {client.user_id} to"
|
||||||
f"{path} {e}")
|
f" {path} {e}")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
elif isinstance(message, ImportKeysMessage):
|
elif isinstance(message, ImportKeysMessage):
|
||||||
|
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
|
pass
|
||||||
|
|
||||||
def get_access_token(self, request):
|
def get_access_token(self, request):
|
||||||
|
@ -150,6 +150,19 @@ class Control(dbus.service.Object):
|
|||||||
|
|
||||||
return
|
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):
|
def glib_loop(receive_queue, send_queue, data_dir):
|
||||||
DBusGMainLoop(set_as_default=True)
|
DBusGMainLoop(set_as_default=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user