aboutsummaryrefslogtreecommitdiff

twofa

A terrible, should-not-be-used, wrote-it-for-fun-and-learning 2fa authenticator.

Requirements

twofa requires the base32 and optimist gems.

Clipboard

For clipboard tasks, twofa requires the clipboard gem, and either the xclip or xsel application.

Usage

$ twofa -h
twofa is a command line OTP code generator.

Usage:
  twofa [opts] ISSUER

where [opts] are:
  -n, --no-clip           Do not copy code to the clipboard
  -t, --twofa-file=<s>    Location of the twofa secrets file (default: /home/nl987/.twofa)
  -v, --version           Print version and exit
  -h, --help              Show this message

twofa secrets file

The twofa secrets file is normally found at ~./twofa, and each record has the following fields. If any of the optional fields are given, all preceeding optional fields must also be given.

If a HOTP code is requested, the file will be canoncalised.

Each issuer should appear on it’s own line with the following format:

[*]Method Issuer Secret [TDC [Length [Hash]]]

Required fields

Method
The OTP type, currently totp or hotp. Optionally, prefixing the method with an asterisk specifies this is the default issuer to be used if one is not specified on the command line.
Issuer
Human name to identify this issuer.
Secret
The BASE32 shared secret.

Optional fields

TDC
Either the time delta (for TOTP) or counter (for HOTP). The former defaults to 30 if not given, the latter to 0.
Length
The output code length. Defaults to 6 digits.
Hash
The algorithm used to generate the HMAC hash. Defaults to sha1.