{"id":20909462,"url":"https://github.com/jai0212/secure-auth-ai","last_synced_at":"2026-02-11T21:33:41.648Z","repository":{"id":249117990,"uuid":"830505044","full_name":"Jai0212/secure-auth-ai","owner":"Jai0212","description":"An npm package for advanced sign-in security, including AI-based risk assessment, anomaly detection, real-time PostgreSQL database, automated user management and MFA. Compatible with React, Vue, and Angular","archived":false,"fork":false,"pushed_at":"2024-07-19T11:37:04.000Z","size":601,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-12T05:53:12.881Z","etag":null,"topics":["ai-security","anomaly-detection","authentication","javascript","mfa","multi-factor-authentication","npm-package","postgresql","python","realtime-database","user-management","web-development","z-score"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/secure-auth-ai","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Jai0212.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-07-18T12:05:03.000Z","updated_at":"2024-07-20T10:36:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"e8f099f0-5a65-4ef4-a9f4-4cde59353cbf","html_url":"https://github.com/Jai0212/secure-auth-ai","commit_stats":null,"previous_names":["jai0212/secure-auth-ai"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Jai0212/secure-auth-ai","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jai0212%2Fsecure-auth-ai","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jai0212%2Fsecure-auth-ai/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jai0212%2Fsecure-auth-ai/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jai0212%2Fsecure-auth-ai/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Jai0212","download_url":"https://codeload.github.com/Jai0212/secure-auth-ai/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Jai0212%2Fsecure-auth-ai/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29345535,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-11T20:11:40.865Z","status":"ssl_error","status_checked_at":"2026-02-11T20:10:41.637Z","response_time":97,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["ai-security","anomaly-detection","authentication","javascript","mfa","multi-factor-authentication","npm-package","postgresql","python","realtime-database","user-management","web-development","z-score"],"created_at":"2024-11-18T14:11:17.284Z","updated_at":"2026-02-11T21:33:41.633Z","avatar_url":"https://github.com/Jai0212.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SecureAuthAI\n\n[![npm version](https://img.shields.io/npm/v/secure-auth-ai.svg)](https://www.npmjs.com/package/secure-auth-ai)\n![npm](https://img.shields.io/npm/dt/secure-auth-ai)\n![Frameworks](https://img.shields.io/badge/supports-React%20%7C%20Vue%20%7C%20Angular-blue)\n\n\n🔐 SecureAuthAI offers web developers a comprehensive solution for implementing secure sign-in functionalities.  \n\nThis **npm** package integrates **multi-factor authentication** (MFA), real-time **PostgreSQL** database management, statistical **anomaly detection**, and a custom **AI model**. Designed to enhance login security, it automates **user management** tasks and ensures robust protection against unauthorized access.  \n\nIt integrates seamlessly with popular web frameworks like **React**, **Vue**, and **Angular**.\n\n\n## Features\n- **AI-Based Risk Assessment:** Custom AI model detects unsafe login attempts based on location, device, time, and attempts.\n- **Anomaly Detection:** Statistical methods (Z-Score Calculation) to identify anomalies and prevent unauthorized access.\n- **MFA Integration:** Enhances security with multi-factor authentication using a secret key.\n- **Realtime PostgreSQL Database:** Store user details securely with customizable functions provided out-of-the-box.\n- **Hassle-Free Implementation:** Pre-made functions handle database interactions, eliminating the need for manual API calls.\n- **Security:** Passwords are tokenized, and user-specific details are automatically managed to prevent security breaches.\n\n\n## Framework Support\nSecureAuthAI integrates seamlessly with popular web frameworks:  \n\n\u003cdiv style=\"display: flex; justify-content: center;\"\u003e\n    \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/120px-React-icon.svg.png\" alt=\"React\" height=\"60\" width=\"60\" style=\"margin: 0 10px;\"\u003e\n    \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/9/95/Vue.js_Logo_2.svg/120px-Vue.js_Logo_2.svg.png\" alt=\"Vue.js\" height=\"60\" width=\"60\" style=\"margin: 0 10px;\"\u003e\n    \u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/c/cf/Angular_full_color_logo.svg/120px-Angular_full_color_logo.svg.png\" alt=\"Angular\" height=\"70\" width=\"70\" style=\"margin: -5 10px;\"\u003e\n\u003c/div\u003e\n\n## Installation \u0026 Usage:\n\nInstall SecureAuthAI via npm:\n```bash\nnpm install secure-auth-ai\n```\n\nImport the package in your project:  \n```bash\nimport * as SAA from 'secure-auth-ai';\n```\n\nOr import specific functions:  \n```bash\nimport { initializePackageSAA, signUpSAA } from 'secure-auth-ai';\n```\n\nAll functions are asynchronous and should be used with axios for HTTP requests:  \n```bash\nconst response = await initializePackageSAA();\n```\n\nEach response has three attributes to it:  \n- **value** - any value that needs to be returned. If not, or in case of an error, this will be either an empty string or []\n- **success** - true if request was successful, false otherwise\n- **message** - message for debugging in case of an error or a success message\n\nWhen you first use the package, you must call the function `initializePackageSAA()` which will give you a token that refers to your table. This token is the first parameter in all other functions.\n\n\n## Example\n```bash\nimport { initializePackageSAA, signUpSAA, updateUserDetailsSAA, getUserDetailsSAA } from 'secure-auth-ai';\n \nconst SECURE_AUTH_AI_TABLE_KEY = await initializePackageSAA([\"email\"]);\n\nconst signUpResponse = await signUpSAA(SECURE_AUTH_AI_TABLE_KEY, \"hello\", {\"email\": \"placeholder@example.com\", \"phone_number\": \"+123456789\"});\n\nif (signUpResponse.success) {\n    const updateResponse = await updateUserDetailsSAA(SECURE_AUTH_AI_TABLE_KEY, \"email\", \"placeholder@example.com\", {\"phone_number\": \"+199999999\"});\n\n    console.log(updateResponse.message);\n\n    const detailsResponse = await getUserDetailsSAA(SECURE_AUTH_AI_TABLE_KEY, \"email\", \"placeholder@example.com\");\n\n    console.log(detailsResponse.value);\n}\n```\n\nEverytime the function `logInSAA()` is called, using the AI model and anomaly detection, it is checked whether the login attempt is safe or not. If it is not safe, you are required to call `verifyMfaSSA()` to do the MFA.\n\n**NOTE**: Initally it can take about a minute to get a response as the backend needs to load up.\n\n## Available Functions\n\n* initializePackageSAA\n* signUpSAA\n* logInSAA\n* verifyMfaSAA\n* getUserDetailsSAA\n* getAllDetailsSAA\n* updateUserDetailsSAA\n* addColumnSAA\n* removeColumnSAA\n* removeUserSAA\n\n**NOTE**: All functions are ASYNCHRONOUS\n\nFor detailed usage of each function, refer to the `api.js` file.\n\n\n## Technical Aspects\n\n* **Backend**: Python backend hosted on Render\n* **Database**: PostgreSQL hosted on Neon\n* **Package**: JavaScript and Node.js, published on npm\n* **AI Model**:\n    * Created using:\n        * XGBoost Classifier\n        * Random Forest Classifier\n    * Training Data based on change in:\n        * Location\n        * Device\n        * Time\n        * Attempts\n* **Anomaly Detection**: Z-Score Calculation for detecting unusual login patterns.\n* **Prediction**: Based on the variation in location, device, time \u0026 attempts, along with the anomaly detection, it is decided whether a particular login attempt is safe or not\n        \n\n### Files\n* `backend/` - Core logic and AI model implementation.\n* `api.js` - API calls.\n\n\n## Webpack Configuration\n\nIf you're using React (Webpack) and encounter issues with missing core Node.js modules (like `crypto`), you may need to update your Webpack configuration. Add the following to your `webpack.config.js` (found inside `node_modules/react-scripts/config/`):\n\n```js\nresolve: {\n  fallback: {\n    crypto: false,\n    // Add other fallbacks if necessary\n  }\n}\n```\n\n## Acknowledgments\nSpecial thanks to Render, Neon, and npm for their support in hosting and distributing this package.\n\n### Contact\n*For suggestions, feedback, collaborations, or bug reports, please contact me via email: jj.joshijai@gmail.com*\n\nAuthor and Date  \nby Jai Joshi  \nUpdated on 19th July, 2024","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjai0212%2Fsecure-auth-ai","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjai0212%2Fsecure-auth-ai","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjai0212%2Fsecure-auth-ai/lists"}