Skip to content

Two-Factor Authentication CLI for macOS and Linux.

License

Notifications You must be signed in to change notification settings

susumuota/twofa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TwoFA: Two-Factor Authentication CLI

Two-Factor Authentication CLI for macOS and Linux.

twofa

Install

node -v  # I have tested with v18.14.1
git clone https://github.com/susumuota/twofa.git
cd twofa
npm ci
npm run build

Usage

Add secret of two-factor authentication

Add base32 encoded secret string (e.g. JBSWY3DPEHPK3PXP) to your keychain application. You can see the secret string when you add the QR code to your two-factor authentication application. username and servicename must be alphanumeric.

  • for macOS, use security command.
security add-generic-password -a username -s servicename -T "" -w
  • for Linux, use pass. pass is a command line password manager.
pass insert servicename/username
  • for Windows, use cmdkey command. (WIP, adding secret is done but retrieving secret is not implemented yet)
cmdkey /generic:servicename /user:username /pass

Show help

node dist/twofa.mjs -h

Usage: twofa [-h] [-a account] [-s service] [-n num]

Options:
  -h, --help      Show this help message and exit.
  -a, --account   Account name.
  -s, --service   Service name.
  -n, --num       Number of codes to generate. Default is 1.

Generate codes

  • Generate two-factor authentication codes, current one and next one.
node dist/twofa.mjs -a username -s servicename -n 2

twofa

Related Links

License

MIT, see LICENSE file.

Author

Susumu OTA

Releases

No releases published

Packages

No packages published