adminforth 1.1.74 → 1.1.76
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/auth.ts +14 -0
- package/dataConnectors/postgres.ts +1 -1
- package/dist/auth.js +7 -0
- package/dist/index.js +117 -65
- package/dist/modules/codeInjector.js +29 -15
- package/dist/modules/utils.js +1 -1
- package/dist/plugins/AuditLogPlugin/index.js +2 -17
- package/dist/plugins/S3UploadPlugin/custom/s3uploader.vue +120 -0
- package/dist/plugins/S3UploadPlugin/index.js +103 -0
- package/dist/plugins/S3UploadPlugin/package-lock.json +431 -0
- package/dist/plugins/S3UploadPlugin/package.json +16 -0
- package/dist/plugins/TwoFactorsAuthPlugin/custom/TwoFactorsConfirmation.vue +152 -0
- package/dist/plugins/TwoFactorsAuthPlugin/custom/TwoFactorsOtp.vue +0 -0
- package/dist/plugins/TwoFactorsAuthPlugin/custom/TwoFactorsSetup.vue +188 -0
- package/dist/plugins/TwoFactorsAuthPlugin/index.js +150 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/.package-lock.json +61 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/LICENSE +21 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/README.md +15 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/package.json +217 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/LICENSE +21 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/README.md +15 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/package.json +21 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/LICENSE +201 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/README.md +68 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/index.js +51 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/interfaces.js +2 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/package.json +58 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/.travis.yml +6 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/LICENSE +22 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/Readme.md +135 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/examples/TOTP-verify.js +33 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/examples/TOTP.js +15 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/index.js +221 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/package.json +22 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/test/mocha.opts +1 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/notp/test/notp.js +217 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/LICENSE.txt +19 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/Makefile +24 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/README.md +15 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/index.js +23 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/lib/thirty-two/index.js +26 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/lib/thirty-two/thirty-two.js +128 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/package.json +15 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/spec/thirty-two_spec.js +63 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/CopyrightNotice.txt +15 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/LICENSE.txt +12 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/README.md +164 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/SECURITY.md +41 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/index.js +68 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/package.json +3 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/package.json +47 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.html +1 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.js +374 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.mjs +373 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.html +1 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.js +424 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/README.md +6 -0
- package/dist/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/package.json +55 -0
- package/dist/plugins/TwoFactorsAuthPlugin/package-lock.json +69 -0
- package/dist/plugins/TwoFactorsAuthPlugin/package.json +15 -0
- package/dist/plugins/TwoFactorsAuthPlugin/types.js +1 -0
- package/dist/spa/index.html +1 -1
- package/dist/spa/package-lock.json +111 -0
- package/dist/spa/package.json +1 -0
- package/dist/spa/spa/src/App.vue +154 -121
- package/dist/spa/spa/src/components/ResourceForm.vue +91 -91
- package/dist/spa/spa/src/router/index.ts +0 -1
- package/dist/spa/spa/src/utils.ts +1 -1
- package/dist/spa/spa/src/views/CreateView.vue +0 -1
- package/dist/spa/spa/src/views/LoginView.vue +4 -1
- package/dist/spa/src/App.vue +178 -133
- package/dist/spa/src/components/MenuLink.vue +3 -3
- package/dist/spa/src/components/ResourceForm.vue +96 -96
- package/dist/spa/src/components/ResourceListTable.vue +69 -84
- package/dist/spa/src/components/SkeleteLoader.vue +23 -0
- package/dist/spa/src/components/ValueRenderer.vue +2 -3
- package/dist/spa/src/composables/useStores.ts +24 -11
- package/dist/spa/src/main.ts +1 -1
- package/dist/spa/src/router/index.ts +0 -1
- package/dist/spa/src/utils.ts +1 -1
- package/dist/spa/src/views/CreateView.vue +1 -9
- package/dist/spa/src/views/EditView.vue +1 -9
- package/dist/spa/src/views/ListView.vue +12 -3
- package/dist/spa/src/views/LoginView.vue +6 -1
- package/dist/spa/src/views/ResourceParent.vue +1 -2
- package/dist/spa/src/views/ShowView.vue +6 -14
- package/dist/spa/tailwind.config.js +3 -1
- package/index.ts +94 -35
- package/modules/codeInjector.ts +38 -27
- package/modules/utils.ts +1 -1
- package/package.json +1 -1
- package/plugins/AuditLogPlugin/index.ts +4 -20
- package/plugins/S3UploadPlugin/custom/s3uploader.vue +120 -0
- package/plugins/S3UploadPlugin/index.ts +112 -0
- package/plugins/S3UploadPlugin/package-lock.json +431 -0
- package/plugins/S3UploadPlugin/package.json +16 -0
- package/plugins/S3UploadPlugin/types.ts +76 -0
- package/plugins/TwoFactorsAuthPlugin/custom/TwoFactorsConfirmation.vue +152 -0
- package/plugins/TwoFactorsAuthPlugin/custom/TwoFactorsOtp.vue +0 -0
- package/plugins/TwoFactorsAuthPlugin/custom/TwoFactorsSetup.vue +188 -0
- package/plugins/TwoFactorsAuthPlugin/index.ts +150 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/.package-lock.json +61 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/LICENSE +21 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/README.md +15 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/assert.d.ts +1040 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/async_hooks.d.ts +541 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/buffer.d.ts +2363 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/child_process.d.ts +1544 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/cluster.d.ts +578 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/console.d.ts +452 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/constants.d.ts +19 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/crypto.d.ts +4523 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/dgram.d.ts +596 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/dns/promises.d.ts +476 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/dns.d.ts +864 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/dom-events.d.ts +124 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/domain.d.ts +170 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/events.d.ts +931 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/fs/promises.d.ts +1245 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/fs.d.ts +4317 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/globals.d.ts +412 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/globals.global.d.ts +1 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/http.d.ts +1908 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/http2.d.ts +2418 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/https.d.ts +550 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/index.d.ts +89 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/inspector.d.ts +2746 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/module.d.ts +315 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/net.d.ts +999 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/os.d.ts +495 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/package.json +217 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/path.d.ts +191 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/perf_hooks.d.ts +905 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/process.d.ts +1754 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/punycode.d.ts +117 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/querystring.d.ts +153 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/readline/promises.d.ts +150 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/readline.d.ts +540 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/repl.d.ts +430 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/sea.d.ts +153 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/stream/promises.d.ts +83 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/stream/web.d.ts +367 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/stream.d.ts +1707 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/test.d.ts +1718 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/timers/promises.d.ts +97 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/timers.d.ts +240 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/tls.d.ts +1217 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/trace_events.d.ts +197 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/tty.d.ts +208 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/url.d.ts +952 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/util.d.ts +2292 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/v8.d.ts +808 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/vm.d.ts +924 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/wasi.d.ts +181 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/worker_threads.d.ts +694 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/node/zlib.d.ts +530 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/LICENSE +21 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/README.md +15 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/index.d.ts +127 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/@types/notp/package.json +21 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/LICENSE +201 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/README.md +68 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/index.d.ts +11 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/index.js +51 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/interfaces.d.ts +4 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/dist/interfaces.js +2 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/node-2fa/package.json +58 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/.travis.yml +6 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/LICENSE +22 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/Readme.md +135 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/examples/TOTP-verify.js +33 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/examples/TOTP.js +15 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/index.js +221 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/package.json +22 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/test/mocha.opts +1 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/notp/test/notp.js +217 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/LICENSE.txt +19 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/Makefile +24 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/README.md +15 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/index.js +23 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/lib/thirty-two/index.js +26 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/lib/thirty-two/thirty-two.js +128 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/package.json +15 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/spec/thirty-two_spec.js +63 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/CopyrightNotice.txt +15 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/LICENSE.txt +12 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/README.md +164 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/SECURITY.md +41 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/index.d.ts +37 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/index.js +68 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/modules/package.json +3 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/package.json +47 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.d.ts +453 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.html +1 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.js +374 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.es6.mjs +373 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.html +1 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/tslib/tslib.js +424 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/README.md +6 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/agent.d.ts +31 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/api.d.ts +43 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/cache.d.ts +36 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/client.d.ts +97 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/connector.d.ts +34 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/content-type.d.ts +21 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/cookies.d.ts +28 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/errors.d.ts +128 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/fetch.d.ts +209 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/file.d.ts +39 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/filereader.d.ts +54 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/formdata.d.ts +108 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/global-origin.d.ts +7 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/handlers.d.ts +9 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/header.d.ts +4 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/index.d.ts +63 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/interceptors.d.ts +5 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-client.d.ts +25 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/package.json +55 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/patch.d.ts +71 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/pool.d.ts +28 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/readable.d.ts +61 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/webidl.d.ts +220 -0
- package/plugins/TwoFactorsAuthPlugin/node_modules/undici-types/websocket.d.ts +131 -0
- package/plugins/TwoFactorsAuthPlugin/package-lock.json +69 -0
- package/plugins/TwoFactorsAuthPlugin/package.json +15 -0
- package/plugins/TwoFactorsAuthPlugin/types.ts +10 -0
- package/servers/express.ts +1 -0
- package/spa/src/App.vue +154 -121
- package/spa/src/components/ResourceForm.vue +91 -91
- package/spa/src/router/index.ts +0 -1
- package/spa/src/utils.ts +1 -1
- package/spa/src/views/CreateView.vue +0 -1
- package/spa/src/views/LoginView.vue +4 -1
- package/types/AdminForthConfig.ts +24 -3
- package/dist/plugins/AuditLog/index.js +0 -13
- /package/dist/plugins/{AuditLog → S3UploadPlugin}/types.js +0 -0
|
@@ -0,0 +1,221 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
--ui exports
|
|
@@ -0,0 +1,217 @@
|
|
|
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
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
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.
|
|
@@ -0,0 +1,24 @@
|
|
|
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/
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
|
@@ -0,0 +1,23 @@
|
|
|
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/');
|
|
@@ -0,0 +1,26 @@
|
|
|
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;
|