Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

escapeWu/fancy-2fa

Repository files navigation

Fancy 2FA (Guardian Gate)

Deploy with Vercel

English | 简体中文

A secure, privacy-focused Two-Factor Authentication (2FA) dashboard.

Features

  • 📱 API Access: Generate TOTP codes programmatically via a secured API endpoint.
  • 🔗 Share Links: Generate shareable links for individual 2FA codes, allowing temporary access without exposing secrets.
  • 📋 Quick Copy: Quickly copy verification codes, account names, or remarks with a single click.
  • 📥 CSV Import/Export: Bulk import and export accounts via CSV files, including remarks and tags.

Getting Started

1. Environment Configuration

Copy the example environment file to .env:

cp .env.example .env

Edit .env.local and configure the following variables:

Variable Description
NEXT_PUBLIC_SUPABASE_URL Your Supabase project URL (e.g., https://xyz.supabase.co).
NEXT_PUBLIC_SUPABASE_ANON_KEY Your Supabase project's anon (public) key.
SUPABASE_SERVICE_ROLE_KEY (Optional) Your Supabase service_role key. Used for admin/server-side operations bypassing RLS.
AUTH_SECRET_KEY Required. The password used to log in to the web dashboard. Choose a strong secret.
API_AUTH_TOKEN Required. The token used to authenticate requests to the /api/totp endpoint.

2. Database Setup (Supabase)

  1. Go to your Supabase project's SQL Editor.
  2. Open the supabase_schema.sql file located in the root of this project.
  3. Copy the contents and run them in the Supabase SQL Editor.

API: Generate TOTP Code

You can generate a TOTP code programmatically using the API.

Endpoint: GET /api/totp

Headers:

  • Authorization: Bearer <API_AUTH_TOKEN>

Query Parameters:

  • issuer (required): The name of the service (e.g., "Google", "GitHub").
  • account (optional): The account name/email (e.g., "user@example.com").

Example Request:

curl -H "Authorization: Bearer your-api-token" \
 "http://localhost:3000/api/totp?issuer=Google&account=user@example.com"

License

MIT

About

A simple 2FA web project(Vercel + supabase quick deploy)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

Languages

AltStyle によって変換されたページ (->オリジナル) /