adminforth 1.1.75 → 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/dist/modules/utils.js +1 -1
- package/dist/plugins/S3UploadPlugin/package.json +1 -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/spa/spa/.eslintrc.cjs +14 -0
- package/dist/spa/spa/.vscode/extensions.json +6 -0
- package/dist/spa/spa/README.md +39 -0
- package/dist/spa/spa/env.d.ts +1 -0
- package/dist/spa/spa/index.html +23 -0
- package/dist/spa/spa/package-lock.json +4470 -0
- package/dist/spa/spa/package.json +48 -0
- package/dist/spa/spa/postcss.config.js +6 -0
- package/dist/spa/spa/public/assets/favicon.png +0 -0
- package/dist/spa/spa/src/App.vue +316 -0
- package/dist/spa/spa/src/assets/base.css +0 -0
- package/dist/spa/spa/src/assets/logo.svg +19 -0
- package/dist/spa/spa/src/components/AcceptModal.vue +45 -0
- package/dist/spa/spa/src/components/Breadcrumbs.vue +40 -0
- package/dist/spa/spa/src/components/BreadcrumbsWithButtons.vue +26 -0
- package/dist/spa/spa/src/components/CustomDatePicker.vue +174 -0
- package/dist/spa/spa/src/components/CustomDateRangePicker.vue +218 -0
- package/dist/spa/spa/src/components/CustomRangePicker.vue +148 -0
- package/dist/spa/spa/src/components/Dropdown.vue +168 -0
- package/dist/spa/spa/src/components/Filters.vue +211 -0
- package/dist/spa/spa/src/components/HelloWorld.vue +17 -0
- package/dist/spa/spa/src/components/MenuLink.vue +24 -0
- package/dist/spa/spa/src/components/ResourceForm.vue +265 -0
- package/dist/spa/spa/src/components/ResourceListTable.vue +404 -0
- package/dist/spa/spa/src/components/SingleSkeletLoader.vue +13 -0
- package/dist/spa/spa/src/components/SkeleteLoader.vue +23 -0
- package/dist/spa/spa/src/components/Toast.vue +66 -0
- package/dist/spa/spa/src/components/ValueRenderer.vue +59 -0
- package/dist/spa/spa/src/components/icons/IconCalendar.vue +5 -0
- package/dist/spa/spa/src/components/icons/IconCommunity.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconDocumentation.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconEcosystem.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconSupport.vue +7 -0
- package/dist/spa/spa/src/components/icons/IconTime.vue +5 -0
- package/dist/spa/spa/src/components/icons/IconTooling.vue +19 -0
- package/dist/spa/spa/src/composables/useFrontendApi.ts +26 -0
- package/dist/spa/spa/src/composables/useStores.ts +126 -0
- package/dist/spa/spa/src/index.scss +26 -0
- package/dist/spa/spa/src/main.ts +18 -0
- package/dist/spa/spa/src/router/index.ts +63 -0
- package/dist/spa/spa/src/spa_types/core.ts +51 -0
- package/dist/spa/spa/src/stores/core.ts +144 -0
- package/dist/spa/spa/src/stores/filters.ts +22 -0
- package/dist/spa/spa/src/stores/modal.ts +48 -0
- package/dist/spa/spa/src/stores/toast.ts +15 -0
- package/dist/spa/spa/src/stores/user.ts +54 -0
- package/dist/spa/spa/src/utils.ts +101 -0
- package/dist/spa/spa/src/views/CreateView.vue +155 -0
- package/dist/spa/spa/src/views/EditView.vue +157 -0
- package/dist/spa/spa/src/views/ListView.vue +266 -0
- package/dist/spa/spa/src/views/LoginView.vue +139 -0
- package/dist/spa/spa/src/views/ResourceParent.vue +17 -0
- package/dist/spa/spa/src/views/ShowView.vue +180 -0
- package/dist/spa/spa/tailwind.config.js +17 -0
- package/dist/spa/spa/tsconfig.app.json +14 -0
- package/dist/spa/spa/tsconfig.json +11 -0
- package/dist/spa/spa/tsconfig.node.json +19 -0
- package/dist/spa/spa/vite.config.ts +49 -0
- package/modules/utils.ts +1 -1
- package/package.json +1 -2
- package/plugins/S3UploadPlugin/package.json +1 -0
- package/plugins/S3UploadPlugin/types.ts +1 -1
- 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
|
@@ -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;
|
package/dist/plugins/TwoFactorsAuthPlugin/node_modules/thirty-two/lib/thirty-two/thirty-two.js
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
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
|
+
'use strict';
|
|
23
|
+
|
|
24
|
+
var charTable = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";
|
|
25
|
+
var byteTable = [
|
|
26
|
+
0xff, 0xff, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
|
|
27
|
+
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
|
|
28
|
+
0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
|
|
29
|
+
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
|
|
30
|
+
0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
|
|
31
|
+
0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff,
|
|
32
|
+
0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
|
|
33
|
+
0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e,
|
|
34
|
+
0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16,
|
|
35
|
+
0x17, 0x18, 0x19, 0xff, 0xff, 0xff, 0xff, 0xff
|
|
36
|
+
];
|
|
37
|
+
|
|
38
|
+
function quintetCount(buff) {
|
|
39
|
+
var quintets = Math.floor(buff.length / 5);
|
|
40
|
+
return buff.length % 5 === 0 ? quintets: quintets + 1;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
exports.encode = function(plain) {
|
|
44
|
+
if(!Buffer.isBuffer(plain)){
|
|
45
|
+
plain = new Buffer(plain);
|
|
46
|
+
}
|
|
47
|
+
var i = 0;
|
|
48
|
+
var j = 0;
|
|
49
|
+
var shiftIndex = 0;
|
|
50
|
+
var digit = 0;
|
|
51
|
+
var encoded = new Buffer(quintetCount(plain) * 8);
|
|
52
|
+
|
|
53
|
+
/* byte by byte isn't as pretty as quintet by quintet but tests a bit
|
|
54
|
+
faster. will have to revisit. */
|
|
55
|
+
while(i < plain.length) {
|
|
56
|
+
var current = plain[i];
|
|
57
|
+
|
|
58
|
+
if(shiftIndex > 3) {
|
|
59
|
+
digit = current & (0xff >> shiftIndex);
|
|
60
|
+
shiftIndex = (shiftIndex + 5) % 8;
|
|
61
|
+
digit = (digit << shiftIndex) | ((i + 1 < plain.length) ?
|
|
62
|
+
plain[i + 1] : 0) >> (8 - shiftIndex);
|
|
63
|
+
i++;
|
|
64
|
+
} else {
|
|
65
|
+
digit = (current >> (8 - (shiftIndex + 5))) & 0x1f;
|
|
66
|
+
shiftIndex = (shiftIndex + 5) % 8;
|
|
67
|
+
if(shiftIndex === 0) i++;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
encoded[j] = charTable.charCodeAt(digit);
|
|
71
|
+
j++;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
for(i = j; i < encoded.length; i++) {
|
|
75
|
+
encoded[i] = 0x3d; //'='.charCodeAt(0)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return encoded;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
exports.decode = function(encoded) {
|
|
82
|
+
var shiftIndex = 0;
|
|
83
|
+
var plainDigit = 0;
|
|
84
|
+
var plainChar;
|
|
85
|
+
var plainPos = 0;
|
|
86
|
+
if(!Buffer.isBuffer(encoded)){
|
|
87
|
+
encoded = new Buffer(encoded);
|
|
88
|
+
}
|
|
89
|
+
var decoded = new Buffer(Math.ceil(encoded.length * 5 / 8));
|
|
90
|
+
|
|
91
|
+
/* byte by byte isn't as pretty as octet by octet but tests a bit
|
|
92
|
+
faster. will have to revisit. */
|
|
93
|
+
for(var i = 0; i < encoded.length; i++) {
|
|
94
|
+
if(encoded[i] === 0x3d){ //'='
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
var encodedByte = encoded[i] - 0x30;
|
|
99
|
+
|
|
100
|
+
if(encodedByte < byteTable.length) {
|
|
101
|
+
plainDigit = byteTable[encodedByte];
|
|
102
|
+
|
|
103
|
+
if(shiftIndex <= 3) {
|
|
104
|
+
shiftIndex = (shiftIndex + 5) % 8;
|
|
105
|
+
|
|
106
|
+
if(shiftIndex === 0) {
|
|
107
|
+
plainChar |= plainDigit;
|
|
108
|
+
decoded[plainPos] = plainChar;
|
|
109
|
+
plainPos++;
|
|
110
|
+
plainChar = 0;
|
|
111
|
+
} else {
|
|
112
|
+
plainChar |= 0xff & (plainDigit << (8 - shiftIndex));
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
shiftIndex = (shiftIndex + 5) % 8;
|
|
116
|
+
plainChar |= 0xff & (plainDigit >>> shiftIndex);
|
|
117
|
+
decoded[plainPos] = plainChar;
|
|
118
|
+
plainPos++;
|
|
119
|
+
|
|
120
|
+
plainChar = 0xff & (plainDigit << (8 - shiftIndex));
|
|
121
|
+
}
|
|
122
|
+
} else {
|
|
123
|
+
throw new Error('Invalid input - it is not base32 encoded string');
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
return decoded.slice(0, plainPos);
|
|
128
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "thirty-two",
|
|
3
|
+
"description": "Implementation RFC 3548 Base32 encoding/decoding for node.",
|
|
4
|
+
"version": "1.0.2",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=0.2.6"
|
|
7
|
+
},
|
|
8
|
+
"author": "Chris Umbel <chris@chrisumbel.com>",
|
|
9
|
+
"keywords": ["base32", "encoding"],
|
|
10
|
+
"main": "./lib/thirty-two/index.js",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git://github.com/chrisumbel/thirty-two.git"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
if(!expect){
|
|
23
|
+
function expect(a){
|
|
24
|
+
return {
|
|
25
|
+
toBe: function(b){
|
|
26
|
+
require('assert').strictEqual(a, b);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
var base32 = require('../lib/thirty-two/');
|
|
32
|
+
|
|
33
|
+
describe('thirty-two', function() {
|
|
34
|
+
it('should encode', function() {
|
|
35
|
+
expect(base32.encode('a').toString()).toBe('ME======');
|
|
36
|
+
expect(base32.encode('be').toString()).toBe('MJSQ====');
|
|
37
|
+
expect(base32.encode('bee').toString()).toBe('MJSWK===');
|
|
38
|
+
expect(base32.encode('beer').toString()).toBe('MJSWK4Q=');
|
|
39
|
+
expect(base32.encode('beers').toString()).toBe('MJSWK4TT');
|
|
40
|
+
expect(base32.encode('beers 1').toString()).toBe('MJSWK4TTEAYQ====');
|
|
41
|
+
expect(base32.encode('shockingly dismissed').toString()).toBe('ONUG6Y3LNFXGO3DZEBSGS43NNFZXGZLE');
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
it('should decode', function() {
|
|
46
|
+
expect(base32.decode('ME======').toString()).toBe('a');
|
|
47
|
+
expect(base32.decode('MJSQ====').toString()).toBe('be');
|
|
48
|
+
expect(base32.decode('ONXW4===').toString()).toBe('son');
|
|
49
|
+
expect(base32.decode('MJSWK===').toString()).toBe('bee');
|
|
50
|
+
expect(base32.decode('MJSWK4Q=').toString()).toBe('beer');
|
|
51
|
+
expect(base32.decode('MJSWK4TT').toString()).toBe('beers');
|
|
52
|
+
expect(base32.decode('mjswK4TT').toString()).toBe('beers');
|
|
53
|
+
expect(base32.decode('MJSWK4TTN5XA====').toString()).toBe('beerson');
|
|
54
|
+
expect(base32.decode('MJSWK4TTEAYQ====').toString()).toBe('beers 1');
|
|
55
|
+
expect(base32.decode('ONUG6Y3LNFXGO3DZEBSGS43NNFZXGZLE').toString()).toBe('shockingly dismissed');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('should be binary safe', function() {
|
|
59
|
+
expect(base32.decode(base32.encode(new Buffer([0x00, 0xff, 0x88]))).toString('hex')).toBe('00ff88');
|
|
60
|
+
expect(base32.encode(new Buffer("f61e1f998d69151de8334dbe753ab17ae831c13849a6aecd95d0a4e5dc25", 'hex')).toString()).toBe('6YPB7GMNNEKR32BTJW7HKOVRPLUDDQJYJGTK5TMV2CSOLXBF');
|
|
61
|
+
expect(base32.decode('6YPB7GMNNEKR32BTJW7HKOVRPLUDDQJYJGTK5TMV2CSOLXBF').toString('hex')).toBe('f61e1f998d69151de8334dbe753ab17ae831c13849a6aecd95d0a4e5dc25');
|
|
62
|
+
});
|
|
63
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/******************************************************************************
|
|
2
|
+
Copyright (c) Microsoft Corporation.
|
|
3
|
+
|
|
4
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
5
|
+
purpose with or without fee is hereby granted.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
8
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
9
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
10
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
11
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
+
***************************************************************************** */
|
|
15
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright (c) Microsoft Corporation.
|
|
2
|
+
|
|
3
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
4
|
+
purpose with or without fee is hereby granted.
|
|
5
|
+
|
|
6
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
7
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
8
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
9
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
10
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
11
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
12
|
+
PERFORMANCE OF THIS SOFTWARE.
|