hotp-totp-cli

HMAC-Based One-Time Password (HOTP) and Time-Based One-Time Password (TOTP) Command Line Interface

Usage no npm install needed!

<script type="module">
  import hotpTotpCli from 'https://cdn.skypack.dev/hotp-totp-cli';
</script>

README

HOTP TOTP CLI

npm npm license npm downloads

HMAC- and Time-Based One-Time Password (HOTP / TOTP) Command Line Interface

Install via npm

$ npm install --global hotp-totp-cli

Will install two CLI utilities, hotp and totp.

Usage

The key can be either a base32 (RFC 3548) encoded string, or an optauth: URI in Key URI Format

totp

Usage: totp [options] <key>

Options:

  -d, --digits       Number of passcode digits to generate [6-10] (Default: 6)
  -a, --algorithm    HMAC algorithm to use (Default: sha1)
  -p, --period       Seconds the passcode is valid for (Default: 30)
  -t, --time         Time for which to calculate the passcode
  -e, --epoch        T-0

  -h, --help
  -v, --version

hotp

Usage: hotp [options] <key>

Options:

  -c, --counter      Counter value to calculate the passcode for
  -a, --algorithm    HMAC algorithm to use (Default: sha1)
  -d, --digits       Number of passcode digits to generate [6-10] (Default: 6)

  -h, --help
  -v, --version

Examples

Publishing to npm

Avoid manually typing your OTP token with a CLI credential manager (i.e. pass):

npm publish --otp $( totp $( pass 2fa/npm.key ) )

NOTE: This is probably a bad idea if your GPG passphrase is stored anywhere else except your head.