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.
- package/README.md +170 -37
- package/dist/a2a/index.d.ts +2 -1
- package/dist/a2a/index.js +7 -2
- package/dist/a2a/index.js.map +1 -1
- package/dist/agent/index.d.ts +3 -2
- package/dist/agent/index.js +789 -4
- package/dist/agent/index.js.map +1 -1
- package/dist/audit/index.d.ts +2 -1
- package/dist/audit/index.js +635 -3
- package/dist/audit/index.js.map +1 -1
- package/dist/auth/index.d.ts +600 -3
- package/dist/auth/index.js +14668 -4
- package/dist/auth/index.js.map +1 -1
- package/dist/crypto/index.d.ts +55 -0
- package/dist/{chunk-QCRHJMDX.js → crypto/index.js} +2 -2
- package/dist/crypto/index.js.map +1 -0
- package/dist/index.d.ts +251 -58
- package/dist/index.js +16369 -233
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.js +19 -2
- package/dist/mcp/index.js.map +1 -1
- package/dist/permission/index.d.ts +3 -2
- package/dist/permission/index.js +790 -4
- package/dist/permission/index.js.map +1 -1
- package/dist/redirect/index.d.ts +118 -0
- package/dist/redirect/index.js +292 -0
- package/dist/redirect/index.js.map +1 -0
- package/dist/{types-W8X0PXE7.d.ts → types-5Ua5KlPc.d.ts} +222 -124
- package/dist/vc/index.js +542 -3
- package/dist/vc/index.js.map +1 -1
- package/package.json +39 -22
- package/LICENSE +0 -21
- package/dist/chunk-FKVAXCNJ.js +0 -12516
- package/dist/chunk-FKVAXCNJ.js.map +0 -1
- package/dist/chunk-IKTOSJ4O.js +0 -214
- package/dist/chunk-IKTOSJ4O.js.map +0 -1
- package/dist/chunk-KDL6A76K.js +0 -569
- package/dist/chunk-KDL6A76K.js.map +0 -1
- package/dist/chunk-NSBPE2FW.js +0 -15
- package/dist/chunk-NSBPE2FW.js.map +0 -1
- package/dist/chunk-NSTER7KE.js +0 -538
- package/dist/chunk-NSTER7KE.js.map +0 -1
- package/dist/chunk-QCRHJMDX.js.map +0 -1
- package/dist/chunk-VHKZARMM.js +0 -251
- package/dist/chunk-VHKZARMM.js.map +0 -1
- package/dist/chunk-Y3OWAJHK.js +0 -101
- package/dist/chunk-Y3OWAJHK.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,69 +1,202 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://kavachos.com/logo.svg" height="64" alt="KavachOS" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">kavachos</h1>
|
|
4
6
|
|
|
5
|
-
|
|
6
|
-
|
|
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
|
-
|
|
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
|
-
|
|
21
|
+
<p align="center">
|
|
22
|
+
<a href="https://docs.kavachos.com/docs/quickstart">Quickstart</a> ·
|
|
23
|
+
<a href="https://docs.kavachos.com/docs">Documentation</a> ·
|
|
24
|
+
<a href="https://github.com/kavachos/kavachos/tree/main/examples">Examples</a> ·
|
|
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
|
|
41
|
+
import { createKavach } from "kavachos";
|
|
42
|
+
import { emailPassword } from "kavachos/auth";
|
|
20
43
|
|
|
21
44
|
const kavach = createKavach({
|
|
22
|
-
database: { provider:
|
|
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:
|
|
28
|
-
name:
|
|
29
|
-
type:
|
|
51
|
+
ownerId: "user-123",
|
|
52
|
+
name: "github-reader",
|
|
53
|
+
type: "autonomous",
|
|
30
54
|
permissions: [
|
|
31
|
-
{ resource:
|
|
32
|
-
{
|
|
33
|
-
|
|
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
|
|
61
|
+
// Authorize and audit (< 1ms)
|
|
41
62
|
const result = await kavach.authorize(agent.id, {
|
|
42
|
-
action:
|
|
43
|
-
resource:
|
|
63
|
+
action: "read",
|
|
64
|
+
resource: "mcp:github:repos",
|
|
44
65
|
});
|
|
45
|
-
// { allowed: true, auditId:
|
|
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
|
-
|
|
48
|
-
|
|
126
|
+
</td>
|
|
127
|
+
</tr>
|
|
128
|
+
</table>
|
|
129
|
+
|
|
130
|
+
### Security
|
|
131
|
+
|
|
132
|
+
Rate limiting (per-agent and per-IP) · HIBP breach checking · CSRF protection · httpOnly secure cookies · Email enumeration prevention · Trusted device windows · 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
|
-
##
|
|
185
|
+
## KavachOS Cloud
|
|
52
186
|
|
|
53
|
-
|
|
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
|
-
|
|
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/
|
|
194
|
+
[Start free](https://app.kavachos.com/sign-up) · [Compare plans](https://kavachos.com/pricing) · [Self-host instead](https://docs.kavachos.com/docs/quickstart)
|
|
62
195
|
|
|
63
|
-
##
|
|
196
|
+
## Documentation
|
|
64
197
|
|
|
65
|
-
[
|
|
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)
|
package/dist/a2a/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as jose from 'jose';
|
|
2
|
-
import { A as AgentIdentity } from '../types-
|
|
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";
|