diff --git a/libpkpass/identities.py b/libpkpass/identities.py index 5cc2fa1..cc1eaf2 100644 --- a/libpkpass/identities.py +++ b/libpkpass/identities.py @@ -1,7 +1,7 @@ """This Module handles the identitydb object""" import os import tempfile -import threading +from threading import Thread import libpkpass.crypto as crypto from libpkpass.errors import FileOpenError, CliArgumentError @@ -78,15 +78,12 @@ def load_certs_from_directory(self, if certpath: self._load_from_directory(certpath, 'certificate') if verify_on_load: - x_ls = self.iddb.keys() - thread_list = [] - results = [] - for username in x_ls: - thread = threading.Thread(target=self.verify_identity, args=(username, results)) - thread_list.append(thread) - for thread in thread_list: - thread.start() - for thread in thread_list: + threads = [] + for identity, _ in self.iddb.items(): + threads.append(Thread(target=self.verify_identity, + args=(identity, []))) + threads[-1].start() + for thread in threads: thread.join() ####################################################################### diff --git a/libpkpass/password.py b/libpkpass/password.py index b04a7ca..668ae36 100644 --- a/libpkpass/password.py +++ b/libpkpass/password.py @@ -8,7 +8,7 @@ import libpkpass.crypto as crypto ####################################################################### -class PasswordEntry(object): +class PasswordEntry(): """ Password entry object. Contains information about a password and related metadata, as well as a list of individually encrypted strings""" ########################################################################## @@ -110,10 +110,10 @@ def add_recipients( ####################################################################### if recipients is None: recipients = [] - for recipient in recipients: - self.recipients[recipient] = self._add_recipient(recipient, secret, distributor, - identitydb, encryption_algorithm, passphrase, - card_slot) + + self.recipients = {r:self._add_recipient( + r, secret, distributor, identitydb, encryption_algorithm, passphrase, card_slot + ) for r in recipients} if escrow_users: #escrow_users may now be none after the set operations if (len(escrow_users) > 3) and (len(list((set(escrow_users) - set(recipients)))) < 3): @@ -145,7 +145,8 @@ def _add_recipient( identitydb=None, encryption_algorithm='rsautl', passphrase=None, - card_slot=None): + card_slot=None, + ): """Add recipient or sharer to list""" ####################################################################### try: diff --git a/libpkpass/passworddb.py b/libpkpass/passworddb.py index 1d6b611..d9879a9 100644 --- a/libpkpass/passworddb.py +++ b/libpkpass/passworddb.py @@ -5,7 +5,7 @@ from libpkpass.errors import PasswordIOError ############################################################################## -class PasswordDB(object): +class PasswordDB(): """ Password database object. Gets and retrieves password entries from places passwords are stored""" ##############################################################################