Skip to content

Commit

Permalink
fix mypy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
blankdots committed Sep 1, 2022
1 parent b1747aa commit d60495f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crypt4gh_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
from tkinter.scrolledtext import ScrolledText
from functools import partial
from platform import system
from typing import Optional, Union
from io import BufferedWriter, BufferedReader

from nacl.public import PrivateKey
from crypt4gh.keys import c4gh, get_private_key, get_public_key
Expand Down Expand Up @@ -144,9 +146,10 @@ def open_file(self, action: str) -> None:
else:
print(f"Unknown action: {action}")

def password_prompt(self, action: str) -> None:
def password_prompt(self, action: Optional[str]) -> None:
"""Ask user for private key password."""
password1 = password2 = ""
password1: Optional[str] = ""
password2: Optional[str] = ""
if action == "generate":
# Passphrase for private key generation
password1 = askstring("Private Key Passphrase", "Private Key Passphrase", show="*")
Expand Down Expand Up @@ -204,6 +207,7 @@ def password_prompt(self, action: str) -> None:
if private_key is not None:
their_key = get_public_key(self.their_key_value.get())
print("Encrypting...")
encrypted_file: Union[BufferedWriter, BufferedReader]
original_file = open(self.file_value.get(), "rb")
encrypted_file = open(f"{self.file_value.get()}.c4gh", "wb")
encrypt([(0, private_key, their_key)], original_file, encrypted_file)
Expand Down

0 comments on commit d60495f

Please sign in to comment.