@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.
@@ -44,7 +44,7 @@ async function sha256(data) {
44
44
  const digest = await globalThis.crypto.subtle.digest("SHA-256", toBytes(data));
45
45
  return toHex(new Uint8Array(digest));
46
46
  }
47
- var users = sqliteTable("kavach_users", {
47
+ var users = sqliteTable("theauth_users", {
48
48
  id: text("id").primaryKey(),
49
49
  email: text("email").notNull().unique(),
50
50
  name: text("name"),
@@ -60,14 +60,14 @@ var users = sqliteTable("kavach_users", {
60
60
  banExpiresAt: integer("ban_expires_at", { mode: "timestamp" }),
61
61
  forcePasswordReset: integer("force_password_reset").notNull().default(0),
62
62
  emailVerified: integer("email_verified").notNull().default(0),
63
- // Stripe integration fields (populated by kavach-stripe plugin)
63
+ // Stripe integration fields (populated by theauth-stripe plugin)
64
64
  stripeCustomerId: text("stripe_customer_id").unique(),
65
65
  stripeSubscriptionId: text("stripe_subscription_id"),
66
66
  stripeSubscriptionStatus: text("stripe_subscription_status"),
67
67
  stripePriceId: text("stripe_price_id"),
68
68
  stripeCurrentPeriodEnd: integer("stripe_current_period_end", { mode: "timestamp" }),
69
69
  stripeCancelAtPeriodEnd: integer("stripe_cancel_at_period_end", { mode: "boolean" }).notNull().default(false),
70
- // Polar integration fields (populated by kavach-polar plugin)
70
+ // Polar integration fields (populated by theauth-polar plugin)
71
71
  polarCustomerId: text("polar_customer_id").unique(),
72
72
  polarSubscriptionId: text("polar_subscription_id"),
73
73
  polarSubscriptionStatus: text("polar_subscription_status"),
@@ -77,7 +77,7 @@ var users = sqliteTable("kavach_users", {
77
77
  createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
78
78
  updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
79
79
  });
80
- var tenants = sqliteTable("kavach_tenants", {
80
+ var tenants = sqliteTable("theauth_tenants", {
81
81
  id: text("id").primaryKey(),
82
82
  name: text("name").notNull(),
83
83
  slug: text("slug").notNull().unique(),
@@ -86,7 +86,7 @@ var tenants = sqliteTable("kavach_tenants", {
86
86
  createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
87
87
  updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
88
88
  });
89
- var agents = sqliteTable("kavach_agents", {
89
+ var agents = sqliteTable("theauth_agents", {
90
90
  id: text("id").primaryKey(),
91
91
  ownerId: text("owner_id").notNull().references(() => users.id),
92
92
  tenantId: text("tenant_id").references(() => tenants.id),
@@ -104,7 +104,7 @@ var agents = sqliteTable("kavach_agents", {
104
104
  createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
105
105
  updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
106
106
  });
107
- var permissions = sqliteTable("kavach_permissions", {
107
+ var permissions = sqliteTable("theauth_permissions", {
108
108
  id: text("id").primaryKey(),
109
109
  agentId: text("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
110
110
  resource: text("resource").notNull(),
@@ -116,7 +116,7 @@ var permissions = sqliteTable("kavach_permissions", {
116
116
  relation: text("relation"),
117
117
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
118
118
  });
119
- sqliteTable("kavach_delegation_chains", {
119
+ sqliteTable("theauth_delegation_chains", {
120
120
  id: text("id").primaryKey(),
121
121
  fromAgentId: text("from_agent_id").notNull().references(() => agents.id),
122
122
  toAgentId: text("to_agent_id").notNull().references(() => agents.id),
@@ -127,7 +127,7 @@ sqliteTable("kavach_delegation_chains", {
127
127
  expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
128
128
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
129
129
  });
130
- sqliteTable("kavach_audit_logs", {
130
+ sqliteTable("theauth_audit_logs", {
131
131
  id: text("id").primaryKey(),
132
132
  agentId: text("agent_id").notNull().references(() => agents.id),
133
133
  userId: text("user_id").notNull().references(() => users.id),
@@ -147,14 +147,14 @@ sqliteTable("kavach_audit_logs", {
147
147
  cacheHit: integer("cache_hit", { mode: "boolean" }).notNull().default(false),
148
148
  timestamp: integer("timestamp", { mode: "timestamp" }).notNull()
149
149
  });
150
- sqliteTable("kavach_rate_limits", {
150
+ sqliteTable("theauth_rate_limits", {
151
151
  id: text("id").primaryKey(),
152
152
  agentId: text("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
153
153
  resource: text("resource").notNull(),
154
154
  windowStart: integer("window_start", { mode: "timestamp" }).notNull(),
155
155
  count: integer("count").notNull().default(0)
156
156
  });
157
- sqliteTable("kavach_mcp_servers", {
157
+ sqliteTable("theauth_mcp_servers", {
158
158
  id: text("id").primaryKey(),
159
159
  name: text("name").notNull(),
160
160
  endpoint: text("endpoint").notNull().unique(),
@@ -165,14 +165,14 @@ sqliteTable("kavach_mcp_servers", {
165
165
  createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
166
166
  updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
167
167
  });
168
- sqliteTable("kavach_sessions", {
168
+ sqliteTable("theauth_sessions", {
169
169
  id: text("id").primaryKey(),
170
170
  userId: text("user_id").notNull().references(() => users.id),
171
171
  expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
172
172
  metadata: text("metadata", { mode: "json" }).$type(),
173
173
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
174
174
  });
175
- var oauthClients = sqliteTable("kavach_oauth_clients", {
175
+ var oauthClients = sqliteTable("theauth_oauth_clients", {
176
176
  id: text("id").primaryKey(),
177
177
  clientId: text("client_id").notNull().unique(),
178
178
  clientSecret: text("client_secret"),
@@ -189,7 +189,7 @@ var oauthClients = sqliteTable("kavach_oauth_clients", {
189
189
  createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
190
190
  updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
191
191
  });
192
- sqliteTable("kavach_oauth_access_tokens", {
192
+ sqliteTable("theauth_oauth_access_tokens", {
193
193
  id: text("id").primaryKey(),
194
194
  accessToken: text("access_token").notNull().unique(),
195
195
  refreshToken: text("refresh_token").unique(),
@@ -203,7 +203,7 @@ sqliteTable("kavach_oauth_access_tokens", {
203
203
  refreshTokenExpiresAt: integer("refresh_token_expires_at", { mode: "timestamp" }),
204
204
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
205
205
  });
206
- sqliteTable("kavach_oauth_authorization_codes", {
206
+ sqliteTable("theauth_oauth_authorization_codes", {
207
207
  id: text("id").primaryKey(),
208
208
  code: text("code").notNull().unique(),
209
209
  clientId: text("client_id").notNull().references(() => oauthClients.clientId),
@@ -219,7 +219,7 @@ sqliteTable("kavach_oauth_authorization_codes", {
219
219
  expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
220
220
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
221
221
  });
222
- sqliteTable("kavach_budget_policies", {
222
+ sqliteTable("theauth_budget_policies", {
223
223
  id: text("id").primaryKey(),
224
224
  agentId: text("agent_id").references(() => agents.id, { onDelete: "cascade" }),
225
225
  // nullable
@@ -233,7 +233,7 @@ sqliteTable("kavach_budget_policies", {
233
233
  status: text("status", { enum: ["active", "triggered", "disabled"] }).notNull().default("active"),
234
234
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
235
235
  });
236
- sqliteTable("kavach_agent_cards", {
236
+ sqliteTable("theauth_agent_cards", {
237
237
  id: text("id").primaryKey(),
238
238
  agentId: text("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
239
239
  name: text("name").notNull(),
@@ -247,7 +247,7 @@ sqliteTable("kavach_agent_cards", {
247
247
  createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
248
248
  updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
249
249
  });
250
- sqliteTable("kavach_approval_requests", {
250
+ sqliteTable("theauth_approval_requests", {
251
251
  id: text("id").primaryKey(),
252
252
  agentId: text("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
253
253
  userId: text("user_id").notNull().references(() => users.id),
@@ -260,7 +260,7 @@ sqliteTable("kavach_approval_requests", {
260
260
  respondedBy: text("responded_by"),
261
261
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
262
262
  });
263
- sqliteTable("kavach_trust_scores", {
263
+ sqliteTable("theauth_trust_scores", {
264
264
  agentId: text("agent_id").primaryKey().references(() => agents.id, { onDelete: "cascade" }),
265
265
  score: integer("score").notNull(),
266
266
  level: text("level", {
@@ -269,7 +269,7 @@ sqliteTable("kavach_trust_scores", {
269
269
  factors: text("factors", { mode: "json" }).notNull().$type(),
270
270
  computedAt: integer("computed_at", { mode: "timestamp" }).notNull()
271
271
  });
272
- sqliteTable("kavach_magic_links", {
272
+ sqliteTable("theauth_magic_links", {
273
273
  id: text("id").primaryKey(),
274
274
  email: text("email").notNull(),
275
275
  token: text("token").notNull().unique(),
@@ -277,7 +277,7 @@ sqliteTable("kavach_magic_links", {
277
277
  used: integer("used", { mode: "boolean" }).notNull().default(false),
278
278
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
279
279
  });
280
- sqliteTable("kavach_email_otps", {
280
+ sqliteTable("theauth_email_otps", {
281
281
  id: text("id").primaryKey(),
282
282
  email: text("email").notNull(),
283
283
  codeHash: text("code_hash").notNull(),
@@ -285,7 +285,7 @@ sqliteTable("kavach_email_otps", {
285
285
  attempts: integer("attempts").notNull().default(0),
286
286
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
287
287
  });
288
- sqliteTable("kavach_totp", {
288
+ sqliteTable("theauth_totp", {
289
289
  userId: text("user_id").primaryKey().references(() => users.id),
290
290
  secret: text("secret").notNull(),
291
291
  // base32-encoded TOTP secret
@@ -294,7 +294,7 @@ sqliteTable("kavach_totp", {
294
294
  createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
295
295
  updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
296
296
  });
297
- var organizations = sqliteTable("kavach_organizations", {
297
+ var organizations = sqliteTable("theauth_organizations", {
298
298
  id: text("id").primaryKey(),
299
299
  name: text("name").notNull(),
300
300
  slug: text("slug").notNull().unique(),
@@ -303,14 +303,14 @@ var organizations = sqliteTable("kavach_organizations", {
303
303
  createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
304
304
  updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
305
305
  });
306
- sqliteTable("kavach_org_members", {
306
+ sqliteTable("theauth_org_members", {
307
307
  id: text("id").primaryKey(),
308
308
  orgId: text("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
309
309
  userId: text("user_id").notNull().references(() => users.id),
310
310
  role: text("role").notNull().default("member"),
311
311
  joinedAt: integer("joined_at", { mode: "timestamp" }).notNull()
312
312
  });
313
- sqliteTable("kavach_org_invitations", {
313
+ sqliteTable("theauth_org_invitations", {
314
314
  id: text("id").primaryKey(),
315
315
  orgId: text("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
316
316
  email: text("email").notNull(),
@@ -320,13 +320,13 @@ sqliteTable("kavach_org_invitations", {
320
320
  expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
321
321
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
322
322
  });
323
- sqliteTable("kavach_org_roles", {
323
+ sqliteTable("theauth_org_roles", {
324
324
  id: text("id").primaryKey(),
325
325
  orgId: text("org_id").notNull().references(() => organizations.id, { onDelete: "cascade" }),
326
326
  name: text("name").notNull(),
327
327
  permissions: text("permissions", { mode: "json" }).notNull().$type()
328
328
  });
329
- sqliteTable("kavach_passkey_credentials", {
329
+ sqliteTable("theauth_passkey_credentials", {
330
330
  id: text("id").primaryKey(),
331
331
  userId: text("user_id").notNull().references(() => users.id),
332
332
  credentialId: text("credential_id").notNull().unique(),
@@ -339,7 +339,7 @@ sqliteTable("kavach_passkey_credentials", {
339
339
  createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
340
340
  lastUsedAt: integer("last_used_at", { mode: "timestamp" }).notNull()
341
341
  });
342
- sqliteTable("kavach_sso_connections", {
342
+ sqliteTable("theauth_sso_connections", {
343
343
  id: text("id").primaryKey(),
344
344
  orgId: text("org_id").notNull(),
345
345
  providerId: text("provider_id").notNull(),
@@ -348,7 +348,7 @@ sqliteTable("kavach_sso_connections", {
348
348
  enabled: integer("enabled").notNull().default(1),
349
349
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
350
350
  });
351
- sqliteTable("kavach_api_keys", {
351
+ sqliteTable("theauth_api_keys", {
352
352
  id: text("id").primaryKey(),
353
353
  userId: text("user_id").notNull().references(() => users.id),
354
354
  name: text("name").notNull(),
@@ -359,7 +359,7 @@ sqliteTable("kavach_api_keys", {
359
359
  lastUsedAt: integer("last_used_at", { mode: "timestamp" }),
360
360
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
361
361
  });
362
- sqliteTable("kavach_passkey_challenges", {
362
+ sqliteTable("theauth_passkey_challenges", {
363
363
  id: text("id").primaryKey(),
364
364
  challenge: text("challenge").notNull().unique(),
365
365
  userId: text("user_id"),
@@ -368,7 +368,7 @@ sqliteTable("kavach_passkey_challenges", {
368
368
  expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
369
369
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
370
370
  });
371
- sqliteTable("kavach_username_accounts", {
371
+ sqliteTable("theauth_username_accounts", {
372
372
  id: text("id").primaryKey(),
373
373
  userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
374
374
  username: text("username").notNull().unique(),
@@ -376,7 +376,7 @@ sqliteTable("kavach_username_accounts", {
376
376
  createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
377
377
  updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
378
378
  });
379
- sqliteTable("kavach_phone_verifications", {
379
+ sqliteTable("theauth_phone_verifications", {
380
380
  id: text("id").primaryKey(),
381
381
  phoneNumber: text("phone_number").notNull(),
382
382
  codeHash: text("code_hash").notNull(),
@@ -384,7 +384,7 @@ sqliteTable("kavach_phone_verifications", {
384
384
  expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
385
385
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
386
386
  });
387
- sqliteTable("kavach_trusted_devices", {
387
+ sqliteTable("theauth_trusted_devices", {
388
388
  id: text("id").primaryKey(),
389
389
  userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
390
390
  fingerprint: text("fingerprint").notNull(),
@@ -394,7 +394,7 @@ sqliteTable("kavach_trusted_devices", {
394
394
  trustedAt: integer("trusted_at", { mode: "timestamp" }).notNull(),
395
395
  expiresAt: integer("expires_at", { mode: "timestamp" }).notNull()
396
396
  });
397
- sqliteTable("kavach_one_time_tokens", {
397
+ sqliteTable("theauth_one_time_tokens", {
398
398
  id: text("id").primaryKey(),
399
399
  tokenHash: text("token_hash").notNull().unique(),
400
400
  // SHA-256 hex of the raw token
@@ -408,7 +408,7 @@ sqliteTable("kavach_one_time_tokens", {
408
408
  expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
409
409
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
410
410
  });
411
- sqliteTable("kavach_login_history", {
411
+ sqliteTable("theauth_login_history", {
412
412
  id: text("id").primaryKey(),
413
413
  userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
414
414
  method: text("method").notNull(),
@@ -417,7 +417,7 @@ sqliteTable("kavach_login_history", {
417
417
  userAgent: text("user_agent"),
418
418
  timestamp: integer("timestamp", { mode: "timestamp_ms" }).notNull()
419
419
  });
420
- sqliteTable("kavach_agent_dids", {
420
+ sqliteTable("theauth_agent_dids", {
421
421
  agentId: text("agent_id").primaryKey().references(() => agents.id, { onDelete: "cascade" }),
422
422
  did: text("did").notNull().unique(),
423
423
  method: text("method", { enum: ["key", "web"] }).notNull(),
@@ -427,7 +427,7 @@ sqliteTable("kavach_agent_dids", {
427
427
  // JSON-serialised DID Document
428
428
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
429
429
  });
430
- sqliteTable("kavach_oidc_clients", {
430
+ sqliteTable("theauth_oidc_clients", {
431
431
  id: text("id").primaryKey(),
432
432
  clientId: text("client_id").notNull().unique(),
433
433
  clientSecretHash: text("client_secret_hash").notNull(),
@@ -441,7 +441,7 @@ sqliteTable("kavach_oidc_clients", {
441
441
  createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
442
442
  updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
443
443
  });
444
- sqliteTable("kavach_oidc_auth_codes", {
444
+ sqliteTable("theauth_oidc_auth_codes", {
445
445
  id: text("id").primaryKey(),
446
446
  codeHash: text("code_hash").notNull().unique(),
447
447
  // SHA-256 hex of the raw code
@@ -458,7 +458,7 @@ sqliteTable("kavach_oidc_auth_codes", {
458
458
  expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
459
459
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
460
460
  });
461
- sqliteTable("kavach_oidc_refresh_tokens", {
461
+ sqliteTable("theauth_oidc_refresh_tokens", {
462
462
  id: text("id").primaryKey(),
463
463
  tokenHash: text("token_hash").notNull().unique(),
464
464
  // SHA-256 hex of the raw token
@@ -470,7 +470,7 @@ sqliteTable("kavach_oidc_refresh_tokens", {
470
470
  expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
471
471
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
472
472
  });
473
- sqliteTable("kavach_cost_events", {
473
+ sqliteTable("theauth_cost_events", {
474
474
  id: text("id").primaryKey(),
475
475
  agentId: text("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
476
476
  tool: text("tool").notNull(),
@@ -485,7 +485,7 @@ sqliteTable("kavach_cost_events", {
485
485
  // null when not part of a chain
486
486
  recordedAt: integer("recorded_at", { mode: "timestamp" }).notNull()
487
487
  });
488
- sqliteTable("kavach_ephemeral_sessions", {
488
+ sqliteTable("theauth_ephemeral_sessions", {
489
489
  id: text("id").primaryKey(),
490
490
  agentId: text("agent_id").notNull().references(() => agents.id, { onDelete: "cascade" }),
491
491
  ownerId: text("owner_id").notNull().references(() => users.id),
@@ -499,7 +499,7 @@ sqliteTable("kavach_ephemeral_sessions", {
499
499
  createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
500
500
  updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
501
501
  });
502
- sqliteTable("kavach_stream_events", {
502
+ sqliteTable("theauth_stream_events", {
503
503
  id: text("id").primaryKey(),
504
504
  type: text("type").notNull(),
505
505
  timestamp: integer("timestamp", { mode: "timestamp" }).notNull(),
@@ -507,7 +507,7 @@ sqliteTable("kavach_stream_events", {
507
507
  agentId: text("agent_id"),
508
508
  userId: text("user_id")
509
509
  });
510
- sqliteTable("kavach_jwt_refresh_tokens", {
510
+ sqliteTable("theauth_jwt_refresh_tokens", {
511
511
  id: text("id").primaryKey(),
512
512
  /** SHA-256 hex of the raw refresh token. The raw token is never stored. */
513
513
  tokenHash: text("token_hash").notNull().unique(),
@@ -518,7 +518,7 @@ sqliteTable("kavach_jwt_refresh_tokens", {
518
518
  expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
519
519
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
520
520
  });
521
- sqliteTable("kavach_rebac_resources", {
521
+ sqliteTable("theauth_rebac_resources", {
522
522
  id: text("id").notNull().primaryKey(),
523
523
  type: text("type").notNull(),
524
524
  // 'org', 'workspace', 'project', 'document', etc.
@@ -526,7 +526,7 @@ sqliteTable("kavach_rebac_resources", {
526
526
  parentType: text("parent_type"),
527
527
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
528
528
  });
529
- sqliteTable("kavach_rebac_relationships", {
529
+ sqliteTable("theauth_rebac_relationships", {
530
530
  id: text("id").primaryKey(),
531
531
  subjectType: text("subject_type").notNull(),
532
532
  // 'user', 'agent', 'team', 'role'
@@ -537,7 +537,7 @@ sqliteTable("kavach_rebac_relationships", {
537
537
  objectId: text("object_id").notNull(),
538
538
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
539
539
  });
540
- sqliteTable("kavach_federation_instances", {
540
+ sqliteTable("theauth_federation_instances", {
541
541
  id: text("id").primaryKey(),
542
542
  instanceId: text("instance_id").notNull().unique(),
543
543
  instanceUrl: text("instance_url").notNull(),
@@ -548,7 +548,7 @@ sqliteTable("kavach_federation_instances", {
548
548
  createdAt: integer("created_at", { mode: "timestamp" }).notNull(),
549
549
  updatedAt: integer("updated_at", { mode: "timestamp" }).notNull()
550
550
  });
551
- sqliteTable("kavach_federation_tokens", {
551
+ sqliteTable("theauth_federation_tokens", {
552
552
  id: text("id").primaryKey(),
553
553
  tokenJti: text("token_jti").notNull().unique(),
554
554
  // JWT ID for dedup
@@ -562,7 +562,7 @@ sqliteTable("kavach_federation_tokens", {
562
562
  expiresAt: integer("expires_at", { mode: "timestamp" }).notNull(),
563
563
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
564
564
  });
565
- var refreshTokenFamilies = sqliteTable("kavach_refresh_token_families", {
565
+ var refreshTokenFamilies = sqliteTable("theauth_refresh_token_families", {
566
566
  id: text("id").primaryKey(),
567
567
  userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
568
568
  /** Absolute session expiry — no rotation can extend beyond this date. */
@@ -571,7 +571,7 @@ var refreshTokenFamilies = sqliteTable("kavach_refresh_token_families", {
571
571
  revoked: integer("revoked").notNull().default(0),
572
572
  createdAt: integer("created_at", { mode: "timestamp" }).notNull()
573
573
  });
574
- sqliteTable("kavach_refresh_tokens", {
574
+ sqliteTable("theauth_refresh_tokens", {
575
575
  id: text("id").primaryKey(),
576
576
  familyId: text("family_id").notNull().references(() => refreshTokenFamilies.id, { onDelete: "cascade" }),
577
577
  /** SHA-256 hash of the opaque token — never store the raw token. */