@nauth-toolkit/client 0.2.0 → 0.2.2

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.
Files changed (2) hide show
  1. package/README.md +48 -4
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -4,14 +4,58 @@ Framework-agnostic frontend SDK for [nauth-toolkit](https://nauth.dev).
4
4
 
5
5
  Handles authentication flows from the browser — signup, login, token refresh, MFA, social OAuth, session management. Works with React, Vue, Svelte, or any TypeScript/JavaScript frontend. Ships as both CJS and ESM.
6
6
 
7
+ **[Documentation](https://nauth.dev/docs/frontend-sdk)** · **[GitHub](https://github.com/noorixorg/nauth)**
8
+
9
+ > Part of [nauth-toolkit](https://www.npmjs.com/package/@nauth-toolkit/core). Works with any nauth-toolkit backend.
10
+
11
+ ---
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install @nauth-toolkit/client
17
+ ```
18
+
19
+ ## Quick start
20
+
21
+ ```typescript
22
+ import { NAuthClient } from '@nauth-toolkit/client';
23
+
24
+ const auth = new NAuthClient({
25
+ baseUrl: 'https://api.example.com/auth',
26
+ });
27
+
28
+ // Sign up
29
+ await auth.signup({ email: 'user@example.com', password: 'securePass1!' });
30
+
31
+ // Log in
32
+ const result = await auth.login({ email: 'user@example.com', password: 'securePass1!' });
33
+
34
+ // Get current user
35
+ const user = auth.getUser();
36
+
37
+ // Listen for auth state changes
38
+ auth.on('authStateChanged', (user) => {
39
+ console.log('Auth state:', user);
40
+ });
41
+ ```
42
+
7
43
  ## What's included
8
44
 
9
- - **AuthClient** — typed API client for all nauth-toolkit endpoints
10
- - **Token management** — automatic silent refresh, storage abstraction
45
+ - **NAuthClient** — typed API client for all nauth-toolkit endpoints
46
+ - **Token management** — automatic silent refresh, pluggable storage (browser or in-memory)
11
47
  - **MFA flows** — TOTP enrollment, SMS/email verification, passkey registration and authentication
12
48
  - **Social OAuth** — redirect and popup flows for Google, Apple, Facebook
13
49
  - **Session management** — list sessions, revoke sessions, device info
50
+ - **Challenge router** — automatic multi-step flow handling (MFA challenges, email verification)
51
+ - **Admin operations** — user management for admin-scoped tokens
52
+
53
+ ---
54
+
55
+ ## Angular
56
+
57
+ For Angular apps, use [`@nauth-toolkit/client-angular`](https://www.npmjs.com/package/@nauth-toolkit/client-angular) which wraps this SDK with Angular services, guards, and HTTP interceptors.
14
58
 
15
- For Angular, use [`@nauth-toolkit/client-angular`](https://www.npmjs.com/package/@nauth-toolkit/client-angular) which builds on this SDK with Angular-specific services and DI.
59
+ ---
16
60
 
17
- **Docs:** [nauth.dev](https://nauth.dev) · **Examples:** [github.com/noorixorg/nauth](https://github.com/noorixorg/nauth) · **Live demo:** [demo.nauth.dev](https://demo.nauth.dev)
61
+ Free to use. See [license](https://nauth.dev/docs/license).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nauth-toolkit/client",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Frontend authentication SDK for nauth-toolkit — framework-agnostic TypeScript",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",