{"_id":"@ahmed_elssamman/auth-lib","_rev":"4-668283a6ecdd0a041b2595e8199b9a5b","name":"@ahmed_elssamman/auth-lib","dist-tags":{"latest":"1.1.2"},"versions":{"1.0.0":{"name":"@ahmed_elssamman/auth-lib","version":"1.0.0","keywords":["Authentication","auth-lib","login","register","reset-password","`verify-email","refresh-token"],"author":{"name":"Ahmed El-Samman"},"license":"MIT","_id":"@ahmed_elssamman/auth-lib@1.0.0","maintainers":[{"name":"ahmed_elssamman","email":"ahmed.elssamman@gmail.com"}],"dist":{"shasum":"10e3f64eed7b56501aa28c24548508c3223d8b50","tarball":"https://registry.npmjs.org/@ahmed_elssamman/auth-lib/-/auth-lib-1.0.0.tgz","fileCount":8,"integrity":"sha512-ikwz5GF0oMGAPRqC5uJdN8DXg4+6Zx9kboWCxZ9UnYrhVrqOLrPN9DH5DzGL+fjk9fuCzJkOOnWopCm3J0o3CA==","signatures":[{"sig":"MEYCIQCHgCa7iaGF1tgHUM79MrJVq+MMzkp+a3o80tgMIepnpQIhALkUU67bUkVmqd2lSg7yW4PtRwM/6NiIVZgD+yQOfg5I","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":34533},"type":"module","module":"fesm2022/ahmed_elssamman-auth-lib.mjs","exports":{".":{"types":"./types/ahmed_elssamman-auth-lib.d.ts","default":"./fesm2022/ahmed_elssamman-auth-lib.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"cbb73379282e6484569495a8e66a519054d379a2","typings":"types/ahmed_elssamman-auth-lib.d.ts","_npmUser":{"name":"ahmed_elssamman","email":"ahmed.elssamman@gmail.com"},"_npmVersion":"11.16.0","description":"Authentication library built with Angular 21","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"@angular/core":"^21.2.0","@angular/common":"^21.2.0"},"_npmOperationalInternal":{"tmp":"tmp/auth-lib_1.0.0_1785310196290_0.18792920791968637","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@ahmed_elssamman/auth-lib","version":"1.1.0","keywords":["angular","angular21","authentication","auth-lib","login","register","forgot-password","reset-password","verify-email","otp","signals","rxjs"],"author":{"name":"Ahmed El-Samman"},"license":"MIT","_id":"@ahmed_elssamman/auth-lib@1.1.0","maintainers":[{"name":"ahmed_elssamman","email":"ahmed.elssamman@gmail.com"}],"dist":{"shasum":"a01400c12823a404c2b414d40f0fce46f801d546","tarball":"https://registry.npmjs.org/@ahmed_elssamman/auth-lib/-/auth-lib-1.1.0.tgz","fileCount":8,"integrity":"sha512-XXCwCLNrkkMcJBjnMH99hFlOnGZ54D0h4KC7doe+PMIJerfsrhjBUxSAHSUtNZmYw5op1ZmkvUMNAEXIoiYjXg==","signatures":[{"sig":"MEQCIFUU27+IBxOSuuxV0leKHRsoe/9rzLWlTq55dC8TR9xKAiA+NmUipE/WZgnJqrDxdq1id3zAnw0BcqEmV820d6PEvw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":38585},"type":"module","module":"fesm2022/ahmed_elssamman-auth-lib.mjs","exports":{".":{"types":"./types/ahmed_elssamman-auth-lib.d.ts","default":"./fesm2022/ahmed_elssamman-auth-lib.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"cbb73379282e6484569495a8e66a519054d379a2","typings":"types/ahmed_elssamman-auth-lib.d.ts","_npmUser":{"name":"ahmed_elssamman","email":"ahmed.elssamman@gmail.com"},"_npmVersion":"11.16.0","description":"⚡ A powerful, lightweight Angular 21 authentication library featuring seamless Login, Registration, OTP Email Verification, Password Reset, and Response Adapters.","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"@angular/core":"^21.2.0","@angular/common":"^21.2.0"},"_npmOperationalInternal":{"tmp":"tmp/auth-lib_1.1.0_1785310686258_0.6580683811828394","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@ahmed_elssamman/auth-lib","version":"1.1.1","keywords":["angular","angular21","authentication","auth-lib","login","register","forgot-password","reset-password","verify-email","otp","signals","rxjs"],"author":{"name":"Ahmed El-Samman"},"license":"MIT","_id":"@ahmed_elssamman/auth-lib@1.1.1","maintainers":[{"name":"ahmed_elssamman","email":"ahmed.elssamman@gmail.com"}],"dist":{"shasum":"3df4b775cc3a23a9bb0d69e1579fe35c2d22f5c5","tarball":"https://registry.npmjs.org/@ahmed_elssamman/auth-lib/-/auth-lib-1.1.1.tgz","fileCount":5,"integrity":"sha512-9fY8ihlAzvbMD94OvGHCjQvsH3Za04uRrh57WjZ1fthbNkDeI1maxxIW0gpspu/N/C8hgKbx9ggIkhcpxTm10Q==","signatures":[{"sig":"MEYCIQDu9P1ZsE9+d/m/m17C5p8NDwW7c9x4yHuPOD1AkF0ChQIhAIqnnz3kK+d5QPa1Z0HdUjG9z5/HLz0woL0KiaKdehRX","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":22504},"type":"module","module":"fesm2022/ahmed_elssamman-auth-lib.mjs","exports":{".":{"types":"./types/ahmed_elssamman-auth-lib.d.ts","default":"./fesm2022/ahmed_elssamman-auth-lib.mjs"},"./package.json":{"default":"./package.json"}},"gitHead":"fc93505715cdcd2a6694f9ca0c0001b5be953ea4","typings":"types/ahmed_elssamman-auth-lib.d.ts","_npmUser":{"name":"ahmed_elssamman","email":"ahmed.elssamman@gmail.com"},"_npmVersion":"11.16.0","description":"⚡ A powerful, lightweight Angular 21 authentication library featuring seamless Login, Registration, OTP Email Verification, Password Reset, and Response Adapters.","directories":{},"sideEffects":false,"_nodeVersion":"24.18.0","dependencies":{"tslib":"^2.3.0"},"_hasShrinkwrap":false,"peerDependencies":{"@angular/core":"^21.2.0","@angular/common":"^21.2.0"},"_npmOperationalInternal":{"tmp":"tmp/auth-lib_1.1.1_1786362611268_0.5188718110700576","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@ahmed_elssamman/auth-lib","version":"1.1.2","description":"⚡ A powerful, lightweight Angular 21 authentication library featuring seamless Login, Registration, OTP Email Verification, Password Reset, and Response Adapters.","author":{"name":"Ahmed El-Samman"},"license":"MIT","keywords":["angular","angular21","authentication","auth-lib","login","register","forgot-password","reset-password","verify-email","otp","signals","rxjs"],"peerDependencies":{"@angular/common":"^21.2.0","@angular/core":"^21.2.0"},"dependencies":{"tslib":"^2.3.0"},"sideEffects":false,"module":"fesm2022/ahmed_elssamman-auth-lib.mjs","typings":"types/ahmed_elssamman-auth-lib.d.ts","exports":{"./package.json":{"default":"./package.json"},".":{"types":"./types/ahmed_elssamman-auth-lib.d.ts","default":"./fesm2022/ahmed_elssamman-auth-lib.mjs"}},"type":"module","gitHead":"fc93505715cdcd2a6694f9ca0c0001b5be953ea4","_id":"@ahmed_elssamman/auth-lib@1.1.2","_nodeVersion":"24.18.0","_npmVersion":"11.16.0","dist":{"integrity":"sha512-uBdRq4LaN20Oh75wwuZyjjRKf/0LK/buSCXKJlUBhrsp3PYBGv0Ao68E3XJJy6U+QqFTCM8tqeh/7CSoGvs31A==","shasum":"3ab7f3289adfbf611d89d0dcd24fdd233ae4c56e","tarball":"https://registry.npmjs.org/@ahmed_elssamman/auth-lib/-/auth-lib-1.1.2.tgz","fileCount":5,"unpackedSize":24259,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFkFcYjZHikAornVViGzDjLRIfpEZbUtXGU5wraHcSh3AiEA83KUyUknRTkC6TLdyEpBzHVP+GYN8QYhu9vn+JkAgqY="}]},"_npmUser":{"name":"ahmed_elssamman","email":"ahmed.elssamman@gmail.com"},"directories":{},"maintainers":[{"name":"ahmed_elssamman","email":"ahmed.elssamman@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/auth-lib_1.1.2_1786365523627_0.2431611610863842"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-29T07:29:56.091Z","modified":"2026-08-10T12:38:43.942Z","1.0.0":"2026-07-29T07:29:56.468Z","1.1.0":"2026-07-29T07:38:06.409Z","1.1.1":"2026-08-10T11:50:11.409Z","1.1.2":"2026-08-10T12:38:43.781Z"},"author":{"name":"Ahmed El-Samman"},"license":"MIT","keywords":["angular","angular21","authentication","auth-lib","login","register","forgot-password","reset-password","verify-email","otp","signals","rxjs"],"description":"⚡ A powerful, lightweight Angular 21 authentication library featuring seamless Login, Registration, OTP Email Verification, Password Reset, and Response Adapters.","maintainers":[{"name":"ahmed_elssamman","email":"ahmed.elssamman@gmail.com"}],"readme":"# 🔐 @ahmed_elssamman/auth-lib\n\n<div align=\"center\">\n\n[![Angular Version](https://img.shields.io/badge/Angular-21.2.0+-DD0031?style=for-the-badge&logo=angular&logoColor=white)](https://angular.dev)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.style=for-the-badge&logo=opensourceinitiative&logoColor=white)](LICENSE)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.9+-3178C6?style=for-the-badge&logo=typescript&logoColor=white)](https://www.typescriptlang.org/)\n[![RxJS](https://img.shields.io/badge/RxJS-7.8+-B7178C?style=for-the-badge&logo=reactivex&logoColor=white)](https://rxjs.dev)\n\n**⚡ A modern, lightweight, and signal-ready Angular 21 Authentication Library**  \nDesigned for robust enterprise login, registration workflows, OTP email verification, password resets, and flexible data adaptation.\n\n[Features](#-key-features) • [Installation](#-installation) • [Quick Start](#-quick-start) • [API Reference](#-api-reference) • [Configuration](#-configuration)\n\n</div>\n\n---\n\n## ✨ Key Features\n\n- 🔑 **Complete Auth Lifecycle**: Out-of-the-box support for Login, Register, Password Reset, and OTP Verification.\n- 📩 **OTP Email Verification**: Built-in 2-step email verification workflow.\n- 🔄 **Data Adaptation**: Integrated `AuthAdapterService` to transform raw backend HTTP responses into standardized client models.\n- ⚡ **Angular 21 & Signals Ready**: Built for modern Angular standalone components and Signal Forms.\n- 🎯 **Custom Endpoint Overrides**: Pass custom backend endpoints on a per-method basis without changing global config.\n- 🛡️ **Type-Safe Interfaces**: Fully typed request and response payloads with strict TypeScript definitions.\n\n---\n\n## 📦 Installation\n\nInstall the package via **npm**:\n\n```bash\nnpm install @ahmed_elssamman/auth-lib\n```\n\n---\n\n## 🚀 Quick Start\n\n### 1. Provide API Configuration\n\nIn your `app.config.ts` or main application providers, register the `API_CONFIG` provider:\n\n```typescript\nimport { ApplicationConfig } from '@angular/core';\nimport { provideHttpClient } from '@angular/common/http';\nimport { API_CONFIG } from '@ahmed_elssamman/auth-lib';\n\nexport const appConfig: ApplicationConfig = {\n  providers: [\n    provideHttpClient(),\n    {\n      provide: API_CONFIG,\n      useValue: {\n        baseUrl: 'https://api.yourdomain.com/api/v1',\n        clientName: 'Name-App',\n      },\n    },\n  ],\n};\n```\n\n---\n\n### 2. Inject and Use `AuthLib`\n\nInject `AuthLib` into your component or feature service:\n\n```typescript\nimport { Component, inject } from '@angular/core';\nimport { AuthLib, IAuthLoginRequest } from '@ahmed_elssamman/auth-lib';\nimport { Router } from '@angular/router';\n\n@Component({\n  selector: 'app-login',\n  standalone: true,\n  templateUrl: './login.component.html',\n})\nexport class LoginComponent {\n  private readonly authLib = inject(AuthLib);\n  private readonly router = inject(Router);\n\n  onLogin(credentials: IAuthLoginRequest): void {\n    this.authLib.login(credentials).subscribe({\n      next: (adaptedResponse) => {\n        console.log('Login Successful:', adaptedResponse.token, adaptedResponse.user);\n        this.router.navigate(['/dashboard']);\n      },\n      error: (err) => console.error('Login Failed:', err),\n    });\n  }\n}\n```\n\n---\n\n## 📚 API Reference\n\n### `AuthLib` Methods\n\n| Method | Parameters | Description | Returns |\n| :--- | :--- | :--- | :--- |\n| `login` | `userData: IAuthLoginRequest`, `customEndpoint?: string` | Authenticates user credentials and adapts token & user data. | `Observable<IAuthAdaptedResponse>` |\n| `register` | `userData: Partial<IAuthRegisterInterface>`, `customEndpoint?: string` | Registers a new user account. | `Observable<IAuthAdaptedResponse>` |\n| `sendEmailForVerification` | `email: string`, `customEndpoint?: string` | Triggers an OTP verification email to the user. | `Observable<any>` |\n| `verifyEmail` | `userData: { email: string; code: string }`, `customEndpoint?: string` | Validates the OTP code received via email. | `Observable<any>` |\n| `forgotPassword` | `userData: { email: string; redirectUrl?: string }`, `customEndpoint?: string` | Initiates password recovery process. | `Observable<any>` |\n| `resetPassword` | `userData: { token: string; newPassword: string; confirmPassword: string }`, `customEndpoint?: string` | Sets a new password using reset token. | `Observable<any>` |\n\n---\n\n## 🛠️ Advanced Customization\n\n> [!TIP]\n> **Overriding Endpoints Dynamically**  \n> If your API has custom routes for specific features (e.g. `/v2/auth/quick-login`), you can pass a custom endpoint string directly to any method call:\n\n```typescript\nthis.authLib.login(credentials, '/v2/auth/quick-login').subscribe(...);\n```\n\n> [!NOTE]\n> **Data Adapter pattern**  \n> By default, `login()` and `register()` pipe response data through `AuthAdapterService`. This normalizes user objects, status codes, and JWT tokens across varying backend API response shapes.\n\n---\n\n## 📄 License\n\nDistributed under the **MIT License**. See `LICENSE` for more information.\n\n---\n\n<div align=\"center\">\n  Crafted with ❤️ by <b>Ahmed El-Samman</b>\n</div>\n","readmeFilename":"README.md"}