How b1tw1z/password-manager works
Main Components
• User Interface (UI) Layer: Represented by the Tkinter components—main window, labels, text fields (for website, email, and password), buttons (Generate Password, Add, Search) and a Canvas for the logo.
• Business Logic / Domain Services: This includes the core functionalities such as:
• Password Generation (generatePass): Combines random letters, numbers, and symbols, shuffles them, and uses the pyperclip to copy the result to the clipboard.
• Password Searching (searchPass): Reads from the JSON file, checking if the given website exists and then displays the stored email and password.
• Password Saving (savePass): Validates input, confirms the save operation, and writes the password data into the JSON file.
• Data Persistence Layer: The JSON file (“passwords.json”) which acts as the storage medium for all password entries.
Relationships and Interactions
• The UI Layer communicates with the Business Logic Layer by invoking commands when buttons are clicked.
• The Business Logic Layer interacts with the Data Persistence Layer:
• For saving new data (write/update operations on passwords.json),
• For retrieving saved data to support password search.
Architectural Patterns and Design Principles
• Separation of Concerns: Even though the entire application is in one file (main.py), conceptually separate the UI components from the business logic (password generation, saving, searching) and the data storage.
• Exception Handling: Identify how the application manages errors (for example, handling FileNotFoundError when the JSON file doesn’t exist).
• Event-Driven Flow: UI actions (button clicks) trigger specific functions (commands) in an event-driven manner.
Relevant Technologies and Libraries
• Tkinter: For building the graphical user interface.
• json: For encoding and decoding JSON data.
• random: For generating the various components of the password.
• pyperclip: For copying generated passwords to the clipboard.
Putting It All Together
• Sketch the overall flow:
• From here, illustrate how generatePass creates a password and triggers a copy to the clipboard.
• Link searchPass and savePass to the JSON file, showing exception handling if the file is not present.