adminforth 1.1.75 → 1.1.77
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/custom/s3uploader.vue +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 -3
- package/plugins/S3UploadPlugin/custom/s3uploader.vue +1 -1
- 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,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@types/notp",
|
|
3
|
+
"version": "2.0.5",
|
|
4
|
+
"description": "TypeScript definitions for notp",
|
|
5
|
+
"homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/notp",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"contributors": [],
|
|
8
|
+
"main": "",
|
|
9
|
+
"types": "index.d.ts",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
|
|
13
|
+
"directory": "types/notp"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@types/node": "*"
|
|
18
|
+
},
|
|
19
|
+
"typesPublisherContentHash": "746a99309c6f17d73e0a9d112b03297e4ec2e2fc6da3d58132842784ae813fd8",
|
|
20
|
+
"typeScriptVersion": "4.5"
|
|
21
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# node-2fa
|
|
2
|
+
|
|
3
|
+
Easy 2-Factor Integration For Node.js
|
|
4
|
+
|
|
5
|
+
There are a number of applications which support 2-Factor Authentication, namely
|
|
6
|
+
|
|
7
|
+
- Authy [iPhone](https://itunes.apple.com/us/app/authy/id494168017?mt=8) | [Android](https://play.google.com/store/apps/details?id=com.authy.authy&hl=en) | [Chrome](https://chrome.google.com/webstore/detail/authy/gaedmjdfmmahhbjefcbgaolhhanlaolb?hl=en) | [Linux](https://www.authy.com/personal/) | [OS X](https://www.authy.com/personal/) | [BlackBerry](https://appworld.blackberry.com/webstore/content/38831914/?countrycode=US&lang=en)
|
|
8
|
+
- Google Authenticator [iPhone](https://itunes.apple.com/us/app/google-authenticator/id388497605?mt=8) | [Android](https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en)
|
|
9
|
+
- Microsoft Authenticator [Windows Phone](https://www.microsoft.com/en-us/store/apps/authenticator/9wzdncrfj3rj) | [Android](https://play.google.com/store/apps/details?id=com.microsoft.msa.authenticator)
|
|
10
|
+
|
|
11
|
+
This module uses [`notp`](https://github.com/guyht/notp) which implements `TOTP` [(RFC 6238)](https://www.ietf.org/rfc/rfc6238.txt)
|
|
12
|
+
(the _Authenticator_ standard), which is based on `HOTP` [(RFC 4226)](https://www.ietf.org/rfc/rfc4226.txt)
|
|
13
|
+
to provide codes that are exactly compatible with all other _Authenticator_ apps and services that use them.
|
|
14
|
+
|
|
15
|
+
Usage
|
|
16
|
+
=====
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install node-2fa --save
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
const twofactor = require("node-2fa");
|
|
24
|
+
|
|
25
|
+
const newSecret = twofactor.generateSecret({ name: "My Awesome App", account: "johndoe" });
|
|
26
|
+
/*
|
|
27
|
+
{ secret: 'XDQXYCP5AC6FA32FQXDGJSPBIDYNKK5W',
|
|
28
|
+
uri: 'otpauth://totp/My%20Awesome%20App:johndoe?secret=XDQXYCP5AC6FA32FQXDGJSPBIDYNKK5W&issuer=My%20Awesome%20App',
|
|
29
|
+
qr: 'https://chart.googleapis.com/chart?chs=166x166&chld=L|0&cht=qr&chl=otpauth://totp/My%20Awesome%20App:johndoe%3Fsecret=XDQXYCP5AC6FA32FQXDGJSPBIDYNKK5W%26issuer=My%20Awesome%20App'
|
|
30
|
+
}
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
const newToken = twofactor.generateToken("XDQXYCP5AC6FA32FQXDGJSPBIDYNKK5W");
|
|
34
|
+
// => { token: '630618' }
|
|
35
|
+
|
|
36
|
+
twofactor.verifyToken("XDQXYCP5AC6FA32FQXDGJSPBIDYNKK5W", "630618");
|
|
37
|
+
// => { delta: 0 }
|
|
38
|
+
|
|
39
|
+
twofactor.verifyToken("XDQXYCP5AC6FA32FQXDGJSPBIDYNKK5W", "00");
|
|
40
|
+
// => null
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## API
|
|
44
|
+
|
|
45
|
+
### generateSecret(options)
|
|
46
|
+
|
|
47
|
+
returns an object containing a 32-character secret (keep user specific, store in DB), a uri (if you want to make your own QR / barcode) and a direct link to a QR code served via HTTPS by the Google Chart API
|
|
48
|
+
|
|
49
|
+
options is an object containing `name` which is the name of your app that will show up when the user scans the QR code and `account` which can be the username and will also show up in the user's app. Both parameters are optional
|
|
50
|
+
|
|
51
|
+
### generateToken(secret)
|
|
52
|
+
|
|
53
|
+
returns an object containing a 6-character token
|
|
54
|
+
|
|
55
|
+
### verifyToken(secret, token, window)
|
|
56
|
+
|
|
57
|
+
checks if a time-based token matches a token from secret key within a +/- _window_ (default: 4) minute window
|
|
58
|
+
|
|
59
|
+
returns either `null` if the token does not match, or an object containing delta key, which is an integer of how for behind / forward the code time sync is in terms of how many new codes have been generated since entry
|
|
60
|
+
|
|
61
|
+
ex.
|
|
62
|
+
`{delta: -1}` means that the client entered the key too late (a newer key was meant to be used).
|
|
63
|
+
`{delta: 1}` means the client entered the key too early (an older key was meant to be used).
|
|
64
|
+
`{delta: 0}` means the client was within the time frame of the current key.
|
|
65
|
+
|
|
66
|
+
## _n_-Minute Window
|
|
67
|
+
|
|
68
|
+
The window is set to 4 by default. Each token is valid for a total of _n_ minutes to account for time drift.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import notp from "notp";
|
|
2
|
+
import { Options } from "./interfaces";
|
|
3
|
+
export declare function generateSecret(options?: Options): {
|
|
4
|
+
secret: string;
|
|
5
|
+
uri: string;
|
|
6
|
+
qr: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function generateToken(secret: string): {
|
|
9
|
+
token: string;
|
|
10
|
+
} | null;
|
|
11
|
+
export declare function verifyToken(secret: string, token?: string, window?: number): notp.VerifyResult | null;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyToken = exports.generateToken = exports.generateSecret = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const notp_1 = tslib_1.__importDefault(require("notp"));
|
|
6
|
+
const crypto_1 = tslib_1.__importDefault(require("crypto"));
|
|
7
|
+
const thirty_two_1 = tslib_1.__importDefault(require("thirty-two"));
|
|
8
|
+
function generateSecret(options) {
|
|
9
|
+
var _a;
|
|
10
|
+
const config = {
|
|
11
|
+
name: encodeURIComponent((_a = options === null || options === void 0 ? void 0 : options.name) !== null && _a !== void 0 ? _a : "App"),
|
|
12
|
+
account: encodeURIComponent((options === null || options === void 0 ? void 0 : options.account) ? `:${options.account}` : ""),
|
|
13
|
+
};
|
|
14
|
+
const bin = crypto_1.default.randomBytes(20);
|
|
15
|
+
const base32 = thirty_two_1.default.encode(bin).toString("utf8").replace(/=/g, "");
|
|
16
|
+
const secret = base32
|
|
17
|
+
.toLowerCase()
|
|
18
|
+
.replace(/(\w{4})/g, "$1 ")
|
|
19
|
+
.trim()
|
|
20
|
+
.split(" ")
|
|
21
|
+
.join("")
|
|
22
|
+
.toUpperCase();
|
|
23
|
+
const query = `?secret=${secret}&issuer=${config.name}`;
|
|
24
|
+
const encodedQuery = query.replace('?', '%3F').replace('&', '%26');
|
|
25
|
+
const uri = `otpauth://totp/${config.name}${config.account}`;
|
|
26
|
+
return {
|
|
27
|
+
secret,
|
|
28
|
+
uri: `${uri}${query}`,
|
|
29
|
+
qr: `https://chart.googleapis.com/chart?chs=166x166&chld=L|0&cht=qr&chl=${uri}${encodedQuery}`
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
exports.generateSecret = generateSecret;
|
|
33
|
+
function generateToken(secret) {
|
|
34
|
+
if (!secret || !secret.length)
|
|
35
|
+
return null;
|
|
36
|
+
const unformatted = secret.replace(/\W+/g, "").toUpperCase();
|
|
37
|
+
const bin = thirty_two_1.default.decode(unformatted);
|
|
38
|
+
return { token: notp_1.default.totp.gen(bin) };
|
|
39
|
+
}
|
|
40
|
+
exports.generateToken = generateToken;
|
|
41
|
+
function verifyToken(secret, token, window = 4) {
|
|
42
|
+
if (!token || !token.length)
|
|
43
|
+
return null;
|
|
44
|
+
const unformatted = secret.replace(/\W+/g, "").toUpperCase();
|
|
45
|
+
const bin = thirty_two_1.default.decode(unformatted);
|
|
46
|
+
return notp_1.default.totp.verify(token.replace(/\W+/g, ""), bin, {
|
|
47
|
+
window,
|
|
48
|
+
time: 30,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.verifyToken = verifyToken;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "node-2fa",
|
|
3
|
+
"version": "2.0.3",
|
|
4
|
+
"description": "Easy 2-Factor Integration For Node.js",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"private": false,
|
|
8
|
+
"scripts": {
|
|
9
|
+
"test": "eslint . --fix&&jest",
|
|
10
|
+
"prepublishOnly": "npm run test&&npm run build",
|
|
11
|
+
"build": "tsc"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"package.json",
|
|
16
|
+
"readme.md"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/jeremyscalpello/node-2fa"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"auth",
|
|
24
|
+
"2fa",
|
|
25
|
+
"mfa",
|
|
26
|
+
"token",
|
|
27
|
+
"key",
|
|
28
|
+
"base32",
|
|
29
|
+
"code",
|
|
30
|
+
"generator"
|
|
31
|
+
],
|
|
32
|
+
"contributors": [
|
|
33
|
+
"Jeremy Scalpello <jeremy@scalpello.info>",
|
|
34
|
+
"Alistair Smith <hey@alistair.cloud>"
|
|
35
|
+
],
|
|
36
|
+
"license": "Apache-2.0",
|
|
37
|
+
"homepage": "https://github.com/jeremyscalpello/node-2fa#readme",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@types/notp": "^2.0.0",
|
|
40
|
+
"notp": "^2.0.3",
|
|
41
|
+
"thirty-two": "1.0.2",
|
|
42
|
+
"tslib": "^2.1.0"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/jest": "^26.0.20",
|
|
46
|
+
"@types/node": "^14.14.20",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^4.12.0",
|
|
48
|
+
"@typescript-eslint/parser": "^4.12.0",
|
|
49
|
+
"eslint": "^7.17.0",
|
|
50
|
+
"jest": "^26.6.3",
|
|
51
|
+
"prettier": "^2.2.1",
|
|
52
|
+
"ts-jest": "^26.4.4",
|
|
53
|
+
"typescript": "^4.1.3"
|
|
54
|
+
},
|
|
55
|
+
"prettier": {
|
|
56
|
+
"printWidth": 120
|
|
57
|
+
}
|
|
58
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
(The MIT License)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2011 Guy Halford-Thompson <guy@cach.me>
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
'Software'), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
|
|
16
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
19
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
21
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
22
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
[](https://travis-ci.org/guyht/notp)
|
|
2
|
+
|
|
3
|
+
# Node One Time Password library
|
|
4
|
+
Simple to use, fast, and with zero dependencies. The Node One Time Password library is fully compliant with [HOTP](http://tools.ietf.org/html/rfc4226) (counter based one time passwords) and [TOTP](http://tools.ietf.org/html/rfc6238) (time based one time passwords). It can be used in conjunction with the [Google Authenticator](http://code.google.com/p/google-authenticator/) which has free apps for iOS, Android and BlackBerry.
|
|
5
|
+
|
|
6
|
+
# Installation
|
|
7
|
+
|
|
8
|
+
```
|
|
9
|
+
npm install notp
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
# Usage
|
|
13
|
+
|
|
14
|
+
```javascript
|
|
15
|
+
var notp = require('notp');
|
|
16
|
+
|
|
17
|
+
//.... some initial login code, that receives the user details and TOTP / HOTP token
|
|
18
|
+
|
|
19
|
+
var key = 'secret key for user... could be stored in DB';
|
|
20
|
+
var token = 'user supplied one time use token';
|
|
21
|
+
|
|
22
|
+
// Check TOTP is correct (HOTP if hotp pass type)
|
|
23
|
+
var login = notp.totp.verify(token, key);
|
|
24
|
+
|
|
25
|
+
// invalid token if login is null
|
|
26
|
+
if (!login) {
|
|
27
|
+
return console.log('Token invalid');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// valid token
|
|
31
|
+
console.log('Token valid, sync value is %s', login.delta);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Google Authenticator
|
|
35
|
+
|
|
36
|
+
[Google authenticator](https://code.google.com/p/google-authenticator/) requires that keys be base32 encoded before being used. This includes manual entry into the app as well as preparing a QR code URI.
|
|
37
|
+
|
|
38
|
+
To base32 encode a utf8 key you can use the `thirty-two` module.
|
|
39
|
+
|
|
40
|
+
```javascript
|
|
41
|
+
var base32 = require('thirty-two');
|
|
42
|
+
|
|
43
|
+
var key = 'secret key for the user';
|
|
44
|
+
|
|
45
|
+
// encoded will be the secret key, base32 encoded
|
|
46
|
+
var encoded = base32.encode(key);
|
|
47
|
+
|
|
48
|
+
// Google authenticator doesn't like equal signs
|
|
49
|
+
var encodedForGoogle = encoded.toString().replace(/=/g,'');
|
|
50
|
+
|
|
51
|
+
// to create a URI for a qr code (change totp to hotp is using hotp)
|
|
52
|
+
var uri = 'otpauth://totp/somelabel?secret=' + encodedForGoogle;
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Note: If your label has spaces or other invalid uri characters you will need to encode it accordingly using `encodeURIComponent` More details about the uri key format can be found on the [google auth wiki](https://code.google.com/p/google-authenticator/wiki/KeyUriFormat)
|
|
56
|
+
|
|
57
|
+
# API
|
|
58
|
+
##hotp.verify(token, key, opt)
|
|
59
|
+
|
|
60
|
+
Check a counter based one time password for validity.
|
|
61
|
+
|
|
62
|
+
Returns null if token is not valid for given key and options.
|
|
63
|
+
|
|
64
|
+
Returns an object `{delta: #}` if the token is valid. `delta` is the count skew between client and server.
|
|
65
|
+
|
|
66
|
+
### opt
|
|
67
|
+
**window**
|
|
68
|
+
> The allowable margin for the counter. The function will check `window` codes in the future against the provided token.
|
|
69
|
+
> i.e. if `window = 100` and `counter = 5` all tokens between 5 and 105 will be checked against the supplied token
|
|
70
|
+
> Default - 50
|
|
71
|
+
|
|
72
|
+
**counter**
|
|
73
|
+
> Counter value. This should be stored by the application on a per user basis. It is up to the application to track and increment this value as needed. It is also up to the application to increment this value if there is a skew between the client and server (`delta`)
|
|
74
|
+
|
|
75
|
+
##totp.verify(token, key, opt)
|
|
76
|
+
|
|
77
|
+
Check a time based one time password for validity
|
|
78
|
+
|
|
79
|
+
Returns null if token is not valid for given key and options.
|
|
80
|
+
|
|
81
|
+
Returns an object `{delta: #}` if the token is valid. `delta` is the count skew between client and server.
|
|
82
|
+
|
|
83
|
+
### opt
|
|
84
|
+
**window**
|
|
85
|
+
> The allowable margin for the counter. The function will check `window` codes in the future against the provided token.
|
|
86
|
+
> i.e. if `window = 5` and `counter = 1000` all tokens between 995 and 1005 will be checked against the supplied token
|
|
87
|
+
> Default - 6
|
|
88
|
+
|
|
89
|
+
**time**
|
|
90
|
+
> The time step of the counter. This must be the same for every request and is used to calculate C.
|
|
91
|
+
> Default - 30
|
|
92
|
+
|
|
93
|
+
##hotp.gen(key, opt)
|
|
94
|
+
|
|
95
|
+
Return a counter based one time password
|
|
96
|
+
|
|
97
|
+
### opt
|
|
98
|
+
**counter**
|
|
99
|
+
> Counter value. This should be stored by the application, must be user specific, and be incremented for each request.
|
|
100
|
+
|
|
101
|
+
##totp.gen(key, opt)
|
|
102
|
+
|
|
103
|
+
Return a time based one time password
|
|
104
|
+
|
|
105
|
+
### opt
|
|
106
|
+
**time**
|
|
107
|
+
> The time step of the counter. This must be the same for every request and is used to calculate C.
|
|
108
|
+
> Default - 30
|
|
109
|
+
|
|
110
|
+
# Migrating from 1.x to 2.x
|
|
111
|
+
|
|
112
|
+
## Removed
|
|
113
|
+
The `encBase32` and `decBase32` methods have been removed. If you wish to encode/decode base32 you should install a module to do so. We recommend the `thirty-two` npm module.
|
|
114
|
+
|
|
115
|
+
## Changed
|
|
116
|
+
|
|
117
|
+
All of the APIs have been changed to return values directly instead of using callbacks. This reflects the fact that the functions are actually synchronous and perform no I/O.
|
|
118
|
+
|
|
119
|
+
Some of the required arguments to the functions have also been removed from the `args` parameter and are passed as separate function parameters. See the above API docs for details.
|
|
120
|
+
|
|
121
|
+
* `notp.checkHOTP(args, err, cb)` -> `notp.hotp.verify(token, key, opt)`
|
|
122
|
+
* `notp.checkTOTP(args, err, cb)` -> `notp.totp.verify(token, key, opt)`
|
|
123
|
+
* `notp.getHOTP(args, err, cb)` -> `notp.gotp.gen(key, opt)`
|
|
124
|
+
* `notp.getTOTP(args, err, cb)` -> `notp.totp.gen(key, opt)`
|
|
125
|
+
|
|
126
|
+
## Args
|
|
127
|
+
|
|
128
|
+
The argument names have also changed to better describe the purpose of the argument.
|
|
129
|
+
|
|
130
|
+
* `K` -> no longer in args/opt but passed directly as a function argument
|
|
131
|
+
* `P` -> no longer in args/opt but passed directly as a function argument
|
|
132
|
+
* `W` -> `window`
|
|
133
|
+
* `C` -> `counter`
|
|
134
|
+
* `T` -> `time`
|
|
135
|
+
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
var notp = require('../index'),
|
|
3
|
+
t2 = require('thirty-two'),
|
|
4
|
+
K = '12345678901234567890',
|
|
5
|
+
b32 = t2.encode(K);
|
|
6
|
+
|
|
7
|
+
console.log('Click on this link to gennerate a QR code, and use Google Authenticator on your phone to read it:');
|
|
8
|
+
console.log('http://qrcode.kaywa.com/img.php?s=8&d=' + encodeURIComponent('otpauth://totp/notp@example.com?secret=' + b32));
|
|
9
|
+
verify();
|
|
10
|
+
|
|
11
|
+
function verify() {
|
|
12
|
+
ask('Enter a code to verify', function(code) {
|
|
13
|
+
if(notp.totp.verify(code, K, {})) {
|
|
14
|
+
console.log('Success!!!');
|
|
15
|
+
}
|
|
16
|
+
console.log(notp.totp.verify(code, K, {}));
|
|
17
|
+
verify();
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
function ask(question, callback) {
|
|
24
|
+
var stdin = process.stdin, stdout = process.stdout;
|
|
25
|
+
|
|
26
|
+
stdin.resume();
|
|
27
|
+
stdout.write(question + ": ");
|
|
28
|
+
|
|
29
|
+
stdin.once('data', function(data) {
|
|
30
|
+
data = data.toString().trim();
|
|
31
|
+
callback(data);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
|
|
2
|
+
var notp = require('../index'),
|
|
3
|
+
t2 = require('thirty-two'),
|
|
4
|
+
K = '12345678901234567890',
|
|
5
|
+
b32 = t2.encode(K);
|
|
6
|
+
|
|
7
|
+
console.log('Getting current counter value for K = 12345678901234567890');
|
|
8
|
+
console.log('This has a base32 value of ' + b32);
|
|
9
|
+
console.log('The base32 value should be entered in the Google Authenticator App');
|
|
10
|
+
console.log('');
|
|
11
|
+
console.log('Open the following URL for a QR code. Google Authenticator can read this QR code using your phone\'s camera:');
|
|
12
|
+
console.log('http://qrcode.kaywa.com/img.php?s=8&d=' + encodeURIComponent('otpauth://totp/notp@example.com?secret=' + b32));
|
|
13
|
+
|
|
14
|
+
console.log('The current TOTP value is ' + notp.totp.gen(K, {}));
|
|
15
|
+
|