# flowtp

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

Latest version **1.2.0** (published 2018-11-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install flowtp
pnpm add flowtp
yarn add flowtp
bun add flowtp
```

Provides the command `flowtp`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2018-11-01 |
| First published | 2017-12-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 92.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Braden Jonsson |
| Maintainers | braden337 |
| Keywords | totp, otp |

## Links

- npm: https://www.npmjs.com/package/flowtp
- Repository: https://github.com/braden337/flowtp
- Homepage: https://github.com/braden337/flowtp#readme
- Issues: https://github.com/braden337/flowtp/issues
- npm.io page: https://npm.io/package/flowtp

## Dependencies (3)

- [colors](https://npm.io/package/colors.md) ^1.1.2
- [commander](https://npm.io/package/commander.md) ^2.12.2
- [thirty-two](https://npm.io/package/thirty-two.md) ^1.0.2

## Recent versions

- 1.2.0 (latest) — 2018-11-01
- 1.1.22 — 2018-08-21
- 1.1.1 — 2017-12-17
- 1.1.0 — 2017-12-17
- 1.0.1 — 2017-12-17

## README

# Flowtp

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

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](https://tools.ietf.org/html/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`

```javascript
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

```shell
  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.

---
_Source: https://npm.io/package/flowtp · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
