Bare bones RFC4226 / RFC6238 implementation
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Wijnand Modderman-Lenstra b6cf3cc724 Add YubiKeys support hace 2 meses
cmd/totp Initial import hace 2 años
yubikey Add YubiKeys support hace 2 meses
.gitignore Initial commit hace 2 años
LICENSE Initial commit hace 2 años
README.md Cleanup hace 2 años
otp.go Initial import hace 2 años

README.md

otp

Bare bones RFC4226 / RFC6238 implementation.

Installation

Install Go and install the package:

go get -u maze.io/otp.v1/...

And build it:

go build maze.io/otp.v1/cmd/totp

Now place the totp binary in your $PATH.

Tokens from (go)pass

For base32-encoded secrets stored in (go)pass, it’s easy to generate tokens:

gopass path/to/totp | totp

Example

An example using dmenu en xdotool may look like:

SECRET=$(gopass list | grep 'totp' | dmenu)
if [ -n $SECRET ]; then
    (echo -n "type "; gopass "$SECRET" | totp) | xdotool -
fi

Usage

The following flags are available to the totp command:

-digits int
  	number of output digits (default 6)

-encoding string
  	secret encoding (default "base32")

-period int
  	period (default 30)

The following encodings are supported:

base32  RFC4648 base32 encoding (default)
base64  RFC4648 base64 encoding
hex     Hexadecimal encoding (each byte is encoded as two hex nibbles)
ascii   Secret is used as-is