npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

flowtp

v1.2.0

Published

[![Build Status](https://travis-ci.org/braden337/flowtp.svg?branch=master)](https://travis-ci.org/braden337/flowtp)

Downloads

12

Readme

Flowtp

Build Status

This is a JavaScript class and a command line tool that helps you process and manage Time-Base One Time Passwords (TOTP) that are used for a second factor of authentication in some applications.

Implementing this has helped me better understand bit manipulation.

Implementation

  • follows RFC6238
  • uses a Unix time step of 30 seconds
  • uses SHA1 in the process of calculating the TOTP

Library

Add the library to your package.json with NPM npm install flowtp or Yarn yarn add flowtp

const Flowtp = require('flowtp')

// at this moment, Unix time is 1513304902 so
let now = 1513304902

// create an instance of Flotp
// passing it a base32 encoded secret
let linda = new Flowtp('HELLOWORLD234567')

// if you don't pass it a secret,
// the constructor will generate a
// secret for you and set it as an
// instance variable
let paul = new Flowtp()

paul.secret // 'L6QVQRCVFXXP2T2G'
paul.now()  // '665713'

linda.now()       // '999328'
linda.at(now+30)  // '184569'

linda.verify('999328')           // true
linda.verifyAt('184569', now+30) // true

linda.toString() // '999 328'

Command Line

Install the tool globally with NPM npm install -g flowtp or Yarn yarn global add flowtp

Here are the different options that you can use

  Usage: flowtp [options] <name> [secret]


  Options:

    -V, --version  output the version number
    -l, --list     show all the secrets
    -r, --remove   remove an entry with given name
    -a, --add      add an entry with given name and secret
    -w, --watch    watch TOTPs being generated forever
    -h, --help     output usage information

Once you add some secrets with the -a flag, you can get the current TOTP for that secret by typing flowtp followed by the name of the secret. Add the -w flag and it will loop forever, showing you the new code every 30 seconds. If your terminal supports colors, the current 6 digit code will turn red when it is close to running out of time.