mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-13 09:58:31 +02:00
update the upgrade process for new encryption classes
This commit is contained in:
parent
358e6c7f68
commit
41a5af533d
2 changed files with 14 additions and 4 deletions
|
@ -10,5 +10,8 @@ class NoEncryption(BaseEncryption):
|
||||||
def _encrypt(self, text: str) -> str:
|
def _encrypt(self, text: str) -> str:
|
||||||
return text
|
return text
|
||||||
|
|
||||||
def _decrypt(self, text: str) -> str:
|
def _decrypt(self, text: bytes | str) -> str:
|
||||||
return text
|
result = text
|
||||||
|
if isinstance(result, bytes):
|
||||||
|
result = result.decode(self._encoding)
|
||||||
|
return result
|
||||||
|
|
|
@ -134,8 +134,15 @@ def upgrade_jrnl(config_path):
|
||||||
)
|
)
|
||||||
|
|
||||||
logging.debug(f"Clearing encryption method for '{journal_name}' journal")
|
logging.debug(f"Clearing encryption method for '{journal_name}' journal")
|
||||||
old_journal.encryption_method = None
|
|
||||||
all_journals.append(old_journal)
|
# Update the encryption method
|
||||||
|
new_journal = Journal.PlainJournal.from_journal(old_journal)
|
||||||
|
new_journal.config["encrypt"] = "jrnlv2"
|
||||||
|
new_journal._get_encryption_method()
|
||||||
|
# Copy over password (jrnlv1 only supported password-based encryption)
|
||||||
|
new_journal.encryption_method.password = old_journal.encryption_method.password
|
||||||
|
|
||||||
|
all_journals.append(new_journal)
|
||||||
|
|
||||||
for journal_name, path in plain_journals.items():
|
for journal_name, path in plain_journals.items():
|
||||||
print_msg(
|
print_msg(
|
||||||
|
|
Loading…
Add table
Reference in a new issue