adminforth 1.1.79 → 1.1.80

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.
Files changed (210) hide show
  1. package/dist/modules/codeInjector.js +51 -23
  2. package/dist/plugins/AuditLog/index.js +13 -0
  3. package/dist/plugins/AuditLog/types.js +1 -0
  4. package/dist/plugins/S3UploadPlugin/custom/s3uploader.vue +4 -1
  5. package/dist/spa/index.html +1 -1
  6. package/dist/spa/package-lock.json +0 -111
  7. package/dist/spa/package.json +0 -1
  8. package/dist/spa/spa/src/App.vue +1 -1
  9. package/dist/spa/spa/src/components/MenuLink.vue +1 -1
  10. package/dist/spa/src/App.vue +133 -178
  11. package/dist/spa/src/components/MenuLink.vue +3 -3
  12. package/dist/spa/src/components/ResourceForm.vue +96 -96
  13. package/dist/spa/src/components/ResourceListTable.vue +84 -69
  14. package/dist/spa/src/components/ValueRenderer.vue +3 -2
  15. package/dist/spa/src/composables/useStores.ts +11 -24
  16. package/dist/spa/src/main.ts +1 -1
  17. package/dist/spa/src/router/index.ts +1 -0
  18. package/dist/spa/src/utils.ts +1 -1
  19. package/dist/spa/src/views/CreateView.vue +9 -1
  20. package/dist/spa/src/views/EditView.vue +9 -1
  21. package/dist/spa/src/views/ListView.vue +3 -12
  22. package/dist/spa/src/views/LoginView.vue +1 -6
  23. package/dist/spa/src/views/ResourceParent.vue +2 -1
  24. package/dist/spa/src/views/ShowView.vue +14 -6
  25. package/dist/spa/tailwind.config.js +1 -3
  26. package/modules/codeInjector.ts +56 -26
  27. package/package.json +1 -1
  28. package/plugins/S3UploadPlugin/custom/s3uploader.vue +4 -1
  29. package/spa/src/App.vue +1 -1
  30. package/spa/src/components/MenuLink.vue +1 -1
  31. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/.package-lock.json +0 -61
  32. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/LICENSE +0 -21
  33. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/README.md +0 -15
  34. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/package.json +0 -217
  35. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/LICENSE +0 -21
  36. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/README.md +0 -15
  37. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/package.json +0 -21
  38. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/LICENSE +0 -201
  39. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/README.md +0 -68
  40. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/index.js +0 -51
  41. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/interfaces.js +0 -2
  42. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/package.json +0 -58
  43. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/.travis.yml +0 -6
  44. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/LICENSE +0 -22
  45. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/Readme.md +0 -135
  46. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/examples/TOTP-verify.js +0 -33
  47. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/examples/TOTP.js +0 -15
  48. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/index.js +0 -221
  49. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/package.json +0 -22
  50. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/test/mocha.opts +0 -1
  51. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/test/notp.js +0 -217
  52. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/LICENSE.txt +0 -19
  53. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/Makefile +0 -24
  54. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/README.md +0 -15
  55. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/index.js +0 -23
  56. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/lib/thirty-two/index.js +0 -26
  57. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/lib/thirty-two/thirty-two.js +0 -128
  58. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/package.json +0 -15
  59. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/spec/thirty-two_spec.js +0 -63
  60. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/CopyrightNotice.txt +0 -15
  61. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/LICENSE.txt +0 -12
  62. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/README.md +0 -164
  63. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/SECURITY.md +0 -41
  64. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/index.js +0 -68
  65. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/package.json +0 -3
  66. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/package.json +0 -47
  67. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.html +0 -1
  68. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.js +0 -374
  69. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.mjs +0 -373
  70. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.html +0 -1
  71. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.js +0 -424
  72. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/README.md +0 -6
  73. package/dist/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/package.json +0 -55
  74. package/dist/spa/src/components/SkeleteLoader.vue +0 -23
  75. package/plugins/TwoFactorsAuthPlugin/node_modules/.package-lock.json +0 -61
  76. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/LICENSE +0 -21
  77. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/README.md +0 -15
  78. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/assert/strict.d.ts +0 -8
  79. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/assert.d.ts +0 -1040
  80. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/async_hooks.d.ts +0 -541
  81. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/buffer.d.ts +0 -2363
  82. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/child_process.d.ts +0 -1544
  83. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/cluster.d.ts +0 -578
  84. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/console.d.ts +0 -452
  85. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/constants.d.ts +0 -19
  86. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/crypto.d.ts +0 -4523
  87. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/dgram.d.ts +0 -596
  88. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/diagnostics_channel.d.ts +0 -554
  89. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/dns/promises.d.ts +0 -476
  90. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/dns.d.ts +0 -864
  91. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/dom-events.d.ts +0 -124
  92. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/domain.d.ts +0 -170
  93. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/events.d.ts +0 -931
  94. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/fs/promises.d.ts +0 -1245
  95. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/fs.d.ts +0 -4317
  96. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/globals.d.ts +0 -412
  97. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/globals.global.d.ts +0 -1
  98. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/http.d.ts +0 -1908
  99. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/http2.d.ts +0 -2418
  100. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/https.d.ts +0 -550
  101. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/index.d.ts +0 -89
  102. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/inspector.d.ts +0 -2746
  103. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/module.d.ts +0 -315
  104. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/net.d.ts +0 -999
  105. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/os.d.ts +0 -495
  106. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/package.json +0 -217
  107. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/path.d.ts +0 -191
  108. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/perf_hooks.d.ts +0 -905
  109. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/process.d.ts +0 -1754
  110. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/punycode.d.ts +0 -117
  111. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/querystring.d.ts +0 -153
  112. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/readline/promises.d.ts +0 -150
  113. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/readline.d.ts +0 -540
  114. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/repl.d.ts +0 -430
  115. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/sea.d.ts +0 -153
  116. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/stream/consumers.d.ts +0 -12
  117. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/stream/promises.d.ts +0 -83
  118. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/stream/web.d.ts +0 -367
  119. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/stream.d.ts +0 -1707
  120. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/string_decoder.d.ts +0 -67
  121. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/test.d.ts +0 -1718
  122. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/timers/promises.d.ts +0 -97
  123. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/timers.d.ts +0 -240
  124. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/tls.d.ts +0 -1217
  125. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/trace_events.d.ts +0 -197
  126. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/tty.d.ts +0 -208
  127. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/url.d.ts +0 -952
  128. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/util.d.ts +0 -2292
  129. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/v8.d.ts +0 -808
  130. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/vm.d.ts +0 -924
  131. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/wasi.d.ts +0 -181
  132. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/worker_threads.d.ts +0 -694
  133. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/zlib.d.ts +0 -530
  134. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/LICENSE +0 -21
  135. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/README.md +0 -15
  136. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/index.d.ts +0 -127
  137. package/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/package.json +0 -21
  138. package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/LICENSE +0 -201
  139. package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/README.md +0 -68
  140. package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/index.d.ts +0 -11
  141. package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/index.js +0 -51
  142. package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/interfaces.d.ts +0 -4
  143. package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/interfaces.js +0 -2
  144. package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/package.json +0 -58
  145. package/plugins/TwoFactorsAuthPlugin/node_modules/notp/.travis.yml +0 -6
  146. package/plugins/TwoFactorsAuthPlugin/node_modules/notp/LICENSE +0 -22
  147. package/plugins/TwoFactorsAuthPlugin/node_modules/notp/Readme.md +0 -135
  148. package/plugins/TwoFactorsAuthPlugin/node_modules/notp/examples/TOTP-verify.js +0 -33
  149. package/plugins/TwoFactorsAuthPlugin/node_modules/notp/examples/TOTP.js +0 -15
  150. package/plugins/TwoFactorsAuthPlugin/node_modules/notp/index.js +0 -221
  151. package/plugins/TwoFactorsAuthPlugin/node_modules/notp/package.json +0 -22
  152. package/plugins/TwoFactorsAuthPlugin/node_modules/notp/test/mocha.opts +0 -1
  153. package/plugins/TwoFactorsAuthPlugin/node_modules/notp/test/notp.js +0 -217
  154. package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/LICENSE.txt +0 -19
  155. package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/Makefile +0 -24
  156. package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/README.md +0 -15
  157. package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/index.js +0 -23
  158. package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/lib/thirty-two/index.js +0 -26
  159. package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/lib/thirty-two/thirty-two.js +0 -128
  160. package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/package.json +0 -15
  161. package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/spec/thirty-two_spec.js +0 -63
  162. package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/CopyrightNotice.txt +0 -15
  163. package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/LICENSE.txt +0 -12
  164. package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/README.md +0 -164
  165. package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/SECURITY.md +0 -41
  166. package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/index.d.ts +0 -37
  167. package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/index.js +0 -68
  168. package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/package.json +0 -3
  169. package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/package.json +0 -47
  170. package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.d.ts +0 -453
  171. package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.html +0 -1
  172. package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.js +0 -374
  173. package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.mjs +0 -373
  174. package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.html +0 -1
  175. package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.js +0 -424
  176. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/README.md +0 -6
  177. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/agent.d.ts +0 -31
  178. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/api.d.ts +0 -43
  179. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/balanced-pool.d.ts +0 -18
  180. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/cache.d.ts +0 -36
  181. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/client.d.ts +0 -97
  182. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/connector.d.ts +0 -34
  183. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/content-type.d.ts +0 -21
  184. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/cookies.d.ts +0 -28
  185. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/diagnostics-channel.d.ts +0 -67
  186. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/dispatcher.d.ts +0 -241
  187. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/errors.d.ts +0 -128
  188. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/fetch.d.ts +0 -209
  189. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/file.d.ts +0 -39
  190. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/filereader.d.ts +0 -54
  191. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/formdata.d.ts +0 -108
  192. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/global-dispatcher.d.ts +0 -9
  193. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/global-origin.d.ts +0 -7
  194. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/handlers.d.ts +0 -9
  195. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/header.d.ts +0 -4
  196. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/index.d.ts +0 -63
  197. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/interceptors.d.ts +0 -5
  198. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-agent.d.ts +0 -50
  199. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-client.d.ts +0 -25
  200. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-errors.d.ts +0 -12
  201. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-interceptor.d.ts +0 -93
  202. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-pool.d.ts +0 -25
  203. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/package.json +0 -55
  204. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/patch.d.ts +0 -71
  205. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/pool-stats.d.ts +0 -19
  206. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/pool.d.ts +0 -28
  207. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/proxy-agent.d.ts +0 -30
  208. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/readable.d.ts +0 -61
  209. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/webidl.d.ts +0 -220
  210. package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/websocket.d.ts +0 -131
@@ -1,221 +0,0 @@
1
-
2
- var crypto = require('crypto');
3
-
4
- var hotp = {};
5
-
6
- /**
7
- * Generate a counter based One Time Password
8
- *
9
- * @return {String} the one time password
10
- *
11
- * Arguments:
12
- *
13
- * args
14
- * key - Key for the one time password. This should be unique and secret for
15
- * every user as this is the seed that is used to calculate the HMAC
16
- *
17
- * counter - Counter value. This should be stored by the application, must
18
- * be user specific, and be incremented for each request.
19
- *
20
- */
21
- hotp.gen = function(key, opt) {
22
- key = key || '';
23
- opt = opt || {};
24
- var counter = opt.counter || 0;
25
-
26
- var p = 6;
27
-
28
- // Create the byte array
29
- var b = new Buffer(intToBytes(counter));
30
-
31
- var hmac = crypto.createHmac('sha1', new Buffer(key));
32
-
33
- // Update the HMAC with the byte array
34
- var digest = hmac.update(b).digest('hex');
35
-
36
- // Get byte array
37
- var h = hexToBytes(digest);
38
-
39
- // Truncate
40
- var offset = h[19] & 0xf;
41
- var v = (h[offset] & 0x7f) << 24 |
42
- (h[offset + 1] & 0xff) << 16 |
43
- (h[offset + 2] & 0xff) << 8 |
44
- (h[offset + 3] & 0xff);
45
-
46
- v = v + '';
47
-
48
- return v.substr(v.length - p, p);
49
- };
50
-
51
- /**
52
- * Check a One Time Password based on a counter.
53
- *
54
- * @return {Object} null if failure, { delta: # } on success
55
- * delta is the time step difference between the client and the server
56
- *
57
- * Arguments:
58
- *
59
- * args
60
- * key - Key for the one time password. This should be unique and secret for
61
- * every user as it is the seed used to calculate the HMAC
62
- *
63
- * token - Passcode to validate.
64
- *
65
- * window - The allowable margin for the counter. The function will check
66
- * 'W' codes in the future against the provided passcode. Note,
67
- * it is the calling applications responsibility to keep track of
68
- * 'W' and increment it for each password check, and also to adjust
69
- * it accordingly in the case where the client and server become
70
- * out of sync (second argument returns non zero).
71
- * E.g. if W = 100, and C = 5, this function will check the passcode
72
- * against all One Time Passcodes between 5 and 105.
73
- *
74
- * Default - 50
75
- *
76
- * counter - Counter value. This should be stored by the application, must
77
- * be user specific, and be incremented for each request.
78
- *
79
- */
80
- hotp.verify = function(token, key, opt) {
81
- opt = opt || {};
82
- var window = opt.window || 50;
83
- var counter = opt.counter || 0;
84
-
85
- // Now loop through from C to C + W to determine if there is
86
- // a correct code
87
- for(var i = counter - window; i <= counter + window; ++i) {
88
- opt.counter = i;
89
- if(this.gen(key, opt) === token) {
90
- // We have found a matching code, trigger callback
91
- // and pass offset
92
- return { delta: i - counter };
93
- }
94
- }
95
-
96
- // If we get to here then no codes have matched, return null
97
- return null;
98
- };
99
-
100
- var totp = {};
101
-
102
- /**
103
- * Generate a time based One Time Password
104
- *
105
- * @return {String} the one time password
106
- *
107
- * Arguments:
108
- *
109
- * args
110
- * key - Key for the one time password. This should be unique and secret for
111
- * every user as it is the seed used to calculate the HMAC
112
- *
113
- * time - The time step of the counter. This must be the same for
114
- * every request and is used to calculat C.
115
- *
116
- * Default - 30
117
- *
118
- */
119
- totp.gen = function(key, opt) {
120
- opt = opt || {};
121
- var time = opt.time || 30;
122
- var _t = new Date().getTime();;
123
-
124
- // Time has been overwritten.
125
- if(opt._t) {
126
- if(process.env.NODE_ENV != 'test') {
127
- throw new Error('cannot overwrite time in non-test environment!');
128
- }
129
- _t = opt._t;
130
- }
131
-
132
- // Determine the value of the counter, C
133
- // This is the number of time steps in seconds since T0
134
- opt.counter = Math.floor((_t / 1000) / time);
135
-
136
- return hotp.gen(key, opt);
137
- };
138
-
139
- /**
140
- * Check a One Time Password based on a timer.
141
- *
142
- * @return {Object} null if failure, { delta: # } on success
143
- * delta is the time step difference between the client and the server
144
- *
145
- * Arguments:
146
- *
147
- * args
148
- * key - Key for the one time password. This should be unique and secret for
149
- * every user as it is the seed used to calculate the HMAC
150
- *
151
- * token - Passcode to validate.
152
- *
153
- * window - The allowable margin for the counter. The function will check
154
- * 'W' codes either side of the provided counter. Note,
155
- * it is the calling applications responsibility to keep track of
156
- * 'W' and increment it for each password check, and also to adjust
157
- * it accordingly in the case where the client and server become
158
- * out of sync (second argument returns non zero).
159
- * E.g. if W = 5, and C = 1000, this function will check the passcode
160
- * against all One Time Passcodes between 995 and 1005.
161
- *
162
- * Default - 6
163
- *
164
- * time - The time step of the counter. This must be the same for
165
- * every request and is used to calculate C.
166
- *
167
- * Default - 30
168
- *
169
- */
170
- totp.verify = function(token, key, opt) {
171
- opt = opt || {};
172
- var time = opt.time || 30;
173
- var _t = new Date().getTime();
174
-
175
- // Time has been overwritten.
176
- if(opt._t) {
177
- if(process.env.NODE_ENV != 'test') {
178
- throw new Error('cannot overwrite time in non-test environment!');
179
- }
180
- _t = opt._t;
181
- }
182
-
183
- // Determine the value of the counter, C
184
- // This is the number of time steps in seconds since T0
185
- opt.counter = Math.floor((_t / 1000) / time);
186
-
187
- return hotp.verify(token, key, opt);
188
- };
189
-
190
- module.exports.hotp = hotp;
191
- module.exports.totp = totp;
192
-
193
- /**
194
- * convert an integer to a byte array
195
- * @param {Integer} num
196
- * @return {Array} bytes
197
- */
198
- var intToBytes = function(num) {
199
- var bytes = [];
200
-
201
- for(var i=7 ; i>=0 ; --i) {
202
- bytes[i] = num & (255);
203
- num = num >> 8;
204
- }
205
-
206
- return bytes;
207
- };
208
-
209
-
210
- /**
211
- * convert a hex value to a byte array
212
- * @param {String} hex string of hex to convert to a byte array
213
- * @return {Array} bytes
214
- */
215
- var hexToBytes = function(hex) {
216
- var bytes = [];
217
- for(var c = 0; c < hex.length; c += 2) {
218
- bytes.push(parseInt(hex.substr(c, 2), 16));
219
- }
220
- return bytes;
221
- };
@@ -1,22 +0,0 @@
1
- {
2
- "author": "Guy Halford-Thompson <guy@guy.ht> (http://guy.ht)",
3
- "name": "notp",
4
- "description": "Node One Time Password library, supports HOTP, TOTP and works with Google Authenticator",
5
- "version": "2.0.3",
6
- "homepage": "https://github.com/guyht/notp",
7
- "repository": {
8
- "type": "git",
9
- "url": "git://github.com/guyht/notp.git"
10
- },
11
- "main": "index.js",
12
- "scripts": {
13
- "test": "NODE_ENV=test mocha"
14
- },
15
- "engines": {
16
- "node": "> v0.6.0"
17
- },
18
- "dependencies": {},
19
- "devDependencies": {
20
- "mocha": "~1.18.2"
21
- }
22
- }
@@ -1,217 +0,0 @@
1
- var notp = require('..');
2
- var assert = require('assert');
3
-
4
- /*
5
- * Test HOTtoken. Uses test values from RFcounter 4226
6
- *
7
- *
8
- * The following test data uses the AScounterII string
9
- * "12345678901234567890" for the secret:
10
- *
11
- * Secret = 0x3132333435363738393031323334353637383930
12
- *
13
- * Table 1 details for each count, the intermediate HMAcounter value.
14
- *
15
- * counterount Hexadecimal HMAcounter-SHA-1(secret, count)
16
- * 0 cc93cf18508d94934c64b65d8ba7667fb7cde4b0
17
- * 1 75a48a19d4cbe100644e8ac1397eea747a2d33ab
18
- * 2 0bacb7fa082fef30782211938bc1c5e70416ff44
19
- * 3 66c28227d03a2d5529262ff016a1e6ef76557ece
20
- * 4 a904c900a64b35909874b33e61c5938a8e15ed1c
21
- * 5 a37e783d7b7233c083d4f62926c7a25f238d0316
22
- * 6 bc9cd28561042c83f219324d3c607256c03272ae
23
- * 7 a4fb960c0bc06e1eabb804e5b397cdc4b45596fa
24
- * 8 1b3c89f65e6c9e883012052823443f048b4332db
25
- * 9 1637409809a679dc698207310c8c7fc07290d9e5
26
- *
27
- * Table 2 details for each count the truncated values (both in
28
- * hexadecimal and decimal) and then the HOTtoken value.
29
- *
30
- * Truncated
31
- * counterount Hexadecimal Decimal HOTtoken
32
- * 0 4c93cf18 1284755224 755224
33
- * 1 41397eea 1094287082 287082
34
- * 2 82fef30 137359152 359152
35
- * 3 66ef7655 1726969429 969429
36
- * 4 61c5938a 1640338314 338314
37
- * 5 33c083d4 868254676 254676
38
- * 6 7256c032 1918287922 287922
39
- * 7 4e5b397 82162583 162583
40
- * 8 2823443f 673399871 399871
41
- * 9 2679dc69 645520489 520489
42
- *
43
- *
44
- * see http://tools.ietf.org/html/rfc4226
45
- */
46
- exports.testHOTP = function() {
47
- var key = '12345678901234567890';
48
- var opt = {
49
- window : 0,
50
- };
51
- var HOTP = ['755224', '287082','359152', '969429', '338314', '254676', '287922', '162583', '399871', '520489'];
52
-
53
- // make sure we can not pass in opt
54
- notp.hotp.verify('WILL NOT PASS', key);
55
-
56
- // counterheck for failure
57
- opt.counter = 0;
58
- assert.ok(!notp.hotp.verify('WILL NOT PASS', key, opt), 'Should not pass');
59
-
60
- // counterheck for passes
61
- for(i=0;i<HOTP.length;i++) {
62
- opt.counter = i;
63
- var res = notp.hotp.verify(HOTP[i], key, opt);
64
-
65
- assert.ok(res, 'Should pass');
66
- assert.equal(res.delta, 0, 'Should be in sync');
67
- }
68
- };
69
-
70
-
71
- /*
72
- * Test TOTtoken using test vectors from TOTtoken RFcounter.
73
- *
74
- * see http://tools.ietf.org/id/draft-mraihi-totp-timebased-06.txt
75
- */
76
- exports.testTOTtoken = function() {
77
- var key = '12345678901234567890';
78
- var opt = {
79
- window : 0,
80
- };
81
-
82
- // make sure we can not pass in opt
83
- notp.totp.verify(token, key);
84
-
85
- // counterheck for failure
86
- opt.time = 0;
87
- var token = 'windowILLNOTtokenASS';
88
- assert.ok(!notp.totp.verify(token, key, opt), 'Should not pass');
89
-
90
- // counterheck for test vector at 59s
91
- opt._t = 59*1000;
92
- var token = '287082';
93
- var res = notp.totp.verify(token, key, opt);
94
- assert.ok(res, 'Should pass');
95
- assert.equal(res.delta, 0, 'Should be in sync');
96
-
97
- // counterheck for test vector at 1234567890
98
- opt._t = 1234567890*1000;
99
- var token = '005924';
100
- var res = notp.totp.verify(token, key, opt);
101
- assert.ok(res, 'Should pass');
102
- assert.equal(res.delta, 0, 'Should be in sync');
103
-
104
- // counterheck for test vector at 1111111109
105
- opt._t = 1111111109*1000;
106
- var token = '081804';
107
- var res = notp.totp.verify(token, key, opt);
108
- assert.ok(res, 'Should pass');
109
- assert.equal(res.delta, 0, 'Should be in sync');
110
-
111
- // counterheck for test vector at 2000000000
112
- opt._t = 2000000000*1000;
113
- var token = '279037';
114
- var res = notp.totp.verify(token, key, opt);
115
- assert.ok(res, 'Should pass');
116
- assert.equal(res.delta, 0, 'Should be in sync');
117
- };
118
-
119
-
120
- /*
121
- * counterheck for codes that are out of sync
122
- * windowe are going to use a value of counter = 1 and test against
123
- * a code for counter = 9
124
- */
125
- exports.testHOTPOutOfSync = function() {
126
-
127
- var key = '12345678901234567890';
128
- var token = '520489';
129
-
130
- var opt = {
131
- counter : 1
132
- };
133
-
134
- // counterheck that the test should fail for window < 8
135
- opt.window = 7;
136
- assert.ok(!notp.hotp.verify(token, key, opt), 'Should not pass for value of window < 8');
137
-
138
- // counterheck that the test should pass for window >= 9
139
- opt.window = 8;
140
- assert.ok(notp.hotp.verify(token, key, opt), 'Should pass for value of window >= 9');
141
-
142
- // counterheck that test should pass for negative counter values
143
- token = '755224';
144
- opt.counter = 7
145
- opt.window = 8;
146
- assert.ok(notp.hotp.verify(token, key, opt), 'Should pass for negative counter values');
147
- };
148
-
149
-
150
- /*
151
- * counterheck for codes that are out of sync
152
- * windowe are going to use a value of T = 1999999909 (91s behind 2000000000)
153
- */
154
- exports.testTOTPOutOfSync = function() {
155
-
156
- var key = '12345678901234567890';
157
- var token = '279037';
158
-
159
- var opt = {
160
- _t : 1999999909*1000
161
- };
162
-
163
- // counterheck that the test should fail for window < 2
164
- opt.window = 2;
165
- assert.ok(!notp.totp.verify(token, key, opt), 'Should not pass for value of window < 3');
166
-
167
- // counterheck that the test should pass for window >= 3
168
- opt.window = 3;
169
- assert.ok(notp.totp.verify(token, key, opt), 'Should pass for value of window >= 3');
170
- };
171
-
172
-
173
- exports.hotp_gen = function() {
174
- var key = '12345678901234567890';
175
- var opt = {
176
- window : 0,
177
- };
178
-
179
- var HOTP = ['755224', '287082','359152', '969429', '338314', '254676', '287922', '162583', '399871', '520489'];
180
-
181
- // make sure we can not pass in opt
182
- notp.hotp.gen(key);
183
-
184
- // counterheck for passes
185
- for(i=0;i<HOTP.length;i++) {
186
- opt.counter = i;
187
- assert.equal(notp.hotp.gen(key, opt), HOTP[i], 'HOTP value should be correct');
188
- }
189
- };
190
-
191
-
192
- exports.totp_gen = function() {
193
- var key = '12345678901234567890';
194
- var opt = {
195
- window : 0,
196
- };
197
-
198
- // make sure we can not pass in opt
199
- notp.totp.gen(key);
200
-
201
- // counterheck for test vector at 59s
202
- opt._t = 59*1000;
203
- assert.equal(notp.totp.gen(key, opt), '287082', 'TOTtoken values should match');
204
-
205
- // counterheck for test vector at 1234567890
206
- opt._t = 1234567890*1000;
207
- assert.equal(notp.totp.gen(key, opt), '005924', 'TOTtoken values should match');
208
-
209
- // counterheck for test vector at 1111111109
210
- opt._t = 1111111109*1000;
211
- assert.equal(notp.totp.gen(key, opt), '081804', 'TOTtoken values should match');
212
-
213
- // counterheck for test vector at 2000000000
214
- opt._t = 2000000000*1000;
215
- assert.equal(notp.totp.gen(key, opt), '279037', 'TOTtoken values should match');
216
- };
217
-
@@ -1,19 +0,0 @@
1
- Copyright (c) 2011, Chris Umbel
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
@@ -1,24 +0,0 @@
1
- # Copyright (c) 2011, Chris Umbel
2
-
3
- # Permission is hereby granted, free of charge, to any person obtaining a copy
4
- # of this software and associated documentation files (the "Software"), to deal
5
- # in the Software without restriction, including without limitation the rights
6
- # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- # copies of the Software, and to permit persons to whom the Software is
8
- # furnished to do so, subject to the following conditions:
9
-
10
- # The above copyright notice and this permission notice shall be included in
11
- # all copies or substantial portions of the Software.
12
-
13
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- # THE SOFTWARE.
20
-
21
- SHELL := /bin/bash
22
-
23
- test:
24
- jasmine-node spec/
@@ -1,15 +0,0 @@
1
- # thirty-two
2
-
3
- Implementation of RFC 3548 Base32 encoding/decoding for node.
4
-
5
- ## Installation
6
-
7
- npm install thirty-two
8
-
9
- ## Usage
10
-
11
- var base32 = require('thirty-two');
12
- base32.encode('node');
13
- // output: NZXWIZI=
14
- base32.decode('NZXWIZI=');
15
- //output: node
@@ -1,23 +0,0 @@
1
- /*
2
- Copyright (c) 2011, Chris Umbel
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be included in
12
- all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- THE SOFTWARE.
21
- */
22
-
23
- module.exports = require('./lib/base32/');
@@ -1,26 +0,0 @@
1
- /*
2
- Copyright (c) 2011, Chris Umbel
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be included in
12
- all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- THE SOFTWARE.
21
- */
22
-
23
- var base32 = require('./thirty-two');
24
-
25
- exports.encode = base32.encode;
26
- exports.decode = base32.decode;