@iqauth/sdk 2.2.0 → 2.5.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.
Files changed (96) hide show
  1. package/README.md +134 -0
  2. package/dist/browser-session.d.mts +3 -3
  3. package/dist/browser-session.d.ts +3 -3
  4. package/dist/browser-session.js +89 -68
  5. package/dist/browser-session.mjs +2 -1
  6. package/dist/browser.d.mts +64 -29
  7. package/dist/browser.d.ts +64 -29
  8. package/dist/browser.js +794 -39
  9. package/dist/browser.mjs +44 -4
  10. package/dist/bundle-LUKDQYVQ.mjs +374 -0
  11. package/dist/chunk-3JULWS6F.mjs +106 -0
  12. package/dist/chunk-5T7GHBX6.mjs +1165 -0
  13. package/dist/{chunk-M4J6BPK7.mjs → chunk-6TDJJER7.mjs} +12 -3
  14. package/dist/{chunk-QZB745C2.mjs → chunk-76W5TLQQ.mjs} +264 -211
  15. package/dist/{chunk-D72UL5HL.mjs → chunk-BVV54LPI.mjs} +36 -4
  16. package/dist/chunk-LIZYFXH7.mjs +90 -0
  17. package/dist/chunk-MKKZULZR.mjs +241 -0
  18. package/dist/chunk-SL3KRS4W.mjs +54 -0
  19. package/dist/chunk-TKZTCPEK.mjs +232 -0
  20. package/dist/chunk-UKZLOHZG.mjs +83 -0
  21. package/dist/chunk-UNYDG2L4.mjs +209 -0
  22. package/dist/{chunk-MDUHPQMM.mjs → chunk-W3F4JYGP.mjs} +8 -180
  23. package/dist/{chunk-QEJB7WEQ.mjs → chunk-WQWBJSSS.mjs} +1 -1
  24. package/dist/cli/index.js +144 -36
  25. package/dist/cli/index.mjs +1 -1
  26. package/dist/{client-DXbHb2ul.d.ts → client-BNQe3AgF.d.ts} +3 -67
  27. package/dist/{client-Dv4v92Mj.d.mts → client-kYlJFgPv.d.mts} +3 -67
  28. package/dist/doctor-YYNHNMLD.mjs +198 -0
  29. package/dist/{express-BZmF1llh.d.mts → express-B6_1vBYZ.d.mts} +23 -2
  30. package/dist/{express-B4o3P8vK.d.ts → express-CHpfa7D_.d.ts} +23 -2
  31. package/dist/express.d.mts +77 -6
  32. package/dist/express.d.ts +77 -6
  33. package/dist/express.js +336 -74
  34. package/dist/express.mjs +209 -8
  35. package/dist/fastify.js +103 -72
  36. package/dist/fastify.mjs +6 -4
  37. package/dist/hono.js +102 -72
  38. package/dist/hono.mjs +5 -4
  39. package/dist/index.d.mts +8 -4
  40. package/dist/index.d.ts +8 -4
  41. package/dist/index.js +590 -73
  42. package/dist/index.mjs +30 -8
  43. package/dist/locales.d.mts +53 -0
  44. package/dist/locales.d.ts +53 -0
  45. package/dist/locales.js +1202 -0
  46. package/dist/locales.mjs +29 -0
  47. package/dist/mobile.d.mts +3 -3
  48. package/dist/mobile.d.ts +3 -3
  49. package/dist/mobile.js +89 -68
  50. package/dist/mobile.mjs +2 -1
  51. package/dist/next.d.mts +10 -1
  52. package/dist/next.d.ts +10 -1
  53. package/dist/next.js +101 -1618
  54. package/dist/next.mjs +9 -9
  55. package/dist/provisioningBridge-88xjOS2n.d.mts +86 -0
  56. package/dist/provisioningBridge-DnTfzdZK.d.ts +86 -0
  57. package/dist/react.d.mts +1349 -10
  58. package/dist/react.d.ts +1349 -10
  59. package/dist/react.js +2998 -569
  60. package/dist/react.mjs +1518 -95
  61. package/dist/reverify-4UEJXUS6.mjs +16 -0
  62. package/dist/server/handlers.d.mts +12 -1
  63. package/dist/server/handlers.d.ts +12 -1
  64. package/dist/server/handlers.js +12 -3
  65. package/dist/server/handlers.mjs +2 -2
  66. package/dist/server.d.mts +5 -4
  67. package/dist/server.d.ts +5 -4
  68. package/dist/server.js +188 -73
  69. package/dist/server.mjs +13 -8
  70. package/dist/service.d.mts +3 -3
  71. package/dist/service.d.ts +3 -3
  72. package/dist/service.js +89 -68
  73. package/dist/service.mjs +2 -1
  74. package/dist/signIn-CCY4JE5G.mjs +15 -0
  75. package/dist/{signIn-D_kP3v-c.d.mts → signIn-CiIBTJIh.d.mts} +232 -4
  76. package/dist/{signIn-BVDTIA_t.d.ts → signIn-OCr88Zf8.d.ts} +232 -4
  77. package/dist/test.d.mts +86 -0
  78. package/dist/test.d.ts +86 -0
  79. package/dist/test.js +289 -0
  80. package/dist/test.mjs +9 -0
  81. package/dist/tokens-DCyzzn8L.d.mts +63 -0
  82. package/dist/tokens-aHiGFr_E.d.ts +63 -0
  83. package/dist/types-6bNdxesb.d.mts +196 -0
  84. package/dist/types-6bNdxesb.d.ts +196 -0
  85. package/dist/{types-Cxl3bQHt.d.ts → types-DZAflmmq.d.mts} +6 -0
  86. package/dist/{types-Cxl3bQHt.d.mts → types-DZAflmmq.d.ts} +6 -0
  87. package/dist/webhooks.d.mts +61 -0
  88. package/dist/webhooks.d.ts +61 -0
  89. package/dist/webhooks.js +119 -0
  90. package/dist/webhooks.mjs +11 -0
  91. package/dist/ws.d.mts +73 -0
  92. package/dist/ws.d.ts +73 -0
  93. package/dist/ws.js +397 -0
  94. package/dist/ws.mjs +12 -0
  95. package/package.json +24 -3
  96. package/dist/doctor-XCI77BQS.mjs +0 -90
package/dist/cli/index.js CHANGED
@@ -338,76 +338,184 @@ var doctor_exports = {};
338
338
  __export(doctor_exports, {
339
339
  runDoctor: () => runDoctor
340
340
  });
341
+ function pass(name, detail) {
342
+ return { name, level: "pass", detail };
343
+ }
344
+ function fail(name, detail, remediation) {
345
+ return { name, level: "fail", detail, remediation };
346
+ }
347
+ function info(name, detail) {
348
+ return { name, level: "info", detail };
349
+ }
341
350
  async function runDoctor(argv) {
342
351
  const { flags } = parseFlags(argv);
343
352
  const envFile = flags.get("env-file") || ".env";
344
353
  const env = await loadEnv(envFile);
345
354
  const probes = [];
346
355
  const pkRaw = env.IQAUTH_PUBLISHABLE_KEY;
356
+ const skRaw = env.IQAUTH_SECRET_KEY;
347
357
  const issuerEnv = env.IQAUTH_ISSUER;
348
358
  const redirect = env.IQAUTH_REDIRECT_URI;
349
- probes.push({
350
- name: ".env present",
351
- ok: !!pkRaw,
352
- detail: pkRaw ? `${envFile} loaded; IQAUTH_PUBLISHABLE_KEY=${pkRaw.slice(0, 10)}\u2026` : `IQAUTH_PUBLISHABLE_KEY missing in ${envFile}`
353
- });
359
+ const appOrigin = env.IQAUTH_APP_ORIGIN || env.APP_ORIGIN;
360
+ probes.push(
361
+ pkRaw ? pass(".env present", `${envFile} loaded; IQAUTH_PUBLISHABLE_KEY=${pkRaw.slice(0, 10)}\u2026`) : fail(
362
+ ".env present",
363
+ `IQAUTH_PUBLISHABLE_KEY missing in ${envFile}`,
364
+ "Run `iqauth init` or copy your publishable key from the IQAuth admin console into .env."
365
+ )
366
+ );
354
367
  const parsed = pkRaw ? parsePublishableKey(pkRaw) : null;
355
- probes.push({
356
- name: "publishable key parses",
357
- ok: !!parsed,
358
- detail: parsed ? `mode=${parsed.mode} appId=${parsed.appId} tenantId=${parsed.tenantId} kid=${parsed.kid}` : "key did not match pk_<test|live>_<base64> format"
359
- });
368
+ probes.push(
369
+ parsed ? pass(
370
+ "publishable key parses",
371
+ `mode=${parsed.mode} appId=${parsed.appId} tenantId=${parsed.tenantId} kid=${parsed.kid}`
372
+ ) : fail(
373
+ "publishable key parses",
374
+ "key did not match pk_<test|live>_<base64> format",
375
+ "Regenerate the key from the IQAuth admin console \u2014 it must be the URL-safe base64 form."
376
+ )
377
+ );
360
378
  const issuer = (issuerEnv || (parsed?.iss.startsWith("http") ? parsed.iss : parsed ? `https://${parsed.iss}` : "")).replace(/\/+$/, "");
361
379
  if (issuer) {
362
380
  try {
363
381
  const res = await fetch(`${issuer}/.well-known/openid-configuration`);
364
- probes.push({
365
- name: "issuer reachable",
366
- ok: res.ok,
367
- detail: `${issuer}/.well-known/openid-configuration \u2192 ${res.status}`
368
- });
382
+ const body = res.ok ? await res.json().catch(() => null) : null;
383
+ probes.push(
384
+ res.ok ? pass("issuer reachable", `${issuer}/.well-known/openid-configuration \u2192 ${res.status}`) : fail(
385
+ "issuer reachable",
386
+ `${issuer}/.well-known/openid-configuration \u2192 ${res.status}`,
387
+ "Check that IQAUTH_ISSUER (or the host encoded in your publishable key) points to a running IQAuth deployment."
388
+ )
389
+ );
390
+ if (parsed && body?.issuer) {
391
+ const expected = parsed.iss.startsWith("http") ? parsed.iss : `https://${parsed.iss}`;
392
+ const ok = body.issuer.replace(/\/+$/, "") === expected.replace(/\/+$/, "");
393
+ probes.push(
394
+ ok ? pass("iss matches publishable key", `discovery.issuer=${body.issuer}`) : fail(
395
+ "iss matches publishable key",
396
+ `discovery.issuer=${body.issuer} but publishable key encodes ${expected}`,
397
+ "Regenerate your publishable key from the SAME issuer host you're targeting (mismatched issuers are the #1 cause of TOKEN_INVALID)."
398
+ )
399
+ );
400
+ }
369
401
  } catch (err) {
370
- probes.push({
371
- name: "issuer reachable",
372
- ok: false,
373
- detail: `fetch failed: ${err.message}`
374
- });
402
+ probes.push(fail(
403
+ "issuer reachable",
404
+ `fetch failed: ${err.message}`,
405
+ "Verify network reachability and that IQAUTH_ISSUER is correct."
406
+ ));
375
407
  }
376
408
  } else {
377
- probes.push({ name: "issuer reachable", ok: false, detail: "issuer URL unknown (no IQAUTH_ISSUER and no key)" });
409
+ probes.push(fail("issuer reachable", "issuer URL unknown (no IQAUTH_ISSUER and no key)"));
378
410
  }
379
411
  if (issuer) {
380
412
  try {
381
413
  const res = await fetch(`${issuer}/.well-known/jwks.json`);
382
414
  const json = await res.json().catch(() => ({}));
383
415
  const keys = json.keys;
384
- probes.push({
385
- name: "JWKS reachable",
386
- ok: res.ok && Array.isArray(keys) && keys.length > 0,
387
- detail: `${issuer}/.well-known/jwks.json \u2192 ${res.status} (${Array.isArray(keys) ? keys.length : 0} keys)`
388
- });
416
+ const ok = res.ok && Array.isArray(keys) && keys.length > 0;
417
+ probes.push(
418
+ ok ? pass("JWKS reachable", `${issuer}/.well-known/jwks.json \u2192 ${res.status} (${keys.length} keys)`) : fail(
419
+ "JWKS reachable",
420
+ `${issuer}/.well-known/jwks.json \u2192 ${res.status} (${Array.isArray(keys) ? keys.length : 0} keys)`,
421
+ "JWKS must publish at least one signing key \u2014 contact your IQAuth admin."
422
+ )
423
+ );
389
424
  } catch (err) {
390
- probes.push({ name: "JWKS reachable", ok: false, detail: `fetch failed: ${err.message}` });
425
+ probes.push(fail("JWKS reachable", `fetch failed: ${err.message}`));
391
426
  }
392
427
  }
393
428
  if (redirect) {
394
429
  try {
395
430
  const res = await fetch(redirect, { method: "GET" });
396
- probes.push({
397
- name: "redirect URI reachable",
398
- ok: res.status > 0 && res.status < 500,
399
- detail: `${redirect} \u2192 ${res.status}`
400
- });
431
+ const ok = res.status > 0 && res.status < 500;
432
+ probes.push(
433
+ ok ? pass("redirect URI reachable", `${redirect} \u2192 ${res.status}`) : fail(
434
+ "redirect URI reachable",
435
+ `${redirect} \u2192 ${res.status}`,
436
+ "The configured callback path must be reachable from the public internet (or localhost for dev)."
437
+ )
438
+ );
401
439
  } catch (err) {
402
- probes.push({ name: "redirect URI reachable", ok: false, detail: `fetch failed: ${err.message}` });
440
+ probes.push(fail("redirect URI reachable", `fetch failed: ${err.message}`));
403
441
  }
404
442
  } else {
405
- probes.push({ name: "redirect URI reachable", ok: false, detail: "IQAUTH_REDIRECT_URI not set" });
443
+ probes.push(info("redirect URI reachable", "IQAUTH_REDIRECT_URI not set (skipped \u2014 set it to enable this probe)"));
444
+ }
445
+ if (issuer && parsed) {
446
+ const probeReturnTo = appOrigin || redirect || `${issuer}/`;
447
+ const ctxUrl = `${issuer}/api/public/apps/${encodeURIComponent(parsed.appId)}/sign-in-context?return_to=${encodeURIComponent(probeReturnTo)}`;
448
+ try {
449
+ const res = await fetch(ctxUrl);
450
+ const body = await res.json().catch(() => null);
451
+ if (!res.ok || !body?.success || !body.data) {
452
+ probes.push(fail(
453
+ "app active at issuer",
454
+ `GET sign-in-context \u2192 ${res.status}${body?.error?.code ? ` ${body.error.code}` : ""}`,
455
+ "The app key may be revoked, archived, or pointing at the wrong tenant. Check the IQAuth admin console."
456
+ ));
457
+ } else {
458
+ const data = body.data;
459
+ probes.push(pass("app active at issuer", `app=${data.app?.key} mode=${data.app?.mode}`));
460
+ const allowed = data.allowedOrigins ?? [];
461
+ if (appOrigin) {
462
+ let originOk = false;
463
+ try {
464
+ originOk = allowed.includes(new URL(appOrigin).origin);
465
+ } catch {
466
+ originOk = allowed.includes(appOrigin);
467
+ }
468
+ probes.push(
469
+ originOk ? pass("APP_ORIGIN allowed", `${appOrigin} \u2208 allowedOrigins`) : fail(
470
+ "APP_ORIGIN allowed",
471
+ `${appOrigin} not in [${allowed.join(", ") || "\u2014"}]`,
472
+ `Add this origin in the IQAuth admin console: Apps \u2192 ${data.app?.key} \u2192 Allowed Origins.`
473
+ )
474
+ );
475
+ } else {
476
+ probes.push(info("APP_ORIGIN allowed", "Set IQAUTH_APP_ORIGIN to enable this probe"));
477
+ }
478
+ if (redirect) {
479
+ let cbOriginOk = false;
480
+ try {
481
+ cbOriginOk = allowed.includes(new URL(redirect).origin);
482
+ } catch {
483
+ cbOriginOk = false;
484
+ }
485
+ probes.push(
486
+ cbOriginOk ? pass("callback origin allowed", `origin of ${redirect} \u2208 allowedOrigins`) : fail(
487
+ "callback origin allowed",
488
+ `origin of ${redirect} not in [${allowed.join(", ") || "\u2014"}]`,
489
+ `Register the callback URL in the IQAuth admin console: Apps \u2192 ${data.app?.key} \u2192 Allowed Redirect URIs.`
490
+ )
491
+ );
492
+ } else {
493
+ probes.push(info("callback origin allowed", "Set IQAUTH_REDIRECT_URI to enable this probe"));
494
+ }
495
+ }
496
+ } catch (err) {
497
+ probes.push(fail("app active at issuer", `fetch failed: ${err.message}`));
498
+ }
499
+ }
500
+ if (skRaw) {
501
+ probes.push(
502
+ /^sk_(test|live)_[A-Za-z0-9_\-]+$/.test(skRaw) ? pass("secret key shape", `IQAUTH_SECRET_KEY=${skRaw.slice(0, 8)}\u2026`) : fail(
503
+ "secret key shape",
504
+ "IQAUTH_SECRET_KEY does not match sk_<test|live>_<base64>",
505
+ "Regenerate the secret from the IQAuth admin console."
506
+ )
507
+ );
508
+ } else {
509
+ probes.push(info("secret key shape", "IQAUTH_SECRET_KEY not set (only required for backend adapters)"));
406
510
  }
407
511
  let allOk = true;
408
512
  for (const p of probes) {
409
- console.log(`${symbol(p.ok)} ${p.name.padEnd(28)} ${p.detail}`);
410
- if (!p.ok) allOk = false;
513
+ const sym = p.level === "pass" ? symbol(true) : p.level === "fail" ? symbol(false) : "\u2139";
514
+ console.log(`${sym} ${p.name.padEnd(32)} ${p.detail}`);
515
+ if (p.remediation && p.level === "fail") {
516
+ console.log(` \u21B3 ${p.remediation}`);
517
+ }
518
+ if (p.level === "fail") allOk = false;
411
519
  }
412
520
  console.log("");
413
521
  console.log(allOk ? "\u2705 All checks passed." : "\u274C One or more checks failed \u2014 see above.");
@@ -17,7 +17,7 @@ async function run() {
17
17
  return;
18
18
  }
19
19
  case "doctor": {
20
- const { runDoctor } = await import("../doctor-XCI77BQS.mjs");
20
+ const { runDoctor } = await import("../doctor-YYNHNMLD.mjs");
21
21
  await runDoctor(rest);
22
22
  return;
23
23
  }
@@ -1,5 +1,5 @@
1
- import { I as IQAuthEnvironment, T as TokenPair, W as IQAuthRetryConfig, L as LoginResult, a$ as SignupRequest, D as MfaVerifyResult, d as SessionUser, J as JwtClaims, h as Session, U as UserProfile, H as ProvisionUserRequest, K as ProvisionUserResponse, G as UserPermissions, O as OidcDiscovery, t as JwksResponse, u as OidcTokenResponse, b0 as HostedClientContext, i as TenantInfo, C as CreateTenantRequest, j as UpdateTenantRequest, P as PromoteToVendorRequest, k as PromoteToVendorResult, a7 as TenantUser, l as InviteTenantUserRequest, m as InviteTenantUserResult, n as TenantUserRoleUpdate, M as MigrateUserRequest, E as PasswordPolicy, F as MfaPolicy, B as BrandingConfig, _ as AppInfo, $ as PermissionNodeInfo, Z as AppManifest, a0 as AppSyncResult, a1 as Role, a2 as CreateRoleRequest, a3 as UpdateRoleRequest, a4 as AssignRoleRequest, a5 as UserRoleAssignment, a8 as PermissionGroup, a9 as GroupPermission, aa as AddGroupPermissionRequest, ab as InheritanceRelation, a6 as UserGroupAssignment, ac as UserPermissionOverride, ad as AddUserOverrideRequest, ae as EffectivePermission, af as PermissionCheckResult, ah as CreateApiKeyRequest, ai as CreateApiKeyResult, ag as ApiKeyInfo, aj as ApiKeyIntrospection, al as CreateInviteRequest, ak as Invitation, am as InviteValidation, an as AcceptInviteRequest, ap as CreateWebhookRequest, aq as CreateWebhookResult, ao as WebhookEndpoint, ar as WebhookDelivery, as as WebhookTestResult, at as Entitlement, au as GrantEntitlementRequest, av as Vendor, aw as CreateVendorRequest, ax as UpdateVendorRequest, az as CreateSourceRequest, ay as Source, aA as UpdateSourceRequest, aC as CreateClientRequest, aB as Client, aD as UpdateClientRequest, aE as HierarchyVendor, aH as HierarchyLink, aL as MembershipWithDetails, aJ as CreateMembershipRequest, aI as Membership, aK as UpdateMembershipRequest, aM as AvailableScopesTree, aQ as ScopeSwitchResult, aR as GdprExportData, aS as PinStatus, aU as MfaAvailableMethods, aV as TotpEnrollResult, aW as TotpVerifyResult, aX as SmsEnrollResult, y as MfaEnrollment, aY as EmailEnrollResult, aZ as BackupCodesResult, a_ as BackupCodeCountResult, o as UpdateBrandingRequest, q as UploadAssetRequest, p as BrandingAsset, r as BrandingDomainMapping, a as IQAuthClientConfig, c as IQAuthBrowserSessionClientConfig, b as IQAuthTokenClientConfig } from './types-Cxl3bQHt.js';
2
- import jwt from 'jsonwebtoken';
1
+ import { I as IQAuthEnvironment, T as TokenPair, W as IQAuthRetryConfig, L as LoginResult, a$ as SignupRequest, D as MfaVerifyResult, d as SessionUser, h as Session, U as UserProfile, H as ProvisionUserRequest, K as ProvisionUserResponse, G as UserPermissions, J as JwtClaims, O as OidcDiscovery, t as JwksResponse, u as OidcTokenResponse, b0 as HostedClientContext, i as TenantInfo, C as CreateTenantRequest, j as UpdateTenantRequest, P as PromoteToVendorRequest, k as PromoteToVendorResult, a7 as TenantUser, l as InviteTenantUserRequest, m as InviteTenantUserResult, n as TenantUserRoleUpdate, M as MigrateUserRequest, E as PasswordPolicy, F as MfaPolicy, B as BrandingConfig, _ as AppInfo, $ as PermissionNodeInfo, Z as AppManifest, a0 as AppSyncResult, a1 as Role, a2 as CreateRoleRequest, a3 as UpdateRoleRequest, a4 as AssignRoleRequest, a5 as UserRoleAssignment, a8 as PermissionGroup, a9 as GroupPermission, aa as AddGroupPermissionRequest, ab as InheritanceRelation, a6 as UserGroupAssignment, ac as UserPermissionOverride, ad as AddUserOverrideRequest, ae as EffectivePermission, af as PermissionCheckResult, ah as CreateApiKeyRequest, ai as CreateApiKeyResult, ag as ApiKeyInfo, aj as ApiKeyIntrospection, al as CreateInviteRequest, ak as Invitation, am as InviteValidation, an as AcceptInviteRequest, ap as CreateWebhookRequest, aq as CreateWebhookResult, ao as WebhookEndpoint, ar as WebhookDelivery, as as WebhookTestResult, at as Entitlement, au as GrantEntitlementRequest, av as Vendor, aw as CreateVendorRequest, ax as UpdateVendorRequest, az as CreateSourceRequest, ay as Source, aA as UpdateSourceRequest, aC as CreateClientRequest, aB as Client, aD as UpdateClientRequest, aE as HierarchyVendor, aH as HierarchyLink, aL as MembershipWithDetails, aJ as CreateMembershipRequest, aI as Membership, aK as UpdateMembershipRequest, aM as AvailableScopesTree, aQ as ScopeSwitchResult, aR as GdprExportData, aS as PinStatus, aU as MfaAvailableMethods, aV as TotpEnrollResult, aW as TotpVerifyResult, aX as SmsEnrollResult, y as MfaEnrollment, aY as EmailEnrollResult, aZ as BackupCodesResult, a_ as BackupCodeCountResult, o as UpdateBrandingRequest, q as UploadAssetRequest, p as BrandingAsset, r as BrandingDomainMapping, a as IQAuthClientConfig, c as IQAuthBrowserSessionClientConfig, b as IQAuthTokenClientConfig } from './types-DZAflmmq.js';
2
+ import { T as TokensModule } from './tokens-aHiGFr_E.js';
3
3
 
4
4
  /**
5
5
  * SOURCE REFS:
@@ -83,70 +83,6 @@ declare class AuthModule {
83
83
  getSessionUser(): Promise<SessionUser>;
84
84
  }
85
85
 
86
- /**
87
- * SOURCE REFS:
88
- * - Route file: src/services/token.service.ts (RS256, issuer "auth.dispositioniq.com", audience array)
89
- * - Route file: src/routes/wellknown.routes.ts (JWKS endpoint /.well-known/jwks.json)
90
- * - Route file: src/lib/crypto.ts (key rotation with kid)
91
- * - Verified claims: sub, email, name, tenantId, vendorId, roles, entitlements, sessionId, jti, iss, aud, exp, iat, scopeContext, loginMethod
92
- * - Last verified: Phase 0 Research Summary
93
- */
94
-
95
- declare const DEFAULT_TOKEN_ISSUER: string[];
96
- declare const DEFAULT_TOKEN_AUDIENCE: string[];
97
- declare const DEFAULT_CLOCK_TOLERANCE_SECONDS = 30;
98
- interface TokenVerifyOptions {
99
- issuer?: string | string[];
100
- audience?: string | string[];
101
- clockTolerance?: number;
102
- algorithms?: jwt.Algorithm[];
103
- }
104
- interface TokensModuleOptions {
105
- issuer?: string | string[];
106
- audience?: string | string[];
107
- clockTolerance?: number;
108
- }
109
- declare class TokensModule {
110
- private baseUrl;
111
- private jwksCache;
112
- private inFlightRefresh;
113
- private defaultIssuer;
114
- private defaultAudience;
115
- private defaultClockTolerance;
116
- constructor(baseUrl: string, options?: TokensModuleOptions);
117
- /**
118
- * Verify a JWT access token using RS256 via JWKS from /.well-known/jwks.json.
119
- * Caches JWKS keys for 1 hour. Retries once on unknown `kid`.
120
- *
121
- * @remarks Validates against /.well-known/jwks.json. Issuer, audience, and
122
- * clock tolerance default to client config but can be overridden per call.
123
- */
124
- verify(token: string, options?: TokenVerifyOptions): Promise<JwtClaims>;
125
- /**
126
- * Decode a JWT without verification. Returns null if malformed.
127
- *
128
- * @remarks Local decode only — no network call
129
- */
130
- decode(token: string): JwtClaims | null;
131
- /**
132
- * Check if a token is expired based on the `exp` claim.
133
- *
134
- * @remarks Local check only — no network call
135
- */
136
- isExpired(token: string): boolean;
137
- /**
138
- * Get the claims from a token without verification.
139
- *
140
- * @remarks Local decode only — no network call
141
- */
142
- getClaims(token: string): JwtClaims;
143
- private getPublicKey;
144
- private refreshJwks;
145
- private jwkToPem;
146
- /** @internal Exposed for testing — clears JWKS cache */
147
- clearCache(): void;
148
- }
149
-
150
86
  /**
151
87
  * SOURCE REFS:
152
88
  * - Route file: src/routes/sessions.routes.ts (GET /, DELETE /:sessionId)
@@ -908,4 +844,4 @@ declare class IQAuthClient {
908
844
  private static resolveEnvironment;
909
845
  }
910
846
 
911
- export { AuthModule as A, BrandingModule as B, type CreateAppRequest as C, DEFAULT_TOKEN_ISSUER as D, EntitlementsModule as E, GdprModule as G, HierarchyModule as H, IQAuthClient as I, MembershipsModule as M, OidcModule as O, PermissionsModule as P, RolesModule as R, SessionsModule as S, TokensModule as T, UsersModule as U, VendorsModule as V, WebhooksModule as W, InMemoryOidcStateStore as a, type OidcStateStore as b, type OidcStoredRequest as c, type OidcAuthRequest as d, type OidcCallbackResult as e, type OidcModuleOptions as f, DEFAULT_TOKEN_AUDIENCE as g, DEFAULT_CLOCK_TOLERANCE_SECONDS as h, type TokenVerifyOptions as i, type TokensModuleOptions as j, TenantsModule as k, AppsModule as l, type CreateAppResponse as m, PermissionGroupsModule as n, ApiKeysModule as o, InvitesModule as p, SourcesModule as q, ClientsModule as r, ScopeModule as s, PinModule as t, MfaModule as u };
847
+ export { AuthModule as A, BrandingModule as B, type CreateAppRequest as C, EntitlementsModule as E, GdprModule as G, HierarchyModule as H, IQAuthClient as I, MembershipsModule as M, OidcModule as O, PermissionsModule as P, RolesModule as R, SessionsModule as S, TenantsModule as T, UsersModule as U, VendorsModule as V, WebhooksModule as W, InMemoryOidcStateStore as a, type OidcStateStore as b, type OidcStoredRequest as c, type OidcAuthRequest as d, type OidcCallbackResult as e, type OidcModuleOptions as f, AppsModule as g, type CreateAppResponse as h, PermissionGroupsModule as i, ApiKeysModule as j, InvitesModule as k, SourcesModule as l, ClientsModule as m, ScopeModule as n, PinModule as o, MfaModule as p };
@@ -1,5 +1,5 @@
1
- import { I as IQAuthEnvironment, T as TokenPair, W as IQAuthRetryConfig, L as LoginResult, a$ as SignupRequest, D as MfaVerifyResult, d as SessionUser, J as JwtClaims, h as Session, U as UserProfile, H as ProvisionUserRequest, K as ProvisionUserResponse, G as UserPermissions, O as OidcDiscovery, t as JwksResponse, u as OidcTokenResponse, b0 as HostedClientContext, i as TenantInfo, C as CreateTenantRequest, j as UpdateTenantRequest, P as PromoteToVendorRequest, k as PromoteToVendorResult, a7 as TenantUser, l as InviteTenantUserRequest, m as InviteTenantUserResult, n as TenantUserRoleUpdate, M as MigrateUserRequest, E as PasswordPolicy, F as MfaPolicy, B as BrandingConfig, _ as AppInfo, $ as PermissionNodeInfo, Z as AppManifest, a0 as AppSyncResult, a1 as Role, a2 as CreateRoleRequest, a3 as UpdateRoleRequest, a4 as AssignRoleRequest, a5 as UserRoleAssignment, a8 as PermissionGroup, a9 as GroupPermission, aa as AddGroupPermissionRequest, ab as InheritanceRelation, a6 as UserGroupAssignment, ac as UserPermissionOverride, ad as AddUserOverrideRequest, ae as EffectivePermission, af as PermissionCheckResult, ah as CreateApiKeyRequest, ai as CreateApiKeyResult, ag as ApiKeyInfo, aj as ApiKeyIntrospection, al as CreateInviteRequest, ak as Invitation, am as InviteValidation, an as AcceptInviteRequest, ap as CreateWebhookRequest, aq as CreateWebhookResult, ao as WebhookEndpoint, ar as WebhookDelivery, as as WebhookTestResult, at as Entitlement, au as GrantEntitlementRequest, av as Vendor, aw as CreateVendorRequest, ax as UpdateVendorRequest, az as CreateSourceRequest, ay as Source, aA as UpdateSourceRequest, aC as CreateClientRequest, aB as Client, aD as UpdateClientRequest, aE as HierarchyVendor, aH as HierarchyLink, aL as MembershipWithDetails, aJ as CreateMembershipRequest, aI as Membership, aK as UpdateMembershipRequest, aM as AvailableScopesTree, aQ as ScopeSwitchResult, aR as GdprExportData, aS as PinStatus, aU as MfaAvailableMethods, aV as TotpEnrollResult, aW as TotpVerifyResult, aX as SmsEnrollResult, y as MfaEnrollment, aY as EmailEnrollResult, aZ as BackupCodesResult, a_ as BackupCodeCountResult, o as UpdateBrandingRequest, q as UploadAssetRequest, p as BrandingAsset, r as BrandingDomainMapping, a as IQAuthClientConfig, c as IQAuthBrowserSessionClientConfig, b as IQAuthTokenClientConfig } from './types-Cxl3bQHt.mjs';
2
- import jwt from 'jsonwebtoken';
1
+ import { I as IQAuthEnvironment, T as TokenPair, W as IQAuthRetryConfig, L as LoginResult, a$ as SignupRequest, D as MfaVerifyResult, d as SessionUser, h as Session, U as UserProfile, H as ProvisionUserRequest, K as ProvisionUserResponse, G as UserPermissions, J as JwtClaims, O as OidcDiscovery, t as JwksResponse, u as OidcTokenResponse, b0 as HostedClientContext, i as TenantInfo, C as CreateTenantRequest, j as UpdateTenantRequest, P as PromoteToVendorRequest, k as PromoteToVendorResult, a7 as TenantUser, l as InviteTenantUserRequest, m as InviteTenantUserResult, n as TenantUserRoleUpdate, M as MigrateUserRequest, E as PasswordPolicy, F as MfaPolicy, B as BrandingConfig, _ as AppInfo, $ as PermissionNodeInfo, Z as AppManifest, a0 as AppSyncResult, a1 as Role, a2 as CreateRoleRequest, a3 as UpdateRoleRequest, a4 as AssignRoleRequest, a5 as UserRoleAssignment, a8 as PermissionGroup, a9 as GroupPermission, aa as AddGroupPermissionRequest, ab as InheritanceRelation, a6 as UserGroupAssignment, ac as UserPermissionOverride, ad as AddUserOverrideRequest, ae as EffectivePermission, af as PermissionCheckResult, ah as CreateApiKeyRequest, ai as CreateApiKeyResult, ag as ApiKeyInfo, aj as ApiKeyIntrospection, al as CreateInviteRequest, ak as Invitation, am as InviteValidation, an as AcceptInviteRequest, ap as CreateWebhookRequest, aq as CreateWebhookResult, ao as WebhookEndpoint, ar as WebhookDelivery, as as WebhookTestResult, at as Entitlement, au as GrantEntitlementRequest, av as Vendor, aw as CreateVendorRequest, ax as UpdateVendorRequest, az as CreateSourceRequest, ay as Source, aA as UpdateSourceRequest, aC as CreateClientRequest, aB as Client, aD as UpdateClientRequest, aE as HierarchyVendor, aH as HierarchyLink, aL as MembershipWithDetails, aJ as CreateMembershipRequest, aI as Membership, aK as UpdateMembershipRequest, aM as AvailableScopesTree, aQ as ScopeSwitchResult, aR as GdprExportData, aS as PinStatus, aU as MfaAvailableMethods, aV as TotpEnrollResult, aW as TotpVerifyResult, aX as SmsEnrollResult, y as MfaEnrollment, aY as EmailEnrollResult, aZ as BackupCodesResult, a_ as BackupCodeCountResult, o as UpdateBrandingRequest, q as UploadAssetRequest, p as BrandingAsset, r as BrandingDomainMapping, a as IQAuthClientConfig, c as IQAuthBrowserSessionClientConfig, b as IQAuthTokenClientConfig } from './types-DZAflmmq.mjs';
2
+ import { T as TokensModule } from './tokens-DCyzzn8L.mjs';
3
3
 
4
4
  /**
5
5
  * SOURCE REFS:
@@ -83,70 +83,6 @@ declare class AuthModule {
83
83
  getSessionUser(): Promise<SessionUser>;
84
84
  }
85
85
 
86
- /**
87
- * SOURCE REFS:
88
- * - Route file: src/services/token.service.ts (RS256, issuer "auth.dispositioniq.com", audience array)
89
- * - Route file: src/routes/wellknown.routes.ts (JWKS endpoint /.well-known/jwks.json)
90
- * - Route file: src/lib/crypto.ts (key rotation with kid)
91
- * - Verified claims: sub, email, name, tenantId, vendorId, roles, entitlements, sessionId, jti, iss, aud, exp, iat, scopeContext, loginMethod
92
- * - Last verified: Phase 0 Research Summary
93
- */
94
-
95
- declare const DEFAULT_TOKEN_ISSUER: string[];
96
- declare const DEFAULT_TOKEN_AUDIENCE: string[];
97
- declare const DEFAULT_CLOCK_TOLERANCE_SECONDS = 30;
98
- interface TokenVerifyOptions {
99
- issuer?: string | string[];
100
- audience?: string | string[];
101
- clockTolerance?: number;
102
- algorithms?: jwt.Algorithm[];
103
- }
104
- interface TokensModuleOptions {
105
- issuer?: string | string[];
106
- audience?: string | string[];
107
- clockTolerance?: number;
108
- }
109
- declare class TokensModule {
110
- private baseUrl;
111
- private jwksCache;
112
- private inFlightRefresh;
113
- private defaultIssuer;
114
- private defaultAudience;
115
- private defaultClockTolerance;
116
- constructor(baseUrl: string, options?: TokensModuleOptions);
117
- /**
118
- * Verify a JWT access token using RS256 via JWKS from /.well-known/jwks.json.
119
- * Caches JWKS keys for 1 hour. Retries once on unknown `kid`.
120
- *
121
- * @remarks Validates against /.well-known/jwks.json. Issuer, audience, and
122
- * clock tolerance default to client config but can be overridden per call.
123
- */
124
- verify(token: string, options?: TokenVerifyOptions): Promise<JwtClaims>;
125
- /**
126
- * Decode a JWT without verification. Returns null if malformed.
127
- *
128
- * @remarks Local decode only — no network call
129
- */
130
- decode(token: string): JwtClaims | null;
131
- /**
132
- * Check if a token is expired based on the `exp` claim.
133
- *
134
- * @remarks Local check only — no network call
135
- */
136
- isExpired(token: string): boolean;
137
- /**
138
- * Get the claims from a token without verification.
139
- *
140
- * @remarks Local decode only — no network call
141
- */
142
- getClaims(token: string): JwtClaims;
143
- private getPublicKey;
144
- private refreshJwks;
145
- private jwkToPem;
146
- /** @internal Exposed for testing — clears JWKS cache */
147
- clearCache(): void;
148
- }
149
-
150
86
  /**
151
87
  * SOURCE REFS:
152
88
  * - Route file: src/routes/sessions.routes.ts (GET /, DELETE /:sessionId)
@@ -908,4 +844,4 @@ declare class IQAuthClient {
908
844
  private static resolveEnvironment;
909
845
  }
910
846
 
911
- export { AuthModule as A, BrandingModule as B, type CreateAppRequest as C, DEFAULT_TOKEN_ISSUER as D, EntitlementsModule as E, GdprModule as G, HierarchyModule as H, IQAuthClient as I, MembershipsModule as M, OidcModule as O, PermissionsModule as P, RolesModule as R, SessionsModule as S, TokensModule as T, UsersModule as U, VendorsModule as V, WebhooksModule as W, InMemoryOidcStateStore as a, type OidcStateStore as b, type OidcStoredRequest as c, type OidcAuthRequest as d, type OidcCallbackResult as e, type OidcModuleOptions as f, DEFAULT_TOKEN_AUDIENCE as g, DEFAULT_CLOCK_TOLERANCE_SECONDS as h, type TokenVerifyOptions as i, type TokensModuleOptions as j, TenantsModule as k, AppsModule as l, type CreateAppResponse as m, PermissionGroupsModule as n, ApiKeysModule as o, InvitesModule as p, SourcesModule as q, ClientsModule as r, ScopeModule as s, PinModule as t, MfaModule as u };
847
+ export { AuthModule as A, BrandingModule as B, type CreateAppRequest as C, EntitlementsModule as E, GdprModule as G, HierarchyModule as H, IQAuthClient as I, MembershipsModule as M, OidcModule as O, PermissionsModule as P, RolesModule as R, SessionsModule as S, TenantsModule as T, UsersModule as U, VendorsModule as V, WebhooksModule as W, InMemoryOidcStateStore as a, type OidcStateStore as b, type OidcStoredRequest as c, type OidcAuthRequest as d, type OidcCallbackResult as e, type OidcModuleOptions as f, AppsModule as g, type CreateAppResponse as h, PermissionGroupsModule as i, ApiKeysModule as j, InvitesModule as k, SourcesModule as l, ClientsModule as m, ScopeModule as n, PinModule as o, MfaModule as p };
@@ -0,0 +1,198 @@
1
+ import {
2
+ loadEnv,
3
+ parseFlags,
4
+ symbol
5
+ } from "./chunk-X3K3WOBR.mjs";
6
+ import {
7
+ parsePublishableKey
8
+ } from "./chunk-WQWBJSSS.mjs";
9
+ import "./chunk-6I6RM4MN.mjs";
10
+ import "./chunk-Y6FXYEAI.mjs";
11
+
12
+ // src/cli/doctor.ts
13
+ function pass(name, detail) {
14
+ return { name, level: "pass", detail };
15
+ }
16
+ function fail(name, detail, remediation) {
17
+ return { name, level: "fail", detail, remediation };
18
+ }
19
+ function info(name, detail) {
20
+ return { name, level: "info", detail };
21
+ }
22
+ async function runDoctor(argv) {
23
+ const { flags } = parseFlags(argv);
24
+ const envFile = flags.get("env-file") || ".env";
25
+ const env = await loadEnv(envFile);
26
+ const probes = [];
27
+ const pkRaw = env.IQAUTH_PUBLISHABLE_KEY;
28
+ const skRaw = env.IQAUTH_SECRET_KEY;
29
+ const issuerEnv = env.IQAUTH_ISSUER;
30
+ const redirect = env.IQAUTH_REDIRECT_URI;
31
+ const appOrigin = env.IQAUTH_APP_ORIGIN || env.APP_ORIGIN;
32
+ probes.push(
33
+ pkRaw ? pass(".env present", `${envFile} loaded; IQAUTH_PUBLISHABLE_KEY=${pkRaw.slice(0, 10)}\u2026`) : fail(
34
+ ".env present",
35
+ `IQAUTH_PUBLISHABLE_KEY missing in ${envFile}`,
36
+ "Run `iqauth init` or copy your publishable key from the IQAuth admin console into .env."
37
+ )
38
+ );
39
+ const parsed = pkRaw ? parsePublishableKey(pkRaw) : null;
40
+ probes.push(
41
+ parsed ? pass(
42
+ "publishable key parses",
43
+ `mode=${parsed.mode} appId=${parsed.appId} tenantId=${parsed.tenantId} kid=${parsed.kid}`
44
+ ) : fail(
45
+ "publishable key parses",
46
+ "key did not match pk_<test|live>_<base64> format",
47
+ "Regenerate the key from the IQAuth admin console \u2014 it must be the URL-safe base64 form."
48
+ )
49
+ );
50
+ const issuer = (issuerEnv || (parsed?.iss.startsWith("http") ? parsed.iss : parsed ? `https://${parsed.iss}` : "")).replace(/\/+$/, "");
51
+ if (issuer) {
52
+ try {
53
+ const res = await fetch(`${issuer}/.well-known/openid-configuration`);
54
+ const body = res.ok ? await res.json().catch(() => null) : null;
55
+ probes.push(
56
+ res.ok ? pass("issuer reachable", `${issuer}/.well-known/openid-configuration \u2192 ${res.status}`) : fail(
57
+ "issuer reachable",
58
+ `${issuer}/.well-known/openid-configuration \u2192 ${res.status}`,
59
+ "Check that IQAUTH_ISSUER (or the host encoded in your publishable key) points to a running IQAuth deployment."
60
+ )
61
+ );
62
+ if (parsed && body?.issuer) {
63
+ const expected = parsed.iss.startsWith("http") ? parsed.iss : `https://${parsed.iss}`;
64
+ const ok = body.issuer.replace(/\/+$/, "") === expected.replace(/\/+$/, "");
65
+ probes.push(
66
+ ok ? pass("iss matches publishable key", `discovery.issuer=${body.issuer}`) : fail(
67
+ "iss matches publishable key",
68
+ `discovery.issuer=${body.issuer} but publishable key encodes ${expected}`,
69
+ "Regenerate your publishable key from the SAME issuer host you're targeting (mismatched issuers are the #1 cause of TOKEN_INVALID)."
70
+ )
71
+ );
72
+ }
73
+ } catch (err) {
74
+ probes.push(fail(
75
+ "issuer reachable",
76
+ `fetch failed: ${err.message}`,
77
+ "Verify network reachability and that IQAUTH_ISSUER is correct."
78
+ ));
79
+ }
80
+ } else {
81
+ probes.push(fail("issuer reachable", "issuer URL unknown (no IQAUTH_ISSUER and no key)"));
82
+ }
83
+ if (issuer) {
84
+ try {
85
+ const res = await fetch(`${issuer}/.well-known/jwks.json`);
86
+ const json = await res.json().catch(() => ({}));
87
+ const keys = json.keys;
88
+ const ok = res.ok && Array.isArray(keys) && keys.length > 0;
89
+ probes.push(
90
+ ok ? pass("JWKS reachable", `${issuer}/.well-known/jwks.json \u2192 ${res.status} (${keys.length} keys)`) : fail(
91
+ "JWKS reachable",
92
+ `${issuer}/.well-known/jwks.json \u2192 ${res.status} (${Array.isArray(keys) ? keys.length : 0} keys)`,
93
+ "JWKS must publish at least one signing key \u2014 contact your IQAuth admin."
94
+ )
95
+ );
96
+ } catch (err) {
97
+ probes.push(fail("JWKS reachable", `fetch failed: ${err.message}`));
98
+ }
99
+ }
100
+ if (redirect) {
101
+ try {
102
+ const res = await fetch(redirect, { method: "GET" });
103
+ const ok = res.status > 0 && res.status < 500;
104
+ probes.push(
105
+ ok ? pass("redirect URI reachable", `${redirect} \u2192 ${res.status}`) : fail(
106
+ "redirect URI reachable",
107
+ `${redirect} \u2192 ${res.status}`,
108
+ "The configured callback path must be reachable from the public internet (or localhost for dev)."
109
+ )
110
+ );
111
+ } catch (err) {
112
+ probes.push(fail("redirect URI reachable", `fetch failed: ${err.message}`));
113
+ }
114
+ } else {
115
+ probes.push(info("redirect URI reachable", "IQAUTH_REDIRECT_URI not set (skipped \u2014 set it to enable this probe)"));
116
+ }
117
+ if (issuer && parsed) {
118
+ const probeReturnTo = appOrigin || redirect || `${issuer}/`;
119
+ const ctxUrl = `${issuer}/api/public/apps/${encodeURIComponent(parsed.appId)}/sign-in-context?return_to=${encodeURIComponent(probeReturnTo)}`;
120
+ try {
121
+ const res = await fetch(ctxUrl);
122
+ const body = await res.json().catch(() => null);
123
+ if (!res.ok || !body?.success || !body.data) {
124
+ probes.push(fail(
125
+ "app active at issuer",
126
+ `GET sign-in-context \u2192 ${res.status}${body?.error?.code ? ` ${body.error.code}` : ""}`,
127
+ "The app key may be revoked, archived, or pointing at the wrong tenant. Check the IQAuth admin console."
128
+ ));
129
+ } else {
130
+ const data = body.data;
131
+ probes.push(pass("app active at issuer", `app=${data.app?.key} mode=${data.app?.mode}`));
132
+ const allowed = data.allowedOrigins ?? [];
133
+ if (appOrigin) {
134
+ let originOk = false;
135
+ try {
136
+ originOk = allowed.includes(new URL(appOrigin).origin);
137
+ } catch {
138
+ originOk = allowed.includes(appOrigin);
139
+ }
140
+ probes.push(
141
+ originOk ? pass("APP_ORIGIN allowed", `${appOrigin} \u2208 allowedOrigins`) : fail(
142
+ "APP_ORIGIN allowed",
143
+ `${appOrigin} not in [${allowed.join(", ") || "\u2014"}]`,
144
+ `Add this origin in the IQAuth admin console: Apps \u2192 ${data.app?.key} \u2192 Allowed Origins.`
145
+ )
146
+ );
147
+ } else {
148
+ probes.push(info("APP_ORIGIN allowed", "Set IQAUTH_APP_ORIGIN to enable this probe"));
149
+ }
150
+ if (redirect) {
151
+ let cbOriginOk = false;
152
+ try {
153
+ cbOriginOk = allowed.includes(new URL(redirect).origin);
154
+ } catch {
155
+ cbOriginOk = false;
156
+ }
157
+ probes.push(
158
+ cbOriginOk ? pass("callback origin allowed", `origin of ${redirect} \u2208 allowedOrigins`) : fail(
159
+ "callback origin allowed",
160
+ `origin of ${redirect} not in [${allowed.join(", ") || "\u2014"}]`,
161
+ `Register the callback URL in the IQAuth admin console: Apps \u2192 ${data.app?.key} \u2192 Allowed Redirect URIs.`
162
+ )
163
+ );
164
+ } else {
165
+ probes.push(info("callback origin allowed", "Set IQAUTH_REDIRECT_URI to enable this probe"));
166
+ }
167
+ }
168
+ } catch (err) {
169
+ probes.push(fail("app active at issuer", `fetch failed: ${err.message}`));
170
+ }
171
+ }
172
+ if (skRaw) {
173
+ probes.push(
174
+ /^sk_(test|live)_[A-Za-z0-9_\-]+$/.test(skRaw) ? pass("secret key shape", `IQAUTH_SECRET_KEY=${skRaw.slice(0, 8)}\u2026`) : fail(
175
+ "secret key shape",
176
+ "IQAUTH_SECRET_KEY does not match sk_<test|live>_<base64>",
177
+ "Regenerate the secret from the IQAuth admin console."
178
+ )
179
+ );
180
+ } else {
181
+ probes.push(info("secret key shape", "IQAUTH_SECRET_KEY not set (only required for backend adapters)"));
182
+ }
183
+ let allOk = true;
184
+ for (const p of probes) {
185
+ const sym = p.level === "pass" ? symbol(true) : p.level === "fail" ? symbol(false) : "\u2139";
186
+ console.log(`${sym} ${p.name.padEnd(32)} ${p.detail}`);
187
+ if (p.remediation && p.level === "fail") {
188
+ console.log(` \u21B3 ${p.remediation}`);
189
+ }
190
+ if (p.level === "fail") allOk = false;
191
+ }
192
+ console.log("");
193
+ console.log(allOk ? "\u2705 All checks passed." : "\u274C One or more checks failed \u2014 see above.");
194
+ process.exit(allOk ? 0 : 1);
195
+ }
196
+ export {
197
+ runDoctor
198
+ };
@@ -1,5 +1,5 @@
1
- import { I as IQAuthClient } from './client-Dv4v92Mj.mjs';
2
- import { J as JwtClaims, N as ExpressMiddlewareOptions, Q as IQAuthRequestLike, R as IQAuthResponseLike, V as IQAuthNextFunction } from './types-Cxl3bQHt.mjs';
1
+ import { I as IQAuthClient } from './client-kYlJFgPv.mjs';
2
+ import { J as JwtClaims, N as ExpressMiddlewareOptions, Q as IQAuthRequestLike, R as IQAuthResponseLike, V as IQAuthNextFunction } from './types-DZAflmmq.mjs';
3
3
 
4
4
  /**
5
5
  * SOURCE REFS:
@@ -34,6 +34,27 @@ interface CookieAwareMiddlewareOptions extends ExpressMiddlewareOptions {
34
34
  * configured access cookie. When false, only the bearer header is checked.
35
35
  */
36
36
  cookieAware?: boolean;
37
+ /**
38
+ * F14 — Umbrella shorthand for `accessCookieName` / `refreshCookieName`.
39
+ * When both forms are supplied the individual fields win for back-compat.
40
+ */
41
+ cookieNames?: {
42
+ access?: string;
43
+ refresh?: string;
44
+ };
45
+ /**
46
+ * F33 — Declarative protect/public route configuration. When `protect` is
47
+ * given, only requests whose path matches one of the patterns are
48
+ * verified; everything else is allowed through (`req.auth` left unset).
49
+ * When `publicRoutes` is given, those paths are always allowed through
50
+ * even if `protect` would have matched. Each entry is either a glob-like
51
+ * string (`*` = single segment, `**` = any path remainder) or a `RegExp`.
52
+ *
53
+ * If neither is given, the middleware behaves as before — every request
54
+ * goes through the verifier.
55
+ */
56
+ protect?: Array<string | RegExp>;
57
+ publicRoutes?: Array<string | RegExp>;
37
58
  }
38
59
  /**
39
60
  * Express middleware that verifies access tokens via the SDK's token verifier.