@glinr/theauth 0.5.0 → 0.6.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/README.md +54 -20
- package/dist/a2a/index.d.ts +3 -3
- package/dist/a2a/index.js.map +1 -1
- package/dist/agent/index.d.ts +3 -3
- package/dist/agent/index.js +48 -48
- package/dist/agent/index.js.map +1 -1
- package/dist/audit/index.d.ts +2 -2
- package/dist/audit/index.js +48 -48
- package/dist/audit/index.js.map +1 -1
- package/dist/auth/index.d.ts +71 -51
- package/dist/auth/index.js +1156 -241
- package/dist/auth/index.js.map +1 -1
- package/dist/index.d.ts +1204 -1224
- package/dist/index.js +4467 -3520
- package/dist/index.js.map +1 -1
- package/dist/mcp/index.d.ts +2 -2
- package/dist/mcp/index.js.map +1 -1
- package/dist/permission/index.d.ts +3 -3
- package/dist/permission/index.js +51 -50
- package/dist/permission/index.js.map +1 -1
- package/dist/redirect/index.d.ts +1 -1
- package/dist/redirect/index.js +1 -1
- package/dist/redirect/index.js.map +1 -1
- package/dist/standards/index.d.ts +1 -1
- package/dist/standards/index.js.map +1 -1
- package/dist/{types-D1dTo8-m.d.ts → types-JOx1R8-Q.d.ts} +494 -499
- package/dist/{types-IkWVkOVv.d.ts → types-XoCxTUZj.d.ts} +2 -6
- package/dist/vc/index.d.ts +6 -12
- package/dist/vc/index.js +4 -7
- package/dist/vc/index.js.map +1 -1
- package/package.json +10 -4
package/dist/audit/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { eq, gte, lte, desc, and, lt } from 'drizzle-orm';
|
|
|
2
2
|
import { sqliteTable, integer, text } from 'drizzle-orm/sqlite-core';
|
|
3
3
|
|
|
4
4
|
// src/audit/audit.ts
|
|
5
|
-
var users = sqliteTable("
|
|
5
|
+
var users = sqliteTable("theauth_users", {
|
|
6
6
|
id: text("id").primaryKey(),
|
|
7
7
|
email: text("email").notNull().unique(),
|
|
8
8
|
name: text("name"),
|
|
@@ -18,14 +18,14 @@ var users = sqliteTable("kavach_users", {
|
|
|
18
18
|
banExpiresAt: integer("ban_expires_at", { mode: "timestamp" }),
|
|
19
19
|
forcePasswordReset: integer("force_password_reset").notNull().default(0),
|
|
20
20
|
emailVerified: integer("email_verified").notNull().default(0),
|
|
21
|
-
// Stripe integration fields (populated by
|
|
21
|
+
// Stripe integration fields (populated by theauth-stripe plugin)
|
|
22
22
|
stripeCustomerId: text("stripe_customer_id").unique(),
|
|
23
23
|
stripeSubscriptionId: text("stripe_subscription_id"),
|
|
24
24
|
stripeSubscriptionStatus: text("stripe_subscription_status"),
|
|
25
25
|
stripePriceId: text("stripe_price_id"),
|
|
26
26
|
stripeCurrentPeriodEnd: integer("stripe_current_period_end", { mode: "timestamp" }),
|
|
27
27
|
stripeCancelAtPeriodEnd: integer("stripe_cancel_at_period_end", { mode: "boolean" }).notNull().default(false),
|
|
28
|
-
// Polar integration fields (populated by
|
|
28
|
+
// Polar integration fields (populated by theauth-polar plugin)
|
|
29
29
|
polarCustomerId: text("polar_customer_id").unique(),
|
|
30
30
|
polarSubscriptionId: text("polar_subscription_id"),
|
|
31
31
|
polarSubscriptionStatus: text("polar_subscription_status"),
|
|
@@ -35,7 +35,7 @@ var users = sqliteTable("kavach_users", {
|
|
|
35
35
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
36
36
|
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
37
37
|
});
|
|
38
|
-
var tenants = sqliteTable("
|
|
38
|
+
var tenants = sqliteTable("theauth_tenants", {
|
|
39
39
|
id: text("id").primaryKey(),
|
|
40
40
|
name: text("name").notNull(),
|
|
41
41
|
slug: text("slug").notNull().unique(),
|
|
@@ -44,7 +44,7 @@ var tenants = sqliteTable("kavach_tenants", {
|
|
|
44
44
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
45
45
|
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
46
46
|
});
|
|
47
|
-
var agents = sqliteTable("
|
|
47
|
+
var agents = sqliteTable("theauth_agents", {
|
|
48
48
|
id: text("id").primaryKey(),
|
|
49
49
|
ownerId: text("owner_id").notNull().references(() => users.id),
|
|
50
50
|
tenantId: text("tenant_id").references(() => tenants.id),
|
|
@@ -62,7 +62,7 @@ var agents = sqliteTable("kavach_agents", {
|
|
|
62
62
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
63
63
|
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
64
64
|
});
|
|
65
|
-
sqliteTable("
|
|
65
|
+
sqliteTable("theauth_permissions", {
|
|
66
66
|
id: text("id").primaryKey(),
|
|
67
67
|
agentId: text("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
|
|
68
68
|
resource: text("resource").notNull(),
|
|
@@ -74,7 +74,7 @@ sqliteTable("kavach_permissions", {
|
|
|
74
74
|
relation: text("relation"),
|
|
75
75
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
76
76
|
});
|
|
77
|
-
sqliteTable("
|
|
77
|
+
sqliteTable("theauth_delegation_chains", {
|
|
78
78
|
id: text("id").primaryKey(),
|
|
79
79
|
fromAgentId: text("from_agent_id").notNull().references(() => agents.id),
|
|
80
80
|
toAgentId: text("to_agent_id").notNull().references(() => agents.id),
|
|
@@ -85,7 +85,7 @@ sqliteTable("kavach_delegation_chains", {
|
|
|
85
85
|
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
|
|
86
86
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
87
87
|
});
|
|
88
|
-
var auditLogs = sqliteTable("
|
|
88
|
+
var auditLogs = sqliteTable("theauth_audit_logs", {
|
|
89
89
|
id: text("id").primaryKey(),
|
|
90
90
|
agentId: text("agent_id").notNull().references(() => agents.id),
|
|
91
91
|
userId: text("user_id").notNull().references(() => users.id),
|
|
@@ -105,14 +105,14 @@ var auditLogs = sqliteTable("kavach_audit_logs", {
|
|
|
105
105
|
cacheHit: integer("cache_hit", { mode: "boolean" }).notNull().default(false),
|
|
106
106
|
timestamp: integer("timestamp", { mode: "timestamp" }).notNull()
|
|
107
107
|
});
|
|
108
|
-
sqliteTable("
|
|
108
|
+
sqliteTable("theauth_rate_limits", {
|
|
109
109
|
id: text("id").primaryKey(),
|
|
110
110
|
agentId: text("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
|
|
111
111
|
resource: text("resource").notNull(),
|
|
112
112
|
windowStart: integer("window_start", { mode: "timestamp" }).notNull(),
|
|
113
113
|
count: integer("count").notNull().default(0)
|
|
114
114
|
});
|
|
115
|
-
sqliteTable("
|
|
115
|
+
sqliteTable("theauth_mcp_servers", {
|
|
116
116
|
id: text("id").primaryKey(),
|
|
117
117
|
name: text("name").notNull(),
|
|
118
118
|
endpoint: text("endpoint").notNull().unique(),
|
|
@@ -123,14 +123,14 @@ sqliteTable("kavach_mcp_servers", {
|
|
|
123
123
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
124
124
|
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
125
125
|
});
|
|
126
|
-
sqliteTable("
|
|
126
|
+
sqliteTable("theauth_sessions", {
|
|
127
127
|
id: text("id").primaryKey(),
|
|
128
128
|
userId: text("user_id").notNull().references(() => users.id),
|
|
129
129
|
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
|
|
130
130
|
metadata: text("metadata", { mode: "json" }).$type(),
|
|
131
131
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
132
132
|
});
|
|
133
|
-
var oauthClients = sqliteTable("
|
|
133
|
+
var oauthClients = sqliteTable("theauth_oauth_clients", {
|
|
134
134
|
id: text("id").primaryKey(),
|
|
135
135
|
clientId: text("client_id").notNull().unique(),
|
|
136
136
|
clientSecret: text("client_secret"),
|
|
@@ -147,7 +147,7 @@ var oauthClients = sqliteTable("kavach_oauth_clients", {
|
|
|
147
147
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
148
148
|
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
149
149
|
});
|
|
150
|
-
sqliteTable("
|
|
150
|
+
sqliteTable("theauth_oauth_access_tokens", {
|
|
151
151
|
id: text("id").primaryKey(),
|
|
152
152
|
accessToken: text("access_token").notNull().unique(),
|
|
153
153
|
refreshToken: text("refresh_token").unique(),
|
|
@@ -161,7 +161,7 @@ sqliteTable("kavach_oauth_access_tokens", {
|
|
|
161
161
|
refreshTokenExpiresAt: integer("refresh_token_expires_at", { mode: "timestamp" }),
|
|
162
162
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
163
163
|
});
|
|
164
|
-
sqliteTable("
|
|
164
|
+
sqliteTable("theauth_oauth_authorization_codes", {
|
|
165
165
|
id: text("id").primaryKey(),
|
|
166
166
|
code: text("code").notNull().unique(),
|
|
167
167
|
clientId: text("client_id").notNull().references(() => oauthClients.clientId),
|
|
@@ -177,7 +177,7 @@ sqliteTable("kavach_oauth_authorization_codes", {
|
|
|
177
177
|
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
|
|
178
178
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
179
179
|
});
|
|
180
|
-
sqliteTable("
|
|
180
|
+
sqliteTable("theauth_budget_policies", {
|
|
181
181
|
id: text("id").primaryKey(),
|
|
182
182
|
agentId: text("agent_id").references(() => agents.id, { onDelete: "cascade" }),
|
|
183
183
|
// nullable
|
|
@@ -191,7 +191,7 @@ sqliteTable("kavach_budget_policies", {
|
|
|
191
191
|
status: text("status", { enum: ["active", "triggered", "disabled"] }).notNull().default("active"),
|
|
192
192
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
193
193
|
});
|
|
194
|
-
sqliteTable("
|
|
194
|
+
sqliteTable("theauth_agent_cards", {
|
|
195
195
|
id: text("id").primaryKey(),
|
|
196
196
|
agentId: text("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
|
|
197
197
|
name: text("name").notNull(),
|
|
@@ -205,7 +205,7 @@ sqliteTable("kavach_agent_cards", {
|
|
|
205
205
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
206
206
|
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
207
207
|
});
|
|
208
|
-
sqliteTable("
|
|
208
|
+
sqliteTable("theauth_approval_requests", {
|
|
209
209
|
id: text("id").primaryKey(),
|
|
210
210
|
agentId: text("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
|
|
211
211
|
userId: text("user_id").notNull().references(() => users.id),
|
|
@@ -218,7 +218,7 @@ sqliteTable("kavach_approval_requests", {
|
|
|
218
218
|
respondedBy: text("responded_by"),
|
|
219
219
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
220
220
|
});
|
|
221
|
-
sqliteTable("
|
|
221
|
+
sqliteTable("theauth_trust_scores", {
|
|
222
222
|
agentId: text("agent_id").primaryKey().references(() => agents.id, { onDelete: "cascade" }),
|
|
223
223
|
score: integer("score").notNull(),
|
|
224
224
|
level: text("level", {
|
|
@@ -227,7 +227,7 @@ sqliteTable("kavach_trust_scores", {
|
|
|
227
227
|
factors: text("factors", { mode: "json" }).notNull().$type(),
|
|
228
228
|
computedAt: integer("computed_at", { mode: "timestamp" }).notNull()
|
|
229
229
|
});
|
|
230
|
-
sqliteTable("
|
|
230
|
+
sqliteTable("theauth_magic_links", {
|
|
231
231
|
id: text("id").primaryKey(),
|
|
232
232
|
email: text("email").notNull(),
|
|
233
233
|
token: text("token").notNull().unique(),
|
|
@@ -235,7 +235,7 @@ sqliteTable("kavach_magic_links", {
|
|
|
235
235
|
used: integer("used", { mode: "boolean" }).notNull().default(false),
|
|
236
236
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
237
237
|
});
|
|
238
|
-
sqliteTable("
|
|
238
|
+
sqliteTable("theauth_email_otps", {
|
|
239
239
|
id: text("id").primaryKey(),
|
|
240
240
|
email: text("email").notNull(),
|
|
241
241
|
codeHash: text("code_hash").notNull(),
|
|
@@ -243,7 +243,7 @@ sqliteTable("kavach_email_otps", {
|
|
|
243
243
|
attempts: integer("attempts").notNull().default(0),
|
|
244
244
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
245
245
|
});
|
|
246
|
-
sqliteTable("
|
|
246
|
+
sqliteTable("theauth_totp", {
|
|
247
247
|
userId: text("user_id").primaryKey().references(() => users.id),
|
|
248
248
|
secret: text("secret").notNull(),
|
|
249
249
|
// base32-encoded TOTP secret
|
|
@@ -252,7 +252,7 @@ sqliteTable("kavach_totp", {
|
|
|
252
252
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
253
253
|
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
254
254
|
});
|
|
255
|
-
var organizations = sqliteTable("
|
|
255
|
+
var organizations = sqliteTable("theauth_organizations", {
|
|
256
256
|
id: text("id").primaryKey(),
|
|
257
257
|
name: text("name").notNull(),
|
|
258
258
|
slug: text("slug").notNull().unique(),
|
|
@@ -261,14 +261,14 @@ var organizations = sqliteTable("kavach_organizations", {
|
|
|
261
261
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
262
262
|
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
263
263
|
});
|
|
264
|
-
sqliteTable("
|
|
264
|
+
sqliteTable("theauth_org_members", {
|
|
265
265
|
id: text("id").primaryKey(),
|
|
266
266
|
orgId: text("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
267
267
|
userId: text("user_id").notNull().references(() => users.id),
|
|
268
268
|
role: text("role").notNull().default("member"),
|
|
269
269
|
joinedAt: integer("joined_at", { mode: "timestamp" }).notNull()
|
|
270
270
|
});
|
|
271
|
-
sqliteTable("
|
|
271
|
+
sqliteTable("theauth_org_invitations", {
|
|
272
272
|
id: text("id").primaryKey(),
|
|
273
273
|
orgId: text("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
274
274
|
email: text("email").notNull(),
|
|
@@ -278,13 +278,13 @@ sqliteTable("kavach_org_invitations", {
|
|
|
278
278
|
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
|
|
279
279
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
280
280
|
});
|
|
281
|
-
sqliteTable("
|
|
281
|
+
sqliteTable("theauth_org_roles", {
|
|
282
282
|
id: text("id").primaryKey(),
|
|
283
283
|
orgId: text("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
|
|
284
284
|
name: text("name").notNull(),
|
|
285
285
|
permissions: text("permissions", { mode: "json" }).notNull().$type()
|
|
286
286
|
});
|
|
287
|
-
sqliteTable("
|
|
287
|
+
sqliteTable("theauth_passkey_credentials", {
|
|
288
288
|
id: text("id").primaryKey(),
|
|
289
289
|
userId: text("user_id").notNull().references(() => users.id),
|
|
290
290
|
credentialId: text("credential_id").notNull().unique(),
|
|
@@ -297,7 +297,7 @@ sqliteTable("kavach_passkey_credentials", {
|
|
|
297
297
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
298
298
|
lastUsedAt: integer("last_used_at", { mode: "timestamp" }).notNull()
|
|
299
299
|
});
|
|
300
|
-
sqliteTable("
|
|
300
|
+
sqliteTable("theauth_sso_connections", {
|
|
301
301
|
id: text("id").primaryKey(),
|
|
302
302
|
orgId: text("org_id").notNull(),
|
|
303
303
|
providerId: text("provider_id").notNull(),
|
|
@@ -306,7 +306,7 @@ sqliteTable("kavach_sso_connections", {
|
|
|
306
306
|
enabled: integer("enabled").notNull().default(1),
|
|
307
307
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
308
308
|
});
|
|
309
|
-
sqliteTable("
|
|
309
|
+
sqliteTable("theauth_api_keys", {
|
|
310
310
|
id: text("id").primaryKey(),
|
|
311
311
|
userId: text("user_id").notNull().references(() => users.id),
|
|
312
312
|
name: text("name").notNull(),
|
|
@@ -317,7 +317,7 @@ sqliteTable("kavach_api_keys", {
|
|
|
317
317
|
lastUsedAt: integer("last_used_at", { mode: "timestamp" }),
|
|
318
318
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
319
319
|
});
|
|
320
|
-
sqliteTable("
|
|
320
|
+
sqliteTable("theauth_passkey_challenges", {
|
|
321
321
|
id: text("id").primaryKey(),
|
|
322
322
|
challenge: text("challenge").notNull().unique(),
|
|
323
323
|
userId: text("user_id"),
|
|
@@ -326,7 +326,7 @@ sqliteTable("kavach_passkey_challenges", {
|
|
|
326
326
|
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
|
|
327
327
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
328
328
|
});
|
|
329
|
-
sqliteTable("
|
|
329
|
+
sqliteTable("theauth_username_accounts", {
|
|
330
330
|
id: text("id").primaryKey(),
|
|
331
331
|
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
332
332
|
username: text("username").notNull().unique(),
|
|
@@ -334,7 +334,7 @@ sqliteTable("kavach_username_accounts", {
|
|
|
334
334
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
335
335
|
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
336
336
|
});
|
|
337
|
-
sqliteTable("
|
|
337
|
+
sqliteTable("theauth_phone_verifications", {
|
|
338
338
|
id: text("id").primaryKey(),
|
|
339
339
|
phoneNumber: text("phone_number").notNull(),
|
|
340
340
|
codeHash: text("code_hash").notNull(),
|
|
@@ -342,7 +342,7 @@ sqliteTable("kavach_phone_verifications", {
|
|
|
342
342
|
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
|
|
343
343
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
344
344
|
});
|
|
345
|
-
sqliteTable("
|
|
345
|
+
sqliteTable("theauth_trusted_devices", {
|
|
346
346
|
id: text("id").primaryKey(),
|
|
347
347
|
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
348
348
|
fingerprint: text("fingerprint").notNull(),
|
|
@@ -352,7 +352,7 @@ sqliteTable("kavach_trusted_devices", {
|
|
|
352
352
|
trustedAt: integer("trusted_at", { mode: "timestamp" }).notNull(),
|
|
353
353
|
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull()
|
|
354
354
|
});
|
|
355
|
-
sqliteTable("
|
|
355
|
+
sqliteTable("theauth_one_time_tokens", {
|
|
356
356
|
id: text("id").primaryKey(),
|
|
357
357
|
tokenHash: text("token_hash").notNull().unique(),
|
|
358
358
|
// SHA-256 hex of the raw token
|
|
@@ -366,7 +366,7 @@ sqliteTable("kavach_one_time_tokens", {
|
|
|
366
366
|
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
|
|
367
367
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
368
368
|
});
|
|
369
|
-
sqliteTable("
|
|
369
|
+
sqliteTable("theauth_login_history", {
|
|
370
370
|
id: text("id").primaryKey(),
|
|
371
371
|
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
372
372
|
method: text("method").notNull(),
|
|
@@ -375,7 +375,7 @@ sqliteTable("kavach_login_history", {
|
|
|
375
375
|
userAgent: text("user_agent"),
|
|
376
376
|
timestamp: integer("timestamp", { mode: "timestamp_ms" }).notNull()
|
|
377
377
|
});
|
|
378
|
-
sqliteTable("
|
|
378
|
+
sqliteTable("theauth_agent_dids", {
|
|
379
379
|
agentId: text("agent_id").primaryKey().references(() => agents.id, { onDelete: "cascade" }),
|
|
380
380
|
did: text("did").notNull().unique(),
|
|
381
381
|
method: text("method", { enum: ["key", "web"] }).notNull(),
|
|
@@ -385,7 +385,7 @@ sqliteTable("kavach_agent_dids", {
|
|
|
385
385
|
// JSON-serialised DID Document
|
|
386
386
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
387
387
|
});
|
|
388
|
-
sqliteTable("
|
|
388
|
+
sqliteTable("theauth_oidc_clients", {
|
|
389
389
|
id: text("id").primaryKey(),
|
|
390
390
|
clientId: text("client_id").notNull().unique(),
|
|
391
391
|
clientSecretHash: text("client_secret_hash").notNull(),
|
|
@@ -399,7 +399,7 @@ sqliteTable("kavach_oidc_clients", {
|
|
|
399
399
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
400
400
|
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
401
401
|
});
|
|
402
|
-
sqliteTable("
|
|
402
|
+
sqliteTable("theauth_oidc_auth_codes", {
|
|
403
403
|
id: text("id").primaryKey(),
|
|
404
404
|
codeHash: text("code_hash").notNull().unique(),
|
|
405
405
|
// SHA-256 hex of the raw code
|
|
@@ -416,7 +416,7 @@ sqliteTable("kavach_oidc_auth_codes", {
|
|
|
416
416
|
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
|
|
417
417
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
418
418
|
});
|
|
419
|
-
sqliteTable("
|
|
419
|
+
sqliteTable("theauth_oidc_refresh_tokens", {
|
|
420
420
|
id: text("id").primaryKey(),
|
|
421
421
|
tokenHash: text("token_hash").notNull().unique(),
|
|
422
422
|
// SHA-256 hex of the raw token
|
|
@@ -428,7 +428,7 @@ sqliteTable("kavach_oidc_refresh_tokens", {
|
|
|
428
428
|
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
|
|
429
429
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
430
430
|
});
|
|
431
|
-
sqliteTable("
|
|
431
|
+
sqliteTable("theauth_cost_events", {
|
|
432
432
|
id: text("id").primaryKey(),
|
|
433
433
|
agentId: text("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
|
|
434
434
|
tool: text("tool").notNull(),
|
|
@@ -443,7 +443,7 @@ sqliteTable("kavach_cost_events", {
|
|
|
443
443
|
// null when not part of a chain
|
|
444
444
|
recordedAt: integer("recorded_at", { mode: "timestamp" }).notNull()
|
|
445
445
|
});
|
|
446
|
-
sqliteTable("
|
|
446
|
+
sqliteTable("theauth_ephemeral_sessions", {
|
|
447
447
|
id: text("id").primaryKey(),
|
|
448
448
|
agentId: text("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
|
|
449
449
|
ownerId: text("owner_id").notNull().references(() => users.id),
|
|
@@ -457,7 +457,7 @@ sqliteTable("kavach_ephemeral_sessions", {
|
|
|
457
457
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
458
458
|
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
459
459
|
});
|
|
460
|
-
sqliteTable("
|
|
460
|
+
sqliteTable("theauth_stream_events", {
|
|
461
461
|
id: text("id").primaryKey(),
|
|
462
462
|
type: text("type").notNull(),
|
|
463
463
|
timestamp: integer("timestamp", { mode: "timestamp" }).notNull(),
|
|
@@ -465,7 +465,7 @@ sqliteTable("kavach_stream_events", {
|
|
|
465
465
|
agentId: text("agent_id"),
|
|
466
466
|
userId: text("user_id")
|
|
467
467
|
});
|
|
468
|
-
sqliteTable("
|
|
468
|
+
sqliteTable("theauth_jwt_refresh_tokens", {
|
|
469
469
|
id: text("id").primaryKey(),
|
|
470
470
|
/** SHA-256 hex of the raw refresh token. The raw token is never stored. */
|
|
471
471
|
tokenHash: text("token_hash").notNull().unique(),
|
|
@@ -476,7 +476,7 @@ sqliteTable("kavach_jwt_refresh_tokens", {
|
|
|
476
476
|
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
|
|
477
477
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
478
478
|
});
|
|
479
|
-
sqliteTable("
|
|
479
|
+
sqliteTable("theauth_rebac_resources", {
|
|
480
480
|
id: text("id").notNull().primaryKey(),
|
|
481
481
|
type: text("type").notNull(),
|
|
482
482
|
// 'org', 'workspace', 'project', 'document', etc.
|
|
@@ -484,7 +484,7 @@ sqliteTable("kavach_rebac_resources", {
|
|
|
484
484
|
parentType: text("parent_type"),
|
|
485
485
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
486
486
|
});
|
|
487
|
-
sqliteTable("
|
|
487
|
+
sqliteTable("theauth_rebac_relationships", {
|
|
488
488
|
id: text("id").primaryKey(),
|
|
489
489
|
subjectType: text("subject_type").notNull(),
|
|
490
490
|
// 'user', 'agent', 'team', 'role'
|
|
@@ -495,7 +495,7 @@ sqliteTable("kavach_rebac_relationships", {
|
|
|
495
495
|
objectId: text("object_id").notNull(),
|
|
496
496
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
497
497
|
});
|
|
498
|
-
sqliteTable("
|
|
498
|
+
sqliteTable("theauth_federation_instances", {
|
|
499
499
|
id: text("id").primaryKey(),
|
|
500
500
|
instanceId: text("instance_id").notNull().unique(),
|
|
501
501
|
instanceUrl: text("instance_url").notNull(),
|
|
@@ -506,7 +506,7 @@ sqliteTable("kavach_federation_instances", {
|
|
|
506
506
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
|
|
507
507
|
updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
|
|
508
508
|
});
|
|
509
|
-
sqliteTable("
|
|
509
|
+
sqliteTable("theauth_federation_tokens", {
|
|
510
510
|
id: text("id").primaryKey(),
|
|
511
511
|
tokenJti: text("token_jti").notNull().unique(),
|
|
512
512
|
// JWT ID for dedup
|
|
@@ -520,7 +520,7 @@ sqliteTable("kavach_federation_tokens", {
|
|
|
520
520
|
expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
|
|
521
521
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
522
522
|
});
|
|
523
|
-
var refreshTokenFamilies = sqliteTable("
|
|
523
|
+
var refreshTokenFamilies = sqliteTable("theauth_refresh_token_families", {
|
|
524
524
|
id: text("id").primaryKey(),
|
|
525
525
|
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
526
526
|
/** Absolute session expiry — no rotation can extend beyond this date. */
|
|
@@ -529,7 +529,7 @@ var refreshTokenFamilies = sqliteTable("kavach_refresh_token_families", {
|
|
|
529
529
|
revoked: integer("revoked").notNull().default(0),
|
|
530
530
|
createdAt: integer("created_at", { mode: "timestamp" }).notNull()
|
|
531
531
|
});
|
|
532
|
-
sqliteTable("
|
|
532
|
+
sqliteTable("theauth_refresh_tokens", {
|
|
533
533
|
id: text("id").primaryKey(),
|
|
534
534
|
familyId: text("family_id").notNull().references(() => refreshTokenFamilies.id, { onDelete: "cascade" }),
|
|
535
535
|
/** SHA-256 hash of the opaque token — never store the raw token. */
|