Skip to main content

A command-line tool for managing two-factor authentication (2FA) TOTP codes.

Project description

TFA CLI Tool

A command-line tool for managing two-factor authentication (2FA) TOTP codes.

Why did I build this?

  • I wanted to understand how TOTP codes work. I don't like trusting access to my accounts to a black box which I don't understand.
  • I don't keep my phone with me all the time.
  • I'm worried about losing access to my accounts if I lose my phone.

I feel far more comfortable with TOTP codes now!

Should you use this?

Maybe? This probably isn't best practice for two factor authentication codes. The default assumption is that phones have better security than computers. Depending on how you manage passwords, and access to your e-mail someone with access to your computer probably has the ability to access your accounts.

The secret database is not encrypted. It a simple json file that gets rewritten on every modification. It might lose your secrets. You should keep backups, and probably use the qr code feature to add accounts an authenticator app.

I'm also not a security expert. I'm just a programmer who wanted to understand TOTP. Maybe you should use a standard tool instead.

Use at your own risk.

Installation

pip install tfa

There is no default location for the database because the point is to make secret management less opaque than typical authentication apps. Set a preferred location in your shell configuration.

export TFA_STORAGE_PATH=~/.config/tfa/accounts.json

The secrets are stored in a simple json file with no encryption.

Usage

Add a new account

tfa add <account_name> <secret_key>

# With custom issuer name
tfa add <account_name> <secret_key> --issuer "Custom Name"

# Force overwrite existing account
tfa add <account_name> <secret_key> -f

Get TOTP code

tfa code <account_name>

List accounts

tfa list

Remove account

tfa remove <account_name>

Generate QR Code

Generate a QR code to scan with other authenticator apps:

tfa qr <account_name>

Examples

# Add a new GitHub account
tfa add github JBSWY3DPEHPK3PXP --issuer "GitHub"

# Get current code
tfa code github
# Output: GitHub: 123456

# List all accounts
tfa list
# Output: github

# Generate QR code
tfa qr github

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tfa-0.2.2.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tfa-0.2.2-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file tfa-0.2.2.tar.gz.

File metadata

  • Download URL: tfa-0.2.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.15.0-131-generic

File hashes

Hashes for tfa-0.2.2.tar.gz
Algorithm Hash digest
SHA256 dfaa783b2e031bc04df3df8ca4e248f7b0a11858a2e03fa6e3233aef28784a10
MD5 0c6e6870171078e9b6fd3d97c7855b3c
BLAKE2b-256 de6c5d8e87bf1c0ec93ab242d55581aa3aaa892fe011221904fef3796fbe6dd1

See more details on using hashes here.

File details

Details for the file tfa-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: tfa-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.2 CPython/3.10.6 Linux/5.15.0-131-generic

File hashes

Hashes for tfa-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 db3fdfed8d418aca22dd1272cb542fb0e3b5037e95099980d7b5d7aac966f103
MD5 112337df003d601b2a54ee81d905c109
BLAKE2b-256 e34fb538d4d113e52ba47db0a81720c2a0523a6af47c32163f8f25ed8dbaa7ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page