README

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

Documentation

Overview

    Package otp is a bare bones RFC4226 / RFC6238 implementation.

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func HOTP

    func HOTP(secret []byte, counter int64, size int) string

      HOTP generates a HMAC-based One-Time Password

      func TOTP

      func TOTP(secret []byte, period, size int) string

        TOTP generates a Time-based One-Time Password

        Types

        This section is empty.

        Source Files

        Directories

        Path Synopsis
        cmd