
CS 109 Challenge | Artur B. Carneiro
Type your password 3 times
Safe Login is an concept, open-source project designed for CS 109: Probability for Computer Scientists, the coolest class at Stanford University. The aim of the API is to allow website developers to improve the security of their signin systems. The aim of the API is not to replace already established protocols. Instead, it serves as an additional layer to the authentication flow.
The API registers the user's keystroke distance values when they type their password and saves this historical data. Later, when the user types their password again, the API checks the new datapoints against the historical data and returns the probability that the person behind the computer is who they say they are. With this information, the developer can choose to trigger an additional authentication step (e.g., MFA), send an e-mail about suspecious activity, etc.
First, import the library and initilize the SafeLogin class:

Next, capture the they keystroke length distance values when the user types in their password:

When a user tries to login, verify that they are the true account owner by calling the verifyUser function. This function should return a probability (a number between 0 and 1):

We with ❤️ by Artur B. Carneiro. Lock logo made using DALL-E 2.