Compare commits
16 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0c021be7a3 | ||
| 8826eda195 | |||
|
|
f67283c91c | ||
|
|
406e7b118c | ||
| fad69a2ba9 | |||
|
|
32196b4a67 | ||
|
|
b912f75a53 | ||
|
|
7884491693 | ||
|
|
71599a554d | ||
|
|
d404e5406e | ||
|
|
776b8beb8a | ||
|
|
cccf7dba05 | ||
|
|
bf5c24af58 | ||
|
|
5ba2cdddf2 | ||
|
|
0178e8b89d | ||
|
|
524283161e |
52
README.md
52
README.md
@ -1,6 +1,8 @@
|
|||||||
Node.js Authenticator
|
Node.js Authenticator
|
||||||
=====================
|
=====================
|
||||||
|
|
||||||
|
| Sponsored by [ppl](https://ppl.family)
|
||||||
|
|
||||||
Two- and Multi- Factor Authenication (2FA / MFA) for node.js
|
Two- and Multi- Factor Authenication (2FA / MFA) for node.js
|
||||||
|
|
||||||

|

|
||||||
@ -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)
|
(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.
|
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
|
```bash
|
||||||
npm install authenticator --save
|
npm install authenticator --save
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**command line**
|
||||||
|
```bash
|
||||||
|
npm install authenticator-cli --global
|
||||||
|
```
|
||||||
|
|
||||||
|
Usage
|
||||||
|
=====
|
||||||
|
|
||||||
|
**node.js api**
|
||||||
```javascript
|
```javascript
|
||||||
'use strict';
|
'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
|
// 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
|
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
|
// generates an `OTPAUTH://` scheme URI for QR Code generation.
|
||||||
|
generateTotpUri(formattedKey, accountName, issuer, algorithm, digits, period)
|
||||||
### 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**
|
**OTPAuth Scheme**
|
||||||
|
|
||||||
|
|||||||
4
bin/authenticator.js
Executable file
4
bin/authenticator.js
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/usr/bin/env node
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
module.exports = require('authenticator-cli/bin/authenticator');
|
||||||
16
package.json
16
package.json
@ -1,14 +1,17 @@
|
|||||||
{
|
{
|
||||||
"name": "authenticator",
|
"name": "authenticator",
|
||||||
"version": "1.1.0",
|
"version": "1.1.5",
|
||||||
"description": "Two- / Multi- Factor Authenication (2FA / MFA) for node.js",
|
"description": "Two- / Multi- Factor Authenication (2FA / MFA) for node.js",
|
||||||
"main": "authenticator.js",
|
"main": "authenticator.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "node example.js"
|
"test": "node example.js"
|
||||||
},
|
},
|
||||||
|
"bin": {
|
||||||
|
"authenticator": "bin/authenticator.js"
|
||||||
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/Daplie/node-authenticator.git"
|
"url": "git+https://git.coolaj86.com/coolaj86/node-authenticator.js.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"authenticator",
|
"authenticator",
|
||||||
@ -25,13 +28,14 @@
|
|||||||
"google",
|
"google",
|
||||||
"microsoft"
|
"microsoft"
|
||||||
],
|
],
|
||||||
"author": "AJ ONeal <aj@daplie.com> (https://daplie.com/)",
|
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)",
|
||||||
"license": "Apache-2.0",
|
"license": "(MIT or Apache-2.0)",
|
||||||
"bugs": {
|
"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": {
|
"dependencies": {
|
||||||
|
"authenticator-cli": "^1.0.5",
|
||||||
"notp": "^2.0.3",
|
"notp": "^2.0.3",
|
||||||
"thirty-two": "0.0.2"
|
"thirty-two": "0.0.2"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user