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
- Host: GitHub
- URL: https://github.com/weavc/weav-totp
- Owner: weavc
- License: mit
- Created: 2018-12-16T20:25:27.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-02-11T00:31:54.000Z (over 4 years ago)
- Last Synced: 2025-10-03T22:23:38.049Z (9 months ago)
- Topics: 2fa, javascript, npm, security, totp, typescript
- Language: TypeScript
- Homepage:
- Size: 36.1 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## weav-totp
[](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.