@glinr/theauth 0.4.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.
- package/LICENSE +21 -0
- package/README.md +202 -0
- package/dist/a2a/index.d.ts +2341 -0
- package/dist/a2a/index.js +826 -0
- package/dist/a2a/index.js.map +1 -0
- package/dist/agent/index.d.ts +32 -0
- package/dist/agent/index.js +795 -0
- package/dist/agent/index.js.map +1 -0
- package/dist/audit/index.d.ts +24 -0
- package/dist/audit/index.js +641 -0
- package/dist/audit/index.js.map +1 -0
- package/dist/auth/index.d.ts +3466 -0
- package/dist/auth/index.js +16139 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/crypto/index.d.ts +55 -0
- package/dist/crypto/index.js +186 -0
- package/dist/crypto/index.js.map +1 -0
- package/dist/index.d.ts +1711 -0
- package/dist/index.js +23160 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/index.d.ts +274 -0
- package/dist/mcp/index.js +1262 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/permission/index.d.ts +89 -0
- package/dist/permission/index.js +801 -0
- package/dist/permission/index.js.map +1 -0
- 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/standards/index.d.ts +139 -0
- package/dist/standards/index.js +72 -0
- package/dist/standards/index.js.map +1 -0
- package/dist/types-BiUe9e8u.d.ts +426 -0
- package/dist/types-D1sBnWrs.d.ts +9636 -0
- package/dist/types-RJPOU4un.d.ts +9636 -0
- package/dist/vc/index.d.ts +989 -0
- package/dist/vc/index.js +692 -0
- package/dist/vc/index.js.map +1 -0
- package/package.json +139 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TheAuth
|
|
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,202 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://theauth.com/logo.svg" height="64" alt="TheAuth" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">theauth</h1>
|
|
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>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://www.npmjs.com/package/@glinr/theauth"><img src="https://img.shields.io/npm/v/@glinr/theauth?style=flat-square&color=c9a84c" alt="npm" /></a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/@glinr/theauth"><img src="https://img.shields.io/npm/dm/@glinr/theauth?style=flat-square&color=c9a84c" alt="downloads" /></a>
|
|
15
|
+
<a href="https://github.com/glincker/theauth/actions"><img src="https://img.shields.io/github/actions/workflow/status/glincker/theauth/ci.yml?style=flat-square&label=tests" alt="tests" /></a>
|
|
16
|
+
<a href="https://github.com/glincker/theauth/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.theauth.com"><img src="https://img.shields.io/badge/docs-theauth.com-c9a84c?style=flat-square" alt="docs" /></a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<a href="https://docs.theauth.com/docs/quickstart">Quickstart</a> ·
|
|
23
|
+
<a href="https://docs.theauth.com/docs">Documentation</a> ·
|
|
24
|
+
<a href="https://github.com/glincker/theauth/tree/main/examples">Examples</a> ·
|
|
25
|
+
<a href="https://app.theauth.com">TheAuth Cloud</a>
|
|
26
|
+
</p>
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Why theauth?
|
|
31
|
+
|
|
32
|
+
Every auth library handles human login. None of them handle **AI agent identity**. TheAuth gives every agent its own bearer token, scoped permissions, delegation chains, and an immutable audit trail. Plus full human auth (14 methods, 17 OAuth providers, passkeys, SSO) so you don't need two auth systems.
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
npm install @glinr/theauth
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Quick start
|
|
39
|
+
|
|
40
|
+
```typescript
|
|
41
|
+
import { createKavach } from "@glinr/theauth";
|
|
42
|
+
import { emailPassword } from "@glinr/theauth/auth";
|
|
43
|
+
|
|
44
|
+
const kavach = createKavach({
|
|
45
|
+
database: { provider: "sqlite", url: "kavach.db" },
|
|
46
|
+
plugins: [emailPassword()],
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
// Create an AI agent with scoped permissions
|
|
50
|
+
const agent = await kavach.agent.create({
|
|
51
|
+
ownerId: "user-123",
|
|
52
|
+
name: "github-reader",
|
|
53
|
+
type: "autonomous",
|
|
54
|
+
permissions: [
|
|
55
|
+
{ resource: "mcp:github:*", actions: ["read"] },
|
|
56
|
+
{ resource: "mcp:deploy:production", actions: ["execute"],
|
|
57
|
+
constraints: { requireApproval: true } },
|
|
58
|
+
],
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
// Authorize and audit (< 1ms)
|
|
62
|
+
const result = await kavach.authorize(agent.id, {
|
|
63
|
+
action: "read",
|
|
64
|
+
resource: "mcp:github:repos",
|
|
65
|
+
});
|
|
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 (17 providers)
|
|
104
|
+
Apple, Atlassian, Discord, Dropbox, Figma, GitHub, GitLab, Google, LinkedIn, Microsoft, Notion, Reddit, Slack, Spotify, Twitch, Twitter/X, Zoom, plus a generic OIDC factory for anything else.
|
|
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`.
|
|
125
|
+
|
|
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** | `@glinr/theauth-hono` | **Nuxt** | `@glinr/theauth-nuxt` |
|
|
141
|
+
| **Express** | `@glinr/theauth-express` | **SvelteKit** | `@glinr/theauth-sveltekit` |
|
|
142
|
+
| **Next.js** | `@glinr/theauth-nextjs` | **Astro** | `@glinr/theauth-astro` |
|
|
143
|
+
| **Fastify** | `@glinr/theauth-fastify` | **NestJS** | `@glinr/theauth-nestjs` |
|
|
144
|
+
|
|
145
|
+
## Client libraries
|
|
146
|
+
|
|
147
|
+
| Package | What |
|
|
148
|
+
|---------|------|
|
|
149
|
+
| `@glinr/theauth-react` | KavachProvider + hooks |
|
|
150
|
+
| `@glinr/theauth-vue` | Vue 3 plugin + composables |
|
|
151
|
+
| `@glinr/theauth-svelte` | Svelte stores |
|
|
152
|
+
| `@glinr/theauth-ui` | 7 pre-built auth components (SignIn, SignUp, UserButton...) |
|
|
153
|
+
| `@glinr/theauth-expo` | React Native / Expo |
|
|
154
|
+
| `@glinr/theauth-electron` | Electron desktop |
|
|
155
|
+
| `@glinr/theauth-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 "@glinr/theauth/auth";
|
|
178
|
+
|
|
179
|
+
createKavach({
|
|
180
|
+
database: { provider: "sqlite", url: "kavach.db" },
|
|
181
|
+
plugins: [emailPassword(), magicLink({ sendMagicLink }), passkey(), totp()],
|
|
182
|
+
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## TheAuth Cloud
|
|
186
|
+
|
|
187
|
+
Don't want to self-host? [TheAuth Cloud](https://app.theauth.com) is the managed version with dashboard, billing, and zero infrastructure.
|
|
188
|
+
|
|
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 |
|
|
193
|
+
|
|
194
|
+
[Start free](https://app.theauth.com/sign-up) · [Compare plans](https://theauth.com/pricing) · [Self-host instead](https://docs.theauth.com/docs/quickstart)
|
|
195
|
+
|
|
196
|
+
## Documentation
|
|
197
|
+
|
|
198
|
+
Full docs at **[docs.theauth.com](https://docs.theauth.com/docs)**
|
|
199
|
+
|
|
200
|
+
## License
|
|
201
|
+
|
|
202
|
+
[MIT](https://github.com/glincker/theauth/blob/main/LICENSE)
|