{"_id":"@aintechcorporation/auth","name":"@aintechcorporation/auth","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@aintechcorporation/auth","version":"1.0.0","description":"AINTECH auth library - JWT, TOTP, magic link, middleware","type":"module","main":"src/index.mjs","exports":{".":"./src/index.mjs"},"dependencies":{"@aintechcorporation/aina-auth":"^2.0.0"},"scripts":{"test":"node --test tests/*.test.mjs","prepublishOnly":"node --test tests/*.test.mjs"},"keywords":["aintech","auth","jwt","totp"],"license":"MIT","engines":{"node":">=20"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/AINTECH-CORPORATION/AINTECH-CORP.git","directory":"005-APL-Platform/packages/auth"},"gitHead":"73c3c410536f0eb70254a639802622a13b711dff","_id":"@aintechcorporation/auth@1.0.0","bugs":{"url":"https://github.com/AINTECH-CORPORATION/AINTECH-CORP/issues"},"homepage":"https://github.com/AINTECH-CORPORATION/AINTECH-CORP#readme","_nodeVersion":"22.14.0","_npmVersion":"11.11.1","dist":{"integrity":"sha512-VzLL/BYy6qgkL3mrKMhjLT6AvHXr0D8FfoeQ36aA92E07LUatPAAWkV93S/5l7TMitlSkClqOCEXMe0vwX6Dmw==","shasum":"0263a898ee4b126d35d5ae68e6b171babf437cad","tarball":"https://registry.npmjs.org/@aintechcorporation/auth/-/auth-1.0.0.tgz","fileCount":3,"unpackedSize":3140,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIBajfQSSC+CNw1tsjaHkAgmN5lK0Jrj820S7LkvnKGfsAiBQTjzhm7nharYlq2zjdpTZ/dLeqdTtFfHfN9pxAKNKeA=="}]},"_npmUser":{"name":"aintechcorporation","email":"rsorianoagullo@gmail.com"},"directories":{},"maintainers":[{"name":"aintechcorporation","email":"rsorianoagullo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/auth_1.0.0_1781894852764_0.16390092297361192"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-19T18:47:32.560Z","1.0.0":"2026-06-19T18:47:32.915Z","modified":"2026-06-19T18:47:33.124Z"},"maintainers":[{"name":"aintechcorporation","email":"rsorianoagullo@gmail.com"}],"description":"AINTECH auth library - JWT, TOTP, magic link, middleware","homepage":"https://github.com/AINTECH-CORPORATION/AINTECH-CORP#readme","keywords":["aintech","auth","jwt","totp"],"repository":{"type":"git","url":"git+https://github.com/AINTECH-CORPORATION/AINTECH-CORP.git","directory":"005-APL-Platform/packages/auth"},"bugs":{"url":"https://github.com/AINTECH-CORPORATION/AINTECH-CORP/issues"},"license":"MIT","readme":"# @aintech/auth\n\nShared authentication library based on aina-auth (JWT HS256, TOTP MFA, magic-link).\n\n## Install\n\n```bash\nnpm install @aintech/auth\n```\n\n## Usage\n\n```js\nimport { signJWT, verifyJWT, issueTokens } from '@aintech/auth';\n\nconst tokens = issueTokens({ sub: 'user123' }, process.env.JWT_SECRET);\n// { accessToken, refreshToken, tokenType, expiresIn }\n```\n\n## API\n\n### JWT\n- `signJWT(payload, secret, opts?)` — sign HS256 token\n- `verifyJWT(token, secret)` — verify and decode\n- `issueTokens(claims, secret)` — access + refresh pair\n- `refresh(refreshToken, secret, claimsLookup?)` — rotate refresh\n\n### TOTP MFA\n- `generateTOTPSecret(len?)` — RFC 6238 base32 secret\n- `totp(secret, opts?)` — generate TOTP code\n- `verifyTOTP(secret, token, opts?)` — verify with ±1 step window\n- `otpauthURL(secret, opts?)` — QR code URL for authenticator apps\n\n### Magic Link\n- `createMagicToken(email, secret, ttlSec?)` — generate magic link token\n- `verifyMagicToken(token, secret)` — verify magic link\n\n### Middleware (Express/Fastify compatible)\n- `requireAuth(secret, opts?)` — protect routes with JWT Bearer\n- `requireRole(...roles)` — role-based access guard\n","readmeFilename":"README.md","_rev":"1-1a1a3ff157277303f07db9f9a24a63f6"}