{"_id":"@anephenix/auth","_rev":"3-8599105b1069001e09edf68893f49883","name":"@anephenix/auth","dist-tags":{"latest":"0.0.7"},"versions":{"0.0.5":{"name":"@anephenix/auth","version":"0.0.5","keywords":["fastify","objection","authentication"],"author":{"name":"Paul Jensen","email":"paul@anephenix.com"},"license":"MIT","_id":"@anephenix/auth@0.0.5","maintainers":[{"name":"paulbjensen","email":"paulbjensen@gmail.com"}],"dist":{"shasum":"239ed0e542dd78fe724031666f88de79271fd3e8","tarball":"https://registry.npmjs.org/@anephenix/auth/-/auth-0.0.5.tgz","fileCount":6,"integrity":"sha512-D2RqpUbREyqDWT74zR3KH6F3u3wpffb/ClfuFX8oNQ/G6UbzTXB4zXE0Msruahg/lLlIhoIVJHLFyN5bKK4bYg==","signatures":[{"sig":"MEUCIBIuZBgCzCcwO/1S+eWF3Mol9xFp8m56n3kXx4MY4+pRAiEA0JZ992zeVesjkGGP/8V0XPaMv4LdeJzJxd37ypRCTOc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15815},"type":"module","types":"./dist/index.d.ts","engines":{"node":">=12"},"exports":{".":{"import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"4db8424e69a8d7a6986d7e9dcbc170e255ffd911","scripts":{"lint":"npx @biomejs/biome check --write src scripts test .github","size":"size-limit","test":"cross-env NODE_ENV=test npx vitest test --run --no-file-parallelism","build":"tsc --project tsconfig.json","cover":"cross-env NODE_ENV=test npx vitest test --run --coverage --no-file-parallelism","watch":"tsc --project tsconfig.json --watch","analyze":"size-limit --why","prepare":"husky","lint:package":"npx publint","update-changelog":"node --experimental-strip-types scripts/update-changelog.ts","prepare-patch-release":"npm run update-changelog && git add CHANGELOG.md && git commit -m \"Updated changelog\" && npm version patch","publish-patch-release":"npm run prepare-patch-release && git push origin main && git push --tags"},"_npmUser":{"name":"paulbjensen","email":"paulbjensen@gmail.com"},"size-limit":[{"path":"dist/*.js","limit":"10 KB"}],"_npmVersion":"10.9.3","description":"An authentication library for apps.","directories":{},"_nodeVersion":"22.20.0","dependencies":{"argon2":"^0.44.0"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^17.1.0","husky":"^9.1.7","vitest":"^3.2.4","publint":"^0.3.15","cross-env":"^10.1.0","size-limit":"^11.2.0","typescript":"^5.9.3","@types/node":"^24.8.1","@biomejs/biome":"2.2.6","@size-limit/file":"^11.2.0","@cucumber/cucumber":"^12.2.0","@size-limit/esbuild":"^11.2.0","@vitest/coverage-v8":"^3.2.4","@size-limit/esbuild-why":"^11.2.0","size-limit-node-esbuild":"^0.4.0","@anephenix/fastify-resource":"^0.0.8"},"_npmOperationalInternal":{"tmp":"tmp/auth_0.0.5_1760970435357_0.5526098148637133","host":"s3://npm-registry-packages-npm-production"}},"0.0.6":{"name":"@anephenix/auth","version":"0.0.6","keywords":["fastify","objection","authentication"],"author":{"name":"Paul Jensen","email":"paul@anephenix.com"},"license":"MIT","_id":"@anephenix/auth@0.0.6","maintainers":[{"name":"paulbjensen","email":"paulbjensen@gmail.com"}],"dist":{"shasum":"39230ddb983c6fb69dbc2fe7b531411936cacc9d","tarball":"https://registry.npmjs.org/@anephenix/auth/-/auth-0.0.6.tgz","fileCount":6,"integrity":"sha512-E5nTHZFE39Rvm9c9e/Jx3nfYopUXkbYcp/Ass8hqZKMaWIdP1mDudvPqSAYjew9zI0rxVlCGE0dSq+RTeQBhvg==","signatures":[{"sig":"MEUCIQCwXNB0hmNG1cxn1eNQuzvNYpeACrVH60ATZXxfQ4DfkgIgOD+j03K7J21spibtp0AvrtFkID73F07Kui5kn/SD1rc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15818},"type":"module","types":"./dist/index.d.ts","engines":{"node":">=12"},"exports":{".":{"import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"affda3065a8960343477e0d808fa2efcac974fb2","scripts":{"lint":"npx @biomejs/biome check --write src scripts test .github","size":"size-limit","test":"cross-env NODE_ENV=test npx vitest test --run --no-file-parallelism","build":"tsc --project tsconfig.json","cover":"cross-env NODE_ENV=test npx vitest test --run --coverage --no-file-parallelism","watch":"tsc --project tsconfig.json --watch","analyze":"size-limit --why","prepare":"husky","lint:package":"npx publint","update-changelog":"node --experimental-strip-types scripts/update-changelog.ts","prepare-patch-release":"npm run update-changelog && git add CHANGELOG.md && git commit -m \"Updated changelog\" && npm version patch","publish-patch-release":"npm run prepare-patch-release && git push origin main && git push --tags"},"_npmUser":{"name":"paulbjensen","email":"paulbjensen@gmail.com"},"size-limit":[{"path":"dist/*.js","limit":"10 KB"}],"_npmVersion":"10.9.4","description":"An authentication library for apps.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"argon2":"^0.44.0"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^17.1.0","husky":"^9.1.7","vitest":"^4.0.13","publint":"^0.3.15","cross-env":"^10.1.0","size-limit":"^11.2.0","typescript":"^5.9.3","@types/node":"^24.10.0","@biomejs/biome":"2.3.7","@size-limit/file":"^11.2.0","@cucumber/cucumber":"^12.2.0","@size-limit/esbuild":"^11.2.0","@vitest/coverage-v8":"^4.0.13","@size-limit/esbuild-why":"^11.2.0","size-limit-node-esbuild":"^0.4.0","@anephenix/fastify-resource":"^0.0.9"},"_npmOperationalInternal":{"tmp":"tmp/auth_0.0.6_1764785609959_0.717070311079169","host":"s3://npm-registry-packages-npm-production"}},"0.0.7":{"_id":"@anephenix/auth@0.0.7","dist":{"shasum":"df97525a34c85650fba0f71a62d02251a48322e6","tarball":"https://registry.npmjs.org/@anephenix/auth/-/auth-0.0.7.tgz","fileCount":6,"integrity":"sha512-vqfPkY6+5hiDnYEd/QfUezwQhSc72+ZdAs0MEen+N8Gmqq4xCF7o5HQ4MR9t/1OCe/kBZB6+A2cM+d8qdfltaw==","signatures":[{"sig":"MEUCIQDVh0nibnY+4AbIi2ciK51VCYOwC4MWJ6Fph76AU/mOgwIgabHAMAd/w2yj6i49aqDWmY9qHcnbgwU9t7PNTHjdIOA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCpSli6J/hJ8vbpF+aRknyWbzqOooNO+6GebSavMH0gNQIhAO3yTTbqGTZLq6TlU+hKUut9DOI8vaKnBMFnjwUx+wbp"}],"unpackedSize":20420},"name":"@anephenix/auth","type":"module","types":"./dist/index.d.ts","author":{"name":"Paul Jensen","email":"paul@anephenix.com"},"engines":{"node":">=12"},"exports":{".":{"import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"83a34d2aa886f7d407855e4fa41f1aa5efda8fa0","license":"MIT","scripts":{"lint":"npx @biomejs/biome check src scripts test .github","size":"size-limit","test":"cross-env NODE_ENV=test npx vitest test --run --no-file-parallelism","build":"tsc --project tsconfig.json","cover":"cross-env NODE_ENV=test npx vitest test --run --coverage --no-file-parallelism","watch":"tsc --project tsconfig.json --watch","format":"npx @biomejs/biome check src scripts test .github --write","analyze":"size-limit --why","prepare":"husky","lint:package":"npx publint","update-changelog":"node --experimental-strip-types scripts/update-changelog.ts","prepare-patch-release":"npm run update-changelog && git add CHANGELOG.md && git commit -m \"Updated changelog\" && npm version patch","publish-patch-release":"npm run prepare-patch-release && git push origin main && git push --tags"},"version":"0.0.7","_npmUser":{"name":"paulbjensen","email":"paulbjensen@gmail.com"},"keywords":["fastify","objection","authentication"],"size-limit":[{"path":"dist/*.js","limit":"10 KB"}],"_npmVersion":"12.0.2","description":"An authentication library for apps.","directories":{},"maintainers":[{"name":"paulbjensen","email":"paulbjensen@gmail.com"}],"_nodeVersion":"24.18.0","dependencies":{"argon2":"^0.45.1"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.7","vitest":"^5.0.0","publint":"^0.3.23","cross-env":"^10.1.0","size-limit":"^13.0.1","typescript":"^7.0.2","@types/node":"^26.4.1","@biomejs/biome":"2.5.12","@size-limit/file":"^13.0.1","@cucumber/cucumber":"^13.2.1","@size-limit/esbuild":"^13.0.1","@vitest/coverage-v8":"^5.0.0","@size-limit/esbuild-why":"^13.0.1","size-limit-node-esbuild":"^0.4.0","@anephenix/fastify-resource":"^0.0.14"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/auth_0.0.7_1789295096231_0.3827246014325767"}}},"time":{"created":"2025-10-20T14:27:15.266Z","modified":"2026-09-13T10:24:56.509Z","0.0.5":"2025-10-20T14:27:15.578Z","0.0.6":"2025-12-03T18:13:30.147Z","0.0.7":"2026-09-13T10:24:56.319Z"},"author":{"name":"Paul Jensen","email":"paul@anephenix.com"},"license":"MIT","keywords":["fastify","objection","authentication"],"description":"An authentication library for apps.","maintainers":[{"name":"paulbjensen","email":"paulbjensen@gmail.com"}],"readme":"# Auth\n\nAn authentication library for apps.\n\n[![Node.js CI](https://github.com/anephenix/auth/actions/workflows/node.js.yml/badge.svg)](https://github.com/anephenix/auth/actions/workflows/node.js.yml)\n\n## Install\n\n```shell\nnpm i @anephenix/auth\n```\n\n## Usage\n\nIf you have a fastify app, you can attach it as a plugin.\n\n```typescript\nimport fastify from 'fastify';\nimport User from './models/User';\nimport auth from '@anephenix/auth';\n\nconst app = fastify({ logger: false });\n\napp.register(auth, {\n\tmodel: User,\n});\n```\n\n<i>\n\nIs this enough? For it to work, we'd need for the User model:\n\n- to have the method to perform the act of encrypting the password\n- to have the required fields for looking up the username/email and then the hashed password to lookup\n- to have a method to find the User and verify the password is correct\n\nWe would also need to work out how sessions are created/retrieved/stored\n\n- What is used to create the session, a Redis instance for example?\n- What is used to retrive the session\n\nTherefore, we would we need to:\n\n- Generate a migration to add those fields to the model, and run that\n- Attach functions to the model to handle hashing the password when the user is created and updated\n- Attach a function tot he mdoel to handle verifying that the user is found and authenticated when they provide the correct password, or not\n\nAnd this is just for the simple username/password setup. It does not take into consideration the other options:\n\n- Using MFA for the user (so that a compromised password or reset-password method alone cannot be used to get access into the system)\n- Using a magic link sent to the email address for logging in instead.\n\nThese are details that will emerge once we get into the details of implementing this system\n\nWorth looking at [NOTES.md](/NOTES.md) for more information on how to get the plugin working as expected.\n\n</i>\n","readmeFilename":"README.md"}