Giter Club home page Giter Club logo

tiffy's Introduction

Small zero-dependencies vanilla module to generate and verify and two factor auth tokens and secrets, for convenient use with most common auth apps like google authenticator.

usage sample for quick roundtrip ( we generate a random secret, use chart.googleapis to display it as a qr code and then spew out current time based code every 10 seconds ):

import {
  generateSecret,
  encodeReadableSecret,
  generateTOTPuri,
  totpGenerate
} from 'tiffy';


const secret = generateSecret();
const readableSecret = encodeReadableSecret( secret );
const uri = generateTOTPuri( readableSecret, 'maxwellium', 'tiffy' );


console.log( 'readable secret:', readableSecret );

console.log(
  `https://chart.googleapis.com/chart?cht=qr&chl=${ encodeURIComponent( uri ) }&chs=256x256`
);
console.log( 'scan it with your authenticator app to test it' );

console.log( totpGenerate( secret ) );


setInterval( () => console.log( totpGenerate( secret ) ), 10000 );

Copyright (c) 2019 Max Dancau

License MIT

tiffy's People

Contributors

maxwellium avatar

Stargazers

 avatar Pedram avatar Matt Miller avatar

Watchers

James Cloos avatar  avatar

Forkers

vegarringdal

tiffy's Issues

ERR_MODULE_NOT_FOUND

Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'B:\npm\node_modules\tiffy\build\src\lib\util' imported from B:\npm\node_modules\tiffy\build\src\index.js

image

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.