authenticatorcli

package module
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 0 Imported by: 0

README

Authenticator

GitHub Releases Build Status Go Report Card GoDevDoc Donate

CLI tool for managing and generating one-time passwords for multiple accounts.

Prerequisites

  • Go >= 1.22
Keyring

Support OS X, Linux/BSD (dbus) and Windows.

OS X

The OS X implementation depends on the /usr/bin/security binary for interfacing with the OS X keychain. It should be available by default.

Linux and *BSD

The Linux and *BSD implementation depends on the [Secret Service][SecretService] dbus interface, which is provided by GNOME Keyring.

It's expected that the default collection login exists in the keyring, because it's the default in most distros. If it doesn't exist, you can create it through the keyring frontend program Seahorse:

  • Open seahorse
  • Go to File > New > Password Keyring
  • Click Continue
  • When asked for a name, use: login

Install

You can download the latest stable version or the nightly build (edge version).

Once downloaded, the binary can be run from anywhere. Ideally, though, you should move it into your $PATH for easy use. /usr/local/bin is a popular location for this.

To update the tool to the newest version, run authenticator self-update.

Install from source

If you have go installed, you can run the following command to install the latest version:

$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/nhatthm/authenticator-cli/HEAD/install.sh)"

The binary will be installed to $GOBIN or $GOPATH/bin (when $GOBIN is empty) directory. If you don't know where it is, you can run go env to find out.

In order run the binary from anywhere, the $GOBIN or $GOPATH/bin directory should be added to your $PATH.

Usage

Add a new account

Run authenticator account add to add a new account. If you don't specify the namespace, the tool will ask you to input it.

If you have a QR code, you can use --qr flag to tell the tool to scan the QR code. Otherwise, input the account and the totp secret manually.

$ authenticator account add -h
Add an account

Usage:
  authenticator account add [-n <namespace>] [--qr </path/to/qr-code-image>] [flags]

Flags:
  -h, --help               help for add
  -n, --namespace string   namespace
      --qr string          qr code

Global Flags:
  -d, --debug     debug output
  -v, --verbose   verbose output
Generate an OTP

After adding an account, you can generate an OTP by running authenticator otp <namespace> <account>. For example:

$ authenticator otp -n demo john.doe@example.com
103281

If you want to generate and copy the OTP to the clipboard, use the --copy flag, for example:

$ authenticator otp -n demo john.doe@example.com --copy

[!TIP] You can add an alias to your shell startup file, such as .bashrc or .zshrc, to make it easier to use. For example:

alias cotp='authenticator otp demo john.doe@example.com --copy'

Later, you can just run cotp to generate and copy the OTP to the clipboard.

If your terminal allows you to customize the shortcuts, you can also create a shortcut for the alias

image

Examples

Manually input all the information

demo 1
Manually input all the information

Scan a QR code

Example QR code:

qr
totpauth://otp/john.doe%40example.com?secret=NBSWY3DP&issuer=example.com

demo 2

Donation

If this project help you reduce time to develop, you can give me a cup of coffee :)

Paypal donation

paypal

       or scan this

Documentation

Overview

Package authenticatorcli is the main package of the authenticatorcli.

Directories

Path Synopsis
cmd
authenticator
Package main provides the entry point of the application.
Package main provides the entry point of the application.
internal
app
Package app provides functionalities to run the application.
Package app provides functionalities to run the application.
sudo
Package sudo provides functionalities to check if the current user can run sudo.
Package sudo provides functionalities to check if the current user can run sudo.
updater
Package updater provides functionalities to update the binary to the latest version.
Package updater provides functionalities to update the binary to the latest version.
version
Package version provides a version information writer.
Package version provides a version information writer.

Jump to

Keyboard shortcuts

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