How to use the jrnl.util.create_password function in jrnl

To help you get started, we’ve selected a few jrnl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jrnl-org / jrnl / jrnl / EncryptedJournal.py View on Github external
def open(self, filename=None):
        """Opens the journal file defined in the config and parses it into a list of Entries.
        Entries have the form (date, title, body)."""
        filename = filename or self.config['journal']

        if not os.path.exists(filename):
            self.create_file(filename)
            self.password = util.create_password(self.name)
            print(f"Encrypted journal '{self.name}' created at {filename}", file=sys.stderr)

        text = self._load(filename)
        self.entries = self._parse(text)
        self.sort()
        log.debug("opened %s with %d entries", self.__class__.__name__, len(self))
        return self
github jrnl-org / jrnl / jrnl / EncryptedJournal.py View on Github external
def from_journal(cls, other: Journal):
        new_journal = super().from_journal(other)
        new_journal.password = other.password if hasattr(other, "password") else util.create_password(other.name)
        return new_journal