2fa

command
v0.0.0-...-7cd6aa1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2019 License: MIT Imports: 9 Imported by: 0

README

2fa

Terminal-based replacement for Google Authenticator

Basics

Just like Google Authenticator, 2fa uses time-based one-time passwords with 30 second windows and SHA1 hashing.

Installation

$ go get github.com/tristanwietsma/otp/2fa

Usage

Initialize
$ 2fa init

This will create a TOML configuration in your home directory.

$ cat ~/.2fa.toml 
# totp configuration
#
# Example:
#
# [key.label]
# issuer = "The Issuer"
# secret = <Base32 encoded secret key>
Configure

Add your keys to the configuration.

For example, suppose your Base32 encoded GitHub 2-factor key is MFRGGZDFMZTWQ2LK. You might add the following group to your config:

[key.gh]
issuer = "GitHub"
secret = "MFRGGZDFMZTWQ2LK"

In this example, we gave the key is short label ("gh"). This will make normal usage easier.

List Keys
$ 2fa list
Label   Issuer
--------------
gh      GitHub
Calculate the code
$ 2fa calc gh
814498 (16 seconds)

Contributions

For my purposes, the tool is complete. However, if you see opportunities for expansion beyond Google's default behavior, please send me pull requests for review. As 2-factor authentication becomes more prevalent and evolves with security trends and implementations, these defaults may require more flexibility.

Documentation

Overview

Command 2fa is a terminal-based replacement for Google Authenticator

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL