@banata-auth/sdk 0.1.0

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Banata Auth Contributors
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,71 @@
1
+ # @banata-auth/sdk
2
+
3
+ Server-side SDK for the Banata Auth platform — manage users, organizations, SSO, RBAC, webhooks, and more.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @banata-auth/sdk
9
+ ```
10
+
11
+ ## Quick start
12
+
13
+ ```ts
14
+ import { BanataAuth } from "@banata-auth/sdk";
15
+
16
+ const banataAuth = new BanataAuth({
17
+ apiKey: "sk_live_...",
18
+ baseUrl: "https://your-convex-site.convex.site",
19
+ });
20
+
21
+ // List users
22
+ const users = await banataAuth.userManagement.listUsers();
23
+
24
+ // Create organization
25
+ const org = await banataAuth.organizations.createOrganization({
26
+ name: "Acme Corp",
27
+ });
28
+
29
+ // Manage webhooks
30
+ const endpoint = await banataAuth.webhooks.createEndpoint({
31
+ url: "https://example.com/webhooks",
32
+ eventTypes: ["user.created"],
33
+ });
34
+
35
+ // Verify webhook signatures
36
+ const event = await banataAuth.webhooks.constructEvent({
37
+ payload: body,
38
+ sigHeader: headers["webhook-signature"],
39
+ secret: webhookSecret,
40
+ });
41
+ ```
42
+
43
+ ## Resources
44
+
45
+ | Resource | Description |
46
+ |----------|-------------|
47
+ | `userManagement` | CRUD users, list sessions, ban/unban |
48
+ | `organizations` | Create/manage organizations and members |
49
+ | `sso` | SSO connection management |
50
+ | `directorySync` | SCIM directory sync |
51
+ | `rbac` | Role-based access control |
52
+ | `apiKeys` | API key lifecycle management |
53
+ | `webhooks` | Webhook endpoints and signature verification |
54
+ | `emails` | Send emails and manage templates (`emails.send()`, `emails.templates.list()`) |
55
+ | `auditLogs` | Audit event creation and querying |
56
+ | `events` | Event streaming |
57
+ | `portal` | Admin portal link generation |
58
+ | `vault` | Secret storage |
59
+ | `domains` | Domain verification |
60
+ | `projects` | Multi-tenant project management |
61
+
62
+ ## Features
63
+
64
+ - Automatic retry with exponential backoff (5xx and 429)
65
+ - `Retry-After` header support for rate limiting
66
+ - Typed error classes (`AuthenticationError`, `RateLimitError`, etc.)
67
+ - Configurable timeout and retry count
68
+
69
+ ## License
70
+
71
+ MIT