Compare commits

..

16 Commits

Author SHA1 Message Date
AJ ONeal
0c021be7a3 v1.1.5 - update cli package 2018-05-29 14:26:28 -06:00
8826eda195 Merge branch 'master' of rajivshah3/node-authenticator.js into master 2018-05-29 20:24:10 +00:00
Rajiv Shah
f67283c91c
Upgrade authenticator-cli to 1.0.5 2018-05-26 17:49:43 -04:00
AJ ONeal
406e7b118c v1.1.4 2018-03-28 00:30:33 -06:00
fad69a2ba9 Update 'README.md' 2017-11-20 16:36:53 +00:00
AJ ONeal
32196b4a67 udpate urls 2017-09-22 16:55:21 -06:00
AJ ONeal
b912f75a53 auto-update banner 2016-12-30 02:38:02 -07:00
AJ ONeal
7884491693 auto-update ad 2016-12-30 00:52:09 -07:00
AJ ONeal
71599a554d Update README.md 2016-11-25 10:22:04 -07:00
AJ ONeal
d404e5406e Update README.md 2016-11-01 18:29:31 -06:00
AJ ONeal
776b8beb8a v1.1.2 2016-01-02 01:25:50 -08:00
AJ ONeal
cccf7dba05 make executable 2016-01-02 01:25:46 -08:00
AJ ONeal
bf5c24af58 v1.1.1 2016-01-02 01:24:28 -08:00
AJ ONeal
5ba2cdddf2 add bin 2016-01-02 01:24:24 -08:00
AJ ONeal
0178e8b89d Update README.md 2016-01-02 01:15:06 -08:00
AJ ONeal
524283161e Update README.md 2016-01-02 01:13:22 -08:00
3 changed files with 49 additions and 23 deletions

View File

@ -1,6 +1,8 @@
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)
@ -19,18 +21,31 @@ 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 Authenticator
Browser & Commandline Authenticator
---------------------
You may also be interested in [Browser Authenticator](https://github.com/Daplie/browser-authenticator) over at <https://github.com/Daplie/browser-authenticator>
You may also be interested in
Usage
* [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
```
Usage
=====
**node.js api**
```javascript
'use strict';
@ -53,26 +68,29 @@ 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
---
### generateKey()
```javascript
generateKey() // generates a 32-character (160-bit) base32 key
generates a 32-character (160-bit) base32 key
generateToken(formattedKey) // generates a 6-digit (20-bit) decimal time-based token
### generateToken(formattedKey)
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
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.
// generates an `OTPAUTH://` scheme URI for QR Code generation.
generateTotpUri(formattedKey, accountName, issuer, algorithm, digits, period)
```
**OTPAuth Scheme**

4
bin/authenticator.js Executable file
View File

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

View File

@ -1,14 +1,17 @@
{
"name": "authenticator",
"version": "1.1.0",
"version": "1.1.5",
"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://github.com/Daplie/node-authenticator.git"
"url": "git+https://git.coolaj86.com/coolaj86/node-authenticator.js.git"
},
"keywords": [
"authenticator",
@ -25,13 +28,14 @@
"google",
"microsoft"
],
"author": "AJ ONeal <aj@daplie.com> (https://daplie.com/)",
"license": "Apache-2.0",
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)",
"license": "(MIT or Apache-2.0)",
"bugs": {
"url": "https://github.com/Daplie/node-authenticator/issues"
"url": "https://git.coolaj86.com/coolaj86/node-authenticator.js/issues"
},
"homepage": "https://github.com/Daplie/node-authenticator#readme",
"homepage": "https://git.coolaj86.com/coolaj86/node-authenticator.js#readme",
"dependencies": {
"authenticator-cli": "^1.0.5",
"notp": "^2.0.3",
"thirty-two": "0.0.2"
}