a2fa

module
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: Apache-2.0

README

a2fa

a2fa is a command line tool for generating and validating one-time password.

Introduction

a2fa means annoying two-factor authentication. Its purpose is to get rid of phones and be able to authenticate easily. It keeps synced with Google Authenticator, Microsoft Authenticator.

Description:

  • An easy-to-use substitute for 2FA apps like TOTP Google authenticator.
  • Supports the OATH algorithms, such TOTP and HOTP.
  • No need for network connection.
  • Time sync feature included.
  • No need for phone.

Installation instructions

Linux

Download precompiled binary from release page.

Unzip the download and cd to the extracted folder.

tar -zxf a2fa_Linux_x86_64.tar.gz
cd a2fa_Linux_x86_64

Copy binary file

sudo cp a2fa /usr/bin/
sudo chown root:root /usr/bin/a2fa
sudo chmod 755 /usr/bin/a2fa
macOS

Download precompiled binary from release page.

Unzip the download and cd to the extracted folder.

tar -zxf a2fa_Darwin_x86_64.tar.gz
cd a2fa_Darwin_x86_64

Move a2fa to your $PATH.

sudo mkdir -p /usr/local/bin
sudo mv a2fa  /usr/local/bin/
Windows

Download precompiled binary from release page. Open this file in the Explorer and extract a2fa.exe. a2fa is a portable executable so you can place it wherever is convenient. Open a CMD window (or powershell) and run the binary.

Usage

a2fa [command] [flags] [args]
Available Commands:
  add         Add account and its secret key
  completion  Generate the autocompletion script for the specified shell
  generate    Generate one-time password from secret key
  help        Help about any command
  list        List all added accounts and password code
  remove      Remove account and its secret key
  update      Add account and its secret key
  version     show version
a2fa generate [flags] <secret key>
a2fa add [flags] <account name> <secret key>
a2fa remove [flags] <account name> <account name>...
a2fa update [flags] <account name> <secret key>
a2fa list [flags] [account name] [account name]...

Commonly used flags

Flags:
  -b, --base32         use base32 encoding of KEY instead of hex, (default=true) (default true)
  -c, --counter int    used for HOTP, A counter C, which counts the number of iterations
  -e, --epoch int      used for TOTP, epoch (T0) which is the Unix time from which to start counting time steps (default is 0),
  -H, --hash string    A cryptographic hash method H (default is SHA-1) (default "SHA1")
  -h, --help           help for update
      --hotp           use event-based HOTP mode (default is false)
  -i, --interval int   used for TOTP, an interval (Tx) which will be used to calculate the value of the counter CT (default is 30 seconds). (default 30)
  -l, --length int     A HOTP value length d (6–10, default is 6, and 6–8 is recommended) (default 6)
      --totp           use use time-variant TOTP mode (default is true) (default true)

Examples

Generate code
a2fa generate [flags] <secret key>

Examples:

a2fa generate ADOO3MCCCVO5AVD6

Output: Code: 488821

Show flags and usage:

a2fa generate -h
Add account
a2fa add [flags] <account name> <secret key>

Examples:

a2fa add GitHub ADOO3MCCCVO5AVD6

Output: account added successfully

Show flags and usage:

a2fa add -h
Remove accounts
a2fa remove [flags] <account name> <account name>...

Examples:

a2fa remove GitHub

Output: accounts deleted successfully

Update acccount
a2fa update [flags] <account name> <secret key>

Examples:

a2fa update GitHub 5BRSSSBJUWBQBOXE

Output: account updated successfully

Show flags and usage:

a2fa update -h
List acccount
a2fa list [flags] [account name] [account name]...

Examples:

a2fa list

Output:

0. GitHUb 414033
0. Google 337590
0. Microoft 54936
0. Apple 70362

Reporting issues

If you encounter any problems, you can open an issue in our bug tracker, please fill the issue template with as much information as possible.

Contributing

Refer to CONTRIBUTING.md

License

Apache License 2.0, see LICENSE.

Directories

Path Synopsis
cmd
internal
fs

Jump to

Keyboard shortcuts

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