tiffy
    TypeScript icon, indicating that this package has built-in type declarations

    0.4.0 • Public • Published

    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

    Install

    npm i tiffy

    DownloadsWeekly Downloads

    5

    Version

    0.4.0

    License

    MIT

    Unpacked Size

    27.2 kB

    Total Files

    35

    Last publish

    Collaborators

    • maxwellium