Skip to content

Commit 3dcf24e

Browse files
committed
new commit
0 parents  commit 3dcf24e

File tree

205 files changed

+22002
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

205 files changed

+22002
-0
lines changed

.env.example

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
NUXT_SESSION_PASSWORD="38d278fcdb0c47478c0dd5a8b823ab5d"
2+
NUXT_AUTH_USERNAME="admin"
3+
NUXT_AUTH_PASSWORD="Admin@123$"
4+
NUXT_TELEGRAM_BOT_TOKEN="12345670:AAEzFgO9MEsKdfhkO39gfPTgAcJc6StvU5WWDg"
5+
NUXT_TELEGRAM_USERID="123456789"
6+
NUXT_DB_ENCRYPTION_PASSWORD="c5d9ec24c894615e062807c81c348648"

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Nuxt dev/build outputs
2+
.output
3+
.data
4+
.nuxt
5+
.nitro
6+
.cache
7+
dist
8+
9+
# Node dependencies
10+
node_modules
11+
12+
# Logs
13+
logs
14+
*.log
15+
16+
# Misc
17+
.DS_Store
18+
.fleet
19+
.idea
20+
21+
# Local env files
22+
.env
23+
.env.*
24+
!.env.example

.vscode/settings.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"tailwindCSS.experimental.classRegex": [
3+
["ui:\\s*{([^)]*)\\s*}", "[\"'`]([^\"'`]*).*?[\"'`]"],
4+
["/\\*ui\\*/\\s*{([^;]*)}", ":\\s*[\"'`]([^\"'`]*).*?[\"'`]"]
5+
],
6+
"files.associations": {
7+
"*.css": "tailwindcss"
8+
},
9+
"editor.quickSuggestions": {
10+
"strings": true
11+
},
12+
"tailwindCSS.classAttributes": ["class", "className", "ngClass", "ui"]
13+
}

LICENSE

Lines changed: 661 additions & 0 deletions
Large diffs are not rendered by default.

README.md

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
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+
[![Nuxt 3 Badge](https://img.shields.io/badge/Nuxt_3-black?style=for-the-badge&logo=nuxtdotjs&link=https%3A%2F%2Fnuxt.com)](https://nuxt.com)
11+
[![Cloudflare Pages Badge](https://img.shields.io/badge/Cloudflare_Pages-black?style=for-the-badge&logo=cloudflarepages&link=https%3A%2F%2Fpages.cloudflare.com)](https://pages.cloudflare.com)
12+
[![Typescript Badge](https://img.shields.io/badge/Typescript-black?style=for-the-badge&logo=typescript&link=https%3A%2F%2Fwww.typescriptlang.org)](https://www.typescriptlang.org)
13+
[![Drizzle Badge](https://img.shields.io/badge/Drizzle-black?style=for-the-badge&logo=drizzle&link=https%3A%2F%2Fdrizzle.com)](https://drizzle.com)
14+
[![Tailwindcss Badge](https://img.shields.io/badge/Tailwindcss-black?style=for-the-badge&logo=tailwindcss&link=https%3A%2F%2Ftailwindcss.com)](https://tailwindcss.com)
15+
16+
</div>
17+
18+
## Live Demo
19+
20+
See the live demo:
21+
22+
[![Demo Site](https://img.shields.io/badge/Demo-Visit-blue?style=for-the-badge&logo=googlechrome)](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+
![Screenshot](./public/screenshot.png)
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.

app.config.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
export default defineAppConfig({
2+
ui: {
3+
primary: "green",
4+
container: {
5+
padding: "py-0 px-2 sm:px-5 lg:px-8",
6+
},
7+
modal: {
8+
overlay: {
9+
background: "bg-gray-200/75 dark:bg-gray-950/75 backdrop-blur-sm",
10+
},
11+
padding: "p-0",
12+
rounded: "rounded-t-2xl rounded-b-none sm:rounded-lg",
13+
width: "w-full max-w-md sm:max-w-md sm:w-full",
14+
height: "h-max",
15+
base: "relative text-left rtl:text-right flex flex-col p-4 sm:px-8",
16+
},
17+
formGroup: {
18+
wrapper: "w-full mt-4",
19+
size: {
20+
xl: "text-sm",
21+
},
22+
},
23+
button: {
24+
padding: {
25+
xl: "px-5 py-1.5",
26+
},
27+
rounded: "rounded-lg",
28+
},
29+
card: {
30+
body: {
31+
padding: "",
32+
base: "",
33+
},
34+
base: "w-full max-w-xs overflow-hidden",
35+
},
36+
dropdown: {
37+
background: "bg-white dark:bg-gray-900/90",
38+
},
39+
},
40+
});

app.vue

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<template>
2+
<UContainer>
3+
<NuxtPage />
4+
<UModals />
5+
<Toaster />
6+
</UContainer>
7+
<ClientOnly v-if="route.query.tma">
8+
<TelegramMiniApp />
9+
</ClientOnly>
10+
</template>
11+
12+
<script setup lang="ts">
13+
import { Toaster } from "@steveyuowo/vue-hot-toast";
14+
import "@steveyuowo/vue-hot-toast/vue-hot-toast.css";
15+
import TelegramMiniApp from "./components/TelegramMiniApp.vue";
16+
17+
const route = useRoute();
18+
</script>
19+
20+
<style>
21+
::-webkit-scrollbar {
22+
scrollbar-width: none;
23+
display: none;
24+
}
25+
26+
body {
27+
@apply font-sans text-gray-950 bg-gray-50 dark:bg-gray-950 dark:text-gray-100 scroll-smooth;
28+
}
29+
30+
.flex-center {
31+
@apply flex justify-center items-center;
32+
}
33+
34+
.VueHotToast__toast {
35+
@apply !p-1.5;
36+
}
37+
</style>

assets/json/icons-light.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
[
2+
"adafruit",
3+
"amazon",
4+
"aol",
5+
"aws",
6+
"cod",
7+
"default",
8+
"epicgames",
9+
"hackerone",
10+
"invoiceninja",
11+
"Kaspersky",
12+
"lichess",
13+
"mozilla",
14+
"nord",
15+
"nvidia",
16+
"patreon",
17+
"plex",
18+
"proton",
19+
"roblox",
20+
"sony",
21+
"ubisoft",
22+
"unity",
23+
"vmware",
24+
"wikipedia",
25+
"windscribe",
26+
"wordPress",
27+
"zendesk"
28+
]

0 commit comments

Comments
 (0)