{"_id":"2fa-auth-v1","_rev":"2-cfc722dad43694007819a64a97256ab3","name":"2fa-auth-v1","description":"A simple npm package for 2FA (Two-Factor Authentication) using TOTP (Time-Based One-Time Password) and QR codes.","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"2fa-auth-v1","version":"1.0.0","keywords":[],"author":"","license":"ISC","_id":"2fa-auth-v1@1.0.0","maintainers":[{"name":"rahul_sabui","email":"sabuirahul90@gmail.com"}],"dist":{"shasum":"d53a8cac22dda68bd26d79f6846987da75482056","tarball":"https://registry.npmjs.org/2fa-auth-v1/-/2fa-auth-v1-1.0.0.tgz","fileCount":5,"integrity":"sha512-YJl8yMqWwE1tMlz6caIsMREXXpFqd4aug8bKq3AvnVh+Xco55IfisFt2ekVgZmZyBCHA/d8VAV2eMTSETuE0lA==","signatures":[{"sig":"MEUCIBb6PjQnwejW5l3RrjF9BQ8FPyB6IYQLnG5M9ft+USzfAiEAzzFcIte3pyeRvGPRVdtekyC+5G4NXtCFna5L9bB26lw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3394},"main":"index.js","gitHead":"1a8eae5e286ea97f2d99c334d11069ec265bf51d","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"rahul_sabui","email":"sabuirahul90@gmail.com"},"_npmVersion":"10.5.0","description":"A simple npm package for 2FA (Two-Factor Authentication) using TOTP (Time-Based One-Time Password) and QR codes.","directories":{},"_nodeVersion":"21.7.1","dependencies":{"otplib":"^12.0.1","qrcode":"^1.5.3"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/2fa-auth-v1_1.0.0_1716980357489_0.3971354426837923","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"2fa-auth-v1","version":"1.0.1","keywords":[],"author":"","license":"ISC","_id":"2fa-auth-v1@1.0.1","maintainers":[{"name":"rahul_sabui","email":"sabuirahul90@gmail.com"}],"dist":{"shasum":"584da211b0dda929e3564adb4311919a167daca9","tarball":"https://registry.npmjs.org/2fa-auth-v1/-/2fa-auth-v1-1.0.1.tgz","fileCount":5,"integrity":"sha512-XDL9D0fFELCo580ILiDTUmvfcGtpp5z2z8dotH3GSmxbEa5tiLKP/AK4QTAHqAQ2fDhfbybPAjfCazrUOVa/lw==","signatures":[{"sig":"MEYCIQCkb7o1f7LGh+OBW2WrHfN3uJLf4tbu91AOIDezYfkM9wIhAMk6w9TM4q6tAVBfJ0L98XrjXZYnTxNzWxXM1PLGBTAz","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3395},"main":"index.js","gitHead":"7c2e03da19104969fa77ddbd6930ec6d7891bc84","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"_npmUser":{"name":"rahul_sabui","email":"sabuirahul90@gmail.com"},"_npmVersion":"10.5.0","description":"A simple npm package for 2FA (Two-Factor Authentication) using TOTP (Time-Based One-Time Password) and QR codes.","directories":{},"_nodeVersion":"21.7.1","dependencies":{"otplib":"^12.0.1","qrcode":"^1.5.3"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/2fa-auth-v1_1.0.1_1716980877501_0.6832611512341071","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"2fa-auth-v1","version":"1.0.2","description":"A simple npm package for 2FA (Two-Factor Authentication) using TOTP (Time-Based One-Time Password) and QR codes.","main":"index.js","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["otplib","qrcode"],"author":"","license":"ISC","dependencies":{"otplib":"^12.0.1","qrcode":"^1.5.3"},"_id":"2fa-auth-v1@1.0.2","gitHead":"b6739f65537dd230864d5e1d04b85db042beb46e","_nodeVersion":"21.7.1","_npmVersion":"10.5.0","dist":{"integrity":"sha512-OgyiF7OeUPmeFBPIraE2FqolwO42EVCNQgDt0jBEUvd5gOOxDj/WPKDdbS2NsRYVpmezREQR3J/7vdcLEyYYNw==","shasum":"462fc490846927650697f3623175140a2a1c5988","tarball":"https://registry.npmjs.org/2fa-auth-v1/-/2fa-auth-v1-1.0.2.tgz","fileCount":5,"unpackedSize":3413,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEsCmpKFf7+zCVwlaflmjl6BMZtWC6XnIFW8aFoBRA/IAiAJ2R7bzOGZtQIY8nPIQVAieFXNYKl0qEaPsgwVXU+Y/Q=="}]},"_npmUser":{"name":"rahul_sabui","email":"sabuirahul90@gmail.com"},"directories":{},"maintainers":[{"name":"rahul_sabui","email":"sabuirahul90@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2fa-auth-v1_1.0.2_1716980995759_0.7208428331810952"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-29T10:59:17.489Z","modified":"2024-05-29T11:09:56.070Z","1.0.0":"2024-05-29T10:59:17.667Z","1.0.1":"2024-05-29T11:07:57.655Z","1.0.2":"2024-05-29T11:09:55.914Z"},"maintainers":[{"name":"rahul_sabui","email":"sabuirahul90@gmail.com"}],"keywords":["otplib","qrcode"],"license":"ISC","readme":"# 2FA Authentication\n\nA simple npm package for 2FA (Two-Factor Authentication) using TOTP (Time-Based One-Time Password) and QR codes.\n\n## Installation\n\nInstall the package using npm:\n\n```bash\nnpm install 2fa-auth\n``` \n## Usage \n\n# 1. Generating the QR Code\nUse the generate.js script to generate a QR code and save the secret.\n\n`generate.js`\n\n```bash\nconst fs = require('fs');\nconst TwoFactorAuth = require('2fa-auth');\n\nconst twoFA = new TwoFactorAuth();\nconst user = 'example@gmail.com';\n\ntwoFA.generateQRCode(user, (err, qrCodeImage) => {\n  if (err) {\n    console.error('Failed to generate QR code:', err);\n  } else {\n    console.log('QR Code Image:', qrCodeImage);\n\n    // Save the secret to a file\n    const secret = twoFA.secret;\n    \n    console.log('Secret Key ', secret);\n  }\n});\n```\n# 2. Verifying the Token\nUse the verify.js script to verify the token generated by a 2FA app using the secret key.\n\n`verify.js`\n\n```bash\nconst TwoFactorAuth = require('2fa-auth');\n\nconst secret = 'BQKBELJ3B4BHYJQF';\nconst twoFA = new TwoFactorAuth(secret);\n\n\nconst token = '777427';\n\nconst isValid = twoFA.verifyToken(token);\nconsole.log('Is Token Valid?', isValid);\n```\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\nMake sure to replace `'example@gmail.com'` and `'BQKBELJ3B4BHYJQF'` with actual user email and secret key respectively, and adjust the usage examples as needed. Additionally, you should include a `LICENSE` file in your project directory if you haven't already, containing the text of the MIT License or whichever license you choose.\n","readmeFilename":"Readme.md"}