@nauth-toolkit/client 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +90 -0
- package/README.md +92 -0
- package/dist/angular/index.cjs +1958 -0
- package/dist/angular/index.cjs.map +1 -0
- package/dist/angular/index.d.mts +623 -0
- package/dist/angular/index.d.ts +623 -0
- package/dist/angular/index.mjs +1926 -0
- package/dist/angular/index.mjs.map +1 -0
- package/dist/index.cjs +1473 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +638 -0
- package/dist/index.d.ts +638 -0
- package/dist/index.mjs +1433 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
NAUTH TOOLKIT EARLY ACCESS LICENSE
|
|
2
|
+
Version 1.0 (December 2025)
|
|
3
|
+
|
|
4
|
+
================================================================================
|
|
5
|
+
FUTURE OPEN SOURCE NOTICE
|
|
6
|
+
================================================================================
|
|
7
|
+
NAuth Toolkit will transition to an open-source license (MIT or Apache 2.0) for
|
|
8
|
+
core authentication features once the project reaches production readiness.
|
|
9
|
+
|
|
10
|
+
This Early Access License is temporary and designed to:
|
|
11
|
+
• Allow developers to build with nauth-toolkit during preview/beta
|
|
12
|
+
• Provide clear expectations during the pre-release phase
|
|
13
|
+
• Enable feedback and real-world testing before GA
|
|
14
|
+
|
|
15
|
+
We're committed to keeping core auth free and open source. Premium features
|
|
16
|
+
(enterprise SSO, advanced compliance, hosted options) will be offered separately
|
|
17
|
+
under fair commercial terms.
|
|
18
|
+
|
|
19
|
+
================================================================================
|
|
20
|
+
EARLY ACCESS LICENSE TERMS
|
|
21
|
+
================================================================================
|
|
22
|
+
|
|
23
|
+
1. Grant of Use
|
|
24
|
+
You are granted a free, non-exclusive, non-transferable license to:
|
|
25
|
+
- Install and use nauth-toolkit packages in development, testing, staging,
|
|
26
|
+
and production environments
|
|
27
|
+
- Modify the code for your own internal use
|
|
28
|
+
- Deploy applications using nauth-toolkit to serve your users
|
|
29
|
+
|
|
30
|
+
You may NOT:
|
|
31
|
+
- Redistribute NAuth Toolkit as a standalone product or service
|
|
32
|
+
- Sell, sublicense, or offer NAuth Toolkit as part of a competing auth
|
|
33
|
+
platform or toolkit
|
|
34
|
+
- Remove or alter copyright notices
|
|
35
|
+
|
|
36
|
+
2. No Fees During Early Access
|
|
37
|
+
There are no license fees, subscription costs, or usage charges during the
|
|
38
|
+
Early Access period. You may use nauth-toolkit freely for commercial and
|
|
39
|
+
non-commercial purposes within the terms of this license.
|
|
40
|
+
|
|
41
|
+
3. Production Use
|
|
42
|
+
Production use is permitted but comes with standard early-access caveats:
|
|
43
|
+
- Features and APIs may change between preview releases
|
|
44
|
+
- Support is community-based (GitHub issues/discussions)
|
|
45
|
+
- No SLA or guaranteed uptime (you run it on your infrastructure)
|
|
46
|
+
|
|
47
|
+
We recommend thorough testing and having rollback plans for critical systems.
|
|
48
|
+
|
|
49
|
+
4. Future Transition
|
|
50
|
+
When nauth-toolkit releases v1.0 GA:
|
|
51
|
+
- Core packages will adopt an open-source license (MIT or Apache 2.0)
|
|
52
|
+
- Your existing deployments will continue to work
|
|
53
|
+
- Premium features (if any) will be clearly documented with separate licensing
|
|
54
|
+
- No forced upgrades or surprise fees
|
|
55
|
+
|
|
56
|
+
5. Ownership
|
|
57
|
+
NAuth Toolkit is developed and maintained by Noorix Digital Solutions.
|
|
58
|
+
You retain full ownership of your applications and data.
|
|
59
|
+
|
|
60
|
+
6. Data and Privacy
|
|
61
|
+
NAuth Toolkit runs in YOUR infrastructure and database. You control all data.
|
|
62
|
+
You are responsible for compliance with applicable data protection laws.
|
|
63
|
+
|
|
64
|
+
7. Disclaimer of Warranty
|
|
65
|
+
THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
66
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
67
|
+
FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
|
|
68
|
+
|
|
69
|
+
8. Limitation of Liability
|
|
70
|
+
IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY INDIRECT, INCIDENTAL,
|
|
71
|
+
SPECIAL, CONSEQUENTIAL, OR EXEMPLARY DAMAGES, INCLUDING BUT NOT LIMITED TO LOSS
|
|
72
|
+
OF PROFITS, REVENUE, DATA, OR USE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
|
73
|
+
DAMAGES.
|
|
74
|
+
|
|
75
|
+
9. Termination
|
|
76
|
+
This license remains in effect until:
|
|
77
|
+
- You stop using nauth-toolkit, or
|
|
78
|
+
- The project transitions to open source (at which point the new license applies)
|
|
79
|
+
|
|
80
|
+
If you breach these terms, your license terminates and you must stop using the
|
|
81
|
+
software.
|
|
82
|
+
|
|
83
|
+
10. Contact and Support
|
|
84
|
+
- Documentation: https://nauth.dev
|
|
85
|
+
- Issues/Discussions: GitHub (when public repository launches)
|
|
86
|
+
- Commercial inquiries: Contact admin@noorix.com
|
|
87
|
+
|
|
88
|
+
================================================================================
|
|
89
|
+
Thank you for being an early adopter. Your feedback shapes the future of NAuth.
|
|
90
|
+
================================================================================
|
package/README.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# @nauth-toolkit/client
|
|
2
|
+
|
|
3
|
+
Framework-agnostic frontend SDK for nauth-toolkit. Handles auth flows, token delivery (JSON/cookies/hybrid), challenges, MFA, social auth, device trust, and audit history.
|
|
4
|
+
|
|
5
|
+
## ⚠️ Preview Release Notice
|
|
6
|
+
|
|
7
|
+
**This is a preview release for internal testing. Do not use in production yet.**
|
|
8
|
+
|
|
9
|
+
This package is part of nauth-toolkit and is currently in early access/preview. Features and APIs may change between releases. For production use, please wait for the stable v1.0 release.
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install @nauth-toolkit/client@preview
|
|
15
|
+
# or
|
|
16
|
+
yarn add @nauth-toolkit/client@preview
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Angular apps (optional peers):
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
yarn add @angular/core @angular/common rxjs
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start (Vanilla)
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
import { NAuthClient } from '@nauth-toolkit/client';
|
|
29
|
+
|
|
30
|
+
const auth = new NAuthClient({
|
|
31
|
+
baseUrl: 'https://api.example.com/auth',
|
|
32
|
+
tokenDelivery: 'hybrid',
|
|
33
|
+
onSessionExpired: () => window.location.replace('/login')
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const result = await auth.login('user@example.com', 'password');
|
|
37
|
+
if (result.challengeName) {
|
|
38
|
+
// Prompt user to complete challenge then call respondToChallenge()
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Quick Start (Angular)
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// app.config.ts (standalone)
|
|
46
|
+
import { provideHttpClient, withInterceptors } from '@angular/common/http';
|
|
47
|
+
import { authInterceptor, NAUTH_CLIENT_CONFIG } from '@nauth-toolkit/client/angular';
|
|
48
|
+
|
|
49
|
+
providers: [
|
|
50
|
+
{ provide: NAUTH_CLIENT_CONFIG, useValue: {
|
|
51
|
+
baseUrl: 'https://api.example.com/auth',
|
|
52
|
+
tokenDelivery: 'cookies',
|
|
53
|
+
onSessionExpired: () => router.navigate(['/login'])
|
|
54
|
+
}},
|
|
55
|
+
provideHttpClient(withInterceptors([authInterceptor]))
|
|
56
|
+
]
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Configuration
|
|
60
|
+
|
|
61
|
+
- `baseUrl` (required): Auth API base (e.g., `https://api.example.com/auth`)
|
|
62
|
+
- `tokenDelivery`: `json` | `cookies` | `hybrid`
|
|
63
|
+
- `onSessionExpired` (required): Callback when refresh fails
|
|
64
|
+
- `storage`: Custom storage adapter for JSON/hybrid mobile (defaults to localStorage or in-memory)
|
|
65
|
+
- `csrf`: `{ cookieName, headerName }` (defaults: `nauth_csrf_token`, `x-csrf-token`)
|
|
66
|
+
- `deviceTrust`: `{ headerName, storageKey }` (defaults: `X-Device-Token`, `nauth_device_token`)
|
|
67
|
+
- `endpoints`: Override backend paths if different from defaults
|
|
68
|
+
|
|
69
|
+
## Token Delivery
|
|
70
|
+
|
|
71
|
+
- **json**: Stores tokens via storage adapter, sends Bearer header.
|
|
72
|
+
- **cookies**: Sends credentials; SDK never sends Bearer; CSRF header added automatically.
|
|
73
|
+
- **hybrid**: Browser path behaves like cookies; non-browser behaves like json.
|
|
74
|
+
|
|
75
|
+
## Storage Adapters
|
|
76
|
+
|
|
77
|
+
- `BrowserStorage` (localStorage/sessionStorage)
|
|
78
|
+
- `InMemoryStorage` (SSR/tests)
|
|
79
|
+
- Provide your own (e.g., Capacitor Preferences or React Native AsyncStorage).
|
|
80
|
+
|
|
81
|
+
## Error Handling
|
|
82
|
+
|
|
83
|
+
All errors are `NAuthClientError` with `code` from `NAuthErrorCode` enum and optional `details`.
|
|
84
|
+
|
|
85
|
+
## Scripts
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
yarn workspace @nauth-toolkit/client build
|
|
89
|
+
yarn workspace @nauth-toolkit/client lint
|
|
90
|
+
yarn workspace @nauth-toolkit/client test
|
|
91
|
+
```
|
|
92
|
+
|