{"id":26768180,"url":"https://github.com/codecat1111/2fa-using-speakeasy","last_synced_at":"2025-08-12T14:38:06.215Z","repository":{"id":252088687,"uuid":"839390591","full_name":"codecat1111/2FA-Using-Speakeasy","owner":"codecat1111","description":"This project implements a simple Two-Factor Authentication (2FA) system using Speakeasy and Express.js. The system allows users to register and verify their identity using TOTP (Time-based One-Time Password).","archived":false,"fork":false,"pushed_at":"2024-08-07T14:15:57.000Z","size":31,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-11T09:08:50.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codecat1111.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-07T14:08:48.000Z","updated_at":"2024-08-07T14:16:51.000Z","dependencies_parsed_at":"2024-08-07T17:28:09.795Z","dependency_job_id":null,"html_url":"https://github.com/codecat1111/2FA-Using-Speakeasy","commit_stats":null,"previous_names":["codecat1111/2fa-using-speakeasy"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/codecat1111/2FA-Using-Speakeasy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecat1111%2F2FA-Using-Speakeasy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecat1111%2F2FA-Using-Speakeasy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecat1111%2F2FA-Using-Speakeasy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecat1111%2F2FA-Using-Speakeasy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codecat1111","download_url":"https://codeload.github.com/codecat1111/2FA-Using-Speakeasy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codecat1111%2F2FA-Using-Speakeasy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270077536,"owners_count":24523181,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-12T02:00:09.011Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-28T21:19:55.087Z","updated_at":"2025-08-12T14:38:06.006Z","avatar_url":"https://github.com/codecat1111.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Two-Factor Authentication (2FA) Project\n\nThis project implements a simple Two-Factor Authentication (2FA) system using Speakeasy and Express.js. The system allows users to register and verify their identity using TOTP (Time-based One-Time Password).\n\n## Features\n\n- User registration with a unique ID and TOTP secret generation.\n- Verification of TOTP tokens.\n- Validation of TOTP tokens.\n- Simple in-memory storage using node-json-db.\n\n## Prerequisites\n\n- Node.js\n- npm (Node Package Manager)\n\n## Installation\n\n1. Clone the repository:\n    ```bash\n    git clone https://github.com/your-username/your-repo-name.git\n    cd your-repo-name\n    ```\n\n2. Install dependencies:\n    ```bash\n    npm install\n    ```\n\n## Usage\n\n1. Start the server:\n    ```bash\n    node app.js\n    ```\n\n2. The server will be running on `http://localhost:9000`.\n\n## API Endpoints\n\n### Register a User\n\n- **URL:** `/api/register`\n- **Method:** `POST`\n- **Description:** Registers a new user and generates a TOTP secret.\n- **Response:**\n  ```json\n  {\n    \"id\": \"user-id\",\n    \"secret\": \"base32-encoded-secret\"\n  }\n  ```\n### Verify TOTP Token\n- URL: /api/verify\n- Method: POST\n- Description: Verifies a user's TOTP token.\n- Request Body:\n ```json\n  {\n    \"userId\": \"user-id\",\n    \"token\": \"totp-token\"\n  }\n  ```\n- Response:\n ```json\n{\n  \"verified\": true\n}\n```\n### Validate TOTP Token\n\n- URL: /api/validate\n- Method: POST\n- Description: Validates a user's TOTP token.\n- Request Body:\n ```json\n  {\n    \"userId\": \"user-id\",\n    \"token\": \"totp-token\"\n  }\n```\n- Response:\n ```json\n  {\n    \"validated\": true\n  }\n  ```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecat1111%2F2fa-using-speakeasy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodecat1111%2F2fa-using-speakeasy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodecat1111%2F2fa-using-speakeasy/lists"}