{"_id":"@afnank19/express-auth-helper","_rev":"1-58331f75961a4c3e10a7b1df2f01cb5b","name":"@afnank19/express-auth-helper","dist-tags":{"latest":"0.0.2"},"versions":{"0.0.1":{"name":"@afnank19/express-auth-helper","version":"0.0.1","keywords":["express","auth","jwts"],"author":{"name":"Afnan Khalid"},"license":"MIT","_id":"@afnank19/express-auth-helper@0.0.1","maintainers":[{"name":"afnank19","email":"afnank19@gmail.com"}],"homepage":"https://github.com/afnank19/express-auth-helpers#readme","bugs":{"url":"https://github.com/afnank19/express-auth-helpers/issues"},"dist":{"shasum":"fda25842046b8720895adc45e71e40c1bd16e1cb","tarball":"https://registry.npmjs.org/@afnank19/express-auth-helper/-/express-auth-helper-0.0.1.tgz","fileCount":5,"integrity":"sha512-D1vCYNtooJdU0ji3QKjRyp8ZJBgSrhKq5r51woOS8M8MnW9P3QukxypKHXUcmxhf/gRXB59TFxo552zwm0yKiA==","signatures":[{"sig":"MEUCIQDs6awvAkwd5JUxjmqsLKIRP2XlDf4nzcMhsYgg6/giyAIgQDYgYdynzn3aRyA6+JQO3tqmeeTJBJv1RZMhndgD8fU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":3580},"main":"index.js","type":"module","gitHead":"38d95738f45f469a698cb30b173995a1df353fbf","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"afnank19","email":"afnank19@gmail.com"},"repository":{"url":"git+https://github.com/afnank19/express-auth-helpers.git"},"_npmVersion":"10.8.2","description":"Helper functions for rolling your own auth with bcrypt, jwts and expressjs","directories":{},"_nodeVersion":"20.18.2","dependencies":{"bcryptjs":"^2.4.3","jsonwebtoken":"^9.0.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/express-auth-helper_0.0.1_1739206434880_0.39340010533518277","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@afnank19/express-auth-helper","version":"0.0.2","main":"index.js","type":"module","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"url":"git+https://github.com/afnank19/express-auth-helpers.git"},"keywords":["express","auth","jwts"],"author":{"name":"Afnan Khalid"},"license":"MIT","description":"Helper functions for rolling your own auth with bcrypt, jwts and expressjs","dependencies":{"bcryptjs":"^2.4.3","jsonwebtoken":"^9.0.2"},"_id":"@afnank19/express-auth-helper@0.0.2","gitHead":"bfbb155329984c3e278f337e86f05f654b8dfa74","bugs":{"url":"https://github.com/afnank19/express-auth-helpers/issues"},"homepage":"https://github.com/afnank19/express-auth-helpers#readme","_nodeVersion":"20.18.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-246ncPyfPXTkgTNN8b9GNs02HY+6VFrH2IbcPX3F3nta9w15Rxd5JtIGHmWMRGEWnc6bs2gVlHoApjz+GYFjgA==","shasum":"6fe2039081e1a59fb15ef786caf79f8869509573","tarball":"https://registry.npmjs.org/@afnank19/express-auth-helper/-/express-auth-helper-0.0.2.tgz","fileCount":5,"unpackedSize":4710,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBK7BIDQ588angNO+z19s9YapAmJLHbjkWEcmVzC0uJ0AiEAv9czosA+zpIRjgffjVhajZA0yiIrqWI9HUql6M28Rco="}]},"_npmUser":{"name":"afnank19","email":"afnank19@gmail.com"},"directories":{},"maintainers":[{"name":"afnank19","email":"afnank19@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/express-auth-helper_0.0.2_1739208340468_0.8747119467665594"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-10T16:53:54.766Z","modified":"2025-02-10T17:25:40.855Z","0.0.1":"2025-02-10T16:53:55.068Z","0.0.2":"2025-02-10T17:25:40.670Z"},"bugs":{"url":"https://github.com/afnank19/express-auth-helpers/issues"},"author":{"name":"Afnan Khalid"},"license":"MIT","homepage":"https://github.com/afnank19/express-auth-helpers#readme","keywords":["express","auth","jwts"],"repository":{"url":"git+https://github.com/afnank19/express-auth-helpers.git"},"description":"Helper functions for rolling your own auth with bcrypt, jwts and expressjs","maintainers":[{"name":"afnank19","email":"afnank19@gmail.com"}],"readme":"## express-auth-helpers\n\nExpress auth helpers are a set of middleware and helper functions that speed up rolling your own auth for small projects.\n\nThe documentation is still being worked on :p\n\n### API Reference\n\n##### Function: `authenticateAction(options: Object)`\n\nMiddleware function for authenticating a user that presents an bearer token.\nReturns an express middleware function that can be used in the typical way.\n`options: { secret: your-jwt-key }`\n\n### Example\n\n```javascript\nconst authenticateUser = authenticateAction({ secrets: \"your-jwt-secret\" });\napp.post(\"/users/blogs\", authenticateUser, ...OtherMiddleware);\n```\n\n##### Function: `generateHash(password: string)`\n\nPass in a password to generate a hash using bcrypt, currently only 10 passes.\nReturns the hash for storage in db\n\n### Example\n\n```javascript\nconst hash = generateHash(\"superstrongpassword\");\n```\n\n##### Function: `verifyPassword(password: string, hash: string)`\n\nPass in the password provided by the user, along with the hash fetched from the DB\nReturns a boolean isMatch which is true for success.\n\n### Example\n\n```javascript\nconst { password } = req.body;\nconst hash = userService.fetchUserHash(id);\n\nconst isMatch = await verifyPassword(password, hash);\n\nif (!isMatch) {\n  res.json({ msg: \"Wrong credentials\" });\n}\n\n// rest of your code\n```\n","readmeFilename":"README.md"}