Adding password salting

This commit is contained in:
Fabian Stamm 2020-02-07 19:31:00 +01:00
parent bfe53573f6
commit 416df84c8d
6 changed files with 170 additions and 2377 deletions

View File

@ -1,9 +1,12 @@
root = true root = true
[*] [*]
indent_style = space indent_style = space
indent_size = 3 indent_size = 3
end_of_line = crlf end_of_line = crlf
charset = utf-8 charset = utf-8
trim_trailing_whitespace = false trim_trailing_whitespace = false
insert_final_newline = false insert_final_newline = false
[*.yml]
indent_size = 2

250
package-lock.json generated
View File

@ -5,9 +5,9 @@
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@hibas123/config": { "@hibas123/config": {
"version": "1.0.5", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/@hibas123/config/-/config-1.0.5.tgz", "resolved": "https://registry.npmjs.org/@hibas123/config/-/config-1.1.0.tgz",
"integrity": "sha512-KXgjrhFtcpptP1+x1KEtc8w3oaHyVZGCAaDFKxiJyOBIFySDyN41wbC1DFhk/Fk59eGMxIc0dAF16pkznTRnPQ==", "integrity": "sha512-NrSxeTP+WjDyKMzonbcn3QUIPHJwHjE6UE+URT/ZjNsl9vHtfGUKYOs+w73H7topI/+hTX4s/qHHAn6uCv7bjQ==",
"requires": { "requires": {
"ini": "^1.3.5" "ini": "^1.3.5"
} }
@ -2153,9 +2153,9 @@
"dev": true "dev": true
}, },
"@types/jsonwebtoken": { "@types/jsonwebtoken": {
"version": "8.3.5", "version": "8.3.7",
"resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.3.5.tgz", "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-8.3.7.tgz",
"integrity": "sha512-VGM1gb+LwsQ5EPevvbvdnKncajBdYqNcrvixBif1BsiDQiSF1q+j4bBTvKC6Bt9n2kqNSx+yNTY2TVJ360E7EQ==", "integrity": "sha512-B5SSifLkjB0ns7VXpOOtOUlynE78/hKcY8G8pOAhkLJZinwofIBYqz555nRj2W9iDWZqFhK5R+7NZDaRmKWAoQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/node": "*" "@types/node": "*"
@ -2168,9 +2168,9 @@
"dev": true "dev": true
}, },
"@types/mongodb": { "@types/mongodb": {
"version": "3.3.13", "version": "3.3.15",
"resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.3.13.tgz", "resolved": "https://registry.npmjs.org/@types/mongodb/-/mongodb-3.3.15.tgz",
"integrity": "sha512-ZRNmQefIMIGvPQuT8s0z7Kx8A343dtcepJ4m9l8JwRgyJ6cy15ufDJK5uydrZNKmuU/GKWW2EtZ+CzMQt1GhBQ==", "integrity": "sha512-q2dL0VEdFdE9iS0xrTP0NSgJJBFH4hBvt3beglCwU3qMWrz7dCuu/CrRjPB4+R8jLjCi/Gik2Mkd+lU0sYsZgQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/bson": "*", "@types/bson": "*",
@ -2178,9 +2178,9 @@
} }
}, },
"@types/node": { "@types/node": {
"version": "12.12.18", "version": "13.7.0",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.18.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-13.7.0.tgz",
"integrity": "sha512-DBkZuIMFuAfjJHiunyRc+aNvmXYNwV1IPMgGKGlwCp6zh6MKrVtmvjSWK/axWcD25KJffkXgkfvFra8ndenXAw==" "integrity": "sha512-GnZbirvmqZUzMgkFn70c74OQpTTUcCzlhQliTzYjQMqg+hVKcDnxdL19Ne3UdYzdMA/+W3eb646FWn/ZaT1NfQ=="
}, },
"@types/node-rsa": { "@types/node-rsa": {
"version": "1.0.0", "version": "1.0.0",
@ -2226,13 +2226,10 @@
} }
}, },
"@types/uuid": { "@types/uuid": {
"version": "3.4.6", "version": "3.4.7",
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.6.tgz", "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.7.tgz",
"integrity": "sha512-cCdlC/1kGEZdEglzOieLDYBxHsvEOIg7kp/2FYyVR9Pxakq+Qf/inL3RKQ+PA8gOlI/NnL+fXmQH12nwcGzsHw==", "integrity": "sha512-C2j2FWgQkF1ru12SjZJyMaTPxs/f6n90+5G5qNakBxKXjTBc/YTSelHh4Pz1HUDwxFXD9WvpQhOGCDC+/Y4mIQ==",
"dev": true, "dev": true
"requires": {
"@types/node": "*"
}
}, },
"abbrev": { "abbrev": {
"version": "1.1.1", "version": "1.1.1",
@ -2315,48 +2312,38 @@
} }
}, },
"apidoc": { "apidoc": {
"version": "0.19.0", "version": "0.20.0",
"resolved": "https://registry.npmjs.org/apidoc/-/apidoc-0.19.0.tgz", "resolved": "https://registry.npmjs.org/apidoc/-/apidoc-0.20.0.tgz",
"integrity": "sha512-gnmyvcR3M6J80G3OQzmKQLq0SaZ3uA6wuXPWJO2qoHn83jb9dcoyQ0zqmuL4gmfA3P6g9SPshwcPLdAwclHzHA==", "integrity": "sha512-mD26GJ3yTnC2FRC/XTajiQb7aQsm4dEgFIfHrWFHe5c5ELy1RaxoIrbd/LbhTuhBwR2cVxl9nOyAD5al5EZ4Lw==",
"dev": true, "dev": true,
"requires": { "requires": {
"apidoc-core": "~0.8.3", "apidoc-core": "^0.11.0",
"commander": "^2.20.0", "commander": "^2.20.0",
"fs-extra": "^8.1.0", "fs-extra": "^8.1.0",
"lodash": "^4.17.15", "lodash": "^4.17.15",
"markdown-it": "^10.0.0", "markdown-it": "^10.0.0",
"nodemon": "^2.0.2",
"winston": "^3.2.1" "winston": "^3.2.1"
} }
}, },
"apidoc-core": { "apidoc-core": {
"version": "0.8.3", "version": "0.11.1",
"resolved": "https://registry.npmjs.org/apidoc-core/-/apidoc-core-0.8.3.tgz", "resolved": "https://registry.npmjs.org/apidoc-core/-/apidoc-core-0.11.1.tgz",
"integrity": "sha1-2dY1RYKd8lDSzKBJaDqH53U2S5Y=", "integrity": "sha512-pt/ICBdFQCZTgL38Aw1XB3G9AajDU1JA5E3yoDEgg0mqbPTCkOL8AyWdysjvNtQS/kkXgSPazCZaZzZYqrPHog==",
"dev": true, "dev": true,
"requires": { "requires": {
"fs-extra": "^3.0.1", "fs-extra": "^8.1.0",
"glob": "^7.1.1", "glob": "^7.1.4",
"iconv-lite": "^0.4.17", "iconv-lite": "^0.5.0",
"klaw-sync": "^2.1.0", "klaw-sync": "^6.0.0",
"lodash": "~4.17.4", "lodash": "~4.17.15",
"semver": "~5.3.0" "semver": "~6.3.0"
}, },
"dependencies": { "dependencies": {
"fs-extra": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-3.0.1.tgz",
"integrity": "sha1-N5TzeMWLNC6n27sjCVEJxLO2IpE=",
"dev": true,
"requires": {
"graceful-fs": "^4.1.2",
"jsonfile": "^3.0.0",
"universalify": "^0.1.0"
}
},
"semver": { "semver": {
"version": "5.3.0", "version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
"dev": true "dev": true
} }
} }
@ -2424,8 +2411,7 @@
"base32.js": { "base32.js": {
"version": "0.0.1", "version": "0.0.1",
"resolved": "https://registry.npmjs.org/base32.js/-/base32.js-0.0.1.tgz", "resolved": "https://registry.npmjs.org/base32.js/-/base32.js-0.0.1.tgz",
"integrity": "sha1-0EVzalex9sE58MffQlGKhOkbsro=", "integrity": "sha1-0EVzalex9sE58MffQlGKhOkbsro="
"dev": true
}, },
"base64-arraybuffer": { "base64-arraybuffer": {
"version": "0.1.5", "version": "0.1.5",
@ -2451,6 +2437,39 @@
"integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==", "integrity": "sha512-Phlt0plgpIIBOGTT/ehfFnbNlfsDEiqmzE2KRXoX1bLIlir4X/MR+zSyBEkL05ffWgnRSf/DXv+WrUAVr93/ow==",
"dev": true "dev": true
}, },
"bl": {
"version": "2.2.0",
"resolved": "https://registry.npmjs.org/bl/-/bl-2.2.0.tgz",
"integrity": "sha512-wbgvOpqopSr7uq6fJrLH8EsvYMJf9gzfo2jCsL2eTy75qXPukA4pCgHamOQkZtY5vmfVtjB+P3LNlMHW5CEZXA==",
"requires": {
"readable-stream": "^2.3.5",
"safe-buffer": "^5.1.1"
},
"dependencies": {
"readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
}
}
}
},
"blob": { "blob": {
"version": "0.0.5", "version": "0.0.5",
"resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz", "resolved": "https://registry.npmjs.org/blob/-/blob-0.0.5.tgz",
@ -2784,9 +2803,9 @@
"dev": true "dev": true
}, },
"concurrently": { "concurrently": {
"version": "5.0.1", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/concurrently/-/concurrently-5.0.1.tgz", "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-5.1.0.tgz",
"integrity": "sha512-fPKUlOAXEXpktp3z7RqIvzTSCowfDo8oQbdKoGKGZVm+G2hGFbIIAFm4qwWcGl/sIHmpMSgPqeCbjld3kdPXvA==", "integrity": "sha512-9ViZMu3OOCID3rBgU31mjBftro2chOop0G2u1olq1OuwRBVRw/GxHTg80TVJBUTJfoswMmEUeuOg1g1yu1X2dA==",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "^2.4.2", "chalk": "^2.4.2",
@ -2796,7 +2815,7 @@
"rxjs": "^6.5.2", "rxjs": "^6.5.2",
"spawn-command": "^0.0.2-1", "spawn-command": "^0.0.2-1",
"supports-color": "^6.1.0", "supports-color": "^6.1.0",
"tree-kill": "^1.2.1", "tree-kill": "^1.2.2",
"yargs": "^13.3.0" "yargs": "^13.3.0"
} }
}, },
@ -2849,8 +2868,7 @@
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
"integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac="
"dev": true
}, },
"cors": { "cors": {
"version": "2.8.5", "version": "2.8.5",
@ -2888,9 +2906,9 @@
"dev": true "dev": true
}, },
"date-fns": { "date-fns": {
"version": "2.8.1", "version": "2.9.0",
"resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.8.1.tgz", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.9.0.tgz",
"integrity": "sha512-EL/C8IHvYRwAHYgFRse4MGAPSqlJVlOrhVYZ75iQBKrnv+ZedmYsgwH3t+BCDuZDXpoo07+q9j4qgSSOa7irJg==", "integrity": "sha512-khbFLu/MlzLjEzy9Gh8oY1hNt/Dvxw3J6Rbc28cVoYWQaC1S3YI4xwkF9ZWcjDLscbZlY9hISMr66RFzZagLsA==",
"dev": true "dev": true
}, },
"debug": { "debug": {
@ -2912,6 +2930,11 @@
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
"dev": true "dev": true
}, },
"denque": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/denque/-/denque-1.4.1.tgz",
"integrity": "sha512-OfzPuSZKGcgr96rf1oODnfjqBFmr1DVoc/TrItj3Ohe0Ah1C5WX5Baquw/9U9KovnQ88EqmJbD66rKYUQYN1tQ=="
},
"depd": { "depd": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
@ -3037,9 +3060,9 @@
"dev": true "dev": true
}, },
"env-variable": { "env-variable": {
"version": "0.0.5", "version": "0.0.6",
"resolved": "https://registry.npmjs.org/env-variable/-/env-variable-0.0.5.tgz", "resolved": "https://registry.npmjs.org/env-variable/-/env-variable-0.0.6.tgz",
"integrity": "sha512-zoB603vQReOFvTg5xMl9I1P2PnHsHQQKTEowsKKD7nseUfJq6UWzK+4YtlWUO1nhiQUxe6XMkk+JleSZD1NZFA==", "integrity": "sha512-bHz59NlBbtS0NhftmR8+ExBEekE7br0e01jw+kk0NDro7TtZzBYZ5ScGPs3OmwnpyfHTHOtr1Y6uedCdrIldtg==",
"dev": true "dev": true
}, },
"error-ex": { "error-ex": {
@ -3218,17 +3241,6 @@
"graceful-fs": "^4.2.0", "graceful-fs": "^4.2.0",
"jsonfile": "^4.0.0", "jsonfile": "^4.0.0",
"universalify": "^0.1.0" "universalify": "^0.1.0"
},
"dependencies": {
"jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
"dev": true,
"requires": {
"graceful-fs": "^4.1.6"
}
}
} }
}, },
"fs.realpath": { "fs.realpath": {
@ -3314,9 +3326,9 @@
"dev": true "dev": true
}, },
"handlebars": { "handlebars": {
"version": "4.5.3", "version": "4.7.3",
"resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.3.tgz",
"integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==", "integrity": "sha512-SRGwSYuNfx8DwHD/6InAPzD6RgeruWLT+B8e8a7gGs8FWgHzlExpTFMEq2IA6QpAfOClpKHy6+8IqTjeBCu6Kg==",
"requires": { "requires": {
"neo-async": "^2.6.0", "neo-async": "^2.6.0",
"optimist": "^0.6.1", "optimist": "^0.6.1",
@ -3369,9 +3381,9 @@
} }
}, },
"i18n": { "i18n": {
"version": "0.8.4", "version": "0.8.5",
"resolved": "https://registry.npmjs.org/i18n/-/i18n-0.8.4.tgz", "resolved": "https://registry.npmjs.org/i18n/-/i18n-0.8.5.tgz",
"integrity": "sha512-PvMcG+yqYWXrwgdmCpL+APCGa8lRY0tdlo2cXp9UeR3u4h1bJGqFsgybfmG/MqtL1iDmdaPPPLJebXGrZ1XoMQ==", "integrity": "sha512-6UgLbhJGgn4XFeuZc/dDdrrri0ij24EK4hxv4Pbi5hloYAZ1B2+0eQchEryBFezLKYOHhVGV/5+H4i0oxng94w==",
"requires": { "requires": {
"debug": "*", "debug": "*",
"make-plural": "^6.0.1", "make-plural": "^6.0.1",
@ -3382,9 +3394,9 @@
} }
}, },
"iconv-lite": { "iconv-lite": {
"version": "0.4.24", "version": "0.5.1",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.5.1.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", "integrity": "sha512-ONHr16SQvKZNSqjQT9gy5z24Jw+uqfO02/ngBSBoqChZ+W8qXX7GPRa1RoUnzGADw8K63R1BXUMzarCVQBpY8Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"safer-buffer": ">= 2.1.2 < 3" "safer-buffer": ">= 2.1.2 < 3"
@ -3545,8 +3557,7 @@
"isarray": { "isarray": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
"dev": true
}, },
"isexe": { "isexe": {
"version": "2.0.0", "version": "2.0.0",
@ -3561,9 +3572,9 @@
"dev": true "dev": true
}, },
"jsonfile": { "jsonfile": {
"version": "3.0.1", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-3.0.1.tgz", "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha1-pezG9l9T9mLEQVx2daAzHQmS7GY=", "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
"dev": true, "dev": true,
"requires": { "requires": {
"graceful-fs": "^4.1.6" "graceful-fs": "^4.1.6"
@ -3618,9 +3629,9 @@
} }
}, },
"klaw-sync": { "klaw-sync": {
"version": "2.1.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-2.1.0.tgz", "resolved": "https://registry.npmjs.org/klaw-sync/-/klaw-sync-6.0.0.tgz",
"integrity": "sha1-PTvNhgDnv971MjHHOf8FOu1WDkQ=", "integrity": "sha512-nIeuVSzdCCs6TDPTqI8w1Yre34sSq7AkZ4B3sfOBbI2CgVSB4Du4aLQijFU2+lhAFCwt9+42Hel6lQNIv6AntQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"graceful-fs": "^4.1.11" "graceful-fs": "^4.1.11"
@ -3874,11 +3885,13 @@
"integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg==" "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
}, },
"mongodb": { "mongodb": {
"version": "3.4.0", "version": "3.5.2",
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.4.0.tgz", "resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.5.2.tgz",
"integrity": "sha512-W90jm/n8F0Edm47ljkVRK9l8qGW9g8T9ZSiZWRiUP58wLhsCJCeN/JxdpVnH0CUwwAw2hITUcCo9x58udpX2Uw==", "integrity": "sha512-Lxt4th2tK2MxmkDBR5cMik+xEnkvhwg0BC5kGcHm9RBwaNEsrIryvV5istGXOHbnif5KslMpY1FbX6YbGJ/Trg==",
"requires": { "requires": {
"bl": "^2.2.0",
"bson": "^1.1.1", "bson": "^1.1.1",
"denque": "^1.4.1",
"require_optional": "^1.0.1", "require_optional": "^1.0.1",
"safe-buffer": "^5.1.2", "safe-buffer": "^5.1.2",
"saslprep": "^1.0.0" "saslprep": "^1.0.0"
@ -3890,9 +3903,9 @@
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
}, },
"mustache": { "mustache": {
"version": "3.1.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/mustache/-/mustache-3.1.0.tgz", "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.0.0.tgz",
"integrity": "sha512-3Bxq1R5LBZp7fbFPZzFe5WN4s0q3+gxZaZuZVY+QctYJiCiVgXHOTIC0/HgZuOPFt/6BQcx5u0H2CUOxT/RoGQ==" "integrity": "sha512-FJgjyX/IVkbXBXYUwH+OYwQKqWpFPLaLVESd70yHjSDunwzV2hZOoTBvPf4KLoxesUzzyfTH6F784Uqd7Wm5yA=="
}, },
"negotiator": { "negotiator": {
"version": "0.6.1", "version": "0.6.1",
@ -4182,8 +4195,7 @@
"process-nextick-args": { "process-nextick-args": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
"dev": true
}, },
"proxy-addr": { "proxy-addr": {
"version": "2.0.5", "version": "2.0.5",
@ -4366,9 +4378,9 @@
} }
}, },
"readable-stream": { "readable-stream": {
"version": "3.4.0", "version": "3.5.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.4.0.tgz", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.5.0.tgz",
"integrity": "sha512-jItXPLmrSR8jmTRmRWJXCnGJsfy85mB3Wd/uINMXA65yrnFo0cPClFIUWzo2najVNSl+mx7/4W8ttlLWJe99pQ==", "integrity": "sha512-gSz026xs2LfxBPudDuI41V1lka8cxg64E66SGe78zJlsUofOg/yqwezdIcdfwik6B4h8LFmWPA9ef9X3FiNFLA==",
"dev": true, "dev": true,
"requires": { "requires": {
"inherits": "^2.0.3", "inherits": "^2.0.3",
@ -4430,9 +4442,9 @@
} }
}, },
"resolve": { "resolve": {
"version": "1.13.1", "version": "1.15.1",
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.13.1.tgz", "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.15.1.tgz",
"integrity": "sha512-CxqObCX8K8YtAhOBRg+lrcdn+LK+WYOS8tSjqSFbjtrI5PnS63QPhZl4+yKfrU9tdsbMu9Anr/amegT87M9Z6w==", "integrity": "sha512-84oo6ZTtoTUpjgNEr5SJyzQhzL72gaRodsSfyxC/AXRvwu0Yse9H8eF9IpGo7b8YetZhlI6v7ZQ6bKBFV/6S7w==",
"dev": true, "dev": true,
"requires": { "requires": {
"path-parse": "^1.0.6" "path-parse": "^1.0.6"
@ -4444,9 +4456,9 @@
"integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c=" "integrity": "sha1-lICrIOlP+h2egKgEx+oUdhGWa1c="
}, },
"rxjs": { "rxjs": {
"version": "6.5.3", "version": "6.5.4",
"resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.3.tgz", "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.5.4.tgz",
"integrity": "sha512-wuYsAYYFdWTAnAaPoKGNhfpWwKZbJW+HgAJ+mImp+Epl7BG8oNWBCTyRM8gba9k4lk8BgWdoYm21Mo/RYhhbgA==", "integrity": "sha512-naMQXcgEo3csAEGvw/NydRA0fuS2nDZJiw1YUWFKU7aPPAPGZEsD4Iimit96qwCieH6y614MCLYwdkrWx7z/7Q==",
"dev": true, "dev": true,
"requires": { "requires": {
"tslib": "^1.9.0" "tslib": "^1.9.0"
@ -4675,7 +4687,6 @@
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/speakeasy/-/speakeasy-2.0.0.tgz", "resolved": "https://registry.npmjs.org/speakeasy/-/speakeasy-2.0.0.tgz",
"integrity": "sha1-hckaBxsJpcuGQlkNmDVmFl9XYTo=", "integrity": "sha1-hckaBxsJpcuGQlkNmDVmFl9XYTo=",
"dev": true,
"requires": { "requires": {
"base32.js": "0.0.1" "base32.js": "0.0.1"
} }
@ -4841,9 +4852,9 @@
} }
}, },
"typescript": { "typescript": {
"version": "3.7.3", "version": "3.7.5",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.3.tgz", "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz",
"integrity": "sha512-Mcr/Qk7hXqFBXMN7p7Lusj1ktCBydylfQM/FZCk5glCNQJrCUKPkMHdo9R0MTFWsC/4kPFvDS0fDPvukfCkFsw==", "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==",
"dev": true "dev": true
}, },
"u2f": { "u2f": {
@ -4858,9 +4869,9 @@
"dev": true "dev": true
}, },
"uglify-js": { "uglify-js": {
"version": "3.7.2", "version": "3.7.7",
"resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.2.tgz", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.7.tgz",
"integrity": "sha512-uhRwZcANNWVLrxLfNFEdltoPNhECUR3lc+UdJoG9CBpMcSnKyWA94tc3eAujB1GcMY5Uwq8ZMp4qWpxWYDQmaA==", "integrity": "sha512-FeSU+hi7ULYy6mn8PKio/tXsdSXN35lm4KgV2asx00kzrLU9Pi3oAslcJT70Jdj7PHX29gGUPOT6+lXGBbemhA==",
"optional": true, "optional": true,
"requires": { "requires": {
"commander": "~2.20.3", "commander": "~2.20.3",
@ -4937,8 +4948,7 @@
"util-deprecate": { "util-deprecate": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
"integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
"dev": true
}, },
"utils-merge": { "utils-merge": {
"version": "1.0.1", "version": "1.0.1",
@ -4946,9 +4956,9 @@
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=" "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
}, },
"uuid": { "uuid": {
"version": "3.3.3", "version": "3.4.0",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz", "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==" "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
}, },
"validate-npm-package-license": { "validate-npm-package-license": {
"version": "3.0.4", "version": "3.0.4",
@ -5043,9 +5053,9 @@
}, },
"dependencies": { "dependencies": {
"readable-stream": { "readable-stream": {
"version": "2.3.6", "version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"dev": true, "dev": true,
"requires": { "requires": {
"core-util-is": "~1.0.0", "core-util-is": "~1.0.0",

View File

@ -6,6 +6,7 @@
"license": "MIT", "license": "MIT",
"scripts": { "scripts": {
"start": "node lib/index.js", "start": "node lib/index.js",
"install": "cd views && npm install",
"build-doc": "apidoc -i src/ -p apidoc/", "build-doc": "apidoc -i src/ -p apidoc/",
"build-ts": "tsc", "build-ts": "tsc",
"build": "tsc && cd views && npm run build && cd ..", "build": "tsc && cd views && npm run build && cd ..",
@ -23,20 +24,20 @@
"@types/express": "^4.17.2", "@types/express": "^4.17.2",
"@types/i18n": "^0.8.6", "@types/i18n": "^0.8.6",
"@types/ini": "^1.3.30", "@types/ini": "^1.3.30",
"@types/jsonwebtoken": "^8.3.5", "@types/jsonwebtoken": "^8.3.7",
"@types/mongodb": "^3.3.13", "@types/mongodb": "^3.3.15",
"@types/node": "^12.12.18", "@types/node": "^13.7.0",
"@types/node-rsa": "^1.0.0", "@types/node-rsa": "^1.0.0",
"@types/qrcode": "^1.3.4", "@types/qrcode": "^1.3.4",
"@types/speakeasy": "^2.0.5", "@types/speakeasy": "^2.0.5",
"@types/uuid": "^3.4.6", "@types/uuid": "^3.4.7",
"apidoc": "^0.19.0", "apidoc": "^0.20.0",
"concurrently": "^5.0.1", "concurrently": "^5.1.0",
"nodemon": "^2.0.2", "nodemon": "^2.0.2",
"typescript": "^3.7.3" "typescript": "^3.7.5"
}, },
"dependencies": { "dependencies": {
"@hibas123/config": "^1.0.5", "@hibas123/config": "^1.1.0",
"@hibas123/nodelogging": "^2.1.2", "@hibas123/nodelogging": "^2.1.2",
"@hibas123/nodeloggingserver_client": "^1.1.2", "@hibas123/nodeloggingserver_client": "^1.1.2",
"@hibas123/openauth-views": "file:../Views", "@hibas123/openauth-views": "file:../Views",
@ -47,17 +48,17 @@
"cors": "^2.8.5", "cors": "^2.8.5",
"dotenv": "^8.2.0", "dotenv": "^8.2.0",
"express": "^4.17.1", "express": "^4.17.1",
"handlebars": "^4.5.3", "handlebars": "^4.7.3",
"i18n": "^0.8.4", "i18n": "^0.8.5",
"ini": "^1.3.5", "ini": "^1.3.5",
"jsonwebtoken": "^8.5.1", "jsonwebtoken": "^8.5.1",
"moment": "^2.24.0", "moment": "^2.24.0",
"mongodb": "^3.4.0", "mongodb": "^3.5.2",
"node-rsa": "^1.0.7", "node-rsa": "^1.0.7",
"qrcode": "^1.4.4", "qrcode": "^1.4.4",
"reflect-metadata": "^0.1.13", "reflect-metadata": "^0.1.13",
"speakeasy": "^2.0.0", "speakeasy": "^2.0.0",
"u2f": "^0.1.3", "u2f": "^0.1.3",
"uuid": "^3.3.3" "uuid": "^3.4.0"
} }
} }

View File

@ -49,6 +49,7 @@ UserRoute.post("/register", Register);
* @apiParam {String} username Username (either username or uid required) * @apiParam {String} username Username (either username or uid required)
* @apiParam {String} uid (either username or uid required) * @apiParam {String} uid (either username or uid required)
* @apiParam {String} password Password hashed and salted like specification (only on type password) * @apiParam {String} password Password hashed and salted like specification (only on type password)
* @apiParam {String | Number} time in milliseconds used to hash password. This is used to make passwords "expire"
* *
* @apiSuccess {String} uid On type = "username" * @apiSuccess {String} uid On type = "username"
* @apiSuccess {String} salt On type = "username" * @apiSuccess {String} salt On type = "username"

View File

@ -5,6 +5,8 @@ import moment = require("moment");
import LoginToken from "../../models/login_token"; import LoginToken from "../../models/login_token";
import promiseMiddleware from "../../helper/promiseMiddleware"; import promiseMiddleware from "../../helper/promiseMiddleware";
import TwoFactor, { TFATypes, TFANames } from "../../models/twofactor"; import TwoFactor, { TFATypes, TFANames } from "../../models/twofactor";
import * as crypto from "crypto";
import Logging from "@hibas123/nodelogging";
const Login = promiseMiddleware(async (req: Request, res: Response) => { const Login = promiseMiddleware(async (req: Request, res: Response) => {
let type = req.query.type; let type = req.query.type;
@ -58,13 +60,22 @@ const Login = promiseMiddleware(async (req: Request, res: Response) => {
}); });
} }
let { username, password, uid } = req.body; let { username, password, uid, date } = req.body;
let user = await User.findOne(username ? { username: username.toLowerCase() } : { uid: uid }) let user = await User.findOne(username ? { username: username.toLowerCase() } : { uid: uid })
if (!user) { if (!user) {
res.json({ error: req.__("User not found") }) res.json({ error: req.__("User not found") })
} else { } else {
if (user.password !== password) { let upw = user.password;
if (date) {
if (!moment(date).isBetween(moment().subtract(1, "minute"), moment().add(1, "minute"))) {
res.json({ error: req.__("Invalid timestamp. Please check your devices time!") });
return;
} else {
upw = crypto.createHash("sha512").update(upw + date.toString()).digest("hex");
}
}
if (upw !== password) {
res.json({ error: req.__("Password or username wrong") }) res.json({ error: req.__("Password or username wrong") })
} else { } else {
let twofactor = await TwoFactor.find({ user: user._id, valid: true }) let twofactor = await TwoFactor.find({ user: user._id, valid: true })

File diff suppressed because it is too large Load Diff