try import and export

This commit is contained in:
2024-12-10 10:06:23 +01:00
parent f9dfcf95bf
commit 28c32dba8a
3 changed files with 15 additions and 15 deletions

View File

@@ -116,13 +116,15 @@ class ConfigLoader(QObject):
@Slot(str, str)
def saveRecoveryKey(self, recovery_file, recovery_password):
# print(f"In {__file__} file, saveRecoveryKey()")
local = False
rp = self.__setRecoveryPassword(recovery_password)
rf = rp[1] + self.__encrypt_key + rp[0]
rf = Vermasseln().oscarVermasseln(rf)
rf = Vermasseln().oscarVermasseln(rf, local)
rec_file = urlparse(recovery_file)
rec_file = rec_file.path + ".pyqrec"
if os.name == "nt":
rec_file = rec_file [1:]
else:
rec_file = rec_file.path + ".pyqrec"
try:
with open(rec_file, "w") as f:
f.write(rf)
@@ -133,6 +135,7 @@ class ConfigLoader(QObject):
@Slot(str, str)
def getRecoveryKey(self, recovery_file, recovery_password):
# print(f"In {__file__} file, getRecoveryKey()")
local = False
rec_file = urlparse(recovery_file)
rec_file = rec_file.path
if os.name == "nt":
@@ -140,7 +143,7 @@ class ConfigLoader(QObject):
try:
with open(rec_file, "r") as f:
rf = f.read()
rf = Vermasseln().entschluesseln(rf)
rf = Vermasseln().entschluesseln(rf, local)
ek = rf[128:]
ek = ek[:-32]
password = rf[:128]
@@ -171,7 +174,7 @@ class ConfigLoader(QObject):
rp = self.__setRecoveryPassword(recovery_password, salt)
return rp[1] == password
@Slot(str, str)
@Slot(str, str) # todo: non local encryption
def importConfig(self, confile, password):
# print(f"In {__file__} file, importConfig()")
confile = urlparse(confile)