Compare commits
No commits in common. "master" and "v1.1.0" have entirely different histories.
58
README.md
58
README.md
@ -1,8 +1,6 @@
|
|||||||
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
|
||||||
|
|
||||||

|

|
||||||
@ -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)
|
(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 & Commandline Authenticator
|
Browser Authenticator
|
||||||
---------------------
|
---------------------
|
||||||
|
|
||||||
You may also be interested in
|
You may also be interested in [Browser Authenticator](https://github.com/Daplie/browser-authenticator) over at <https://github.com/Daplie/browser-authenticator>
|
||||||
|
|
||||||
* [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
|
Usage
|
||||||
=====
|
=====
|
||||||
|
|
||||||
**node.js api**
|
```bash
|
||||||
|
npm install authenticator --save
|
||||||
|
```
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
'use strict';
|
'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
|
// 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
|
||||||
---
|
---
|
||||||
|
|
||||||
```javascript
|
### generateKey()
|
||||||
generateKey() // generates a 32-character (160-bit) base32 key
|
|
||||||
|
|
||||||
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
|
### generateToken(formattedKey)
|
||||||
// returns `null` on failure or an object such as `{ delta: 0 }` on success
|
|
||||||
|
|
||||||
// generates an `OTPAUTH://` scheme URI for QR Code generation.
|
generates a 6-digit (20-bit) decimal time-based token
|
||||||
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**
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +0,0 @@
|
|||||||
#!/usr/bin/env node
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
module.exports = require('authenticator-cli/bin/authenticator');
|
|
||||||
16
package.json
16
package.json
@ -1,17 +1,14 @@
|
|||||||
{
|
{
|
||||||
"name": "authenticator",
|
"name": "authenticator",
|
||||||
"version": "1.1.5",
|
"version": "1.1.0",
|
||||||
"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://git.coolaj86.com/coolaj86/node-authenticator.js.git"
|
"url": "git+https://github.com/Daplie/node-authenticator.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"authenticator",
|
"authenticator",
|
||||||
@ -28,14 +25,13 @@
|
|||||||
"google",
|
"google",
|
||||||
"microsoft"
|
"microsoft"
|
||||||
],
|
],
|
||||||
"author": "AJ ONeal <coolaj86@gmail.com> (https://coolaj86.com/)",
|
"author": "AJ ONeal <aj@daplie.com> (https://daplie.com/)",
|
||||||
"license": "(MIT or Apache-2.0)",
|
"license": "Apache-2.0",
|
||||||
"bugs": {
|
"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": {
|
"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