@iqauth/sdk 2.3.0 → 2.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 +110 -0
- package/dist/browser-session.d.mts +3 -2
- package/dist/browser-session.d.ts +3 -2
- package/dist/browser.d.mts +64 -29
- package/dist/browser.d.ts +64 -29
- package/dist/browser.js +782 -38
- package/dist/browser.mjs +43 -3
- package/dist/bundle-LUKDQYVQ.mjs +374 -0
- package/dist/chunk-3JULWS6F.mjs +106 -0
- package/dist/chunk-5T7GHBX6.mjs +1165 -0
- package/dist/{chunk-KGEPDXHU.mjs → chunk-6TDJJER7.mjs} +2 -2
- package/dist/{chunk-RACIPVLD.mjs → chunk-76W5TLQQ.mjs} +262 -220
- package/dist/{chunk-EKTNEZIH.mjs → chunk-BVV54LPI.mjs} +37 -5
- package/dist/chunk-LIZYFXH7.mjs +90 -0
- package/dist/chunk-MKKZULZR.mjs +241 -0
- package/dist/chunk-SL3KRS4W.mjs +54 -0
- package/dist/chunk-TKZTCPEK.mjs +232 -0
- package/dist/chunk-UKZLOHZG.mjs +83 -0
- package/dist/cli/index.js +144 -36
- package/dist/cli/index.mjs +1 -1
- package/dist/{client-DTX4hNdS.d.ts → client-BNQe3AgF.d.ts} +3 -62
- package/dist/{client-vdh2a9fJ.d.mts → client-kYlJFgPv.d.mts} +3 -62
- package/dist/doctor-YYNHNMLD.mjs +198 -0
- package/dist/{express-A0-dWEMy.d.mts → express-B6_1vBYZ.d.mts} +23 -2
- package/dist/{express-Bo_pJKHN.d.ts → express-CHpfa7D_.d.ts} +23 -2
- package/dist/express.d.mts +5 -4
- package/dist/express.d.ts +5 -4
- package/dist/express.js +36 -4
- package/dist/express.mjs +8 -8
- package/dist/fastify.js +2 -2
- package/dist/fastify.mjs +4 -4
- package/dist/hono.js +2 -2
- package/dist/hono.mjs +4 -4
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js +500 -4
- package/dist/index.mjs +29 -9
- package/dist/locales.d.mts +53 -0
- package/dist/locales.d.ts +53 -0
- package/dist/locales.js +1202 -0
- package/dist/locales.mjs +29 -0
- package/dist/mobile.d.mts +3 -2
- package/dist/mobile.d.ts +3 -2
- package/dist/next.d.mts +1 -1
- package/dist/next.d.ts +1 -1
- package/dist/next.js +2 -2
- package/dist/next.mjs +1 -1
- package/dist/provisioningBridge-88xjOS2n.d.mts +86 -0
- package/dist/provisioningBridge-DnTfzdZK.d.ts +86 -0
- package/dist/react.d.mts +1349 -10
- package/dist/react.d.ts +1349 -10
- package/dist/react.js +3006 -568
- package/dist/react.mjs +1540 -97
- package/dist/reverify-4UEJXUS6.mjs +16 -0
- package/dist/server/handlers.d.mts +10 -1
- package/dist/server/handlers.d.ts +10 -1
- package/dist/server/handlers.js +2 -2
- package/dist/server/handlers.mjs +1 -1
- package/dist/server.d.mts +5 -3
- package/dist/server.d.ts +5 -3
- package/dist/server.js +89 -4
- package/dist/server.mjs +12 -8
- package/dist/service.d.mts +3 -2
- package/dist/service.d.ts +3 -2
- package/dist/signIn-CCY4JE5G.mjs +15 -0
- package/dist/{signIn-Cd0P4y9d.d.mts → signIn-CiIBTJIh.d.mts} +224 -4
- package/dist/{signIn-DKakyzeu.d.ts → signIn-OCr88Zf8.d.ts} +224 -4
- package/dist/test.d.mts +86 -0
- package/dist/test.d.ts +86 -0
- package/dist/test.js +289 -0
- package/dist/test.mjs +9 -0
- package/dist/tokens-DCyzzn8L.d.mts +63 -0
- package/dist/tokens-aHiGFr_E.d.ts +63 -0
- package/dist/types-6bNdxesb.d.mts +196 -0
- package/dist/types-6bNdxesb.d.ts +196 -0
- package/dist/{types-Cxl3bQHt.d.mts → types-DZAflmmq.d.mts} +6 -0
- package/dist/{types-Cxl3bQHt.d.ts → types-DZAflmmq.d.ts} +6 -0
- package/dist/webhooks.d.mts +61 -0
- package/dist/webhooks.d.ts +61 -0
- package/dist/webhooks.js +119 -0
- package/dist/webhooks.mjs +11 -0
- package/dist/ws.d.mts +73 -0
- package/dist/ws.d.ts +73 -0
- package/dist/ws.js +397 -0
- package/dist/ws.mjs +12 -0
- package/package.json +22 -2
- package/dist/doctor-A5E7LSFW.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
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
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
|
-
|
|
357
|
-
|
|
358
|
-
|
|
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
|
-
|
|
365
|
-
|
|
366
|
-
ok
|
|
367
|
-
|
|
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
|
-
|
|
372
|
-
|
|
373
|
-
|
|
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(
|
|
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
|
-
|
|
385
|
-
|
|
386
|
-
ok
|
|
387
|
-
|
|
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(
|
|
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
|
-
|
|
397
|
-
|
|
398
|
-
ok
|
|
399
|
-
|
|
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(
|
|
440
|
+
probes.push(fail("redirect URI reachable", `fetch failed: ${err.message}`));
|
|
403
441
|
}
|
|
404
442
|
} else {
|
|
405
|
-
probes.push(
|
|
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
|
-
|
|
410
|
-
|
|
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.");
|
package/dist/cli/index.mjs
CHANGED
|
@@ -1,4 +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,
|
|
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';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* SOURCE REFS:
|
|
@@ -82,66 +83,6 @@ declare class AuthModule {
|
|
|
82
83
|
getSessionUser(): Promise<SessionUser>;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
/**
|
|
86
|
-
* SOURCE REFS:
|
|
87
|
-
* - Route file: src/services/token.service.ts (RS256, issuer "auth.dispositioniq.com", audience array)
|
|
88
|
-
* - Route file: src/routes/wellknown.routes.ts (JWKS endpoint /.well-known/jwks.json)
|
|
89
|
-
* - Route file: src/lib/crypto.ts (key rotation with kid)
|
|
90
|
-
* - Verified claims: sub, email, name, tenantId, vendorId, roles, entitlements, sessionId, jti, iss, aud, exp, iat, scopeContext, loginMethod
|
|
91
|
-
* - Last verified: Phase 0 Research Summary
|
|
92
|
-
*
|
|
93
|
-
* 2.3.0: Verify path swapped from `jsonwebtoken` (which depends on
|
|
94
|
-
* `node:crypto`) to `jose` so the SDK works on Next.js / Vercel / Cloudflare
|
|
95
|
-
* edge runtimes. Edge has only Web Crypto, so every call from a Next
|
|
96
|
-
* middleware previously threw and was wrapped as `TOKEN_INVALID`,
|
|
97
|
-
* indistinguishable from a real bad token. We keep our own JWKS fetch +
|
|
98
|
-
* cache to preserve INTERNAL_ERROR mapping for malformed JWKS payloads and
|
|
99
|
-
* to keep the kid-aware "Unknown key ID" diagnostic.
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
|
-
declare const DEFAULT_TOKEN_ISSUER: string[];
|
|
103
|
-
declare const DEFAULT_TOKEN_AUDIENCE: string[];
|
|
104
|
-
declare const DEFAULT_CLOCK_TOLERANCE_SECONDS = 30;
|
|
105
|
-
interface TokenVerifyOptions {
|
|
106
|
-
issuer?: string | string[];
|
|
107
|
-
audience?: string | string[];
|
|
108
|
-
clockTolerance?: number;
|
|
109
|
-
algorithms?: string[];
|
|
110
|
-
}
|
|
111
|
-
interface TokensModuleOptions {
|
|
112
|
-
issuer?: string | string[];
|
|
113
|
-
audience?: string | string[];
|
|
114
|
-
clockTolerance?: number;
|
|
115
|
-
}
|
|
116
|
-
declare class TokensModule {
|
|
117
|
-
private baseUrl;
|
|
118
|
-
private jwksCache;
|
|
119
|
-
private inFlightRefresh;
|
|
120
|
-
private defaultIssuer;
|
|
121
|
-
private defaultAudience;
|
|
122
|
-
private defaultClockTolerance;
|
|
123
|
-
constructor(baseUrl: string, options?: TokensModuleOptions);
|
|
124
|
-
/**
|
|
125
|
-
* Verify a JWT access token using RS256/ES256 via JWKS from
|
|
126
|
-
* `/.well-known/jwks.json`. Backed by `jose` (Web Crypto) so it runs on
|
|
127
|
-
* Node, browser, and edge runtimes alike — no `node:crypto` dependency.
|
|
128
|
-
* Caches JWKS for 1 hour and refetches once on unknown `kid`.
|
|
129
|
-
*/
|
|
130
|
-
verify(token: string, options?: TokenVerifyOptions): Promise<JwtClaims>;
|
|
131
|
-
/**
|
|
132
|
-
* Decode a JWT without verification. Returns null if malformed.
|
|
133
|
-
*/
|
|
134
|
-
decode(token: string): JwtClaims | null;
|
|
135
|
-
/** Check if a token is expired based on the `exp` claim. */
|
|
136
|
-
isExpired(token: string): boolean;
|
|
137
|
-
/** Get the claims from a token without verification. */
|
|
138
|
-
getClaims(token: string): JwtClaims;
|
|
139
|
-
private ensureCache;
|
|
140
|
-
private refreshJwks;
|
|
141
|
-
/** @internal Exposed for testing — clears JWKS cache */
|
|
142
|
-
clearCache(): void;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
86
|
/**
|
|
146
87
|
* SOURCE REFS:
|
|
147
88
|
* - Route file: src/routes/sessions.routes.ts (GET /, DELETE /:sessionId)
|
|
@@ -903,4 +844,4 @@ declare class IQAuthClient {
|
|
|
903
844
|
private static resolveEnvironment;
|
|
904
845
|
}
|
|
905
846
|
|
|
906
|
-
export { AuthModule as A, BrandingModule as B, type CreateAppRequest as C,
|
|
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,4 +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,
|
|
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';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* SOURCE REFS:
|
|
@@ -82,66 +83,6 @@ declare class AuthModule {
|
|
|
82
83
|
getSessionUser(): Promise<SessionUser>;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
/**
|
|
86
|
-
* SOURCE REFS:
|
|
87
|
-
* - Route file: src/services/token.service.ts (RS256, issuer "auth.dispositioniq.com", audience array)
|
|
88
|
-
* - Route file: src/routes/wellknown.routes.ts (JWKS endpoint /.well-known/jwks.json)
|
|
89
|
-
* - Route file: src/lib/crypto.ts (key rotation with kid)
|
|
90
|
-
* - Verified claims: sub, email, name, tenantId, vendorId, roles, entitlements, sessionId, jti, iss, aud, exp, iat, scopeContext, loginMethod
|
|
91
|
-
* - Last verified: Phase 0 Research Summary
|
|
92
|
-
*
|
|
93
|
-
* 2.3.0: Verify path swapped from `jsonwebtoken` (which depends on
|
|
94
|
-
* `node:crypto`) to `jose` so the SDK works on Next.js / Vercel / Cloudflare
|
|
95
|
-
* edge runtimes. Edge has only Web Crypto, so every call from a Next
|
|
96
|
-
* middleware previously threw and was wrapped as `TOKEN_INVALID`,
|
|
97
|
-
* indistinguishable from a real bad token. We keep our own JWKS fetch +
|
|
98
|
-
* cache to preserve INTERNAL_ERROR mapping for malformed JWKS payloads and
|
|
99
|
-
* to keep the kid-aware "Unknown key ID" diagnostic.
|
|
100
|
-
*/
|
|
101
|
-
|
|
102
|
-
declare const DEFAULT_TOKEN_ISSUER: string[];
|
|
103
|
-
declare const DEFAULT_TOKEN_AUDIENCE: string[];
|
|
104
|
-
declare const DEFAULT_CLOCK_TOLERANCE_SECONDS = 30;
|
|
105
|
-
interface TokenVerifyOptions {
|
|
106
|
-
issuer?: string | string[];
|
|
107
|
-
audience?: string | string[];
|
|
108
|
-
clockTolerance?: number;
|
|
109
|
-
algorithms?: string[];
|
|
110
|
-
}
|
|
111
|
-
interface TokensModuleOptions {
|
|
112
|
-
issuer?: string | string[];
|
|
113
|
-
audience?: string | string[];
|
|
114
|
-
clockTolerance?: number;
|
|
115
|
-
}
|
|
116
|
-
declare class TokensModule {
|
|
117
|
-
private baseUrl;
|
|
118
|
-
private jwksCache;
|
|
119
|
-
private inFlightRefresh;
|
|
120
|
-
private defaultIssuer;
|
|
121
|
-
private defaultAudience;
|
|
122
|
-
private defaultClockTolerance;
|
|
123
|
-
constructor(baseUrl: string, options?: TokensModuleOptions);
|
|
124
|
-
/**
|
|
125
|
-
* Verify a JWT access token using RS256/ES256 via JWKS from
|
|
126
|
-
* `/.well-known/jwks.json`. Backed by `jose` (Web Crypto) so it runs on
|
|
127
|
-
* Node, browser, and edge runtimes alike — no `node:crypto` dependency.
|
|
128
|
-
* Caches JWKS for 1 hour and refetches once on unknown `kid`.
|
|
129
|
-
*/
|
|
130
|
-
verify(token: string, options?: TokenVerifyOptions): Promise<JwtClaims>;
|
|
131
|
-
/**
|
|
132
|
-
* Decode a JWT without verification. Returns null if malformed.
|
|
133
|
-
*/
|
|
134
|
-
decode(token: string): JwtClaims | null;
|
|
135
|
-
/** Check if a token is expired based on the `exp` claim. */
|
|
136
|
-
isExpired(token: string): boolean;
|
|
137
|
-
/** Get the claims from a token without verification. */
|
|
138
|
-
getClaims(token: string): JwtClaims;
|
|
139
|
-
private ensureCache;
|
|
140
|
-
private refreshJwks;
|
|
141
|
-
/** @internal Exposed for testing — clears JWKS cache */
|
|
142
|
-
clearCache(): void;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
86
|
/**
|
|
146
87
|
* SOURCE REFS:
|
|
147
88
|
* - Route file: src/routes/sessions.routes.ts (GET /, DELETE /:sessionId)
|
|
@@ -903,4 +844,4 @@ declare class IQAuthClient {
|
|
|
903
844
|
private static resolveEnvironment;
|
|
904
845
|
}
|
|
905
846
|
|
|
906
|
-
export { AuthModule as A, BrandingModule as B, type CreateAppRequest as C,
|
|
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-
|
|
2
|
-
import { J as JwtClaims, N as ExpressMiddlewareOptions, Q as IQAuthRequestLike, R as IQAuthResponseLike, V as IQAuthNextFunction } from './types-
|
|
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.
|