@atzentis/auth-sdk 0.0.2 → 0.0.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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -0
  3. package/package.json +17 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Atzentis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,86 @@
1
+ # @atzentis/auth-sdk
2
+
3
+ Zero-dependency TypeScript client for [Atzentis Authentication](https://auth.atzentis.com).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @atzentis/auth-sdk
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import { AuthClient } from "@atzentis/auth-sdk";
15
+
16
+ const auth = new AuthClient({
17
+ baseUrl: "https://auth.atzentis.com",
18
+ apiKey: "atz_live_xxxxx",
19
+ autoRefreshToken: true,
20
+ });
21
+
22
+ // Login
23
+ const { user } = await auth.login({ email: "user@example.com", password: "password123" });
24
+
25
+ // Get current session
26
+ const session = await auth.getSession();
27
+
28
+ // Logout
29
+ await auth.logout();
30
+ ```
31
+
32
+ ## Features
33
+
34
+ - Zero dependencies, works in any JS/TS environment
35
+ - Built-in retry with exponential backoff
36
+ - Rate limit handling with automatic queuing
37
+ - Typed error hierarchy (`AuthenticationError`, `NetworkError`, `RateLimitError`, etc.)
38
+ - Device signal collection for security fingerprinting
39
+ - Pluggable token storage (localStorage, memory, or custom)
40
+ - Request/response interceptors
41
+
42
+ ## HTTP Client
43
+
44
+ The SDK includes a standalone HTTP client with interceptors:
45
+
46
+ ```typescript
47
+ import { HttpClient, createAuthInterceptor } from "@atzentis/auth-sdk";
48
+
49
+ const client = new HttpClient({
50
+ baseUrl: "https://auth.atzentis.com",
51
+ timeout: 30000,
52
+ retry: { maxRetries: 3 },
53
+ });
54
+
55
+ // Add auth header injection
56
+ client.addRequestInterceptor(createAuthInterceptor({ getToken: () => token }));
57
+ ```
58
+
59
+ ## Error Handling
60
+
61
+ All API errors are typed:
62
+
63
+ ```typescript
64
+ import { AuthenticationError, RateLimitError, NetworkError } from "@atzentis/auth-sdk";
65
+
66
+ try {
67
+ await auth.login({ email, password });
68
+ } catch (error) {
69
+ if (error instanceof AuthenticationError) {
70
+ // Invalid credentials (401)
71
+ } else if (error instanceof RateLimitError) {
72
+ // Too many requests — error.retryAfter has the wait time
73
+ } else if (error instanceof NetworkError) {
74
+ // Connection failed
75
+ }
76
+ }
77
+ ```
78
+
79
+ ## Framework Bindings
80
+
81
+ - **React**: [`@atzentis/auth-react`](https://www.npmjs.com/package/@atzentis/auth-react) - hooks and components
82
+ - **Expo**: [`@atzentis/auth-expo`](https://www.npmjs.com/package/@atzentis/auth-expo) - native device signals and secure storage
83
+
84
+ ## License
85
+
86
+ MIT
package/package.json CHANGED
@@ -1,6 +1,22 @@
1
1
  {
2
2
  "name": "@atzentis/auth-sdk",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
+ "description": "Atzentis Auth SDK — zero-dependency TypeScript client for auth.atzentis.com",
5
+ "keywords": [
6
+ "atzentis",
7
+ "auth",
8
+ "sdk",
9
+ "authentication",
10
+ "typescript"
11
+ ],
12
+ "license": "MIT",
13
+ "author": "Atzentis <dev@atzentis.com> (https://atzentis.com)",
14
+ "homepage": "https://github.com/atzentis/atzentis-auth-sdk/tree/main/packages/core#readme",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/atzentis/atzentis-auth-sdk.git",
18
+ "directory": "packages/core"
19
+ },
4
20
  "type": "module",
5
21
  "main": "./dist/index.js",
6
22
  "types": "./dist/index.d.ts",