otplib 10.1.0-0 → 10.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -76,9 +76,6 @@ $ npm install otplib --save
76
76
 
77
77
  # To install the Release Candidates:
78
78
  $ npm install otplib@next --save
79
-
80
- # Additional dependencies for TypeScript
81
- $ npm install @types/node
82
79
  ```
83
80
 
84
81
  | Release Type | Version |
@@ -90,6 +87,11 @@ $ npm install @types/node
90
87
 
91
88
  `TypeScript` support was introduced in `v10.0.0`
92
89
 
90
+ ```bash
91
+ # Additional dependencies needed for TypeScript
92
+ $ npm install @types/node
93
+ ```
94
+
93
95
  ## Upgrading
94
96
 
95
97
  This library follows `semver`. As such, major version bumps usually mean API changes or behavior changes.
@@ -336,7 +338,10 @@ An example is shown below:
336
338
  import qrcode from 'qrcode';
337
339
  import otplib from 'otplib';
338
340
 
339
- const otpauth = otplib.authenticator.keyuri('user', 'service', secret);
341
+ const user = 'A user name, possibly an email';
342
+ const service = 'A service name';
343
+ const otpauth = otplib.authenticator.keyuri(
344
+ encodeURIComponent(user), encodeURIComponent(service), secret);
340
345
 
341
346
  qrcode.toDataURL(otpauth, (err, imageUrl) => {
342
347
  if (err) {
@@ -347,6 +352,9 @@ qrcode.toDataURL(otpauth, (err, imageUrl) => {
347
352
  });
348
353
  ```
349
354
 
355
+ > **Note**: For versions `v10.x.x` and below, `keyuri` does not URI encode
356
+ > `user` and `service` and it's the developer's job to do it as show above.
357
+
350
358
  ### Getting Time Remaining / Time Used
351
359
 
352
360
  Helper methods for getting the remaining time and used time within a validity period
@@ -417,7 +425,7 @@ Check out: [CONTRIBUTING.md][pr-welcome-link]
417
425
  [donate-badge]: https://img.shields.io/badge/donate-%3C3-red.svg?longCache=true&style=flat-square
418
426
  [donate-link]: https://www.paypal.me/yeojz
419
427
  [coffee-badge]: https://img.shields.io/badge/%E2%98%95%EF%B8%8F-buy%20me%20a%20coffee-orange.svg?longCache=true&style=flat-square
420
- [coffee-link]: https://ko-fi.com/geraldyeo
428
+ [coffee-link]: https://paypal.me/yeojz
421
429
  [type-ts-badge]: https://img.shields.io/badge/typedef-.d.ts-blue.svg?style=flat-square&longCache=true
422
430
  [type-ts-link]: https://github.com/yeojz/otplib/tree/master/packages/types-ts
423
431
  [type-ts-file]: https://github.com/yeojz/otplib/blob/master/packages/types-ts/index.d.ts
package/authenticator.js CHANGED
@@ -2,27 +2,38 @@
2
2
  * otplib-authenticator
3
3
  *
4
4
  * @author Gerald Yeo <contact@fusedthought.com>
5
- * @version: 10.1.0-0
5
+ * @version: 10.2.3
6
6
  * @license: MIT
7
7
  **/
8
8
  'use strict';
9
9
 
10
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
11
-
12
10
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
11
 
14
- function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
12
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
13
+
14
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
15
+
16
+ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
17
+
18
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
19
+
20
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
15
21
 
16
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
22
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
23
+
24
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
17
25
 
18
26
  function _interopDefault(ex) {
19
27
  return ex && typeof ex === 'object' && 'default' in ex ? ex['default'] : ex;
20
28
  }
21
29
 
30
+ var totp = _interopDefault(require("./totp"));
31
+
32
+ var otplibUtils = require("./utils");
33
+
34
+ var otplibCore = require("./core");
35
+
22
36
  var base32 = _interopDefault(require('thirty-two'));
23
- var otplibCore = require('./core');
24
- var totp = _interopDefault(require('./totp'));
25
- var otplibUtils = require('./utils');
26
37
 
27
38
  function decodeKey(encodedKey) {
28
39
  return base32.decode(encodedKey).toString('hex');
@@ -34,6 +45,7 @@ function _checkDelta(token, secret, options) {
34
45
 
35
46
  function _check(token, secret, options) {
36
47
  var delta = _checkDelta(token, secret, options);
48
+
37
49
  return Number.isInteger(delta);
38
50
  }
39
51
 
@@ -42,11 +54,11 @@ function encodeKey(secret) {
42
54
  }
43
55
 
44
56
  var data = '{service}:{user}?secret={secret}&issuer={service}';
57
+
45
58
  function _keyuri() {
46
59
  var user = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'user';
47
60
  var service = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'service';
48
61
  var secret = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
49
-
50
62
  var protocol = 'otpauth://totp/';
51
63
  var value = data.replace('{user}', user).replace('{secret}', secret).replace(/{service}/g, service);
52
64
  return protocol + value;
@@ -58,74 +70,77 @@ function token(secret, options) {
58
70
 
59
71
  var TOTP = totp.TOTP;
60
72
 
61
- var Authenticator = function (_TOTP) {
73
+ var Authenticator =
74
+ /*#__PURE__*/
75
+ function (_TOTP) {
62
76
  _inherits(Authenticator, _TOTP);
63
77
 
64
78
  function Authenticator() {
79
+ var _this;
80
+
65
81
  _classCallCheck(this, Authenticator);
66
82
 
67
- return _possibleConstructorReturn(this, (Authenticator.__proto__ || Object.getPrototypeOf(Authenticator)).call(this));
83
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(Authenticator).call(this));
84
+ _this._defaultOptions = {
85
+ encoding: 'hex',
86
+ epoch: null,
87
+ step: 30,
88
+ window: 0
89
+ };
90
+ _this._options = _this._defaultOptions;
91
+ return _this;
68
92
  }
69
93
 
70
94
  _createClass(Authenticator, [{
71
- key: 'getClass',
95
+ key: "getClass",
72
96
  value: function getClass() {
73
97
  return Authenticator;
74
98
  }
75
99
  }, {
76
- key: 'encode',
100
+ key: "encode",
77
101
  value: function encode() {
78
- return encodeKey.apply(undefined, arguments);
102
+ return encodeKey.apply(void 0, arguments);
79
103
  }
80
104
  }, {
81
- key: 'decode',
105
+ key: "decode",
82
106
  value: function decode() {
83
- return decodeKey.apply(undefined, arguments);
107
+ return decodeKey.apply(void 0, arguments);
84
108
  }
85
109
  }, {
86
- key: 'keyuri',
110
+ key: "keyuri",
87
111
  value: function keyuri() {
88
- return _keyuri.apply(undefined, arguments);
112
+ return _keyuri.apply(void 0, arguments);
89
113
  }
90
114
  }, {
91
- key: 'generateSecret',
115
+ key: "generateSecret",
92
116
  value: function generateSecret() {
93
117
  var len = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 20;
94
118
 
95
119
  if (!len) {
96
120
  return '';
97
121
  }
122
+
98
123
  var secret = otplibUtils.secretKey(len, this.optionsAll);
99
124
  return encodeKey(secret);
100
125
  }
101
126
  }, {
102
- key: 'generate',
127
+ key: "generate",
103
128
  value: function generate(secret) {
104
129
  var opt = this.optionsAll;
105
130
  return token(secret || opt.secret, opt);
106
131
  }
107
132
  }, {
108
- key: 'check',
133
+ key: "check",
109
134
  value: function check(token$$1, secret) {
110
135
  var opt = this.optionsAll;
111
136
  return _check(token$$1, secret || opt.secret, opt);
112
137
  }
113
138
  }, {
114
- key: 'checkDelta',
139
+ key: "checkDelta",
115
140
  value: function checkDelta(token$$1, secret) {
116
141
  var opt = this.optionsAll;
117
142
  return _checkDelta(token$$1, secret || opt.secret, opt);
118
143
  }
119
- }, {
120
- key: 'defaultOptions',
121
- get: function get() {
122
- return {
123
- encoding: 'hex',
124
- epoch: null,
125
- step: 30,
126
- window: 0
127
- };
128
- }
129
144
  }]);
130
145
 
131
146
  return Authenticator;
@@ -140,7 +155,5 @@ Authenticator.prototype.utils = {
140
155
  keyuri: _keyuri,
141
156
  token
142
157
  };
143
-
144
158
  var index = new Authenticator();
145
-
146
159
  module.exports = index;
package/core.js CHANGED
@@ -2,14 +2,16 @@
2
2
  * otplib-core
3
3
  *
4
4
  * @author Gerald Yeo <contact@fusedthought.com>
5
- * @version: 10.1.0-0
5
+ * @version: 10.2.3
6
6
  * @license: MIT
7
7
  **/
8
8
  'use strict';
9
9
 
10
- Object.defineProperty(exports, '__esModule', { value: true });
10
+ Object.defineProperty(exports, '__esModule', {
11
+ value: true
12
+ });
11
13
 
12
- var otplibUtils = require('./utils');
14
+ var otplibUtils = require("./utils");
13
15
 
14
16
  function hotpCounter(counter) {
15
17
  var hexCounter = otplibUtils.intToHex(counter);
@@ -20,12 +22,15 @@ function hotpDigest(secret, counter, options) {
20
22
  if (!options.crypto || typeof options.crypto.createHmac !== 'function') {
21
23
  throw new Error('Expecting options.crypto to have a createHmac function');
22
24
  }
25
+
23
26
  if (typeof options.createHmacSecret !== 'function') {
24
27
  throw new Error('Expecting options.createHmacSecret to be a function');
25
28
  }
29
+
26
30
  if (typeof options.algorithm !== 'string') {
27
31
  throw new Error('Expecting options.algorithm to be a string');
28
32
  }
33
+
29
34
  var hmacSecret = options.createHmacSecret(secret, {
30
35
  algorithm: options.algorithm,
31
36
  encoding: options.encoding
@@ -39,9 +44,11 @@ function hotpToken(secret, counter, options) {
39
44
  if (counter == null) {
40
45
  return '';
41
46
  }
47
+
42
48
  if (typeof options.digits !== 'number') {
43
49
  throw new Error('Expecting options.digits to be a number');
44
50
  }
51
+
45
52
  var digest = hotpDigest(secret, counter, options);
46
53
  var offset = digest[digest.length - 1] & 0xf;
47
54
  var binary = (digest[offset] & 0x7f) << 24 | (digest[offset + 1] & 0xff) << 16 | (digest[offset + 2] & 0xff) << 8 | digest[offset + 3] & 0xff;
@@ -52,9 +59,11 @@ function hotpToken(secret, counter, options) {
52
59
 
53
60
  function hotpCheck(token, secret, counter, options) {
54
61
  var systemToken = hotpToken(secret, counter, options);
62
+
55
63
  if (systemToken.length < 1) {
56
64
  return false;
57
65
  }
66
+
58
67
  return otplibUtils.isSameToken(token, systemToken);
59
68
  }
60
69
 
@@ -62,12 +71,12 @@ function hotpSecret(secret, options) {
62
71
  if (typeof options.encoding !== 'string') {
63
72
  throw new Error('Expecting options.encoding to be a string');
64
73
  }
74
+
65
75
  return Buffer.from(secret, options.encoding);
66
76
  }
67
77
 
68
78
  function hotpOptions() {
69
79
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
70
-
71
80
  return Object.assign({
72
81
  algorithm: 'sha1',
73
82
  createHmacSecret: hotpSecret,
@@ -85,18 +94,22 @@ function totpToken(secret, options) {
85
94
  if (typeof options.epoch !== 'number') {
86
95
  throw new Error('Expecting options.epoch to be a number');
87
96
  }
97
+
88
98
  if (typeof options.step !== 'number') {
89
99
  throw new Error('Expecting options.step to be a number');
90
100
  }
101
+
91
102
  var counter = totpCounter(options.epoch, options.step);
92
103
  return hotpToken(secret, counter, options);
93
104
  }
94
105
 
95
106
  function totpCheck(token, secret, options) {
96
107
  var systemToken = totpToken(secret, options || {});
108
+
97
109
  if (systemToken.length < 1) {
98
110
  return false;
99
111
  }
112
+
100
113
  return otplibUtils.isSameToken(token, systemToken);
101
114
  }
102
115
 
@@ -106,20 +119,26 @@ function createChecker(token, secret, opt) {
106
119
  return function (direction, start, bounds) {
107
120
  for (var i = start; i <= bounds; i++) {
108
121
  opt.epoch = epoch + direction * i * delta;
122
+
109
123
  if (totpCheck(token, secret, opt)) {
110
124
  return i === 0 ? 0 : direction * i;
111
125
  }
112
126
  }
127
+
113
128
  return null;
114
129
  };
115
130
  }
131
+
116
132
  function getWindowBounds(opt) {
117
133
  var bounds = Array.isArray(opt.window) ? opt.window : [parseInt(opt.window, 10), parseInt(opt.window, 10)];
134
+
118
135
  if (!Number.isInteger(bounds[0]) || !Number.isInteger(bounds[1])) {
119
136
  throw new Error('Expecting options.window to be an integer or an array of integers');
120
137
  }
138
+
121
139
  return bounds;
122
140
  }
141
+
123
142
  function totpCheckWithWindow(token, secret, options) {
124
143
  var opt = Object.assign({}, options);
125
144
  var bounds = getWindowBounds(opt);
@@ -132,18 +151,24 @@ function totpSecret(secret, options) {
132
151
  if (typeof options.algorithm !== 'string') {
133
152
  throw new Error('Expecting options.algorithm to be a string');
134
153
  }
154
+
135
155
  if (typeof options.encoding !== 'string') {
136
156
  throw new Error('Expecting options.encoding to be a string');
137
157
  }
158
+
138
159
  var encoded = Buffer.from(secret, options.encoding);
139
160
  var algorithm = options.algorithm.toLowerCase();
161
+
140
162
  switch (algorithm) {
141
163
  case 'sha1':
142
164
  return otplibUtils.padSecret(encoded, 20, options.encoding);
165
+
143
166
  case 'sha256':
144
167
  return otplibUtils.padSecret(encoded, 32, options.encoding);
168
+
145
169
  case 'sha512':
146
170
  return otplibUtils.padSecret(encoded, 64, options.encoding);
171
+
147
172
  default:
148
173
  throw new Error(`Unsupported algorithm ${algorithm}. Accepts: sha1, sha256, sha512`);
149
174
  }
@@ -155,9 +180,9 @@ var defaultOptions = {
155
180
  step: 30,
156
181
  window: 0
157
182
  };
183
+
158
184
  function totpOptions() {
159
185
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
160
-
161
186
  var opt = Object.assign(hotpOptions(), defaultOptions, options);
162
187
  opt.epoch = typeof opt.epoch === 'number' ? opt.epoch * 1000 : Date.now();
163
188
  return opt;
package/hotp.js CHANGED
@@ -2,62 +2,76 @@
2
2
  * otplib-hotp
3
3
  *
4
4
  * @author Gerald Yeo <contact@fusedthought.com>
5
- * @version: 10.1.0-0
5
+ * @version: 10.2.3
6
6
  * @license: MIT
7
7
  **/
8
8
  'use strict';
9
9
 
10
- var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
11
-
12
10
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
11
 
14
- var otplibCore = require('./core');
12
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
13
+
14
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
15
+
16
+ var otplibCore = require("./core");
15
17
 
16
- var HOTP = function () {
18
+ var HOTP =
19
+ /*#__PURE__*/
20
+ function () {
17
21
  function HOTP() {
18
22
  _classCallCheck(this, HOTP);
19
23
 
20
- this._options = this.defaultOptions;
24
+ this._defaultOptions = {};
25
+ this._options = this._defaultOptions;
21
26
  }
22
27
 
23
28
  _createClass(HOTP, [{
24
- key: 'getClass',
29
+ key: "getClass",
25
30
  value: function getClass() {
26
31
  return HOTP;
27
32
  }
28
33
  }, {
29
- key: 'resetOptions',
34
+ key: "resetOptions",
30
35
  value: function resetOptions() {
31
36
  this._options = this.defaultOptions;
32
37
  return this;
33
38
  }
34
39
  }, {
35
- key: 'generate',
40
+ key: "generate",
36
41
  value: function generate(secret, counter) {
37
42
  var opt = this.optionsAll;
38
43
  return otplibCore.hotpToken(secret || opt.secret, counter, opt);
39
44
  }
40
45
  }, {
41
- key: 'check',
46
+ key: "check",
42
47
  value: function check(token, secret, counter) {
43
48
  var opt = this.optionsAll;
44
49
  return otplibCore.hotpCheck(token, secret || opt.secret, counter, opt);
45
50
  }
46
51
  }, {
47
- key: 'verify',
52
+ key: "verify",
48
53
  value: function verify(opts) {
49
54
  if (typeof opts !== 'object' || opts == null) {
50
55
  return false;
51
56
  }
57
+
52
58
  return this.check(opts.token, opts.secret, opts.counter);
53
59
  }
54
60
  }, {
55
- key: 'defaultOptions',
61
+ key: "defaultOptions",
62
+ set: function set() {
63
+ var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
64
+
65
+ if (opt) {
66
+ this._defaultOptions = Object.assign({}, this.defaultOptions, opt);
67
+ this.options = opt;
68
+ }
69
+ },
56
70
  get: function get() {
57
- return {};
71
+ return this._defaultOptions;
58
72
  }
59
73
  }, {
60
- key: 'options',
74
+ key: "options",
61
75
  set: function set() {
62
76
  var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
63
77
 
@@ -69,7 +83,7 @@ var HOTP = function () {
69
83
  return Object.assign({}, this._options);
70
84
  }
71
85
  }, {
72
- key: 'optionsAll',
86
+ key: "optionsAll",
73
87
  get: function get() {
74
88
  return otplibCore.hotpOptions(this._options);
75
89
  }
@@ -79,7 +93,5 @@ var HOTP = function () {
79
93
  }();
80
94
 
81
95
  HOTP.prototype.HOTP = HOTP;
82
-
83
96
  var index = new HOTP();
84
-
85
97
  module.exports = index;
package/index.d.ts CHANGED
@@ -81,8 +81,9 @@ declare class HOTP {
81
81
  HOTP: typeof HOTP;
82
82
  getClass(): typeof HOTP;
83
83
 
84
- options: TotpOptionsInterface;
85
- optionsAll: TotpOptionsInterface;
84
+ defaultOptions: HotpOptionsInterface;
85
+ options: HotpOptionsInterface;
86
+ optionsAll: HotpOptionsInterface;
86
87
  resetOptions(): this;
87
88
  generate(secret: string, counter: number): string;
88
89
  check(token: string, secret: string, counter: number): boolean;
@@ -93,6 +94,7 @@ declare class TOTP extends HOTP {
93
94
  TOTP: typeof TOTP;
94
95
  getClass(): typeof TOTP;
95
96
 
97
+ defaultOptions: TotpOptionsInterface;
96
98
  options: TotpOptionsInterface;
97
99
  optionsAll: TotpOptionsInterface;
98
100
  generate(secret: string): string;
package/index.js CHANGED
@@ -2,26 +2,42 @@
2
2
  * otplib
3
3
  *
4
4
  * @author Gerald Yeo <contact@fusedthought.com>
5
- * @version: 10.1.0-0
5
+ * @version: 10.2.3
6
6
  * @license: MIT
7
7
  **/
8
8
  'use strict';
9
9
 
10
- Object.defineProperty(exports, '__esModule', { value: true });
10
+ Object.defineProperty(exports, '__esModule', {
11
+ value: true
12
+ });
11
13
 
12
14
  function _interopDefault(ex) {
13
15
  return ex && typeof ex === 'object' && 'default' in ex ? ex['default'] : ex;
14
16
  }
15
17
 
16
- var hotp = _interopDefault(require('./hotp'));
17
- var totp = _interopDefault(require('./totp'));
18
- var authenticator = _interopDefault(require('./authenticator'));
19
- var crypto = _interopDefault(require('crypto'));
18
+ var hotp = _interopDefault(require("./hotp"));
19
+
20
+ var totp = _interopDefault(require("./totp"));
20
21
 
21
- authenticator.options = { crypto };
22
- hotp.options = { crypto };
23
- totp.options = { crypto };
22
+ var authenticator = _interopDefault(require("./authenticator"));
23
+
24
+ var crypto = _interopDefault(require('crypto'));
24
25
 
26
+ authenticator.defaultOptions = {
27
+ crypto
28
+ };
29
+ hotp.defaultOptions = {
30
+ crypto
31
+ };
32
+ totp.defaultOptions = {
33
+ crypto
34
+ };
35
+ var index = {
36
+ authenticator,
37
+ hotp,
38
+ totp
39
+ };
25
40
  exports.hotp = hotp;
26
41
  exports.totp = totp;
27
- exports.authenticator = authenticator;
42
+ exports.authenticator = authenticator;
43
+ exports.default = index;