Skip to content
/ tok Public

Two-factor authentication (2FA) command-line utility. You can use this instead of a mobile app.

License

Notifications You must be signed in to change notification settings

avahidi/tok

Repository files navigation

tok

tok is a two-factor authentication (2FA) command-line utility. You can use it instead of a mobile app to generate 2FA tokens.

Usage

Add a token:

$ tok add
Enter name: gibsons
Enter secret: VBWA FMHK U522 CBPO
Enter note:
Please enter database password: *****

Token 'gibsons', added 2025-01-01 00:00:00
123 456

Use a token:

$ tok gibsons
Please enter database password: *****

Token 'gibsons', added 2025-01-01 00:00:00:
123 456

Adding and exporting tokens using the key-uri format:

$ tok import "otpauth://totp/gibsons?secret=VBWAFMHKU522CBPO&issuer=issuer&algorithm=SHA1&digits=6&period=30"
...
$ tok export gibsons
  1 - otpauth://totp/gibsons?secret=...

How to install

Build from source code:

sudo apt install golang
go install github.com/avahidi/tok@latest

This will install tok to your ~/go/bin/ folder.

Security note

The tok security strategy is quite simple:

  • tok is a minimal Go implementation of RFC 6238 (TOTP).
  • tok does not use any third-party libraries.
  • The database is GCM-AES-256 encrypted.
  • The encryption key is derived using PBKDF2-SHA-256 with a 256-bit salt.

Note that it is generally advised against storing both passwords and 2FA tokens on the same computer.

On a possibly related note, "tok" is not only shorthand for "token" but also the Swedish word for "fool"...

License

This project is licensed under the GNU General Public License version 2. See the LICENSE file for details.

About

Two-factor authentication (2FA) command-line utility. You can use this instead of a mobile app.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors