GithubHelp home page GithubHelp logo

magalhini / totp-seed-cli Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 18 KB

Generate one-time codes (OTP) directly from the shell and into your clipboard.

JavaScript 100.00%
cli cli-tool otp totp totp-generator

totp-seed-cli's Introduction

TOTP Seed CLI

Given a TOTP seed, you can generate one-time passcodes on your CLI, also receiving the time remaining for a particular code. Passing the -c option will also immediately copy it to the clipboard.

topt-seed-cli -s BD6ZWNRLEOG5JUQHC2YW6BXX2K675AZX


   ╔════════════╗
   ║            ║
   ║   047232   ║
   ║            ║
   ╚════════════╝

9 seconds remaining for this code.

tl;dr

  1. Install it globally using npm i -g totp-seed-cli.
  2. Pass it a seed and use the optional -c flag to copy the code to your clipboard: totp -s ABCDEFGH -c.
  3. Pass the optional -w if you'd like it to generate another code once time expires.

Installing

To use totp locally in your CLI, install it globally using npm:

npm i -g totp-seed-cli

Usage

Use -s to pass in your seed:

totp -s ABCDEFGH

This will output the code to the console.

Copy to clipboard

To display the code and the time remaining, but also copy it to the clipboard, pass -c:

totp -s ABCDEFGH -c

Save seed and read it from local file:

To save the seed in a local file for future use, pass -S

totp -s ABCDEFGH -S

From here on, you can just call totp.

Create an alias for your seed

Using your shell of choice, you can create an alias so you can call this from anywhere without having to pass your seed. If you're using zsh, use your editor to edit your .zshrc:

  1. vi ~/.zshrc

Add an alias with your seed and the copy command, such as:

alias otp="totp -s ABCDEFGH -c"

Save the file and restart your terminal. You can now simply call otp from anywhere.

Acknowledgements: the source for the TOTP Class is entirely sourced from the Blendist's TOTP.io project, which is the web equivalent of this project and where I got the inspiration to do this from.

Requirements

Non-ESM packages specifically to work with node v16.15.0.

totp-seed-cli's People

Contributors

magalhini avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.