Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ask User to Load a key first #56

Open
TanmayArya-1p opened this issue Dec 16, 2024 · 0 comments · May be fixed by #90
Open

Ask User to Load a key first #56

TanmayArya-1p opened this issue Dec 16, 2024 · 0 comments · May be fixed by #90
Labels

Comments

@TanmayArya-1p
Copy link
Contributor

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>

@anshkarwasra anshkarwasra linked a pull request Dec 17, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants