You are browsing as a guest. Sign up (or log in) to start making projects!

Tokn - A CLI TOTP app

  • 14 Devlogs
  • 19 Total hours

A CLI app that generates TOTP keys

Ship #1

My project is a CLI app that generates TOTP (Time-based one-time password) codes for authentication to other apps. I built this to make it easier for me and perhaps others when logging in to apps that require TOTP, as reaching for my phone was annoying. To make it secure, I also implemented password encryption to make it safer. Along the way, I learned about the basics of encryption, UI/UX design, and building real projects. I think I will come back to this at some point in the future and improve it even more.

  • 14 devlogs
  • 19h
  • 15.96x multiplier
  • 303 Stardust
Try project → See source code →
Open comments for this post

1h 29m 11s logged

After quite some time of tinkering, I was able to publish my project on PyPI. In the process, I also wrote a readme and recorded a live demo. I believe I can ship now.

0
0
8
Open comments for this post

1h 54m 22s logged

I have polished the get command to make it somewhat more obvious to the user which of the two codes to use based on the amount of time the current one has left. Also, I made it expand the path so as to allow ~ in the QR code image path.

0
0
6
Open comments for this post

1h 35m 11s logged

I figured out how to fix this bug where it would ask the user for the password regardless of whether they used the –help flag or not. This was because I was handling that logic inside the CLI command group, which is how I make the subcommands, but also runs every time a subcommand is run. I fixed this by using a custom decorator for the commands. This will generally be much more flexible because now I can have commands that don’t require a password.

0
0
2
Open comments for this post

1h 40m 26s logged

Nothing too major, as I haven’t had much time to work on the project. Instead of always requiring a subcommand when running the add command, it will default to QR code because that is the most common. Then, the option to add just a normal secret key is –code, and, now, I implemented just getting from an URI. Also, I made it so that the QR and URI inputs will allow the user to override the output because they generally come with the issuer and label.

0
0
1
Open comments for this post

24m 9s logged

I have started working on improving the overall UX of the app. Instead of an init command, it will automatically detect if the user is a new user and run a sort of wizard. It’s still a little wonky, and I will fix that tomorrow, but when it is done the app will be much easier to use.

0
0
1
Open comments for this post

42m 33s logged

I have split the add command into QR and just a regular raw secret key. The QR option only asks for the image path, because the URI should contain the issuer and label. This should increase clarity for the user because it won’t change the arguments passed to the command based on a flag as it did before.

0
0
1
Open comments for this post

3h 7m 50s logged

I switched to using a pyproject.toml file because this will be getting published sometime, and I will probably also use poetry. For the sake of compatibility with the other established TOTP apps, as well as to use the full extent of the TOTP URIs (they contain the issuer and account name already), I decided to divide the keys into issuers and accounts under those issuers. I will work on redesigning the add command to do this. Progress!

0
0
1
Open comments for this post

59m 6s logged

I added a way to get the secret key from a QR code image to make it easier for the user to use. Previously they would have to scan the image themselves and get the code.

0
0
2
Open comments for this post

47m 42s logged

I have polished some of the prompts. The keys file is also stored in a platform-agnostic way (on Linux it will be stored in ~/.local/share/tokn, but on Windows is another location).

0
0
3
Open comments for this post

1h 47m 20s logged

Since last time:

  • The init command initializes a new keys file; I would’ve just made it automatically initiate the process upon any command, but it would’ve made things like the get command a little wonky
  • The list command lists all the keys
  • The passwd command (not shown) changes the password
  • The rm command removes a key
  • I have added input validation to most of the commands now, and I found out how to do aliases

I still need to polish some things, specially the consistency of the vocabulary (keys, services, etc.) and the prompts

0
0
2
Open comments for this post

1h 9m 54s logged

I got the basics of the app working! I can add new secrets and then retrieve them. I decided to show the next code because it doesn’t update automatically (it is meant to be a CLI app), so this will help if the code has a few seconds left. The password also takes a few seconds to verify, so this will prevent having to run it over and over. The next feature is data validation, as it is very basic right now.

0
0
3
Open comments for this post

2h 37m 3s logged

I have the encryption working, so now I can grab the password salt, make the password hash from that, and use it to decrypt the other part of the file. I wrote this little test to showcase it, the key is generated and then I can encrypt and decrypt the file. Next thing to work on is storing the secret keys.

0
0
2

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…