kavachos 0.0.6 → 0.1.1

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 (47) hide show
  1. package/README.md +170 -37
  2. package/dist/a2a/index.d.ts +2 -1
  3. package/dist/a2a/index.js +7 -2
  4. package/dist/a2a/index.js.map +1 -1
  5. package/dist/agent/index.d.ts +3 -2
  6. package/dist/agent/index.js +789 -4
  7. package/dist/agent/index.js.map +1 -1
  8. package/dist/audit/index.d.ts +2 -1
  9. package/dist/audit/index.js +635 -3
  10. package/dist/audit/index.js.map +1 -1
  11. package/dist/auth/index.d.ts +600 -3
  12. package/dist/auth/index.js +14668 -4
  13. package/dist/auth/index.js.map +1 -1
  14. package/dist/crypto/index.d.ts +55 -0
  15. package/dist/{chunk-QCRHJMDX.js → crypto/index.js} +2 -2
  16. package/dist/crypto/index.js.map +1 -0
  17. package/dist/index.d.ts +251 -58
  18. package/dist/index.js +16369 -233
  19. package/dist/index.js.map +1 -1
  20. package/dist/mcp/index.js +19 -2
  21. package/dist/mcp/index.js.map +1 -1
  22. package/dist/permission/index.d.ts +3 -2
  23. package/dist/permission/index.js +790 -4
  24. package/dist/permission/index.js.map +1 -1
  25. package/dist/redirect/index.d.ts +118 -0
  26. package/dist/redirect/index.js +292 -0
  27. package/dist/redirect/index.js.map +1 -0
  28. package/dist/{types-W8X0PXE7.d.ts → types-5Ua5KlPc.d.ts} +222 -124
  29. package/dist/vc/index.js +542 -3
  30. package/dist/vc/index.js.map +1 -1
  31. package/package.json +39 -22
  32. package/LICENSE +0 -21
  33. package/dist/chunk-FKVAXCNJ.js +0 -12516
  34. package/dist/chunk-FKVAXCNJ.js.map +0 -1
  35. package/dist/chunk-IKTOSJ4O.js +0 -214
  36. package/dist/chunk-IKTOSJ4O.js.map +0 -1
  37. package/dist/chunk-KDL6A76K.js +0 -569
  38. package/dist/chunk-KDL6A76K.js.map +0 -1
  39. package/dist/chunk-NSBPE2FW.js +0 -15
  40. package/dist/chunk-NSBPE2FW.js.map +0 -1
  41. package/dist/chunk-NSTER7KE.js +0 -538
  42. package/dist/chunk-NSTER7KE.js.map +0 -1
  43. package/dist/chunk-QCRHJMDX.js.map +0 -1
  44. package/dist/chunk-VHKZARMM.js +0 -251
  45. package/dist/chunk-VHKZARMM.js.map +0 -1
  46. package/dist/chunk-Y3OWAJHK.js +0 -101
  47. package/dist/chunk-Y3OWAJHK.js.map +0 -1
package/README.md CHANGED
@@ -1,69 +1,202 @@
1
- # kavachos
1
+ <p align="center">
2
+ <img src="https://kavachos.com/logo.svg" height="64" alt="KavachOS" />
3
+ </p>
2
4
 
3
- Auth OS for AI agents. Identity, permissions, delegation, and audit.
5
+ <h1 align="center">kavachos</h1>
4
6
 
5
- [![npm](https://img.shields.io/npm/v/kavachos)](https://www.npmjs.com/package/kavachos)
6
- [![license](https://img.shields.io/badge/license-MIT-blue)](https://github.com/kavachos/kavachos/blob/main/LICENSE)
7
+ <p align="center">
8
+ <strong>The auth OS for AI agents and humans</strong><br />
9
+ Identity, permissions, delegation, and audit for the agentic era.
10
+ </p>
7
11
 
8
- ## Install
12
+ <p align="center">
13
+ <a href="https://www.npmjs.com/package/kavachos"><img src="https://img.shields.io/npm/v/kavachos?style=flat-square&color=c9a84c" alt="npm" /></a>
14
+ <a href="https://www.npmjs.com/package/kavachos"><img src="https://img.shields.io/npm/dm/kavachos?style=flat-square&color=c9a84c" alt="downloads" /></a>
15
+ <a href="https://github.com/kavachos/kavachos/actions"><img src="https://img.shields.io/github/actions/workflow/status/kavachos/kavachos/ci.yml?style=flat-square&label=tests" alt="tests" /></a>
16
+ <a href="https://github.com/kavachos/kavachos/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="MIT" /></a>
17
+ <a href="https://www.typescriptlang.org/"><img src="https://img.shields.io/badge/TypeScript-strict-blue?style=flat-square" alt="TypeScript" /></a>
18
+ <a href="https://docs.kavachos.com"><img src="https://img.shields.io/badge/docs-kavachos.com-c9a84c?style=flat-square" alt="docs" /></a>
19
+ </p>
9
20
 
10
- ```bash
21
+ <p align="center">
22
+ <a href="https://docs.kavachos.com/docs/quickstart">Quickstart</a> &middot;
23
+ <a href="https://docs.kavachos.com/docs">Documentation</a> &middot;
24
+ <a href="https://github.com/kavachos/kavachos/tree/main/examples">Examples</a> &middot;
25
+ <a href="https://app.kavachos.com">KavachOS Cloud</a>
26
+ </p>
27
+
28
+ ---
29
+
30
+ ## Why kavachos?
31
+
32
+ Every auth library handles human login. None of them handle **AI agent identity**. KavachOS gives every agent its own bearer token, scoped permissions, delegation chains, and an immutable audit trail. Plus full human auth (14 methods, 27+ OAuth providers, passkeys, SSO) so you don't need two auth systems.
33
+
34
+ ```
11
35
  npm install kavachos
12
- # or
13
- pnpm add kavachos
14
36
  ```
15
37
 
16
38
  ## Quick start
17
39
 
18
40
  ```typescript
19
- import { createKavach } from 'kavachos';
41
+ import { createKavach } from "kavachos";
42
+ import { emailPassword } from "kavachos/auth";
20
43
 
21
44
  const kavach = createKavach({
22
- database: { provider: 'sqlite', url: 'kavach.db' },
45
+ database: { provider: "sqlite", url: "kavach.db" },
46
+ plugins: [emailPassword()],
23
47
  });
24
48
 
25
- // Create an agent with scoped permissions
49
+ // Create an AI agent with scoped permissions
26
50
  const agent = await kavach.agent.create({
27
- ownerId: 'user-123',
28
- name: 'github-reader',
29
- type: 'autonomous',
51
+ ownerId: "user-123",
52
+ name: "github-reader",
53
+ type: "autonomous",
30
54
  permissions: [
31
- { resource: 'mcp:github:*', actions: ['read'] },
32
- {
33
- resource: 'mcp:deploy:production',
34
- actions: ['execute'],
35
- constraints: { requireApproval: true },
36
- },
55
+ { resource: "mcp:github:*", actions: ["read"] },
56
+ { resource: "mcp:deploy:production", actions: ["execute"],
57
+ constraints: { requireApproval: true } },
37
58
  ],
38
59
  });
39
60
 
40
- // Authorize an action
61
+ // Authorize and audit (< 1ms)
41
62
  const result = await kavach.authorize(agent.id, {
42
- action: 'read',
43
- resource: 'mcp:github:repos',
63
+ action: "read",
64
+ resource: "mcp:github:repos",
44
65
  });
45
- // { allowed: true, auditId: 'aud_...' }
66
+ // { allowed: true, auditId: "aud_..." }
67
+ ```
68
+
69
+ ## Features
70
+
71
+ <table>
72
+ <tr>
73
+ <td width="50%">
74
+
75
+ ### Agent identity
76
+ - Cryptographic bearer tokens (`kv_...`)
77
+ - Wildcard permission matching (`mcp:github:*`)
78
+ - Delegation chains with depth limits
79
+ - Immutable audit trail
80
+ - Trust scoring and anomaly detection
81
+ - Budget policies and cost attribution
82
+ - CIBA-style human approval flows
83
+
84
+ </td>
85
+ <td width="50%">
86
+
87
+ ### Human auth (14 methods)
88
+ - Email + password
89
+ - Magic link, email OTP
90
+ - Passkey / WebAuthn
91
+ - TOTP 2FA
92
+ - Phone SMS
93
+ - Google One-tap
94
+ - Sign In With Ethereum
95
+ - Anonymous auth
96
+ - Session freshness enforcement
97
+
98
+ </td>
99
+ </tr>
100
+ <tr>
101
+ <td>
102
+
103
+ ### OAuth (27+ providers)
104
+ Google, GitHub, Apple, Microsoft, Discord, Slack, GitLab, LinkedIn, Twitter/X, Facebook, Spotify, Twitch, Reddit, Notion, plus a generic OIDC factory for any provider.
105
+
106
+ </td>
107
+ <td>
108
+
109
+ ### MCP OAuth 2.1
110
+ Spec-compliant authorization server for Model Context Protocol. PKCE S256, RFC 9728 / 8707 / 8414 / 7591.
111
+
112
+ </td>
113
+ </tr>
114
+ <tr>
115
+ <td>
116
+
117
+ ### Enterprise
118
+ Organizations + RBAC, SAML SSO, SCIM directory sync, admin controls, API key management, multi-tenant isolation, GDPR compliance.
119
+
120
+ </td>
121
+ <td>
122
+
123
+ ### Edge compatible
124
+ Runs on Cloudflare Workers (D1), Deno, Bun, and Node.js. Only 3 runtime deps: `drizzle-orm`, `jose`, `zod`.
46
125
 
47
- // Query the audit trail
48
- const logs = await kavach.audit.query({ agentId: agent.id });
126
+ </td>
127
+ </tr>
128
+ </table>
129
+
130
+ ### Security
131
+
132
+ Rate limiting (per-agent and per-IP) &middot; HIBP breach checking &middot; CSRF protection &middot; httpOnly secure cookies &middot; Email enumeration prevention &middot; Trusted device windows &middot; Password reset with signed tokens
133
+
134
+ ## Framework adapters
135
+
136
+ Works with every major framework:
137
+
138
+ | Framework | Package | Framework | Package |
139
+ |-----------|---------|-----------|---------|
140
+ | **Hono** | `@kavachos/hono` | **Nuxt** | `@kavachos/nuxt` |
141
+ | **Express** | `@kavachos/express` | **SvelteKit** | `@kavachos/sveltekit` |
142
+ | **Next.js** | `@kavachos/nextjs` | **Astro** | `@kavachos/astro` |
143
+ | **Fastify** | `@kavachos/fastify` | **NestJS** | `@kavachos/nestjs` |
144
+
145
+ ## Client libraries
146
+
147
+ | Package | What |
148
+ |---------|------|
149
+ | `@kavachos/react` | KavachProvider + hooks |
150
+ | `@kavachos/vue` | Vue 3 plugin + composables |
151
+ | `@kavachos/svelte` | Svelte stores |
152
+ | `@kavachos/ui` | 7 pre-built auth components (SignIn, SignUp, UserButton...) |
153
+ | `@kavachos/expo` | React Native / Expo |
154
+ | `@kavachos/electron` | Electron desktop |
155
+ | `@kavachos/client` | Zero-dep TypeScript REST client |
156
+
157
+ ## Databases
158
+
159
+ SQLite, PostgreSQL, MySQL, Cloudflare D1, libSQL (Turso). Tables are auto-created on first run.
160
+
161
+ ```typescript
162
+ // Cloudflare Workers + D1
163
+ createKavach({ database: { provider: "d1", binding: env.KAVACH_DB } });
164
+
165
+ // PostgreSQL
166
+ createKavach({ database: { provider: "postgres", url: process.env.DATABASE_URL } });
167
+ ```
168
+
169
+ ## Plugins
170
+
171
+ Auth methods are plugins. Enable what you need:
172
+
173
+ ```typescript
174
+ import {
175
+ emailPassword, magicLink, passkey, totp,
176
+ organizations, sso, admin, apiKeys, webhooks,
177
+ } from "kavachos/auth";
178
+
179
+ createKavach({
180
+ database: { provider: "sqlite", url: "kavach.db" },
181
+ plugins: [emailPassword(), magicLink({ sendMagicLink }), passkey(), totp()],
182
+ });
49
183
  ```
50
184
 
51
- ## What's included
185
+ ## KavachOS Cloud
52
186
 
53
- - **Agent identity** - create, scope, revoke, and rotate agent credentials. Each agent gets an opaque bearer token (`kv_...`) and a permanent audit identity.
54
- - **Permission engine** - resource-based access control with colon-separated hierarchies (`mcp:github:*`) and wildcard matching. Constraints support rate limits, time windows, and human-in-the-loop approval gates.
55
- - **Delegation chains** - an orchestrator can delegate a subset of its permissions to a sub-agent, with depth limits and expiry. Chains are auditable and revocable at any point.
56
- - **Audit trail** - every authorization decision is written to an immutable log. Export as JSON or CSV for EU AI Act Article 12, SOC 2 CC6.1-CC7.2, and ISO 42001 compliance.
57
- - **MCP OAuth 2.1** - spec-compliant authorization server for the Model Context Protocol, with PKCE (S256), Protected Resource Metadata (RFC 9728), and Resource Indicators (RFC 8707).
187
+ Don't want to self-host? [KavachOS Cloud](https://app.kavachos.com) is the managed version with dashboard, billing, and zero infrastructure.
58
188
 
59
- ## Full docs
189
+ | | Free | Starter | Growth | Scale |
190
+ |---|---|---|---|---|
191
+ | MAU | 1,000 | 10,000 | 50,000 | 200,000 |
192
+ | Price | $0 | $29/mo | $79/mo | $199/mo |
60
193
 
61
- [kavachos.com/docs](https://kavachos.com/docs)
194
+ [Start free](https://app.kavachos.com/sign-up) &middot; [Compare plans](https://kavachos.com/pricing) &middot; [Self-host instead](https://docs.kavachos.com/docs/quickstart)
62
195
 
63
- ## Source
196
+ ## Documentation
64
197
 
65
- [github.com/kavachos/kavachos](https://github.com/kavachos/kavachos)
198
+ Full docs at **[docs.kavachos.com](https://docs.kavachos.com/docs)**
66
199
 
67
200
  ## License
68
201
 
69
- MIT
202
+ [MIT](https://github.com/kavachos/kavachos/blob/main/LICENSE)
@@ -1,8 +1,9 @@
1
1
  import * as jose from 'jose';
2
- import { A as AgentIdentity } from '../types-W8X0PXE7.js';
2
+ import { A as AgentIdentity } from '../types-5Ua5KlPc.js';
3
3
  import { z } from 'zod';
4
4
  import { R as Result } from '../types-BuHrZcjE.js';
5
5
  import 'drizzle-orm/sqlite-core';
6
+ import '../redirect/index.js';
6
7
 
7
8
  /**
8
9
  * A2A (Agent-to-Agent) protocol types for KavachOS.
package/dist/a2a/index.js CHANGED
@@ -1,8 +1,13 @@
1
- import { generateId } from '../chunk-QCRHJMDX.js';
2
- import '../chunk-NSBPE2FW.js';
3
1
  import * as jose from 'jose';
4
2
  import { z } from 'zod';
5
3
 
4
+ // src/a2a/agent-card.ts
5
+
6
+ // src/crypto/web-crypto.ts
7
+ function generateId() {
8
+ return globalThis.crypto.randomUUID();
9
+ }
10
+ new TextEncoder();
6
11
  var A2A_PROTOCOL_VERSION = "0.3";
7
12
  var A2A_JSONRPC_VERSION = "2.0";
8
13
  var A2A_WELL_KNOWN_PATH = "/.well-known/agent.json";