Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

weav-totp

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

weav-totp

Typescript TOTP implementation

latest
Source
npmnpm
Version
0.9.91
Version published
Maintainers
1
Created
Source

weav-totp

NPM

Description

  • Verify 6-digit time-based one time password authentication, as used in applications like google authenticator.
  • Create Base32 secrets used by google authenticator to generated the 6 digit OTP.
  • Get link to Charted QRCode from google charts. Can be used in webpages etc for applications like google auth.

Usage

Install in your project:

npm i weav-totp

Creating secrets:

import { TOTP } from 'weav-totp';

TOTP.create('<unique string to user>', '<unique string to you>')
    .then((secret) => {
        // do stuff with secret
    }, (err) => { })

Verifying 6-digit OTP:

import { TOTP } from 'weav-totp';

TOTP.verify('<user secret>', OTP)
    .then((success) => {
        // verification successful
    }, (fail) => { 
        // verification failed
    })

Get QRCode link:

import { TOTP } from 'weav-totp';

var qrcode = TOTP.chart('<user secret>', '<username/email>', '<issuer>');

then
<img src={{ qrcode }}/>

Disclaimer

This has not yet been fully tested. I have been getting the correct results everytime I have personally tested it though. You can use it, but do so with this caution in mind.

Keywords

totp

FAQs

Package last updated on 21 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts