Open
Description
if a key is not loaded into PasswordManager and the user tries to perform another task, For instance: creating a password file , An error is thrown and the program exits
Steps to Reproduce:
- Run the program and enter choice 3 without loading a key
PS C:\Users\Tanma\Documents\CodingRepos\PwManager> python main.py
What would you like to do?
1. Create a new key
2. Load an existing key
3. Create a new password file
4. Load an existing password file
5. Add a password
6. Get a password
q. Quit
Enter choice: 3
Key not loaded. Please load a key first.
Invalid choice. Please try again.
Enter choice: 4
Key not loaded. Please load a key first.
Invalid choice. Please try again.
Enter choice: Traceback (most recent call last):
File "C:\Users\Tanma\Documents\CodingRepos\PwManager\main.py", line 59, in <module>
if __name__ == '__main__':
^^^^^^
File "C:\Users\Tanma\Documents\CodingRepos\PwManager\main.py", line 31, in main
while not done:
^^^
KeyboardInterrupt
PS C:\Users\Tanma\Documents\CodingRepos\PwManager> ^C
PS C:\Users\Tanma\Documents\CodingRepos\PwManager> python main.py
What would you like to do?
1. Create a new key
2. Load an existing key
3. Create a new password file
4. Load an existing password file
5. Add a password
6. Get a password
q. Quit
Enter choice: 3
Enter password file path: hello
Traceback (most recent call last):
File "C:\Users\Tanma\Documents\CodingRepos\PwManager\main.py", line 60, in <module>
main()
File "C:\Users\Tanma\Documents\CodingRepos\PwManager\main.py", line 41, in main
pm.create_password_file(path, password)
File "C:\Users\Tanma\Documents\CodingRepos\PwManager\manager.py", line 27, in create_password_file
self.add_password(site, password)
File "C:\Users\Tanma\Documents\CodingRepos\PwManager\manager.py", line 40, in add_password
encrypted = Fernet(self.key).encrypt(password.encode()).decode()
^^^^^^^^^^^^^^^^
File "C:\Users\Tanma\AppData\Local\Programs\Python\Python312\Lib\site-packages\cryptography\fernet.py", line 34, in __init__
key = base64.urlsafe_b64decode(key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Tanma\AppData\Local\Programs\Python\Python312\Lib\base64.py", line 132, in urlsafe_b64decode
s = _bytes_from_decode_data(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Tanma\AppData\Local\Programs\Python\Python312\Lib\base64.py", line 45, in _bytes_from_decode_data
raise TypeError("argument should be a bytes-like object or ASCII "
TypeError: argument should be a bytes-like object or ASCII string, not 'NoneType'
PS C:\Users\Tanma\Documents\CodingRepos\PwManager>