{"_id":"@email-otp-auth/redis","_rev":"2-f34e36628ab0f353dfb2821b114aab61","name":"@email-otp-auth/redis","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.1":{"name":"@email-otp-auth/redis","description":"Otp based Authentication package made to streamline the process of otp based Authentication","version":"0.0.1","license":"MIT","repository":{"type":"git","url":"git+https://github.com/Adityagupta1625/otp-auth.git"},"scripts":{"start":"ts-node-dev index.ts","build":"tsc"},"dependencies":{"@email-otp-auth/utils":"0.0.1","redis":"^4.6.11"},"main":"index.ts","author":{"name":"Aditya Gupta","email":"72199742+Adityagupta1625@users.noreply.github.com"},"_id":"@email-otp-auth/redis@0.0.1","gitHead":"594788f100cb9085356ee8e2710f1baa8c776d26","bugs":{"url":"https://github.com/Adityagupta1625/otp-auth/issues"},"homepage":"https://github.com/Adityagupta1625/otp-auth#readme","_nodeVersion":"18.16.1","_npmVersion":"9.8.0","dist":{"integrity":"sha512-pyZbLgteyeNuvNI6Jmffe63Wu0zUhqCeJw63lbGpyyyrOtLEMiN1UXJXoCBNz8gzRas3zdnWpe+fDhabFKcGsg==","shasum":"f73ed1136496134cb2d1ebd30525a8828d78452b","tarball":"https://registry.npmjs.org/@email-otp-auth/redis/-/redis-0.0.1.tgz","fileCount":5,"unpackedSize":7324,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCHGfkCfx+tauD1ydKKxlsj3P/+dFz13SRogh2NnFd8ogIgEm30ZvXxAWwRa+MpO91fRg4hE02+iO0nYEdaa1TsEco="}]},"_npmUser":{"name":"dev-adi","email":"guptaaditya2512@gmail.com"},"directories":{},"maintainers":[{"name":"dev-adi","email":"guptaaditya2512@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redis_0.0.1_1701667147489_0.32741993770745115"},"_hasShrinkwrap":false},"0.0.2":{"name":"@email-otp-auth/redis","description":"Otp based Authentication package made to streamline the process of otp based Authentication","version":"0.0.2","license":"MIT","repository":{"type":"git","url":"git+https://github.com/Adityagupta1625/otp-auth.git"},"scripts":{"start":"ts-node-dev index.ts","build":"tsc"},"dependencies":{"@email-otp-auth/utils":"^0.0.2","redis":"^4.6.11"},"keywords":["Authentication","otp","Redis","Mailer"],"main":"index.ts","author":{"name":"Aditya Gupta","email":"72199742+Adityagupta1625@users.noreply.github.com"},"_id":"@email-otp-auth/redis@0.0.2","gitHead":"5c8d735d763e749c03c7a6169e315732ddfa9c48","bugs":{"url":"https://github.com/Adityagupta1625/otp-auth/issues"},"homepage":"https://github.com/Adityagupta1625/otp-auth#readme","_nodeVersion":"18.16.1","_npmVersion":"9.8.0","dist":{"integrity":"sha512-jDfUCEF3RPA7A10oUqxEi6TdkGGoaxwTa3KFeK7m/5UTlnWPW8/f3iwJiPVDTMj7059C0idwUreslmJOuWG2AA==","shasum":"91c416dbaa7be780f712734ec08aeabe428ddb8e","tarball":"https://registry.npmjs.org/@email-otp-auth/redis/-/redis-0.0.2.tgz","fileCount":6,"unpackedSize":9587,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCuFEMJWNa5H+cuG5GV4dHBgUajyK3wIst5B1wvm6tAygIhAM4J/XJPyvM3saIoyiOxIfF+TF0AlDnkB0XTxn+e0e6d"}]},"_npmUser":{"name":"dev-adi","email":"guptaaditya2512@gmail.com"},"directories":{},"maintainers":[{"name":"dev-adi","email":"guptaaditya2512@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redis_0.0.2_1701669207185_0.1517817705316542"},"_hasShrinkwrap":false},"1.0.0":{"name":"@email-otp-auth/redis","description":"Otp based Authentication package made to streamline the process of otp based Authentication","version":"1.0.0","license":"MIT","main":"dist/redis/index.js","types":"dist/redis/index.d.ts","repository":{"type":"git","url":"git+https://github.com/Adityagupta1625/otp-auth.git"},"scripts":{"start":"ts-node-dev index.ts","build":"tsc","prepublishOnly":"yarn build"},"dependencies":{"redis":"^4.6.11","@types/nodemailer":"^6.4.14","@types/otp-generator":"^4.0.2","nodemailer":"^6.9.7","otp-generator":"^4.0.1"},"keywords":["Authentication","otp","Redis","Mailer"],"author":{"name":"Aditya Gupta","email":"72199742+Adityagupta1625@users.noreply.github.com"},"_id":"@email-otp-auth/redis@1.0.0","gitHead":"ba2d51215e22bc5c2055438d0b9c78532a29179f","bugs":{"url":"https://github.com/Adityagupta1625/otp-auth/issues"},"homepage":"https://github.com/Adityagupta1625/otp-auth#readme","_nodeVersion":"20.10.0","_npmVersion":"9.8.0","dist":{"integrity":"sha512-CwLfNCm07MTC4pWv1Ef5gq7BoO4dBbdHwa0KK5RKCPAeBqimDlDuXOFB1nMor1XR3QyF73OUWecEFjyHw0a5xg==","shasum":"cb4d8d6ea320111e859045dd1b732a2d6407ca86","tarball":"https://registry.npmjs.org/@email-otp-auth/redis/-/redis-1.0.0.tgz","fileCount":20,"unpackedSize":22052,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBq/FIv2SnPG4dlGTqhhOTF73dHzoOQs1V+KGHmiu9C2AiEA66N4gY1XVkwm771MmbZYDGJ6WsfN1I1jyu5QgKX0ZBI="}]},"_npmUser":{"name":"dev-adi","email":"guptaaditya2512@gmail.com"},"directories":{},"maintainers":[{"name":"dev-adi","email":"guptaaditya2512@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/redis_1.0.0_1705300765248_0.6203940236579784"},"_hasShrinkwrap":false}},"time":{"created":"2023-12-04T05:19:07.421Z","0.0.1":"2023-12-04T05:19:07.676Z","modified":"2024-01-15T06:39:25.591Z","0.0.2":"2023-12-04T05:53:27.416Z","1.0.0":"2024-01-15T06:39:25.409Z"},"maintainers":[{"name":"dev-adi","email":"guptaaditya2512@gmail.com"}],"description":"Otp based Authentication package made to streamline the process of otp based Authentication","homepage":"https://github.com/Adityagupta1625/otp-auth#readme","repository":{"type":"git","url":"git+https://github.com/Adityagupta1625/otp-auth.git"},"author":{"name":"Aditya Gupta","email":"72199742+Adityagupta1625@users.noreply.github.com"},"bugs":{"url":"https://github.com/Adityagupta1625/otp-auth/issues"},"license":"MIT","readme":"# Email OTP Auth/Redis\r\n\r\nThis package provies a stremaline way for authentication service using email OTP.This service utilizes Redis for storing and verifying OTPs and a mail server for sending OTPs via email.\r\n\r\n## Configuration\r\n\r\n### Mail Server Configuration\r\n\r\nMake sure to configure the mail server settings by providing the necessary information in the `MailServerConfiguration` interface. The interface is defined as follows:\r\n\r\n```typescript\r\ninterface MailServerConfiguration {\r\n  host: string; // The host name of the mail server.\r\n  port: number; // The port number for connecting to the mail server.\r\n  email: string; // The email address used for authentication.\r\n  pass: string; // The app password associated with the email address for authentication. You can refer google for app password.\r\n  name: string; // The name associated with the sender of the email.\r\n  subject: string; // The subject of the email.\r\n  body: string; // The body or content of the email with template {{otp}} for otp replacement.\r\n}\r\n```\r\n\r\n### Redis Configuration\r\n\r\nSet up a Redis DB URL.\r\n\r\n### Auth Class Configruation\r\n\r\n```typescript\r\nconst auth = new Auth('YOUR_REDIS_URL', mailServerConfig);\r\n```\r\n\r\n## Usage\r\n\r\n### Generate OTP\r\n\r\nTo generate and send an OTP to a specified email address, use the following code snippet:\r\n\r\n```typescript\r\nconst email = 'user@example.com';\r\n\r\ntry {\r\n  await auth.generateOTP(email);\r\n  console.log(`OTP sent successfully to ${email}`);\r\n} catch (error) {\r\n  console.error(`Error sending OTP: ${error.message}`);\r\n}\r\n```\r\n\r\n### Verify OTP\r\n\r\nTo verify an OTP for a specified email address, use the following code snippet:\r\n\r\n```typescript\r\nconst email = 'user@example.com';\r\nconst userEnteredOTP = '123456'; // Replace with the actual OTP entered by the user\r\n\r\ntry {\r\n  const isOTPValid = await auth.verifyOTP(email, userEnteredOTP);\r\n  if (isOTPValid) {\r\n    console.log('OTP is valid');\r\n  } else {\r\n    console.log('Invalid OTP');\r\n  }\r\n} catch (error) {\r\n  console.error(`Error verifying OTP: ${error.message}`);\r\n}\r\n```\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n","readmeFilename":"README.md","keywords":["Authentication","otp","Redis","Mailer"]}