|
| 1 | +<div align="center"> |
| 2 | + <img src="./public/logo.png" width="300px" alt="logo" /> |
| 3 | +</div> |
| 4 | +<h1 align="center">MyAuthenticator</h1> |
| 5 | + |
| 6 | +<p align="center">A serverless web application that generates TOTP and HOTP codes, enabling robust two-factor authentication (2FA) directly within your browser. |
| 7 | +</p> |
| 8 | +<div align="center"> |
| 9 | + |
| 10 | +[](https://nuxt.com) |
| 11 | +[](https://pages.cloudflare.com) |
| 12 | +[](https://www.typescriptlang.org) |
| 13 | +[](https://drizzle.com) |
| 14 | +[](https://tailwindcss.com) |
| 15 | + |
| 16 | +</div> |
| 17 | + |
| 18 | +## Live Demo |
| 19 | + |
| 20 | +See the live demo: |
| 21 | + |
| 22 | +[](https://my-authenticator.pages.dev) |
| 23 | + |
| 24 | +- Credentials: `admin` - `Admin@123$` |
| 25 | + |
| 26 | +## Features 🔥 |
| 27 | + |
| 28 | +🚀 **Serverless:** Leverages complete edge support, eliminating the need to maintain a server. You can deploy this project on your Cloudflare account for _`Free`_. |
| 29 | + |
| 30 | +⚙️ **Compatibility:** MyAuthenticator supports `TOTP` (Time-Based One-Time Password) and `HOTP` (HMAC-Based One-Time Password), which are widely used by most services for two-factor authentication. |
| 31 | + |
| 32 | +☀️ **Theming:** Offers light and dark themes, with customizable accent colors. |
| 33 | + |
| 34 | +💫 **Icons:** Includes 100+ colored icons and access to 3000+ icons from [SimpleIcons](https://simpleicons.org/), all are in `SVG` format for scalability. |
| 35 | + |
| 36 | +🔐 **Secure:** Uses `nuxt-auth-utils` for authentication and encrypts database fields for enhanced security. |
| 37 | + |
| 38 | +🗃️ **Backup / Restore:** Securely backup and restore authenticators with encryption. Supports import from and export to `Google Authenticator`. |
| 39 | + |
| 40 | +🤖 **Telegram Bot and MiniApp:** You can use this web app as a Telegram miniapp within the Telegram app. |
| 41 | + |
| 42 | +## Screenshots 📱 |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | +## Environment Variables |
| 47 | + |
| 48 | +```sh |
| 49 | +# required |
| 50 | +NUXT_SESSION_PASSWORD="your-super-long-secret-for-session-encryption" |
| 51 | +NUXT_AUTH_USERNAME="admin" |
| 52 | +NUXT_AUTH_PASSWORD="Admin@123$" |
| 53 | + |
| 54 | +# optional |
| 55 | +NUXT_DB_ENCRYPTION_PASSWORD="your-super-long-secret-for-db-encryption" |
| 56 | +NUXT_TELEGRAM_BOT_TOKEN="12345678:AAEzFGO9ME4i7hV9gfPTgAcJABCDEFG" |
| 57 | +NUXT_TELEGRAM_USERID="874962691" |
| 58 | +``` |
| 59 | + |
| 60 | +### Required Variables |
| 61 | + |
| 62 | +- `NUXT_SESSION_PASSWORD`: This password is used by `nuxt-auth-utils` to secure your session. It must be at least 32 characters long. |
| 63 | + |
| 64 | +- `NUXT_AUTH_USERNAME`: The username for authentication. It must be at least 5 characters long. |
| 65 | + |
| 66 | +- `NUXT_AUTH_PASSWORD`: The password for authentication. It must be at least 8 characters long and include: |
| 67 | + - One uppercase letter |
| 68 | + - One digit |
| 69 | + - One lowercase letter |
| 70 | + - Two special characters |
| 71 | + |
| 72 | +### Optional Variables |
| 73 | + |
| 74 | +- `NUXT_DB_ENCRYPTION_PASSWORD`: This password is used to encrypt and decrypt the database field of `secretkey`. By default, no encryption is used for data stored in the database. You can enable encryption by setting this variable. It must be exactly 32 characters long. |
| 75 | + |
| 76 | +- `NUXT_TELEGRAM_BOT_TOKEN`: This is the Bot Token for the Telegram Bot, which can be obtained from [@BotFather](https://telegram.dog/BotFather). Required for using this web app as a Telegram miniapp. |
| 77 | + |
| 78 | +- `NUXT_TELEGRAM_USERID`: This is your Telegram User ID used to identify you as a user of the bot. Obtain it from [@MissRose_bot](https://telegram.dog/MissRose_bot) using the `/info` command. Required for using this web app as a Telegram miniapp. |
| 79 | + |
| 80 | +## Deploy to Cloudflare Pages |
| 81 | + |
| 82 | +> [!NOTE] |
| 83 | +> This project is currently under testing and improvements. Please back up your data before proceeding. |
| 84 | +
|
| 85 | +You can deploy this project on your Cloudflare account for free and with zero configuration using [NuxtHub](https://hub.nuxt.com) |
| 86 | +You can use either the NuxtHub CLI or the NuxtHub Admin Web UI. |
| 87 | + |
| 88 | +### Using NuxtHub CLI |
| 89 | + |
| 90 | +- First, clone this repository. |
| 91 | + |
| 92 | +- Follow this [guide](https://hub.nuxt.com/docs/getting-started/deploy) and create `.env` file and add necessary environment variables |
| 93 | + |
| 94 | +```bash |
| 95 | +npx nuxthub deploy |
| 96 | +``` |
| 97 | + |
| 98 | +- Once you deployed your project, apply migrations in production with: |
| 99 | + |
| 100 | +```bash |
| 101 | +npx nuxi dev --remote |
| 102 | +``` |
| 103 | + |
| 104 | +- That's it, you've created your own authenticator. |
| 105 | + |
| 106 | +- You can set up your Telegram bot at https://< yourapp >.pages.dev/telegram |
| 107 | + |
| 108 | +### Using NuxtHub Web UI |
| 109 | + |
| 110 | +- First, fork this repository. |
| 111 | +- Open the [NuxtHub Admin](https://admin.hub.nuxt.com/) |
| 112 | +- Click on `New Project` then Import a `GitHub repository` |
| 113 | +- Select your Github repository |
| 114 | +- Click on `Import repository` |
| 115 | +- Add the necessary environment variables |
| 116 | +- After deploying, go to your project dashboard and create a table in the database by running the following SQL query in the `SQL runner`: |
| 117 | + |
| 118 | +```sql |
| 119 | +CREATE TABLE `accounts` ( |
| 120 | + `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, |
| 121 | + `type` text NOT NULL, |
| 122 | + `issuer` text NOT NULL, |
| 123 | + `label` text NOT NULL, |
| 124 | + `secret` text NOT NULL, |
| 125 | + `algorithm` text NOT NULL, |
| 126 | + `digits` integer NOT NULL, |
| 127 | + `period` integer NOT NULL, |
| 128 | + `counter` integer NOT NULL, |
| 129 | + `icon` text NOT NULL, |
| 130 | + `icontype` text NOT NULL, |
| 131 | + `createdAt` text DEFAULT (current_timestamp) NOT NULL |
| 132 | +); |
| 133 | +``` |
| 134 | + |
| 135 | +- That's it, you've created your own authenticator. |
| 136 | +- You can set up your Telegram bot at https://< yourapp >.pages.dev/telegram |
| 137 | + |
| 138 | +## Contributing and Suggestions |
| 139 | + |
| 140 | +Feel free to contribute to this project with your ideas and improvements. Your feedback and suggestions are highly valued and will help enhance this project further. |
| 141 | + |
| 142 | +## License |
| 143 | + |
| 144 | +MyAuthenticator is Free Software: You can use, study share and improve it at your |
| 145 | +will. Specifically you can redistribute and/or modify it under the terms of the |
| 146 | +[GNU Affero General Public License](https://www.gnu.org/licenses/agpl-3.0.en.html) as |
| 147 | +published by the Free Software Foundation, either version 3 of the License, or |
| 148 | +(at your option) any later version. |
0 commit comments