Skip to content

Skarlso/totp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TOTP CLI

A cli TOTP token generator based on RFC-6238. Build Status

Security

This CLI never stores a password. It always asks for one. The password is used to manage multiple accounts and tokens via an AES encrypted account file located next to the binary.

Commands

❯ totp help
totp 1.0
Gergely Brautigam
TOTP Token generator on the command line with AES encrypted account handling.

USAGE:
    totp [SUBCOMMAND]

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

SUBCOMMANDS:
    add         Adds a new account with a TOTP token.
    delete      Delete a given account.
    generate    Generate a new token for a given account.
    help        Prints this message or the help of the given subcommand(s)

Example

First, create an account by using the provided BASE32 encoded TOTP identifier.

❯ totp add
account:
gmail_main
token:
MFZWIZQASDFFSFDSIJAAA=
Password:

Once this is done, you are ready to use the generator to generate a 6 digit token which changes every 30 seconds.

❯ totp generate -a gmail_main
Password:
364898

You can create an alias for that saying something like gmail_main_token.

Tricks

On linux, this also adds the ability to directly pipe the resulting token to clipboard. Ready to be pasted into something else.

gmail_main_token|pbcopy
Password:

Then simply press {CTRL,CMD}+C and voila...

452987

If you are like me and have many tokens for many accounts, it's tedious to constantly enter the account names.

But that's what aliases are for.

Save this into your bash.rc or zshrc or whatever, which will create aliases like gg and wgg for short-codes.

gotp-generate() {
    gotp generate -a $1
}

gg() {
    gotp-generate personal.gmail
}

wgg() {
    gotp-generate work.gmail
}

Compliance to RFC

This generator is in full compliance to the RFC described here: RFC-6238. Note: With the expection that right now times, and methods are not configurable. That is in the ROADMAP.

Unit Tests

I know, they are missing. And in the works. I'm still learning Rust. Now there are unit tests!

Contributions

Are welcomed.

About

Totp CLI in rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages