An open API service indexing awesome lists of open source software.

https://github.com/weavc/weav-totp

A javascript implementation of the TOTP algorithm, used in applications like Google Authenticator
https://github.com/weavc/weav-totp

2fa javascript npm security totp typescript

Last synced: 6 months ago
JSON representation

A javascript implementation of the TOTP algorithm, used in applications like Google Authenticator

Awesome Lists containing this project

README

          

## weav-totp

[![NPM](https://nodei.co/npm/weav-totp.png)](https://nodei.co/npm/weav-totp/)

### 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('', '')
.then((secret) => {
// do stuff with secret
}, (err) => { })
```

Verifying 6-digit OTP:
```
import { TOTP } from 'weav-totp';

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

Get QRCode link:
```
import { TOTP } from 'weav-totp';

var qrcode = TOTP.chart('', '', '');

then

```

### 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.