2.0.0 • Published 4 months ago

tiffy v2.0.0

Weekly downloads
9
License
MIT
Repository
github
Last release
4 months ago

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

2.0.0

4 months ago

1.0.0

2 years ago

0.4.0

3 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago

0.0.0

5 years ago