Compare commits

..

No commits in common. "master" and "v1.1.0" have entirely different histories.

3 changed files with 26 additions and 52 deletions

View File

@ -1,8 +1,6 @@
Node.js Authenticator
=====================
| Sponsored by [ppl](https://ppl.family)
Two- and Multi- Factor Authenication (2FA / MFA) for node.js
![](https://blog.authy.com/assets/posts/authenticator.png)
@ -21,31 +19,18 @@ This module uses [`notp`](https://github.com/guyht/notp) which implements `TOTP`
(the *Authenticator* standard), which is based on `HOTP` [(RFC 4226)](https://www.ietf.org/rfc/rfc4226.txt)
to provide codes that are exactly compatible with all other *Authenticator* apps and services that use them.
Browser & Commandline Authenticator
Browser Authenticator
---------------------
You may also be interested in
* [Browser Authenticator](https://git.coolaj86.com/coolaj86/browser-authenticator) over at <https://git.coolaj86.com/coolaj86/browser-authenticator>
* [Commandline Authenticator](https://git.coolaj86.com/coolaj86/authenticator-cli) over at <https://git.coolaj86.com/coolaj86/authenticator-cli>
Install
=====
**node.js api**
```bash
npm install authenticator --save
```
**command line**
```bash
npm install authenticator-cli --global
```
You may also be interested in [Browser Authenticator](https://github.com/Daplie/browser-authenticator) over at <https://github.com/Daplie/browser-authenticator>
Usage
=====
**node.js api**
```bash
npm install authenticator --save
```
```javascript
'use strict';
@ -68,29 +53,26 @@ authenticator.generateTotpUri(formattedKey, "john.doe@email.com", "ACME Co", 'SH
// otpauth://totp/ACME%20Co:john.doe@email.com?secret=HXDMVJECJJWSRB3HWIZR4IFUGFTMXBOZ&issuer=ACME%20Co&algorithm=SHA1&digits=6&period=30
```
**command line**
```
# see help
authenticator --help
# generate a key and display qr code
authenticator --qr
```
API
---
```javascript
generateKey() // generates a 32-character (160-bit) base32 key
### generateKey()
generateToken(formattedKey) // generates a 6-digit (20-bit) decimal time-based token
generates a 32-character (160-bit) base32 key
verifyToken(formattedKey, formattedToken) // validates a time-based token within a +/- 30 second (90 seconds) window
// returns `null` on failure or an object such as `{ delta: 0 }` on success
### generateToken(formattedKey)
// generates an `OTPAUTH://` scheme URI for QR Code generation.
generateTotpUri(formattedKey, accountName, issuer, algorithm, digits, period)
```
generates a 6-digit (20-bit) decimal time-based token
### verifyToken(formattedKey, formattedToken)
validates a time-based token within a +/- 30 second (90 seconds) window
returns `null` on failure or an object such as `{ delta: 0 }` on success
### generateTotpUri(formattedKey, accountName, issuer, algorithm, digits, period)
generates an `OTPAUTH://` scheme URI for QR Code generation.
**OTPAuth Scheme**

View File

@ -1,4 +0,0 @@
#!/usr/bin/env node
'use strict';
module.exports = require('authenticator-cli/bin/authenticator');

View File

@ -1,17 +1,14 @@
{
"name": "authenticator",
"version": "1.1.5",
"version": "1.1.0",
"description": "Two- / Multi- Factor Authenication (2FA / MFA) for node.js",
"main": "authenticator.js",
"scripts": {
"test": "node example.js"
},
"bin": {
"authenticator": "bin/authenticator.js"
},
"repository": {
"type": "git",
"url": "git+https://git.coolaj86.com/coolaj86/node-authenticator.js.git"
"url": "git+https://github.com/Daplie/node-authenticator.git"
},
"keywords": [
"authenticator",
@ -28,14 +25,13 @@
"google",
"microsoft"
],
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)",
"license": "(MIT or Apache-2.0)",
"author": "AJ ONeal <aj@daplie.com> (https://daplie.com/)",
"license": "Apache-2.0",
"bugs": {
"url": "https://git.coolaj86.com/coolaj86/node-authenticator.js/issues"
"url": "https://github.com/Daplie/node-authenticator/issues"
},
"homepage": "https://git.coolaj86.com/coolaj86/node-authenticator.js#readme",
"homepage": "https://github.com/Daplie/node-authenticator#readme",
"dependencies": {
"authenticator-cli": "^1.0.5",
"notp": "^2.0.3",
"thirty-two": "0.0.2"
}