9 releases

0.2.6 Mar 30, 2024
0.2.5 Mar 30, 2024
0.2.3 Sep 16, 2022
0.2.2 Jun 17, 2022
0.1.1 Nov 4, 2020

#95 in Authentication

Download history 40/week @ 2024-07-30 18/week @ 2024-09-24 3/week @ 2024-10-01

271 downloads per month

MIT license

20KB
394 lines

Yayo

Latest Version Downloads License Continuous Integration Status

A command line interface (CLI) used to manage and generate OTP (one time password) codes for your various accounts.

Installation

Install using cargo:

cargo install yayo

Pre-compiled Binaries

An alternative method is to download and run the pre-compiled binaries:

https://github.com/nickjer/yayo/releases

Usage

Check the help (--help) for details on using this tool:

Manage and generate OTP (one time password) codes

Usage: yayo <COMMAND>

Commands:
  add         Add a new account
  completion  Output shell completion
  delete      Delete an account
  list        List all accounts
  view        View the code for an account
  help        Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

Add Account

The add subcommand is used to add an account:

Add a new account

Usage: yayo add [OPTIONS] <ACCOUNT> <SECRET>

Arguments:
  <ACCOUNT>  Name of the account
  <SECRET>   Secret key used to generate code

Options:
  -a, --algorithm <ALGORITHM>  Algorithm used to generate code [env: YAYO_ALGORITHM=] [default: SHA1] [possible values: SHA1, SHA256, SHA512]
  -d, --digits <DIGITS>        Number of digits composing code [env: YAYO_DIGITS=] [default: 6]
  -s, --step <STEP>            Duration in seconds of step [env: YAYO_STEP=] [default: 30]
  -h, --help                   Print help

Note: For added security it stores all secrets in your operating system's local keyring.

Example: Add your GitHub account with provided secret (XXXXXXX):

yayo add github XXXXXXX

Although it is not recommended, you can alter any of the arguments used in the OTP code generation (algorithm, digits, and step) as command line options or through environment variables.

Delete Account

The delete subcommand is used to delete a previously added account:

Delete an account

Usage: yayo delete <ACCOUNT>

Arguments:
  <ACCOUNT>  Name of the account

Options:
  -h, --help  Print help

Example: Delete the previously added GitHub account:

yayo delete github

List All Accounts

The list subcommand is used to list all available accounts and their provided configurations:

List all accounts

Usage: yayo list

Options:
  -h, --help  Print help

View Account

The view subcommand is used to output the OTP code generated for the requested account:

View the code for an account

Usage: yayo view <ACCOUNT>

Arguments:
  <ACCOUNT>  Name of the account

Options:
  -h, --help  Print help

Example: View the OTP for the GitHub account:

$ yayo view github
389200

Command Completion

The completion subcommand is used to output a shell script used to support command completion for this binary:

Output shell completion

Usage: yayo completion <SHELL>

Arguments:
  <SHELL>  Name of the shell [possible values: bash, elvish, fish, powershell, zsh]

Options:
  -h, --help  Print help

Example: Output command completion for the fish shell:

yayo completion fish | source

Now you can use tab-completion with yayo.

Linux (Gnome) - Keyboard Shortcut to Clipboard

This is a simple walkthough on setting up the F12 key to populate the clipboard with the OTP code. This makes logging into GitHub or any other service as simple as pushing F12 and pasting the contents of the clipboard into the 2FA input.

  1. You will need xsel or some other CLI that can read the contents of STDOUT to the clipboard:

    sudo apt install -y xsel
    
  2. If using Gnome 3 you can just open the control center and navigate to the "Keyboard Shortcuts" with:

    gnome-control-center
    
  3. Scroll to the bottom and set a "Custom" keyboard shortcut with the following options:

    Name: OTP (GitHub) Command: sh -c '~/bin/yayo view github | xsel --primary' Shortcut: F12

Dependencies

~7–15MB
~292K SLoC