Video Demo: https://www.youtube.com/watch?v=5ypJnQQGy10
Pass Locker solves a common problem "digital detoxers" face today. Social media applications are made to be quite addictive, by "hijacking" people's dopamine system in order for them to remain on their platforms for longer periods of time (thus making more money). As a result, many people today have developed an addiction to such social media applications and thus use app blocking applications on their devices to block themselves from using social media apps like Tik Tok and Instagram. They use such apps because they lack the will power to prevent themselves from using social media themselves. The problem with these app blockers is they require a password in order to setup/activate a block. The issue with that is, if you know the password (since you set it), you can just unlock it at anytime easily. Many people therefore don't have the willpower to prevent themselves from disabling an active block. So many of these blocker applications suggest you have a trusted friend/family member set up the password for you which is very inconvenient and also can be embarrassing!
Pass Locker therefore, allows you to set a long and complicated password for your blocker that you won't remember, paste it into our software and set the duration to which you want the password to be locked for. As a result, you don't need anybody to set the password for you! You can do it entirely yourself. Your password will be inaccessible for the duration you set, and only after that specified duration, is the password revealed and thus, you can deactivate your blocking software.
DATABASE FILE
The sqlite3 database contains 2 tables, passwords and users. Passwords, as the name implies stores the passwords users wish to lock (not their user password for login) as well as the date/time of which the password will be unlocked (which is used in app.py). The user table just contains basic registration/user data such as email, username, login password. I link the passwords in the password table to the users table through the user_id column so each password can be associated with a user.
APP.PY
This file contains all of the logic of the application. Primarily, it contains an encryption function (caesar encryption, using ascii values) and a decryption function which is applied to each new password the user locks. It also checks if a locked password should be unlocked by checking if the lock duration set by the user (stored in the passwords table) for each password has been expired. It also only allows numbers or letters to be used in locked passwords as I encountered some issues with encryption if I didn't add this validator. Also, when a user registers, they are automatically assigned an encryption key from 1 to 4 that is used to encrypt and decrypt their locked passwords.
TEMPLATES
Here lies all of the templates I use to generate pages, using flask with Jinja. Most notably is the index.html template. Here, I let users add a new password using an html form, view their locked passwords (interacts with app.py to check if password is locked) and their unlocked passwords. It also has buttons in the "unlocked passwords" table including "reveal" and "delete" which do what their names imply. The delete button is a form which interacts with the server and deletes the password entirely from the passwords table. The reveal button interacts with the script.js file to dynamically change the html on the page to show the decrypted password. For the design, I used the DaisyUI CSS framework instead of Bootstrap as I like their design more and it's also much easier than doing raw css.
SCRIPT.JS
This file contains the code that allows a user to reveal their unclocked passwords. I do this by adding an event listener on each of the "reveal" buttons in the "/" route. The event listener listens for a click on any of the reveal buttons, and if such event is triggered, then the password is revealed. It does this by grabing the value of the reveal button, in which I store the decrypted password in it's button element. It then takes that value, and places it in it's respective tr elements cell that has the class of "password-cell", which previously contained black dots amounting to the length of the locked password. This is definitely not the most secure way of doing things, but nonetheless it's functional.