A small CLI to manage your 2FA tokens and secrets. It comes with very basic encryption, a TOTP generator, automatic copy-to-clipboard, and the ability to manage up to 999 secrets.
As of right now, I have decided not to use any package managers. This may come at a later date. For now, the CLI will have to manually be added to your PATH.
###Dependencies:
- Python 3.10 or higher
- pip 22.0 or higher
Click the green 'Code' button and select 'download ZIP'
Extract the archive
Open the archive in your terminal. Run pip install -r requirements.txt
Linux & Mac: Drop the file "2fa" into your $PATH (that is ANY directory that is returned from echo $PATH
. /usr/bin recommended)
Windows: N/A
Run 2fa -h anywhere to confirm you've installed the package correctly.
Entry point. Does nothing without a subcommand or flag.
Argument | Description |
---|---|
get | Retrieves a TOTP token for the current time |
ls | List all 'secret' identifiers |
add | Add a new secret |
delete | Delete a secret |
-h, --help | Help |
Example:
2fa -h
Retrieve a TOTP token for the current time.
Argument | Type | Description |
---|---|---|
name | String | What secret to use to generate the token |
-c, --copy | Toggle | Determines whether code is copied to clipboard : default: False |
-h, --help | Toggle | Help / Command Docs |
Example:
2fa get discord -c
Lists all 'secret' identifiers.
Argument | Type | Description |
---|---|---|
-h, --help | Toggle | Help / Command Docs |
Example:
2fa ls
Add a new secret.
Argument | Type | Description |
---|---|---|
name | String | What secret to use to generate the token |
secret | String | The secret provided by an external service. |
-h, --help | Toggle | Help / Command Docs |
Example: (not a real key)
2fa add discord SRSHY6GPEHPU0ZYW
Deletes a secret.
Argument | Type | Description |
---|---|---|
name | String | What secret to delete [by identifier] |
-h, --help | Toggle | Help / Command Docs |
2fa delete discord
This script will create a small 2FA file in your home path. Your (encrypted) secrets are stored here.
I have not yet implemented a configuration file. But at the beginning of the 2fa file, there are a few keys you can change.
Key | Type | Description |
---|---|---|
secret_dir | path, absolute | What dir the .2fa file will go in. ! If you already have a .2fa file, you will need to migrate it manually. Default: ~ |