@frontmcp/auth 1.7.1 → 1.8.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/index.js CHANGED
@@ -262,15 +262,16 @@ __export(index_exports, {
262
262
  CredentialProviderAlreadyRegisteredError: () => CredentialProviderAlreadyRegisteredError,
263
263
  CredentialStorageError: () => CredentialStorageError,
264
264
  CredentialsAccessorImpl: () => CredentialsAccessorImpl,
265
+ DEFAULT_INCREMENTAL_TICKET_TTL_MS: () => DEFAULT_INCREMENTAL_TICKET_TTL_MS,
265
266
  DEFAULT_RESUME_TTL_MS: () => DEFAULT_RESUME_TTL_MS,
266
267
  DEFAULT_THEME: () => DEFAULT_THEME,
267
268
  DcrClientRegistry: () => DcrClientRegistry,
268
269
  EagerCredentialLoader: () => EagerCredentialLoader,
269
270
  ElicitationSecretRequiredError: () => ElicitationSecretRequiredError,
270
271
  EncryptedRedisVault: () => EncryptedRedisVault,
271
- EncryptedStorageError: () => import_utils22.EncryptedStorageError,
272
+ EncryptedStorageError: () => import_utils23.EncryptedStorageError,
272
273
  EncryptedStorageSecureStoreBackend: () => EncryptedStorageSecureStoreBackend,
273
- EncryptedTypedStorage: () => import_utils22.EncryptedTypedStorage,
274
+ EncryptedTypedStorage: () => import_utils23.EncryptedTypedStorage,
274
275
  EncryptionContextNotSetError: () => EncryptionContextNotSetError,
275
276
  EncryptionKeyNotConfiguredError: () => EncryptionKeyNotConfiguredError,
276
277
  FetchCredentialMiddleware: () => FetchCredentialMiddleware,
@@ -284,6 +285,8 @@ __export(index_exports, {
284
285
  InMemoryStoreRequiredError: () => InMemoryStoreRequiredError,
285
286
  InvalidClientIdUrlError: () => InvalidClientIdUrlError,
286
287
  JwksService: () => JwksService,
288
+ JwtSecretRequiredError: () => JwtSecretRequiredError,
289
+ JwtSecretWeakError: () => JwtSecretWeakError,
287
290
  LazyCredentialLoader: () => LazyCredentialLoader,
288
291
  NoProviderIdError: () => NoProviderIdError,
289
292
  NullOrchestratedAuthAccessor: () => NullOrchestratedAuthAccessor,
@@ -316,7 +319,7 @@ __export(index_exports, {
316
319
  TokenVault: () => TokenVault,
317
320
  TransparentAuthorization: () => TransparentAuthorization,
318
321
  TransportIdGenerator: () => TransportIdGenerator,
319
- TypedStorage: () => import_utils21.TypedStorage,
322
+ TypedStorage: () => import_utils22.TypedStorage,
320
323
  VaultEncryption: () => VaultEncryption,
321
324
  VaultLoadError: () => VaultLoadError,
322
325
  VaultNotFoundError: () => VaultNotFoundError,
@@ -398,9 +401,9 @@ __export(index_exports, {
398
401
  credentialTypeSchema: () => credentialTypeSchema,
399
402
  customCredentialSchema: () => customCredentialSchema,
400
403
  decodeJwtPayloadSafe: () => decodeJwtPayloadSafe,
401
- decryptAesGcm: () => import_utils32.decryptAesGcm,
404
+ decryptAesGcm: () => import_utils33.decryptAesGcm,
402
405
  decryptSessionJson: () => decryptSessionJson,
403
- decryptValue: () => import_utils32.decryptValue,
406
+ decryptValue: () => import_utils33.decryptValue,
404
407
  defaultSessionRateLimiter: () => defaultSessionRateLimiter,
405
408
  deriveAuthorizationId: () => deriveAuthorizationId,
406
409
  deriveExpectedAudience: () => deriveExpectedAudience,
@@ -408,9 +411,9 @@ __export(index_exports, {
408
411
  deriveTypedUser: () => deriveTypedUser,
409
412
  detectAuthProviders: () => detectAuthProviders,
410
413
  detectedAuthProviderSchema: () => detectedAuthProviderSchema,
411
- encryptAesGcm: () => import_utils32.encryptAesGcm,
414
+ encryptAesGcm: () => import_utils33.encryptAesGcm,
412
415
  encryptJson: () => encryptJson,
413
- encryptValue: () => import_utils32.encryptValue,
416
+ encryptValue: () => import_utils33.encryptValue,
414
417
  encryptedBlobSchema: () => encryptedBlobSchema,
415
418
  encryptedDataSchema: () => encryptedDataSchema,
416
419
  encryptedVaultEntrySchema: () => encryptedVaultEntrySchema,
@@ -436,7 +439,7 @@ __export(index_exports, {
436
439
  getTokenSignatureFingerprint: () => getTokenSignatureFingerprint,
437
440
  hasOnlyLocalhostRedirectUris: () => hasOnlyLocalhostRedirectUris,
438
441
  headerApplier: () => headerApplier,
439
- hkdfSha256: () => import_utils32.hkdfSha256,
442
+ hkdfSha256: () => import_utils33.hkdfSha256,
440
443
  incrementalAuthConfigSchema: () => incrementalAuthConfigSchema,
441
444
  isCimdClientId: () => isCimdClientId,
442
445
  isFrontMcpCredentials: () => isFrontMcpCredentials,
@@ -450,10 +453,11 @@ __export(index_exports, {
450
453
  isRedisTokenStorage: () => isRedisTokenStorage,
451
454
  isRemoteMode: () => isRemoteMode,
452
455
  isSessionComplete: () => isSessionComplete,
453
- isSignedSession: () => import_utils14.isSignedData,
456
+ isSignedSession: () => import_utils15.isSignedData,
454
457
  isSoonExpiring: () => isSoonExpiring,
455
458
  isSoonExpiringProvider: () => isSoonExpiringProvider,
456
459
  isSqliteTokenStorage: () => isSqliteTokenStorage,
460
+ isStaticMode: () => isStaticMode,
457
461
  isTransparentMode: () => isTransparentMode,
458
462
  jsonWebKeySetSchema: () => jsonWebKeySetSchema,
459
463
  jwkParametersSchema: () => jwkParametersSchema,
@@ -505,6 +509,7 @@ __export(index_exports, {
505
509
  sessionIdPayloadSchema: () => sessionIdPayloadSchema,
506
510
  sessionJwtPayloadSchema: () => sessionJwtPayloadSchema,
507
511
  signCredentialResumeToken: () => signCredentialResumeToken,
512
+ signIncrementalAuthTicket: () => signIncrementalAuthTicket,
508
513
  signSession: () => signSession,
509
514
  skippedAppBehaviorSchema: () => skippedAppBehaviorSchema,
510
515
  sseTransportStateSchema: () => sseTransportStateSchema,
@@ -512,6 +517,7 @@ __export(index_exports, {
512
517
  startNextProvider: () => startNextProvider,
513
518
  statefulHttpTransportStateSchema: () => statefulHttpTransportStateSchema,
514
519
  statelessHttpTransportStateSchema: () => statelessHttpTransportStateSchema,
520
+ staticAuthOptionsSchema: () => staticAuthOptionsSchema,
515
521
  storedSessionSchema: () => storedSessionSchema,
516
522
  streamableHttpTransportStateSchema: () => streamableHttpTransportStateSchema,
517
523
  toEpochSeconds: () => toEpochSeconds,
@@ -533,6 +539,7 @@ __export(index_exports, {
533
539
  vaultConsentRecordSchema: () => vaultConsentRecordSchema,
534
540
  vaultFederatedRecordSchema: () => vaultFederatedRecordSchema,
535
541
  verifyCredentialResumeToken: () => verifyCredentialResumeToken,
542
+ verifyIncrementalAuthTicket: () => verifyIncrementalAuthTicket,
536
543
  verifyOrParseSession: () => verifyOrParseSession,
537
544
  verifyPkce: () => verifyPkce,
538
545
  verifySession: () => verifySession,
@@ -852,26 +859,78 @@ function checkIpv4(ip) {
852
859
  }
853
860
  return { allowed: true, reason: "" };
854
861
  }
862
+ function expandIpv6(ip) {
863
+ let text = ip.toLowerCase();
864
+ if (text.includes("%")) {
865
+ text = text.slice(0, text.indexOf("%"));
866
+ }
867
+ const dottedQuad = text.match(/^(.*:)(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})$/);
868
+ if (dottedQuad) {
869
+ const octets = dottedQuad[2].split(".").map(Number);
870
+ if (octets.some((octet) => !Number.isInteger(octet) || octet < 0 || octet > 255)) return null;
871
+ const high = (octets[0] << 8 | octets[1]).toString(16);
872
+ const low = (octets[2] << 8 | octets[3]).toString(16);
873
+ text = `${dottedQuad[1]}${high}:${low}`;
874
+ }
875
+ const halves = text.split("::");
876
+ if (halves.length > 2) return null;
877
+ const parseGroups = (part) => {
878
+ if (part === "") return [];
879
+ const groups = [];
880
+ for (const group of part.split(":")) {
881
+ if (!/^[0-9a-f]{1,4}$/.test(group)) return null;
882
+ groups.push(parseInt(group, 16));
883
+ }
884
+ return groups;
885
+ };
886
+ const head = parseGroups(halves[0]);
887
+ if (head === null) return null;
888
+ if (halves.length === 1) {
889
+ return head.length === 8 ? head : null;
890
+ }
891
+ const tail = parseGroups(halves[1]);
892
+ if (tail === null) return null;
893
+ if (head.length + tail.length > 7) return null;
894
+ return [...head, ...new Array(8 - head.length - tail.length).fill(0), ...tail];
895
+ }
855
896
  function checkIpv6(ip) {
856
- const normalizedIp = ip.toLowerCase();
857
- if (normalizedIp === "::1") {
897
+ const groups = expandIpv6(ip);
898
+ if (!groups) {
899
+ return { allowed: false, reason: `Malformed IPv6 address: ${ip}` };
900
+ }
901
+ const isZeroPrefix = groups.slice(0, 7).every((group) => group === 0);
902
+ if (isZeroPrefix && groups[7] === 1) {
858
903
  return { allowed: false, reason: "IPv6 loopback address (::1) is not allowed" };
859
904
  }
860
- if (normalizedIp === "::" || normalizedIp === "0:0:0:0:0:0:0:0") {
905
+ if (isZeroPrefix && groups[7] === 0) {
861
906
  return { allowed: false, reason: "IPv6 unspecified address (::) is not allowed" };
862
907
  }
863
- if (normalizedIp.startsWith("fe8") || normalizedIp.startsWith("fe9") || normalizedIp.startsWith("fea") || normalizedIp.startsWith("feb")) {
908
+ if ((groups[0] & 65472) === 65152) {
864
909
  return { allowed: false, reason: "IPv6 link-local addresses (fe80::/10) are not allowed" };
865
910
  }
866
- if (normalizedIp.startsWith("fc") || normalizedIp.startsWith("fd")) {
911
+ if ((groups[0] & 65024) === 64512) {
867
912
  return { allowed: false, reason: "IPv6 unique local addresses (fc00::/7) are not allowed" };
868
913
  }
869
- const ipv4MappedMatch = normalizedIp.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/);
870
- if (ipv4MappedMatch) {
871
- return checkIpv4(ipv4MappedMatch[1]);
914
+ const embedded = extractEmbeddedIpv4(groups);
915
+ if (embedded) {
916
+ return checkIpv4(embedded);
872
917
  }
873
918
  return { allowed: true, reason: "" };
874
919
  }
920
+ function extractEmbeddedIpv4(groups) {
921
+ const toDotted = () => {
922
+ const high = groups[6];
923
+ const low = groups[7];
924
+ return `${high >> 8}.${high & 255}.${low >> 8}.${low & 255}`;
925
+ };
926
+ const firstFive = groups.slice(0, 5).every((group) => group === 0);
927
+ if (firstFive && groups[5] === 65535) return toDotted();
928
+ if (firstFive && groups[5] === 0) return toDotted();
929
+ if (groups[0] === 100 && groups[1] === 65435 && groups.slice(2, 6).every((group) => group === 0)) {
930
+ return toDotted();
931
+ }
932
+ return null;
933
+ }
875
934
  function isDomainInList(hostname, domainList) {
876
935
  const lowerHostname = hostname.toLowerCase();
877
936
  for (const domain of domainList) {
@@ -1641,8 +1700,6 @@ function buildIncrementalAuthPage(params) {
1641
1700
 
1642
1701
  <form method="GET" action="${escapeHtml3(callbackPath)}" class="flex gap-3 pt-4 border-t border-gray-100">
1643
1702
  <input type="hidden" name="pending_auth_id" value="${escapeHtml3(sessionHint)}">
1644
- <input type="hidden" name="app_id" value="${escapeHtml3(app.appId)}">
1645
- <input type="hidden" name="incremental" value="true">
1646
1703
  <button type="button" onclick="window.close()"
1647
1704
  class="flex-1 px-4 py-2.5 text-gray-600 hover:text-gray-900 hover:bg-gray-100 font-medium rounded-lg transition-colors">
1648
1705
  Cancel
@@ -2126,6 +2183,7 @@ function buildPendingRecord(params) {
2126
2183
  createdAt: now,
2127
2184
  expiresAt: now + PENDING_AUTH_TTL_MS,
2128
2185
  isIncremental: params.isIncremental,
2186
+ incrementalSub: params.incrementalSub,
2129
2187
  targetAppId: params.targetAppId,
2130
2188
  targetToolId: params.targetToolId,
2131
2189
  existingSessionId: params.existingSessionId,
@@ -3260,6 +3318,44 @@ function buildCredentialResumeUrl(basePath, token) {
3260
3318
  return `${trimmed}/oauth/connect?token=${encodeURIComponent(token)}`;
3261
3319
  }
3262
3320
 
3321
+ // libs/auth/src/session/incremental-auth-ticket.ts
3322
+ var import_utils10 = require("@frontmcp/utils");
3323
+ var DEFAULT_INCREMENTAL_TICKET_TTL_MS = 3e5;
3324
+ function signIncrementalAuthTicket(input, secret) {
3325
+ const payload = {
3326
+ sub: input.sub,
3327
+ appId: input.appId,
3328
+ ...input.toolId !== void 0 ? { toolId: input.toolId } : {},
3329
+ ...input.priorAppIds !== void 0 ? { priorAppIds: input.priorAppIds } : {},
3330
+ jti: (0, import_utils10.randomUUID)(),
3331
+ exp: Date.now() + (input.ttlMs ?? DEFAULT_INCREMENTAL_TICKET_TTL_MS)
3332
+ };
3333
+ const signedJson = (0, import_utils10.signData)(payload, { secret });
3334
+ return Buffer.from(signedJson, "utf8").toString("base64url");
3335
+ }
3336
+ function verifyIncrementalAuthTicket(token, secret, now = Date.now()) {
3337
+ let signedJson;
3338
+ try {
3339
+ signedJson = Buffer.from(token, "base64url").toString("utf8");
3340
+ } catch {
3341
+ return null;
3342
+ }
3343
+ const payload = (0, import_utils10.verifyData)(signedJson, { secret });
3344
+ if (!payload) return null;
3345
+ if (typeof payload.sub !== "string" || payload.sub.length === 0) return null;
3346
+ if (typeof payload.appId !== "string" || payload.appId.length === 0) return null;
3347
+ if (typeof payload.jti !== "string" || payload.jti.length === 0) return null;
3348
+ if (!Number.isFinite(payload.exp)) return null;
3349
+ if (payload.toolId !== void 0 && typeof payload.toolId !== "string") return null;
3350
+ if (payload.priorAppIds !== void 0 && (!Array.isArray(payload.priorAppIds) || payload.priorAppIds.some((id) => typeof id !== "string"))) {
3351
+ return null;
3352
+ }
3353
+ if (now >= payload.exp) {
3354
+ return null;
3355
+ }
3356
+ return payload;
3357
+ }
3358
+
3263
3359
  // libs/auth/src/session/credentials-accessor.ts
3264
3360
  var CREDENTIALS_ACCESSOR = /* @__PURE__ */ Symbol.for("frontmcp:CREDENTIALS_ACCESSOR");
3265
3361
 
@@ -3424,7 +3520,7 @@ function errMsg2(err) {
3424
3520
  var SECURE_STORE_ACCESSOR = /* @__PURE__ */ Symbol.for("frontmcp:SECURE_STORE_ACCESSOR");
3425
3521
 
3426
3522
  // libs/auth/src/session/secure-store-accessor.impl.ts
3427
- var import_utils10 = require("@frontmcp/utils");
3523
+ var import_utils11 = require("@frontmcp/utils");
3428
3524
  var GLOBAL_NAMESPACE = "global";
3429
3525
  var SecureStoreAccessorImpl = class {
3430
3526
  backend;
@@ -3453,12 +3549,12 @@ var SecureStoreAccessorImpl = class {
3453
3549
  return GLOBAL_NAMESPACE;
3454
3550
  case "session": {
3455
3551
  const sid = this.resolveSessionId();
3456
- return sid ? `s:${(0, import_utils10.sha256Hex)(sid).slice(0, 32)}` : void 0;
3552
+ return sid ? `s:${(0, import_utils11.sha256Hex)(sid).slice(0, 32)}` : void 0;
3457
3553
  }
3458
3554
  case "user":
3459
3555
  default: {
3460
3556
  const sub = this.resolveSub();
3461
- return sub ? `u:${(0, import_utils10.sha256Hex)(sub).slice(0, 32)}` : void 0;
3557
+ return sub ? `u:${(0, import_utils11.sha256Hex)(sub).slice(0, 32)}` : void 0;
3462
3558
  }
3463
3559
  }
3464
3560
  }
@@ -3499,7 +3595,7 @@ function errMsg3(err) {
3499
3595
  }
3500
3596
 
3501
3597
  // libs/auth/src/session/secure-store.factory.ts
3502
- var import_utils11 = require("@frontmcp/utils");
3598
+ var import_utils12 = require("@frontmcp/utils");
3503
3599
  function isCustomBackendConfig(config) {
3504
3600
  return typeof config === "object" && config !== null && "backend" in config && !!config.backend;
3505
3601
  }
@@ -3548,7 +3644,7 @@ async function createSecureStore(options) {
3548
3644
  if (storage) {
3549
3645
  adapter = storage;
3550
3646
  } else if (kind === "memory") {
3551
- adapter = new import_utils11.MemoryStorageAdapter();
3647
+ adapter = new import_utils12.MemoryStorageAdapter();
3552
3648
  await adapter.connect();
3553
3649
  } else {
3554
3650
  adapter = await createTokenStorageAdapter(toTokenStorageConfig(config));
@@ -3562,7 +3658,7 @@ async function createSecureStore(options) {
3562
3658
  }
3563
3659
 
3564
3660
  // libs/auth/src/session/token.vault.ts
3565
- var import_utils12 = require("@frontmcp/utils");
3661
+ var import_utils13 = require("@frontmcp/utils");
3566
3662
  var TokenVault = class {
3567
3663
  /** Active key used for new encryptions */
3568
3664
  active;
@@ -3591,14 +3687,14 @@ var TokenVault = class {
3591
3687
  this.keys.set(k.kid, k.key);
3592
3688
  }
3593
3689
  async encrypt(plaintext, opts) {
3594
- const iv = (0, import_utils12.randomBytes)(12);
3595
- const { ciphertext, tag } = await (0, import_utils12.encryptAesGcm)(this.active.key, new TextEncoder().encode(plaintext), iv);
3690
+ const iv = (0, import_utils13.randomBytes)(12);
3691
+ const { ciphertext, tag } = await (0, import_utils13.encryptAesGcm)(this.active.key, new TextEncoder().encode(plaintext), iv);
3596
3692
  return {
3597
3693
  alg: "A256GCM",
3598
3694
  kid: this.active.kid,
3599
- iv: (0, import_utils12.base64urlEncode)(iv),
3600
- tag: (0, import_utils12.base64urlEncode)(tag),
3601
- data: (0, import_utils12.base64urlEncode)(ciphertext),
3695
+ iv: (0, import_utils13.base64urlEncode)(iv),
3696
+ tag: (0, import_utils13.base64urlEncode)(tag),
3697
+ data: (0, import_utils13.base64urlEncode)(ciphertext),
3602
3698
  exp: opts?.exp,
3603
3699
  meta: opts?.meta
3604
3700
  };
@@ -3612,16 +3708,16 @@ var TokenVault = class {
3612
3708
  }
3613
3709
  const key = this.keys.get(blob.kid);
3614
3710
  if (!key) throw new Error(`vault_unknown_kid:${blob.kid}`);
3615
- const iv = (0, import_utils12.base64urlDecode)(blob.iv);
3616
- const tag = (0, import_utils12.base64urlDecode)(blob.tag);
3617
- const data = (0, import_utils12.base64urlDecode)(blob.data);
3618
- const plaintext = await (0, import_utils12.decryptAesGcm)(key, data, iv, tag);
3711
+ const iv = (0, import_utils13.base64urlDecode)(blob.iv);
3712
+ const tag = (0, import_utils13.base64urlDecode)(blob.tag);
3713
+ const data = (0, import_utils13.base64urlDecode)(blob.data);
3714
+ const plaintext = await (0, import_utils13.decryptAesGcm)(key, data, iv, tag);
3619
3715
  return new TextDecoder().decode(plaintext);
3620
3716
  }
3621
3717
  };
3622
3718
 
3623
3719
  // libs/auth/src/session/index.ts
3624
- var import_utils32 = require("@frontmcp/utils");
3720
+ var import_utils33 = require("@frontmcp/utils");
3625
3721
 
3626
3722
  // libs/auth/src/session/transport-session.types.ts
3627
3723
  var import_lazy_zod4 = require("@frontmcp/lazy-zod");
@@ -3717,10 +3813,10 @@ var redisConfigSchema = import_lazy_zod4.z.object({
3717
3813
  });
3718
3814
 
3719
3815
  // libs/auth/src/session/session-crypto.ts
3720
- var import_utils14 = require("@frontmcp/utils");
3816
+ var import_utils15 = require("@frontmcp/utils");
3721
3817
 
3722
3818
  // libs/auth/src/errors/auth-internal.error.ts
3723
- var import_utils13 = require("@frontmcp/utils");
3819
+ var import_utils14 = require("@frontmcp/utils");
3724
3820
  var AuthInternalError = class extends Error {
3725
3821
  /**
3726
3822
  * Unique error ID for tracking in logs.
@@ -3742,7 +3838,7 @@ var AuthInternalError = class extends Error {
3742
3838
  super(message);
3743
3839
  this.name = this.constructor.name;
3744
3840
  this.code = code;
3745
- this.errorId = `err_${(0, import_utils13.bytesToHex)((0, import_utils13.randomBytes)(8))}`;
3841
+ this.errorId = `err_${(0, import_utils14.bytesToHex)((0, import_utils14.randomBytes)(8))}`;
3746
3842
  Error.captureStackTrace(this, this.constructor);
3747
3843
  }
3748
3844
  /**
@@ -3802,6 +3898,22 @@ var SessionSecretRequiredError = class extends AuthInternalError {
3802
3898
  super(`Session secret is required for ${component}`, "SESSION_SECRET_REQUIRED");
3803
3899
  }
3804
3900
  };
3901
+ var JwtSecretRequiredError = class extends AuthInternalError {
3902
+ constructor(mode) {
3903
+ super(
3904
+ `JWT_SECRET is required in production for auth.mode "${mode}". Without it the server signs tokens with a random per-process secret, so every restart invalidates outstanding tokens and any second instance or isolate rejects tokens the first one minted.`,
3905
+ "JWT_SECRET_REQUIRED"
3906
+ );
3907
+ }
3908
+ };
3909
+ var JwtSecretWeakError = class extends AuthInternalError {
3910
+ constructor(byteLength) {
3911
+ super(
3912
+ `JWT_SECRET is ${byteLength} bytes; HS256 requires at least 32 (RFC 7518 \xA73.2). A shorter secret is guessable, and whoever guesses it can forge tokens for this server. Generate one with \`openssl rand -hex 32\`.`,
3913
+ "JWT_SECRET_INVALID"
3914
+ );
3915
+ }
3916
+ };
3805
3917
  var CredentialProviderAlreadyRegisteredError = class extends AuthInternalError {
3806
3918
  constructor(name) {
3807
3919
  super(`Credential provider "${name}" is already registered`, "CREDENTIAL_PROVIDER_ALREADY_REGISTERED");
@@ -3865,9 +3977,9 @@ var AuthFlowError = class extends AuthInternalError {
3865
3977
 
3866
3978
  // libs/auth/src/session/session-crypto.ts
3867
3979
  function getSigningSecret(config) {
3868
- const secret = config?.secret || (0, import_utils14.getEnv)("MCP_SESSION_SECRET");
3980
+ const secret = config?.secret || (0, import_utils15.getEnv)("MCP_SESSION_SECRET");
3869
3981
  if (!secret) {
3870
- if ((0, import_utils14.isProduction)()) {
3982
+ if ((0, import_utils15.isProduction)()) {
3871
3983
  throw new SessionSecretRequiredError("session signing");
3872
3984
  }
3873
3985
  console.warn("[SessionCrypto] MCP_SESSION_SECRET not set. Using insecure default for development only.");
@@ -3879,13 +3991,13 @@ function resolveConfig(config) {
3879
3991
  return { secret: getSigningSecret(config) };
3880
3992
  }
3881
3993
  function signSession(session, config) {
3882
- return (0, import_utils14.signData)(session, resolveConfig(config));
3994
+ return (0, import_utils15.signData)(session, resolveConfig(config));
3883
3995
  }
3884
3996
  function verifySession(signedData, config) {
3885
- return (0, import_utils14.verifyData)(signedData, resolveConfig(config));
3997
+ return (0, import_utils15.verifyData)(signedData, resolveConfig(config));
3886
3998
  }
3887
3999
  function verifyOrParseSession(data, config) {
3888
- return (0, import_utils14.verifyOrParseData)(data, resolveConfig(config));
4000
+ return (0, import_utils15.verifyOrParseData)(data, resolveConfig(config));
3889
4001
  }
3890
4002
 
3891
4003
  // libs/auth/src/session/session-rate-limiter.ts
@@ -4012,7 +4124,7 @@ var SessionRateLimiter = class {
4012
4124
  var defaultSessionRateLimiter = new SessionRateLimiter();
4013
4125
 
4014
4126
  // libs/auth/src/session/session.transport.ts
4015
- var import_utils15 = require("@frontmcp/utils");
4127
+ var import_utils16 = require("@frontmcp/utils");
4016
4128
  var TransportIdGenerator = class {
4017
4129
  /**
4018
4130
  * Create a transport session ID.
@@ -4021,7 +4133,7 @@ var TransportIdGenerator = class {
4021
4133
  * @returns A transport session ID (UUID without dashes)
4022
4134
  */
4023
4135
  static createId() {
4024
- return (0, import_utils15.randomUUID)().replace(/-/g, "");
4136
+ return (0, import_utils16.randomUUID)().replace(/-/g, "");
4025
4137
  }
4026
4138
  };
4027
4139
 
@@ -4070,7 +4182,7 @@ var TinyTtlCache = class {
4070
4182
  };
4071
4183
 
4072
4184
  // libs/auth/src/session/utils/auth-token.utils.ts
4073
- var import_utils16 = require("@frontmcp/utils");
4185
+ var import_utils17 = require("@frontmcp/utils");
4074
4186
  function isJwt(token) {
4075
4187
  if (!token) return false;
4076
4188
  return token.split(".").length === 3;
@@ -4080,7 +4192,7 @@ function getTokenSignatureFingerprint(token) {
4080
4192
  const sig = token.split(".")[2];
4081
4193
  if (sig) return sig;
4082
4194
  }
4083
- return (0, import_utils16.sha256Base64url)(token);
4195
+ return (0, import_utils17.sha256Base64url)(token);
4084
4196
  }
4085
4197
  function extractClaimValue(claims, key, validator) {
4086
4198
  const value = claims[key];
@@ -4112,26 +4224,26 @@ function extractBearerToken(header) {
4112
4224
  }
4113
4225
 
4114
4226
  // libs/auth/src/session/utils/session-crypto.utils.ts
4115
- var import_utils17 = require("@frontmcp/utils");
4227
+ var import_utils18 = require("@frontmcp/utils");
4116
4228
  var cachedKey = null;
4117
4229
  function getKey() {
4118
4230
  if (cachedKey) return cachedKey;
4119
- const secret = (0, import_utils17.getEnv)("MCP_SESSION_SECRET");
4231
+ const secret = (0, import_utils18.getEnv)("MCP_SESSION_SECRET");
4120
4232
  if (!secret) {
4121
- if ((0, import_utils17.isProduction)()) {
4233
+ if ((0, import_utils18.isProduction)()) {
4122
4234
  throw new SessionSecretRequiredError("session ID encryption");
4123
4235
  }
4124
4236
  console.warn(
4125
4237
  "[SessionIdUtils] Using machine ID as session encryption secret - NOT SECURE FOR PRODUCTION. Set MCP_SESSION_SECRET environment variable for secure session encryption."
4126
4238
  );
4127
4239
  }
4128
- const base = secret || (0, import_utils17.getMachineId)();
4129
- cachedKey = (0, import_utils17.sha256)(new TextEncoder().encode(base));
4240
+ const base = secret || (0, import_utils18.getMachineId)();
4241
+ cachedKey = (0, import_utils18.sha256)(new TextEncoder().encode(base));
4130
4242
  return cachedKey;
4131
4243
  }
4132
4244
  function encryptJson(obj) {
4133
4245
  const key = getKey();
4134
- const encrypted = (0, import_utils17.encryptValue)(obj, key);
4246
+ const encrypted = (0, import_utils18.encryptValue)(obj, key);
4135
4247
  return `${encrypted.iv}.${encrypted.tag}.${encrypted.data}`;
4136
4248
  }
4137
4249
  function decryptSessionJson(sessionId) {
@@ -4140,7 +4252,7 @@ function decryptSessionJson(sessionId) {
4140
4252
  const [ivB64, tagB64, ctB64] = parts;
4141
4253
  if (!ivB64 || !tagB64 || !ctB64) return null;
4142
4254
  const key = getKey();
4143
- return (0, import_utils17.decryptValue)({ alg: "A256GCM", iv: ivB64, tag: tagB64, data: ctB64 }, key);
4255
+ return (0, import_utils18.decryptValue)({ alg: "A256GCM", iv: ivB64, tag: tagB64, data: ctB64 }, key);
4144
4256
  }
4145
4257
  function safeDecrypt(sessionId) {
4146
4258
  try {
@@ -4154,11 +4266,11 @@ function resetCachedKey() {
4154
4266
  }
4155
4267
 
4156
4268
  // libs/auth/src/session/storage/index.ts
4157
- var import_utils21 = require("@frontmcp/utils");
4158
4269
  var import_utils22 = require("@frontmcp/utils");
4270
+ var import_utils23 = require("@frontmcp/utils");
4159
4271
 
4160
4272
  // libs/auth/src/session/storage/storage-token-store.ts
4161
- var import_utils18 = require("@frontmcp/utils");
4273
+ var import_utils19 = require("@frontmcp/utils");
4162
4274
  var StorageTokenStore = class {
4163
4275
  storage;
4164
4276
  namespace;
@@ -4170,13 +4282,13 @@ var StorageTokenStore = class {
4170
4282
  this.defaultTtlSeconds = options.defaultTtlSeconds;
4171
4283
  this.storageIsNamespaced = "namespace" in storage && typeof storage.namespace === "function";
4172
4284
  const namespacedStorage = this.storageIsNamespaced ? storage.namespace(this.namespace) : storage;
4173
- this.storage = new import_utils18.TypedStorage(namespacedStorage);
4285
+ this.storage = new import_utils19.TypedStorage(namespacedStorage);
4174
4286
  }
4175
4287
  /**
4176
4288
  * Allocate a new unique ID for a token record.
4177
4289
  */
4178
4290
  allocId() {
4179
- return (0, import_utils18.randomUUID)();
4291
+ return (0, import_utils19.randomUUID)();
4180
4292
  }
4181
4293
  /**
4182
4294
  * Store an encrypted token blob.
@@ -4239,7 +4351,7 @@ var StorageTokenStore = class {
4239
4351
  };
4240
4352
 
4241
4353
  // libs/auth/src/session/storage/storage-authorization-vault.ts
4242
- var import_utils19 = require("@frontmcp/utils");
4354
+ var import_utils20 = require("@frontmcp/utils");
4243
4355
  var StorageAuthorizationVault = class {
4244
4356
  storage;
4245
4357
  namespace;
@@ -4248,7 +4360,7 @@ var StorageAuthorizationVault = class {
4248
4360
  this.namespace = options.namespace ?? "vault";
4249
4361
  this.pendingAuthTtlMs = options.pendingAuthTtlMs ?? 10 * 60 * 1e3;
4250
4362
  const namespacedStorage = this.isNamespacedStorage(storage) ? storage.namespace(this.namespace) : storage;
4251
- this.storage = new import_utils19.TypedStorage(namespacedStorage, {
4363
+ this.storage = new import_utils20.TypedStorage(namespacedStorage, {
4252
4364
  schema: options.validateOnRead ? authorizationVaultEntrySchema : void 0,
4253
4365
  throwOnInvalid: false
4254
4366
  });
@@ -4259,7 +4371,7 @@ var StorageAuthorizationVault = class {
4259
4371
  async create(params) {
4260
4372
  const now = Date.now();
4261
4373
  const entry = {
4262
- id: (0, import_utils19.randomUUID)(),
4374
+ id: (0, import_utils20.randomUUID)(),
4263
4375
  userSub: params.userSub,
4264
4376
  userEmail: params.userEmail,
4265
4377
  userName: params.userName,
@@ -4333,7 +4445,7 @@ var StorageAuthorizationVault = class {
4333
4445
  }
4334
4446
  const now = Date.now();
4335
4447
  const pendingAuth = {
4336
- id: (0, import_utils19.randomUUID)(),
4448
+ id: (0, import_utils20.randomUUID)(),
4337
4449
  appId: params.appId,
4338
4450
  toolId: params.toolId,
4339
4451
  authUrl: params.authUrl,
@@ -4537,11 +4649,11 @@ var StorageAuthorizationVault = class {
4537
4649
  };
4538
4650
 
4539
4651
  // libs/auth/src/session/storage/in-memory-authorization-vault.ts
4540
- var import_utils20 = require("@frontmcp/utils");
4652
+ var import_utils21 = require("@frontmcp/utils");
4541
4653
  var InMemoryAuthorizationVault = class extends StorageAuthorizationVault {
4542
4654
  memoryAdapter;
4543
4655
  constructor(options = {}) {
4544
- const memoryAdapter = new import_utils20.MemoryStorageAdapter();
4656
+ const memoryAdapter = new import_utils21.MemoryStorageAdapter();
4545
4657
  super(memoryAdapter, {
4546
4658
  namespace: options.namespace ?? "vault",
4547
4659
  pendingAuthTtlMs: options.pendingAuthTtlMs
@@ -4562,7 +4674,7 @@ var InMemoryAuthorizationVault = class extends StorageAuthorizationVault {
4562
4674
  };
4563
4675
 
4564
4676
  // libs/auth/src/session/redis-session.store.ts
4565
- var import_utils23 = require("@frontmcp/utils");
4677
+ var import_utils24 = require("@frontmcp/utils");
4566
4678
  var RedisSessionStore = class {
4567
4679
  storage;
4568
4680
  keyPrefix;
@@ -4584,14 +4696,14 @@ var RedisSessionStore = class {
4584
4696
  });
4585
4697
  }
4586
4698
  if ("redis" in config && config.redis) {
4587
- this.storage = new import_utils23.RedisStorageAdapter({
4699
+ this.storage = new import_utils24.RedisStorageAdapter({
4588
4700
  client: config.redis,
4589
4701
  keyPrefix: this.keyPrefix
4590
4702
  });
4591
4703
  this.externalInstance = true;
4592
4704
  } else {
4593
4705
  const redisConfig = config;
4594
- this.storage = new import_utils23.RedisStorageAdapter({
4706
+ this.storage = new import_utils24.RedisStorageAdapter({
4595
4707
  config: {
4596
4708
  host: redisConfig.host,
4597
4709
  port: redisConfig.port ?? 6379,
@@ -4773,7 +4885,7 @@ var RedisSessionStore = class {
4773
4885
  * Allocate a new session ID
4774
4886
  */
4775
4887
  allocId() {
4776
- return (0, import_utils23.randomUUID)();
4888
+ return (0, import_utils24.randomUUID)();
4777
4889
  }
4778
4890
  /**
4779
4891
  * Disconnect from Redis (only if we created the connection)
@@ -4809,7 +4921,7 @@ var RedisSessionStore = class {
4809
4921
  };
4810
4922
 
4811
4923
  // libs/auth/src/session/vercel-kv-session.store.ts
4812
- var import_utils24 = require("@frontmcp/utils");
4924
+ var import_utils25 = require("@frontmcp/utils");
4813
4925
  var VercelKvSessionStore = class {
4814
4926
  storage;
4815
4927
  keyPrefix;
@@ -4829,7 +4941,7 @@ var VercelKvSessionStore = class {
4829
4941
  maxRequests: this.security.rateLimiting?.maxRequests
4830
4942
  });
4831
4943
  }
4832
- this.storage = new import_utils24.VercelKvStorageAdapter({
4944
+ this.storage = new import_utils25.VercelKvStorageAdapter({
4833
4945
  url: config.url,
4834
4946
  token: config.token,
4835
4947
  keyPrefix: this.keyPrefix
@@ -5003,7 +5115,7 @@ var VercelKvSessionStore = class {
5003
5115
  * Allocate a new session ID
5004
5116
  */
5005
5117
  allocId() {
5006
- return (0, import_utils24.randomUUID)();
5118
+ return (0, import_utils25.randomUUID)();
5007
5119
  }
5008
5120
  /**
5009
5121
  * Disconnect from Vercel KV
@@ -5032,7 +5144,7 @@ var VercelKvSessionStore = class {
5032
5144
  };
5033
5145
 
5034
5146
  // libs/auth/src/session/orchestrated-token.store.ts
5035
- var import_utils25 = require("@frontmcp/utils");
5147
+ var import_utils26 = require("@frontmcp/utils");
5036
5148
  var InMemoryOrchestratedTokenStore = class {
5037
5149
  /** Token storage: Map<compositeKey, ProviderTokenRecord> */
5038
5150
  tokens = /* @__PURE__ */ new Map();
@@ -5074,7 +5186,7 @@ var InMemoryOrchestratedTokenStore = class {
5074
5186
  }
5075
5187
  const info = new TextEncoder().encode(`orchestrated-token:${compositeKey}`);
5076
5188
  const salt = new TextEncoder().encode("frontmcp-token-store");
5077
- const derivedKey = (0, import_utils25.hkdfSha256)(this.encryptionKey, salt, info, 32);
5189
+ const derivedKey = (0, import_utils26.hkdfSha256)(this.encryptionKey, salt, info, 32);
5078
5190
  this.derivedKeys.set(compositeKey, derivedKey);
5079
5191
  return derivedKey;
5080
5192
  }
@@ -5084,8 +5196,8 @@ var InMemoryOrchestratedTokenStore = class {
5084
5196
  async encryptRecord(compositeKey, record) {
5085
5197
  const key = await this.deriveKeyForRecord(compositeKey);
5086
5198
  const plaintext = JSON.stringify(record);
5087
- const iv = (0, import_utils25.randomBytes)(12);
5088
- const { ciphertext, tag } = (0, import_utils25.encryptAesGcm)(key, new TextEncoder().encode(plaintext), iv);
5199
+ const iv = (0, import_utils26.randomBytes)(12);
5200
+ const { ciphertext, tag } = (0, import_utils26.encryptAesGcm)(key, new TextEncoder().encode(plaintext), iv);
5089
5201
  return JSON.stringify({
5090
5202
  iv: Buffer.from(iv).toString("base64url"),
5091
5203
  tag: Buffer.from(tag).toString("base64url"),
@@ -5101,7 +5213,7 @@ var InMemoryOrchestratedTokenStore = class {
5101
5213
  const ivBytes = Buffer.from(iv, "base64url");
5102
5214
  const tagBytes = Buffer.from(tag, "base64url");
5103
5215
  const ciphertextBytes = Buffer.from(data, "base64url");
5104
- const plaintext = (0, import_utils25.decryptAesGcm)(key, ciphertextBytes, ivBytes, tagBytes);
5216
+ const plaintext = (0, import_utils26.decryptAesGcm)(key, ciphertextBytes, ivBytes, tagBytes);
5105
5217
  return JSON.parse(new TextDecoder().decode(plaintext));
5106
5218
  }
5107
5219
  /**
@@ -5303,7 +5415,7 @@ var InMemoryOrchestratedTokenStore = class {
5303
5415
  };
5304
5416
 
5305
5417
  // libs/auth/src/session/orchestrated-token.crypto.ts
5306
- var import_utils26 = require("@frontmcp/utils");
5418
+ var import_utils27 = require("@frontmcp/utils");
5307
5419
  var HKDF_SALT = new TextEncoder().encode("frontmcp-token-store");
5308
5420
  function deriveKeyForRecord(masterKey, compositeKey, cache) {
5309
5421
  const cached = cache.get(compositeKey);
@@ -5311,14 +5423,14 @@ function deriveKeyForRecord(masterKey, compositeKey, cache) {
5311
5423
  return cached;
5312
5424
  }
5313
5425
  const info = new TextEncoder().encode(`orchestrated-token:${compositeKey}`);
5314
- const derived = (0, import_utils26.hkdfSha256)(masterKey, HKDF_SALT, info, 32);
5426
+ const derived = (0, import_utils27.hkdfSha256)(masterKey, HKDF_SALT, info, 32);
5315
5427
  cache.set(compositeKey, derived);
5316
5428
  return derived;
5317
5429
  }
5318
5430
  function encryptRecord(key, record) {
5319
5431
  const plaintext = JSON.stringify(record);
5320
- const iv = (0, import_utils26.randomBytes)(12);
5321
- const { ciphertext, tag } = (0, import_utils26.encryptAesGcm)(key, new TextEncoder().encode(plaintext), iv);
5432
+ const iv = (0, import_utils27.randomBytes)(12);
5433
+ const { ciphertext, tag } = (0, import_utils27.encryptAesGcm)(key, new TextEncoder().encode(plaintext), iv);
5322
5434
  return JSON.stringify({
5323
5435
  iv: Buffer.from(iv).toString("base64url"),
5324
5436
  tag: Buffer.from(tag).toString("base64url"),
@@ -5330,7 +5442,7 @@ function decryptRecord(key, encrypted) {
5330
5442
  const ivBytes = Buffer.from(iv, "base64url");
5331
5443
  const tagBytes = Buffer.from(tag, "base64url");
5332
5444
  const ciphertextBytes = Buffer.from(data, "base64url");
5333
- const plaintext = (0, import_utils26.decryptAesGcm)(key, ciphertextBytes, ivBytes, tagBytes);
5445
+ const plaintext = (0, import_utils27.decryptAesGcm)(key, ciphertextBytes, ivBytes, tagBytes);
5334
5446
  return JSON.parse(new TextDecoder().decode(plaintext));
5335
5447
  }
5336
5448
 
@@ -5509,7 +5621,7 @@ var StorageOrchestratedTokenStore = class {
5509
5621
  };
5510
5622
 
5511
5623
  // libs/auth/src/session/federated-auth.session.ts
5512
- var import_utils27 = require("@frontmcp/utils");
5624
+ var import_utils28 = require("@frontmcp/utils");
5513
5625
  function toSessionRecord(session) {
5514
5626
  return {
5515
5627
  ...session,
@@ -5584,7 +5696,7 @@ var InMemoryFederatedAuthSessionStore = class {
5584
5696
  createSession(params) {
5585
5697
  const now = Date.now();
5586
5698
  return {
5587
- id: (0, import_utils27.randomUUID)(),
5699
+ id: (0, import_utils28.randomUUID)(),
5588
5700
  pendingAuthId: params.pendingAuthId,
5589
5701
  clientId: params.clientId,
5590
5702
  redirectUri: params.redirectUri,
@@ -5616,7 +5728,7 @@ var InMemoryFederatedAuthSessionStore = class {
5616
5728
  function createFederatedAuthSession(params, ttlMs = 15 * 60 * 1e3) {
5617
5729
  const now = Date.now();
5618
5730
  return {
5619
- id: (0, import_utils27.randomUUID)(),
5731
+ id: (0, import_utils28.randomUUID)(),
5620
5732
  pendingAuthId: params.pendingAuthId,
5621
5733
  clientId: params.clientId,
5622
5734
  redirectUri: params.redirectUri,
@@ -5673,7 +5785,7 @@ function startNextProvider(session, pkce, state) {
5673
5785
  }
5674
5786
 
5675
5787
  // libs/auth/src/session/storage-federated-auth.session.ts
5676
- var import_utils28 = require("@frontmcp/utils");
5788
+ var import_utils29 = require("@frontmcp/utils");
5677
5789
  var StorageFederatedAuthSessionStore = class {
5678
5790
  storage;
5679
5791
  namespace;
@@ -5682,7 +5794,7 @@ var StorageFederatedAuthSessionStore = class {
5682
5794
  this.namespace = options.namespace ?? "fed";
5683
5795
  this.storageIsNamespaced = this.isNamespacedStorage(storage);
5684
5796
  const namespacedStorage = this.storageIsNamespaced ? storage.namespace(this.namespace) : storage;
5685
- this.storage = new import_utils28.TypedStorage(namespacedStorage);
5797
+ this.storage = new import_utils29.TypedStorage(namespacedStorage);
5686
5798
  }
5687
5799
  async store(session) {
5688
5800
  await this.put(session);
@@ -5753,7 +5865,7 @@ var InMemoryConsentStore = class {
5753
5865
  };
5754
5866
 
5755
5867
  // libs/auth/src/session/storage-consent.store.ts
5756
- var import_utils29 = require("@frontmcp/utils");
5868
+ var import_utils30 = require("@frontmcp/utils");
5757
5869
  var StorageConsentStore = class {
5758
5870
  storage;
5759
5871
  namespace;
@@ -5762,7 +5874,7 @@ var StorageConsentStore = class {
5762
5874
  this.namespace = options.namespace ?? "remembered-consent";
5763
5875
  this.storageIsNamespaced = this.isNamespacedStorage(storage);
5764
5876
  const namespacedStorage = this.storageIsNamespaced ? storage.namespace(this.namespace) : storage;
5765
- this.storage = new import_utils29.TypedStorage(namespacedStorage);
5877
+ this.storage = new import_utils30.TypedStorage(namespacedStorage);
5766
5878
  }
5767
5879
  async get(userSub, clientId) {
5768
5880
  return this.storage.get(this.key(userSub, clientId));
@@ -5784,7 +5896,7 @@ var StorageConsentStore = class {
5784
5896
 
5785
5897
  // libs/auth/src/session/encrypted-authorization-vault.ts
5786
5898
  var import_lazy_zod5 = require("@frontmcp/lazy-zod");
5787
- var import_utils30 = require("@frontmcp/utils");
5899
+ var import_utils31 = require("@frontmcp/utils");
5788
5900
  var redisVaultEntrySchema = import_lazy_zod5.z.object({
5789
5901
  /** Vault ID */
5790
5902
  id: import_lazy_zod5.z.string(),
@@ -5809,7 +5921,7 @@ var redisVaultEntrySchema = import_lazy_zod5.z.object({
5809
5921
  /** Encrypted sensitive data blob */
5810
5922
  encrypted: encryptedDataSchema
5811
5923
  });
5812
- var encryptionContextStorage = new import_utils30.AsyncLocalStorage();
5924
+ var encryptionContextStorage = new import_utils31.AsyncLocalStorage();
5813
5925
  var EncryptedRedisVault = class {
5814
5926
  constructor(redis, encryption, namespace = "vault:") {
5815
5927
  this.redis = redis;
@@ -5945,7 +6057,7 @@ var EncryptedRedisVault = class {
5945
6057
  async create(params) {
5946
6058
  const now = Date.now();
5947
6059
  const entry = {
5948
- id: (0, import_utils30.randomUUID)(),
6060
+ id: (0, import_utils31.randomUUID)(),
5949
6061
  userSub: params.userSub,
5950
6062
  userEmail: params.userEmail,
5951
6063
  userName: params.userName,
@@ -6004,7 +6116,7 @@ var EncryptedRedisVault = class {
6004
6116
  }
6005
6117
  const now = Date.now();
6006
6118
  const pendingAuth = {
6007
- id: (0, import_utils30.randomUUID)(),
6119
+ id: (0, import_utils31.randomUUID)(),
6008
6120
  appId: params.appId,
6009
6121
  toolId: params.toolId,
6010
6122
  authUrl: params.authUrl,
@@ -6182,7 +6294,7 @@ function createEncryptedVault(redis, config = {}) {
6182
6294
  }
6183
6295
 
6184
6296
  // libs/auth/src/session/token.refresh.ts
6185
- var import_utils31 = require("@frontmcp/utils");
6297
+ var import_utils32 = require("@frontmcp/utils");
6186
6298
  function toEpochSeconds(exp) {
6187
6299
  if (exp == null) return void 0;
6188
6300
  if (exp instanceof Date) return Math.floor(exp.getTime() / 1e3);
@@ -6204,7 +6316,7 @@ function tryJwtExp(token) {
6204
6316
  const parts = token.split(".");
6205
6317
  if (parts.length < 2) return void 0;
6206
6318
  try {
6207
- const json = JSON.parse(new TextDecoder().decode((0, import_utils31.base64urlDecode)(parts[1])));
6319
+ const json = JSON.parse(new TextDecoder().decode((0, import_utils32.base64urlDecode)(parts[1])));
6208
6320
  const e = json?.exp;
6209
6321
  return typeof e === "number" ? toEpochSeconds(e) : void 0;
6210
6322
  } catch {
@@ -6267,7 +6379,7 @@ var progressiveAuthStateSchema = import_lazy_zod6.z.object({
6267
6379
  });
6268
6380
 
6269
6381
  // libs/auth/src/authorization/authorization.class.ts
6270
- var import_utils34 = require("@frontmcp/utils");
6382
+ var import_utils35 = require("@frontmcp/utils");
6271
6383
  var AuthorizationBase = class _AuthorizationBase {
6272
6384
  id;
6273
6385
  isAnonymous;
@@ -6315,14 +6427,14 @@ var AuthorizationBase = class _AuthorizationBase {
6315
6427
  * @param fingerprint - Optional client fingerprint for tracking
6316
6428
  */
6317
6429
  createTransportSession(protocol, fingerprint) {
6318
- const sessionId = (0, import_utils34.randomUUID)();
6430
+ const sessionId = (0, import_utils35.randomUUID)();
6319
6431
  const session = {
6320
6432
  id: sessionId,
6321
6433
  authorizationId: this.id,
6322
6434
  protocol,
6323
6435
  createdAt: Date.now(),
6324
6436
  expiresAt: this.expiresAt,
6325
- nodeId: (0, import_utils34.getMachineId)(),
6437
+ nodeId: (0, import_utils35.getMachineId)(),
6326
6438
  clientFingerprint: fingerprint
6327
6439
  };
6328
6440
  this.#sessions.set(session.id, session);
@@ -6393,11 +6505,22 @@ var AuthorizationBase = class _AuthorizationBase {
6393
6505
  /**
6394
6506
  * Build URL for progressive/incremental authorization.
6395
6507
  * Used when a tool requires authorization for an app that was skipped during initial auth.
6508
+ *
6509
+ * The URL only SKIPS the login step when it carries a valid incremental
6510
+ * ticket (GHSA-2c4g-9c8x-6m8g) — mint one with
6511
+ * {@link signIncrementalAuthTicket} using the server signing secret and pass
6512
+ * it here. Without a ticket the link still works, but the user completes an
6513
+ * ordinary login; `mode=incremental` alone is no longer an authorization
6514
+ * signal and is not emitted.
6515
+ *
6396
6516
  * @param appId - App ID that requires authorization
6397
6517
  * @param baseUrl - Base URL of the server
6518
+ * @param ticket - Signed incremental-authorization ticket for this subject
6398
6519
  */
6399
- getProgressiveAuthUrl(appId, baseUrl) {
6400
- return `${baseUrl}/oauth/authorize?app=${encodeURIComponent(appId)}&mode=incremental`;
6520
+ getProgressiveAuthUrl(appId, baseUrl, ticket) {
6521
+ const params = new URLSearchParams({ app: appId });
6522
+ if (ticket) params.set("ticket", ticket);
6523
+ return `${baseUrl}/oauth/authorize?${params.toString()}`;
6401
6524
  }
6402
6525
  /**
6403
6526
  * Check if the authorization is expired
@@ -6452,7 +6575,7 @@ var AuthorizationBase = class _AuthorizationBase {
6452
6575
  */
6453
6576
  static isJwtHeader(segment) {
6454
6577
  try {
6455
- const bytes = (0, import_utils34.base64urlDecode)(segment);
6578
+ const bytes = (0, import_utils35.base64urlDecode)(segment);
6456
6579
  const text = new TextDecoder().decode(bytes);
6457
6580
  const parsed = JSON.parse(text);
6458
6581
  return typeof parsed === "object" && parsed !== null && typeof parsed.alg === "string";
@@ -6504,7 +6627,7 @@ var AuthorizationBase = class _AuthorizationBase {
6504
6627
  };
6505
6628
 
6506
6629
  // libs/auth/src/authorization/public.authorization.ts
6507
- var import_utils35 = require("@frontmcp/utils");
6630
+ var import_utils36 = require("@frontmcp/utils");
6508
6631
  var PublicAuthorization = class _PublicAuthorization extends AuthorizationBase {
6509
6632
  mode = "public";
6510
6633
  /**
@@ -6540,7 +6663,7 @@ var PublicAuthorization = class _PublicAuthorization extends AuthorizationBase {
6540
6663
  allowedTools = "all",
6541
6664
  allowedPrompts = "all"
6542
6665
  } = ctx;
6543
- const uuid = (0, import_utils35.randomUUID)();
6666
+ const uuid = (0, import_utils36.randomUUID)();
6544
6667
  const sub = `${prefix}:${uuid}`;
6545
6668
  const user = {
6546
6669
  sub,
@@ -6624,7 +6747,7 @@ var PublicAuthorization = class _PublicAuthorization extends AuthorizationBase {
6624
6747
  };
6625
6748
 
6626
6749
  // libs/auth/src/authorization/transparent.authorization.ts
6627
- var import_utils36 = require("@frontmcp/utils");
6750
+ var import_utils37 = require("@frontmcp/utils");
6628
6751
  var TransparentAuthorization = class _TransparentAuthorization extends AuthorizationBase {
6629
6752
  mode = "transparent";
6630
6753
  /**
@@ -6724,7 +6847,7 @@ var TransparentAuthorization = class _TransparentAuthorization extends Authoriza
6724
6847
  static generateAuthorizationId(token) {
6725
6848
  const parts = token.split(".");
6726
6849
  const signature = parts[2] || token;
6727
- return (0, import_utils36.sha256Hex)(signature).substring(0, 16);
6850
+ return (0, import_utils37.sha256Hex)(signature).substring(0, 16);
6728
6851
  }
6729
6852
  /**
6730
6853
  * Get the issuer from the token claims
@@ -6750,11 +6873,11 @@ var TransparentAuthorization = class _TransparentAuthorization extends Authoriza
6750
6873
  };
6751
6874
 
6752
6875
  // libs/auth/src/utils/authorization-id.utils.ts
6753
- var import_utils37 = require("@frontmcp/utils");
6876
+ var import_utils38 = require("@frontmcp/utils");
6754
6877
  function deriveAuthorizationId(token) {
6755
6878
  const parts = token.split(".");
6756
6879
  const signature = parts[2] || token;
6757
- return (0, import_utils37.sha256Hex)(signature).substring(0, 16);
6880
+ return (0, import_utils38.sha256Hex)(signature).substring(0, 16);
6758
6881
  }
6759
6882
 
6760
6883
  // libs/auth/src/authorization/orchestrated.authorization.ts
@@ -7123,7 +7246,7 @@ var OrchestratedAuthAccessorAdapter = class {
7123
7246
  };
7124
7247
 
7125
7248
  // libs/auth/src/authorization/dcr-client.registry.ts
7126
- var import_utils38 = require("@frontmcp/utils");
7249
+ var import_utils39 = require("@frontmcp/utils");
7127
7250
  var DEFAULT_MAX_DYNAMIC_CLIENTS = 1e3;
7128
7251
  function globMatch(pattern, input) {
7129
7252
  let p = 0;
@@ -7249,7 +7372,7 @@ var DcrClientRegistry = class {
7249
7372
  if (!isConfidential) return "ok";
7250
7373
  if (!client.client_secret) return "invalid";
7251
7374
  if (!presentedSecret) return "invalid";
7252
- return (0, import_utils38.timingSafeEqual)((0, import_utils38.sha256)(presentedSecret), (0, import_utils38.sha256)(client.client_secret)) ? "ok" : "invalid";
7375
+ return (0, import_utils39.timingSafeEqual)((0, import_utils39.sha256)(presentedSecret), (0, import_utils39.sha256)(client.client_secret)) ? "ok" : "invalid";
7253
7376
  }
7254
7377
  /** Whether a client id is known to the registry. */
7255
7378
  has(clientId) {
@@ -7337,7 +7460,7 @@ var DcrClientRegistry = class {
7337
7460
  if (typeof presented !== "string" || presented.length === 0) {
7338
7461
  return false;
7339
7462
  }
7340
- return (0, import_utils38.timingSafeEqual)((0, import_utils38.sha256)(presented), (0, import_utils38.sha256)(expected));
7463
+ return (0, import_utils39.timingSafeEqual)((0, import_utils39.sha256)(presented), (0, import_utils39.sha256)(expected));
7341
7464
  }
7342
7465
  };
7343
7466
 
@@ -8457,10 +8580,48 @@ var publicAuthOptionsSchema = import_lazy_zod11.z.object({
8457
8580
  signKey: jwkSchema.or(import_lazy_zod11.z.instanceof(Uint8Array)).optional()
8458
8581
  });
8459
8582
 
8460
- // libs/auth/src/options/transparent.schema.ts
8583
+ // libs/auth/src/options/static.schema.ts
8461
8584
  var import_lazy_zod12 = require("@frontmcp/lazy-zod");
8462
- var transparentAuthOptionsSchema = import_lazy_zod12.z.object({
8463
- mode: import_lazy_zod12.z.literal("transparent"),
8585
+ var staticAuthOptionsSchema = import_lazy_zod12.z.object({
8586
+ mode: import_lazy_zod12.z.literal("static"),
8587
+ /**
8588
+ * Accepted credentials. Compared against the presented one in constant time,
8589
+ * over SHA-256 digests so neither the value nor its length leaks by timing.
8590
+ *
8591
+ * Read these from the environment — never commit them.
8592
+ */
8593
+ tokens: import_lazy_zod12.z.array(import_lazy_zod12.z.string().min(1)).min(1),
8594
+ /**
8595
+ * Request header carrying the credential.
8596
+ * @default 'authorization'
8597
+ */
8598
+ header: import_lazy_zod12.z.string().min(1).default("authorization"),
8599
+ /**
8600
+ * Scheme prefix to strip before comparing, matched case-insensitively. Set to
8601
+ * an empty string for headers that carry a bare token (e.g. `x-api-key`).
8602
+ * @default 'Bearer'
8603
+ */
8604
+ scheme: import_lazy_zod12.z.string().default("Bearer"),
8605
+ /**
8606
+ * Scopes granted to a request that presents a valid token.
8607
+ * @default ['static']
8608
+ */
8609
+ scopes: import_lazy_zod12.z.array(import_lazy_zod12.z.string()).default(["static"]),
8610
+ /**
8611
+ * Realm reported in the `WWW-Authenticate` challenge on failure.
8612
+ * @default 'mcp'
8613
+ */
8614
+ realm: import_lazy_zod12.z.string().default("mcp"),
8615
+ /**
8616
+ * Tool/prompt access configuration, same shape the other modes accept.
8617
+ */
8618
+ publicAccess: publicAccessConfigSchema.optional()
8619
+ });
8620
+
8621
+ // libs/auth/src/options/transparent.schema.ts
8622
+ var import_lazy_zod13 = require("@frontmcp/lazy-zod");
8623
+ var transparentAuthOptionsSchema = import_lazy_zod13.z.object({
8624
+ mode: import_lazy_zod13.z.literal("transparent"),
8464
8625
  /**
8465
8626
  * Flattened remote provider fields (provider, clientId, clientSecret, scopes, providerConfig)
8466
8627
  */
@@ -8469,28 +8630,28 @@ var transparentAuthOptionsSchema = import_lazy_zod12.z.object({
8469
8630
  * Expected token audience
8470
8631
  * If not set, defaults to the resource URL
8471
8632
  */
8472
- expectedAudience: import_lazy_zod12.z.union([import_lazy_zod12.z.string(), import_lazy_zod12.z.array(import_lazy_zod12.z.string())]).optional(),
8633
+ expectedAudience: import_lazy_zod13.z.union([import_lazy_zod13.z.string(), import_lazy_zod13.z.array(import_lazy_zod13.z.string())]).optional(),
8473
8634
  /**
8474
8635
  * Require an `aud` claim (reject audience-less tokens). Defaults to `false`
8475
8636
  * for IdP compatibility; set `true` to reject tokens with no audience.
8476
8637
  */
8477
- requireAudience: import_lazy_zod12.z.boolean().optional(),
8638
+ requireAudience: import_lazy_zod13.z.boolean().optional(),
8478
8639
  /**
8479
8640
  * Required scopes for access
8480
8641
  * Empty array means any valid token is accepted
8481
8642
  * @default []
8482
8643
  */
8483
- requiredScopes: import_lazy_zod12.z.array(import_lazy_zod12.z.string()).default([]),
8644
+ requiredScopes: import_lazy_zod13.z.array(import_lazy_zod13.z.string()).default([]),
8484
8645
  /**
8485
8646
  * Allow anonymous fallback when no token is provided
8486
8647
  * @default false
8487
8648
  */
8488
- allowAnonymous: import_lazy_zod12.z.boolean().default(false),
8649
+ allowAnonymous: import_lazy_zod13.z.boolean().default(false),
8489
8650
  /**
8490
8651
  * Scopes granted to anonymous sessions (when allowAnonymous=true)
8491
8652
  * @default ['anonymous']
8492
8653
  */
8493
- anonymousScopes: import_lazy_zod12.z.array(import_lazy_zod12.z.string()).default(["anonymous"]),
8654
+ anonymousScopes: import_lazy_zod13.z.array(import_lazy_zod13.z.string()).default(["anonymous"]),
8494
8655
  /**
8495
8656
  * Public access config for anonymous users (when allowAnonymous=true)
8496
8657
  */
@@ -8498,13 +8659,13 @@ var transparentAuthOptionsSchema = import_lazy_zod12.z.object({
8498
8659
  });
8499
8660
 
8500
8661
  // libs/auth/src/options/orchestrated.schema.ts
8501
- var import_lazy_zod13 = require("@frontmcp/lazy-zod");
8502
- var authSlotSchema = import_lazy_zod13.z.enum(["login", "consent", "incremental", "federated", "error"]);
8503
- var authUiMapSchema = import_lazy_zod13.z.partialRecord(authSlotSchema, import_lazy_zod13.z.string().min(1));
8504
- var authExtraHandlerSchema = import_lazy_zod13.z.custom((v) => typeof v === "function", {
8662
+ var import_lazy_zod14 = require("@frontmcp/lazy-zod");
8663
+ var authSlotSchema = import_lazy_zod14.z.enum(["login", "consent", "incremental", "federated", "error"]);
8664
+ var authUiMapSchema = import_lazy_zod14.z.partialRecord(authSlotSchema, import_lazy_zod14.z.string().min(1));
8665
+ var authExtraHandlerSchema = import_lazy_zod14.z.custom((v) => typeof v === "function", {
8505
8666
  message: "auth.extras entries must be handler functions (input, ctx) => AuthExtraResult."
8506
8667
  });
8507
- var authExtrasMapSchema = import_lazy_zod13.z.record(import_lazy_zod13.z.string().min(1), authExtraHandlerSchema);
8668
+ var authExtrasMapSchema = import_lazy_zod14.z.record(import_lazy_zod14.z.string().min(1), authExtraHandlerSchema);
8508
8669
  var sharedAuthFields = {
8509
8670
  local: localSigningConfigSchema.optional(),
8510
8671
  tokenStorage: tokenStorageConfigSchema.default("memory"),
@@ -8512,13 +8673,13 @@ var sharedAuthFields = {
8512
8673
  // Optional (no default) so an unset value resolves to the in-memory encrypted
8513
8674
  // default at runtime; existing configs are unaffected.
8514
8675
  secureStore: secureStoreConfigSchema.optional(),
8515
- allowDefaultPublic: import_lazy_zod13.z.boolean().default(false),
8516
- anonymousScopes: import_lazy_zod13.z.array(import_lazy_zod13.z.string()).default(["anonymous"]),
8676
+ allowDefaultPublic: import_lazy_zod14.z.boolean().default(false),
8677
+ anonymousScopes: import_lazy_zod14.z.array(import_lazy_zod14.z.string()).default(["anonymous"]),
8517
8678
  publicAccess: publicAccessConfigSchema.optional(),
8518
8679
  consent: consentConfigSchema.optional(),
8519
8680
  federatedAuth: federatedAuthConfigSchema.optional(),
8520
8681
  refresh: tokenRefreshConfigSchema.optional(),
8521
- expectedAudience: import_lazy_zod13.z.union([import_lazy_zod13.z.string(), import_lazy_zod13.z.array(import_lazy_zod13.z.string())]).optional(),
8682
+ expectedAudience: import_lazy_zod14.z.union([import_lazy_zod14.z.string(), import_lazy_zod14.z.array(import_lazy_zod14.z.string())]).optional(),
8522
8683
  incrementalAuth: incrementalAuthConfigSchema.optional(),
8523
8684
  /**
8524
8685
  * Require the OAuth client to be KNOWN (registered via DCR / pre-registered,
@@ -8534,46 +8695,46 @@ var sharedAuthFields = {
8534
8695
  * matching for every client. Clients on a configured
8535
8696
  * `dcr.allowedRedirectUris` allowlist still pass.
8536
8697
  */
8537
- requireRegisteredClients: import_lazy_zod13.z.boolean().default(false),
8698
+ requireRegisteredClients: import_lazy_zod14.z.boolean().default(false),
8538
8699
  cimd: cimdConfigSchema.optional(),
8539
8700
  // #469 — custom auth UI as a slot→file map + extras name→handler map (per-app
8540
8701
  // under splitByApp). Both optional; omitting them serves the built-in pages.
8541
8702
  ui: authUiMapSchema.optional(),
8542
8703
  extras: authExtrasMapSchema.optional()
8543
8704
  };
8544
- var loginFieldSchema = import_lazy_zod13.z.object({
8545
- type: import_lazy_zod13.z.enum(["text", "password", "email", "select", "hidden"]),
8546
- label: import_lazy_zod13.z.string().optional(),
8547
- required: import_lazy_zod13.z.boolean().optional(),
8548
- placeholder: import_lazy_zod13.z.string().optional(),
8549
- options: import_lazy_zod13.z.array(import_lazy_zod13.z.object({ value: import_lazy_zod13.z.string(), label: import_lazy_zod13.z.string() })).optional()
8705
+ var loginFieldSchema = import_lazy_zod14.z.object({
8706
+ type: import_lazy_zod14.z.enum(["text", "password", "email", "select", "hidden"]),
8707
+ label: import_lazy_zod14.z.string().optional(),
8708
+ required: import_lazy_zod14.z.boolean().optional(),
8709
+ placeholder: import_lazy_zod14.z.string().optional(),
8710
+ options: import_lazy_zod14.z.array(import_lazy_zod14.z.object({ value: import_lazy_zod14.z.string(), label: import_lazy_zod14.z.string() })).optional()
8550
8711
  });
8551
- var loginConfigSchema = import_lazy_zod13.z.object({
8552
- title: import_lazy_zod13.z.string().optional(),
8553
- subtitle: import_lazy_zod13.z.string().optional(),
8554
- logoUri: import_lazy_zod13.z.string().optional(),
8555
- fields: import_lazy_zod13.z.record(import_lazy_zod13.z.string(), loginFieldSchema).optional(),
8712
+ var loginConfigSchema = import_lazy_zod14.z.object({
8713
+ title: import_lazy_zod14.z.string().optional(),
8714
+ subtitle: import_lazy_zod14.z.string().optional(),
8715
+ logoUri: import_lazy_zod14.z.string().optional(),
8716
+ fields: import_lazy_zod14.z.record(import_lazy_zod14.z.string(), loginFieldSchema).optional(),
8556
8717
  // Full HTML override — a function, validated structurally like other callbacks
8557
8718
  // in the codebase (see http/cors handlers using z.custom<…>).
8558
- render: import_lazy_zod13.z.custom((v) => typeof v === "function", {
8719
+ render: import_lazy_zod14.z.custom((v) => typeof v === "function", {
8559
8720
  message: "login.render must be a function"
8560
8721
  }).optional(),
8561
- subject: import_lazy_zod13.z.object({
8562
- fromField: import_lazy_zod13.z.string().optional(),
8563
- strategy: import_lazy_zod13.z.enum(["per-session", "per-account"]).optional()
8722
+ subject: import_lazy_zod14.z.object({
8723
+ fromField: import_lazy_zod14.z.string().optional(),
8724
+ strategy: import_lazy_zod14.z.enum(["per-session", "per-account"]).optional()
8564
8725
  }).optional()
8565
8726
  });
8566
- var authenticateFnSchema = import_lazy_zod13.z.custom((v) => typeof v === "function", {
8727
+ var authenticateFnSchema = import_lazy_zod14.z.custom((v) => typeof v === "function", {
8567
8728
  message: "authenticate must be a function"
8568
8729
  });
8569
- var localAuthSchema = import_lazy_zod13.z.object({
8570
- mode: import_lazy_zod13.z.literal("local"),
8730
+ var localAuthSchema = import_lazy_zod14.z.object({
8731
+ mode: import_lazy_zod14.z.literal("local"),
8571
8732
  ...sharedAuthFields,
8572
8733
  // #468 — opt-out of the email requirement at /oauth/callback for
8573
8734
  // single-operator local setups. Defaults preserve the historical behavior
8574
8735
  // (email required) so existing configs are unaffected.
8575
- requireEmail: import_lazy_zod13.z.boolean().default(true),
8576
- anonymousSubject: import_lazy_zod13.z.string().min(1).default("local-operator"),
8736
+ requireEmail: import_lazy_zod14.z.boolean().default(true),
8737
+ anonymousSubject: import_lazy_zod14.z.string().min(1).default("local-operator"),
8577
8738
  // Checkpoint 3a — declarative login customization + custom verification.
8578
8739
  // Both optional; omitting them preserves the default login path exactly.
8579
8740
  login: loginConfigSchema.optional(),
@@ -8581,7 +8742,7 @@ var localAuthSchema = import_lazy_zod13.z.object({
8581
8742
  // Multi-OAuth-provider orchestration — declare upstream providers (GitHub,
8582
8743
  // Slack, Jira, …) to federate at /oauth/authorize. Optional; omitting it
8583
8744
  // preserves the default single-operator local login exactly.
8584
- providers: import_lazy_zod13.z.array(upstreamProviderSchema).optional(),
8745
+ providers: import_lazy_zod14.z.array(upstreamProviderSchema).optional(),
8585
8746
  // Local-AS Dynamic Client Registration control surface (#462) — gate
8586
8747
  // `POST /oauth/register`, allowlist redirect_uris/client_ids, require an
8587
8748
  // initial access token, and seed pre-registered trusted clients. Optional;
@@ -8589,8 +8750,8 @@ var localAuthSchema = import_lazy_zod13.z.object({
8589
8750
  // no allowlist; no initial access token).
8590
8751
  dcr: localDcrConfigSchema.optional()
8591
8752
  });
8592
- var remoteAuthSchema = import_lazy_zod13.z.object({
8593
- mode: import_lazy_zod13.z.literal("remote"),
8753
+ var remoteAuthSchema = import_lazy_zod14.z.object({
8754
+ mode: import_lazy_zod14.z.literal("remote"),
8594
8755
  ...flatRemoteProviderFields,
8595
8756
  ...sharedAuthFields
8596
8757
  });
@@ -8598,21 +8759,22 @@ var orchestratedLocalSchema = localAuthSchema;
8598
8759
  var orchestratedRemoteSchema = remoteAuthSchema;
8599
8760
 
8600
8761
  // libs/auth/src/options/schema.ts
8601
- var import_lazy_zod14 = require("@frontmcp/lazy-zod");
8602
- var authOptionsSchema = import_lazy_zod14.z.union([
8762
+ var import_lazy_zod15 = require("@frontmcp/lazy-zod");
8763
+ var authOptionsSchema = import_lazy_zod15.z.union([
8603
8764
  publicAuthOptionsSchema,
8765
+ staticAuthOptionsSchema,
8604
8766
  transparentAuthOptionsSchema,
8605
8767
  localAuthSchema,
8606
8768
  remoteAuthSchema
8607
8769
  ]);
8608
8770
 
8609
8771
  // libs/auth/src/options/app-auth.schema.ts
8610
- var import_lazy_zod15 = require("@frontmcp/lazy-zod");
8772
+ var import_lazy_zod16 = require("@frontmcp/lazy-zod");
8611
8773
  var standaloneOptionSchema = {
8612
- standalone: import_lazy_zod15.z.boolean().optional(),
8613
- excludeFromParent: import_lazy_zod15.z.boolean().optional()
8774
+ standalone: import_lazy_zod16.z.boolean().optional(),
8775
+ excludeFromParent: import_lazy_zod16.z.boolean().optional()
8614
8776
  };
8615
- var appAuthOptionsSchema = import_lazy_zod15.z.union([
8777
+ var appAuthOptionsSchema = import_lazy_zod16.z.union([
8616
8778
  publicAuthOptionsSchema.extend(standaloneOptionSchema),
8617
8779
  transparentAuthOptionsSchema.extend(standaloneOptionSchema),
8618
8780
  localAuthSchema.extend(standaloneOptionSchema),
@@ -8626,6 +8788,9 @@ function parseAuthOptions(input) {
8626
8788
  function isPublicMode(options) {
8627
8789
  return options.mode === "public";
8628
8790
  }
8791
+ function isStaticMode(options) {
8792
+ return options.mode === "static";
8793
+ }
8629
8794
  function isTransparentMode(options) {
8630
8795
  return options.mode === "transparent";
8631
8796
  }
@@ -8652,108 +8817,108 @@ function allowsPublicAccess(options) {
8652
8817
  }
8653
8818
 
8654
8819
  // libs/auth/src/consent/consent.types.ts
8655
- var import_lazy_zod16 = require("@frontmcp/lazy-zod");
8656
- var consentToolItemSchema = import_lazy_zod16.z.object({
8820
+ var import_lazy_zod17 = require("@frontmcp/lazy-zod");
8821
+ var consentToolItemSchema = import_lazy_zod17.z.object({
8657
8822
  /** Tool ID (e.g., 'slack:send_message') */
8658
- id: import_lazy_zod16.z.string().min(1),
8823
+ id: import_lazy_zod17.z.string().min(1),
8659
8824
  /** Tool name for display */
8660
- name: import_lazy_zod16.z.string().min(1),
8825
+ name: import_lazy_zod17.z.string().min(1),
8661
8826
  /** Tool description */
8662
- description: import_lazy_zod16.z.string().optional(),
8827
+ description: import_lazy_zod17.z.string().optional(),
8663
8828
  /** App ID this tool belongs to */
8664
- appId: import_lazy_zod16.z.string().min(1),
8829
+ appId: import_lazy_zod17.z.string().min(1),
8665
8830
  /** App name for display */
8666
- appName: import_lazy_zod16.z.string().min(1),
8831
+ appName: import_lazy_zod17.z.string().min(1),
8667
8832
  /** Whether the tool is selected by default */
8668
- defaultSelected: import_lazy_zod16.z.boolean().default(true),
8833
+ defaultSelected: import_lazy_zod17.z.boolean().default(true),
8669
8834
  /** Whether this tool requires specific scopes */
8670
- requiredScopes: import_lazy_zod16.z.array(import_lazy_zod16.z.string()).optional(),
8835
+ requiredScopes: import_lazy_zod17.z.array(import_lazy_zod17.z.string()).optional(),
8671
8836
  /** Category for grouping (e.g., 'read', 'write', 'admin') */
8672
- category: import_lazy_zod16.z.string().optional()
8837
+ category: import_lazy_zod17.z.string().optional()
8673
8838
  });
8674
- var consentSelectionSchema = import_lazy_zod16.z.object({
8839
+ var consentSelectionSchema = import_lazy_zod17.z.object({
8675
8840
  /** Selected tool IDs */
8676
- selectedTools: import_lazy_zod16.z.array(import_lazy_zod16.z.string()),
8841
+ selectedTools: import_lazy_zod17.z.array(import_lazy_zod17.z.string()),
8677
8842
  /** Whether all tools were selected */
8678
- allSelected: import_lazy_zod16.z.boolean(),
8843
+ allSelected: import_lazy_zod17.z.boolean(),
8679
8844
  /** Timestamp when consent was given */
8680
- consentedAt: import_lazy_zod16.z.string().datetime(),
8845
+ consentedAt: import_lazy_zod17.z.string().datetime(),
8681
8846
  /** Consent version for tracking changes */
8682
- consentVersion: import_lazy_zod16.z.string().default("1.0")
8847
+ consentVersion: import_lazy_zod17.z.string().default("1.0")
8683
8848
  });
8684
- var consentStateSchema = import_lazy_zod16.z.object({
8849
+ var consentStateSchema = import_lazy_zod17.z.object({
8685
8850
  /** Whether consent flow is enabled */
8686
- enabled: import_lazy_zod16.z.boolean(),
8851
+ enabled: import_lazy_zod17.z.boolean(),
8687
8852
  /** Available tools for consent */
8688
- availableTools: import_lazy_zod16.z.array(consentToolItemSchema),
8853
+ availableTools: import_lazy_zod17.z.array(consentToolItemSchema),
8689
8854
  /** Pre-selected tools (from previous consent or defaults) */
8690
- preselectedTools: import_lazy_zod16.z.array(import_lazy_zod16.z.string()).optional(),
8855
+ preselectedTools: import_lazy_zod17.z.array(import_lazy_zod17.z.string()).optional(),
8691
8856
  /** Whether to show all tools or group by app */
8692
- groupByApp: import_lazy_zod16.z.boolean().default(true),
8857
+ groupByApp: import_lazy_zod17.z.boolean().default(true),
8693
8858
  /** Custom consent message */
8694
- customMessage: import_lazy_zod16.z.string().optional()
8859
+ customMessage: import_lazy_zod17.z.string().optional()
8695
8860
  });
8696
- var federatedProviderItemSchema = import_lazy_zod16.z.object({
8861
+ var federatedProviderItemSchema = import_lazy_zod17.z.object({
8697
8862
  /** Provider ID (derived or explicit) */
8698
- id: import_lazy_zod16.z.string().min(1),
8863
+ id: import_lazy_zod17.z.string().min(1),
8699
8864
  /** Provider display name */
8700
- name: import_lazy_zod16.z.string().min(1),
8865
+ name: import_lazy_zod17.z.string().min(1),
8701
8866
  /** Provider description */
8702
- description: import_lazy_zod16.z.string().optional(),
8867
+ description: import_lazy_zod17.z.string().optional(),
8703
8868
  /** Provider icon URL or emoji */
8704
- icon: import_lazy_zod16.z.string().optional(),
8869
+ icon: import_lazy_zod17.z.string().optional(),
8705
8870
  /** Provider type */
8706
- type: import_lazy_zod16.z.enum(["local", "remote", "transparent"]),
8871
+ type: import_lazy_zod17.z.enum(["local", "remote", "transparent"]),
8707
8872
  /** OAuth provider URL (for remote providers) */
8708
- providerUrl: import_lazy_zod16.z.string().url().optional(),
8873
+ providerUrl: import_lazy_zod17.z.string().url().optional(),
8709
8874
  /** Apps using this provider */
8710
- appIds: import_lazy_zod16.z.array(import_lazy_zod16.z.string()),
8875
+ appIds: import_lazy_zod17.z.array(import_lazy_zod17.z.string()),
8711
8876
  /** App names using this provider */
8712
- appNames: import_lazy_zod16.z.array(import_lazy_zod16.z.string()),
8877
+ appNames: import_lazy_zod17.z.array(import_lazy_zod17.z.string()),
8713
8878
  /** Scopes required by this provider */
8714
- scopes: import_lazy_zod16.z.array(import_lazy_zod16.z.string()),
8879
+ scopes: import_lazy_zod17.z.array(import_lazy_zod17.z.string()),
8715
8880
  /** Whether this is the primary/parent provider */
8716
- isPrimary: import_lazy_zod16.z.boolean(),
8881
+ isPrimary: import_lazy_zod17.z.boolean(),
8717
8882
  /** Whether this provider is optional (can be skipped) */
8718
- isOptional: import_lazy_zod16.z.boolean().default(false)
8883
+ isOptional: import_lazy_zod17.z.boolean().default(false)
8719
8884
  });
8720
- var federatedLoginStateSchema = import_lazy_zod16.z.object({
8885
+ var federatedLoginStateSchema = import_lazy_zod17.z.object({
8721
8886
  /** All available providers */
8722
- providers: import_lazy_zod16.z.array(federatedProviderItemSchema),
8887
+ providers: import_lazy_zod17.z.array(federatedProviderItemSchema),
8723
8888
  /** Primary provider ID (if any) */
8724
- primaryProviderId: import_lazy_zod16.z.string().optional(),
8889
+ primaryProviderId: import_lazy_zod17.z.string().optional(),
8725
8890
  /** Whether user can skip optional providers */
8726
- allowSkip: import_lazy_zod16.z.boolean().default(true),
8891
+ allowSkip: import_lazy_zod17.z.boolean().default(true),
8727
8892
  /** Pre-selected provider IDs (from previous session) */
8728
- preselectedProviders: import_lazy_zod16.z.array(import_lazy_zod16.z.string()).optional()
8893
+ preselectedProviders: import_lazy_zod17.z.array(import_lazy_zod17.z.string()).optional()
8729
8894
  });
8730
- var federatedSelectionSchema = import_lazy_zod16.z.object({
8895
+ var federatedSelectionSchema = import_lazy_zod17.z.object({
8731
8896
  /** Selected provider IDs */
8732
- selectedProviders: import_lazy_zod16.z.array(import_lazy_zod16.z.string()),
8897
+ selectedProviders: import_lazy_zod17.z.array(import_lazy_zod17.z.string()),
8733
8898
  /** Skipped provider IDs */
8734
- skippedProviders: import_lazy_zod16.z.array(import_lazy_zod16.z.string()),
8899
+ skippedProviders: import_lazy_zod17.z.array(import_lazy_zod17.z.string()),
8735
8900
  /** Provider-specific metadata */
8736
- providerMetadata: import_lazy_zod16.z.record(import_lazy_zod16.z.string(), import_lazy_zod16.z.unknown()).optional()
8901
+ providerMetadata: import_lazy_zod17.z.record(import_lazy_zod17.z.string(), import_lazy_zod17.z.unknown()).optional()
8737
8902
  });
8738
8903
 
8739
8904
  // libs/auth/src/detection/auth-provider-detection.ts
8740
- var import_lazy_zod17 = require("@frontmcp/lazy-zod");
8741
- var detectedAuthProviderSchema = import_lazy_zod17.z.object({
8742
- id: import_lazy_zod17.z.string(),
8743
- providerUrl: import_lazy_zod17.z.string().optional(),
8744
- mode: import_lazy_zod17.z.enum(["public", "transparent", "local", "remote"]),
8745
- appIds: import_lazy_zod17.z.array(import_lazy_zod17.z.string()),
8746
- scopes: import_lazy_zod17.z.array(import_lazy_zod17.z.string()),
8747
- isParentProvider: import_lazy_zod17.z.boolean()
8905
+ var import_lazy_zod18 = require("@frontmcp/lazy-zod");
8906
+ var detectedAuthProviderSchema = import_lazy_zod18.z.object({
8907
+ id: import_lazy_zod18.z.string(),
8908
+ providerUrl: import_lazy_zod18.z.string().optional(),
8909
+ mode: import_lazy_zod18.z.enum(["public", "static", "transparent", "local", "remote"]),
8910
+ appIds: import_lazy_zod18.z.array(import_lazy_zod18.z.string()),
8911
+ scopes: import_lazy_zod18.z.array(import_lazy_zod18.z.string()),
8912
+ isParentProvider: import_lazy_zod18.z.boolean()
8748
8913
  });
8749
- var authProviderDetectionResultSchema = import_lazy_zod17.z.object({
8750
- providers: import_lazy_zod17.z.map(import_lazy_zod17.z.string(), detectedAuthProviderSchema),
8751
- requiresOrchestration: import_lazy_zod17.z.boolean(),
8752
- parentProviderId: import_lazy_zod17.z.string().optional(),
8753
- childProviderIds: import_lazy_zod17.z.array(import_lazy_zod17.z.string()),
8754
- uniqueProviderCount: import_lazy_zod17.z.number(),
8755
- validationErrors: import_lazy_zod17.z.array(import_lazy_zod17.z.string()),
8756
- warnings: import_lazy_zod17.z.array(import_lazy_zod17.z.string())
8914
+ var authProviderDetectionResultSchema = import_lazy_zod18.z.object({
8915
+ providers: import_lazy_zod18.z.map(import_lazy_zod18.z.string(), detectedAuthProviderSchema),
8916
+ requiresOrchestration: import_lazy_zod18.z.boolean(),
8917
+ parentProviderId: import_lazy_zod18.z.string().optional(),
8918
+ childProviderIds: import_lazy_zod18.z.array(import_lazy_zod18.z.string()),
8919
+ uniqueProviderCount: import_lazy_zod18.z.number(),
8920
+ validationErrors: import_lazy_zod18.z.array(import_lazy_zod18.z.string()),
8921
+ warnings: import_lazy_zod18.z.array(import_lazy_zod18.z.string())
8757
8922
  });
8758
8923
  function deriveProviderId(options) {
8759
8924
  if (isPublicMode(options)) {
@@ -9142,43 +9307,43 @@ var AudienceValidator = class _AudienceValidator {
9142
9307
  };
9143
9308
 
9144
9309
  // libs/auth/src/vault/auth-providers.types.ts
9145
- var import_lazy_zod18 = require("@frontmcp/lazy-zod");
9146
- var credentialScopeSchema = import_lazy_zod18.z.enum(["global", "user", "session"]);
9147
- var loadingStrategySchema = import_lazy_zod18.z.enum(["eager", "lazy"]);
9148
- var getCredentialOptionsSchema = import_lazy_zod18.z.object({
9149
- forceRefresh: import_lazy_zod18.z.boolean().optional(),
9150
- scopes: import_lazy_zod18.z.array(import_lazy_zod18.z.string()).optional(),
9151
- timeout: import_lazy_zod18.z.number().positive().optional()
9310
+ var import_lazy_zod19 = require("@frontmcp/lazy-zod");
9311
+ var credentialScopeSchema = import_lazy_zod19.z.enum(["global", "user", "session"]);
9312
+ var loadingStrategySchema = import_lazy_zod19.z.enum(["eager", "lazy"]);
9313
+ var getCredentialOptionsSchema = import_lazy_zod19.z.object({
9314
+ forceRefresh: import_lazy_zod19.z.boolean().optional(),
9315
+ scopes: import_lazy_zod19.z.array(import_lazy_zod19.z.string()).optional(),
9316
+ timeout: import_lazy_zod19.z.number().positive().optional()
9152
9317
  }).strict();
9153
- var credentialProviderConfigSchema = import_lazy_zod18.z.object({
9154
- name: import_lazy_zod18.z.string().min(1),
9155
- description: import_lazy_zod18.z.string().optional(),
9318
+ var credentialProviderConfigSchema = import_lazy_zod19.z.object({
9319
+ name: import_lazy_zod19.z.string().min(1),
9320
+ description: import_lazy_zod19.z.string().optional(),
9156
9321
  scope: credentialScopeSchema,
9157
9322
  loading: loadingStrategySchema,
9158
- cacheTtl: import_lazy_zod18.z.number().nonnegative().optional(),
9323
+ cacheTtl: import_lazy_zod19.z.number().nonnegative().optional(),
9159
9324
  // Functions validated at runtime, not via Zod (Zod 4 compatibility)
9160
- factory: import_lazy_zod18.z.any(),
9161
- refresh: import_lazy_zod18.z.any().optional(),
9162
- toHeaders: import_lazy_zod18.z.any().optional(),
9163
- metadata: import_lazy_zod18.z.record(import_lazy_zod18.z.string(), import_lazy_zod18.z.unknown()).optional(),
9164
- required: import_lazy_zod18.z.boolean().optional()
9325
+ factory: import_lazy_zod19.z.any(),
9326
+ refresh: import_lazy_zod19.z.any().optional(),
9327
+ toHeaders: import_lazy_zod19.z.any().optional(),
9328
+ metadata: import_lazy_zod19.z.record(import_lazy_zod19.z.string(), import_lazy_zod19.z.unknown()).optional(),
9329
+ required: import_lazy_zod19.z.boolean().optional()
9165
9330
  }).strict();
9166
- var authProviderMappingSchema = import_lazy_zod18.z.union([
9167
- import_lazy_zod18.z.string(),
9168
- import_lazy_zod18.z.object({
9169
- name: import_lazy_zod18.z.string().min(1),
9170
- required: import_lazy_zod18.z.boolean().optional().default(true),
9171
- scopes: import_lazy_zod18.z.array(import_lazy_zod18.z.string()).optional(),
9172
- alias: import_lazy_zod18.z.string().optional()
9331
+ var authProviderMappingSchema = import_lazy_zod19.z.union([
9332
+ import_lazy_zod19.z.string(),
9333
+ import_lazy_zod19.z.object({
9334
+ name: import_lazy_zod19.z.string().min(1),
9335
+ required: import_lazy_zod19.z.boolean().optional().default(true),
9336
+ scopes: import_lazy_zod19.z.array(import_lazy_zod19.z.string()).optional(),
9337
+ alias: import_lazy_zod19.z.string().optional()
9173
9338
  }).strict()
9174
9339
  ]);
9175
- var authProvidersVaultOptionsSchema = import_lazy_zod18.z.object({
9176
- enabled: import_lazy_zod18.z.boolean().optional(),
9177
- useSharedStorage: import_lazy_zod18.z.boolean().optional().default(true),
9178
- namespace: import_lazy_zod18.z.string().optional().default("authproviders:"),
9179
- defaultCacheTtl: import_lazy_zod18.z.number().nonnegative().optional().default(36e5),
9180
- maxCredentialsPerSession: import_lazy_zod18.z.number().positive().optional().default(100),
9181
- providers: import_lazy_zod18.z.array(credentialProviderConfigSchema).optional()
9340
+ var authProvidersVaultOptionsSchema = import_lazy_zod19.z.object({
9341
+ enabled: import_lazy_zod19.z.boolean().optional(),
9342
+ useSharedStorage: import_lazy_zod19.z.boolean().optional().default(true),
9343
+ namespace: import_lazy_zod19.z.string().optional().default("authproviders:"),
9344
+ defaultCacheTtl: import_lazy_zod19.z.number().nonnegative().optional().default(36e5),
9345
+ maxCredentialsPerSession: import_lazy_zod19.z.number().positive().optional().default(100),
9346
+ providers: import_lazy_zod19.z.array(credentialProviderConfigSchema).optional()
9182
9347
  }).strict();
9183
9348
 
9184
9349
  // libs/auth/src/vault/credential-helpers.ts
@@ -9383,7 +9548,7 @@ var CredentialCache = class {
9383
9548
  var AUTH_PROVIDERS_ACCESSOR = /* @__PURE__ */ Symbol.for("frontmcp:AUTH_PROVIDERS_ACCESSOR");
9384
9549
 
9385
9550
  // libs/auth/src/vault/auth-providers.accessor.impl.ts
9386
- var import_utils41 = require("@frontmcp/utils");
9551
+ var import_utils42 = require("@frontmcp/utils");
9387
9552
  var AuthProvidersAccessorImpl = class {
9388
9553
  constructor(registry, vault, cache, loader, context, logger) {
9389
9554
  this.registry = registry;
@@ -9598,7 +9763,7 @@ var AuthProvidersAccessorImpl = class {
9598
9763
  return { [credential.headerName]: credential.key };
9599
9764
  case "basic": {
9600
9765
  const value = `${credential.username}:${credential.password}`;
9601
- const encoded = credential.encodedValue ?? (0, import_utils41.base64Encode)(new TextEncoder().encode(value));
9766
+ const encoded = credential.encodedValue ?? (0, import_utils42.base64Encode)(new TextEncoder().encode(value));
9602
9767
  return { Authorization: `Basic ${encoded}` };
9603
9768
  }
9604
9769
  case "custom":
@@ -10400,20 +10565,20 @@ function resolveRequiredScopes(denial, mapping, authorities) {
10400
10565
  }
10401
10566
 
10402
10567
  // libs/auth/src/authorities/authorities.schema.ts
10403
- var import_lazy_zod19 = require("@frontmcp/lazy-zod");
10404
- var rbacRolesPolicySchema = import_lazy_zod19.z.object({
10405
- all: import_lazy_zod19.z.array(import_lazy_zod19.z.string().min(1)).optional(),
10406
- any: import_lazy_zod19.z.array(import_lazy_zod19.z.string().min(1)).optional()
10568
+ var import_lazy_zod20 = require("@frontmcp/lazy-zod");
10569
+ var rbacRolesPolicySchema = import_lazy_zod20.z.object({
10570
+ all: import_lazy_zod20.z.array(import_lazy_zod20.z.string().min(1)).optional(),
10571
+ any: import_lazy_zod20.z.array(import_lazy_zod20.z.string().min(1)).optional()
10407
10572
  }).refine((data) => data.all !== void 0 || data.any !== void 0, {
10408
10573
  message: 'Roles policy must have at least "all" or "any"'
10409
10574
  });
10410
- var rbacPermissionsPolicySchema = import_lazy_zod19.z.object({
10411
- all: import_lazy_zod19.z.array(import_lazy_zod19.z.string().min(1)).optional(),
10412
- any: import_lazy_zod19.z.array(import_lazy_zod19.z.string().min(1)).optional()
10575
+ var rbacPermissionsPolicySchema = import_lazy_zod20.z.object({
10576
+ all: import_lazy_zod20.z.array(import_lazy_zod20.z.string().min(1)).optional(),
10577
+ any: import_lazy_zod20.z.array(import_lazy_zod20.z.string().min(1)).optional()
10413
10578
  }).refine((data) => data.all !== void 0 || data.any !== void 0, {
10414
10579
  message: 'Permissions policy must have at least "all" or "any"'
10415
10580
  });
10416
- var abacOperatorSchema = import_lazy_zod19.z.enum([
10581
+ var abacOperatorSchema = import_lazy_zod20.z.enum([
10417
10582
  "eq",
10418
10583
  "neq",
10419
10584
  "in",
@@ -10428,55 +10593,55 @@ var abacOperatorSchema = import_lazy_zod19.z.enum([
10428
10593
  "exists",
10429
10594
  "matches"
10430
10595
  ]);
10431
- var abacConditionSchema = import_lazy_zod19.z.object({
10432
- path: import_lazy_zod19.z.string().min(1),
10596
+ var abacConditionSchema = import_lazy_zod20.z.object({
10597
+ path: import_lazy_zod20.z.string().min(1),
10433
10598
  op: abacOperatorSchema,
10434
- value: import_lazy_zod19.z.unknown()
10599
+ value: import_lazy_zod20.z.unknown()
10435
10600
  });
10436
- var abacPolicySchema = import_lazy_zod19.z.object({
10437
- match: import_lazy_zod19.z.record(import_lazy_zod19.z.string(), import_lazy_zod19.z.unknown()).optional(),
10438
- conditions: import_lazy_zod19.z.array(abacConditionSchema).optional()
10601
+ var abacPolicySchema = import_lazy_zod20.z.object({
10602
+ match: import_lazy_zod20.z.record(import_lazy_zod20.z.string(), import_lazy_zod20.z.unknown()).optional(),
10603
+ conditions: import_lazy_zod20.z.array(abacConditionSchema).optional()
10439
10604
  }).refine((data) => data.match !== void 0 || data.conditions !== void 0, {
10440
10605
  message: 'Attributes policy must have at least "match" or "conditions"'
10441
10606
  });
10442
- var resourceIdRefSchema = import_lazy_zod19.z.union([
10443
- import_lazy_zod19.z.string().min(1),
10444
- import_lazy_zod19.z.object({ fromInput: import_lazy_zod19.z.string().min(1) }).strict(),
10445
- import_lazy_zod19.z.object({ fromClaims: import_lazy_zod19.z.string().min(1) }).strict()
10607
+ var resourceIdRefSchema = import_lazy_zod20.z.union([
10608
+ import_lazy_zod20.z.string().min(1),
10609
+ import_lazy_zod20.z.object({ fromInput: import_lazy_zod20.z.string().min(1) }).strict(),
10610
+ import_lazy_zod20.z.object({ fromClaims: import_lazy_zod20.z.string().min(1) }).strict()
10446
10611
  ]);
10447
- var rebacPolicySchema = import_lazy_zod19.z.object({
10448
- type: import_lazy_zod19.z.string().min(1),
10449
- resource: import_lazy_zod19.z.string().min(1),
10612
+ var rebacPolicySchema = import_lazy_zod20.z.object({
10613
+ type: import_lazy_zod20.z.string().min(1),
10614
+ resource: import_lazy_zod20.z.string().min(1),
10450
10615
  resourceId: resourceIdRefSchema
10451
10616
  });
10452
10617
  var basePolicyShape = {
10453
10618
  roles: rbacRolesPolicySchema.optional(),
10454
10619
  permissions: rbacPermissionsPolicySchema.optional(),
10455
10620
  attributes: abacPolicySchema.optional(),
10456
- relationships: import_lazy_zod19.z.union([rebacPolicySchema, import_lazy_zod19.z.array(rebacPolicySchema)]).optional(),
10457
- custom: import_lazy_zod19.z.record(import_lazy_zod19.z.string(), import_lazy_zod19.z.unknown()).optional(),
10458
- guards: import_lazy_zod19.z.array(import_lazy_zod19.z.instanceof(Function)).optional(),
10459
- operator: import_lazy_zod19.z.enum(["AND", "OR"]).optional()
10621
+ relationships: import_lazy_zod20.z.union([rebacPolicySchema, import_lazy_zod20.z.array(rebacPolicySchema)]).optional(),
10622
+ custom: import_lazy_zod20.z.record(import_lazy_zod20.z.string(), import_lazy_zod20.z.unknown()).optional(),
10623
+ guards: import_lazy_zod20.z.array(import_lazy_zod20.z.instanceof(Function)).optional(),
10624
+ operator: import_lazy_zod20.z.enum(["AND", "OR"]).optional()
10460
10625
  };
10461
- var authoritiesPolicySchema = import_lazy_zod19.z.lazy(
10462
- () => import_lazy_zod19.z.object({
10626
+ var authoritiesPolicySchema = import_lazy_zod20.z.lazy(
10627
+ () => import_lazy_zod20.z.object({
10463
10628
  ...basePolicyShape,
10464
10629
  not: authoritiesPolicySchema.optional(),
10465
- anyOf: import_lazy_zod19.z.array(authoritiesPolicySchema).optional(),
10466
- allOf: import_lazy_zod19.z.array(authoritiesPolicySchema).optional()
10630
+ anyOf: import_lazy_zod20.z.array(authoritiesPolicySchema).optional(),
10631
+ allOf: import_lazy_zod20.z.array(authoritiesPolicySchema).optional()
10467
10632
  })
10468
10633
  );
10469
- var authoritiesMetadataSchema = import_lazy_zod19.z.union([
10470
- import_lazy_zod19.z.string().min(1),
10471
- import_lazy_zod19.z.array(import_lazy_zod19.z.string().min(1)).min(1),
10634
+ var authoritiesMetadataSchema = import_lazy_zod20.z.union([
10635
+ import_lazy_zod20.z.string().min(1),
10636
+ import_lazy_zod20.z.array(import_lazy_zod20.z.string().min(1)).min(1),
10472
10637
  authoritiesPolicySchema
10473
10638
  ]);
10474
- var authoritiesClaimsMappingSchema = import_lazy_zod19.z.record(import_lazy_zod19.z.string(), import_lazy_zod19.z.string().optional()).refine((data) => Object.values(data).some((v) => v !== void 0), {
10639
+ var authoritiesClaimsMappingSchema = import_lazy_zod20.z.record(import_lazy_zod20.z.string(), import_lazy_zod20.z.string().optional()).refine((data) => Object.values(data).some((v) => v !== void 0), {
10475
10640
  message: "Claims mapping must have at least one mapping"
10476
10641
  });
10477
- var authoritiesConfigSchema = import_lazy_zod19.z.object({
10642
+ var authoritiesConfigSchema = import_lazy_zod20.z.object({
10478
10643
  claimsMapping: authoritiesClaimsMappingSchema.optional(),
10479
- profiles: import_lazy_zod19.z.record(import_lazy_zod19.z.string().min(1), authoritiesPolicySchema).optional()
10644
+ profiles: import_lazy_zod20.z.record(import_lazy_zod20.z.string().min(1), authoritiesPolicySchema).optional()
10480
10645
  });
10481
10646
 
10482
10647
  // libs/auth/src/authorities/authorities.evaluator.ts
@@ -11157,6 +11322,7 @@ var FetchCredentialMiddleware = class {
11157
11322
  CredentialProviderAlreadyRegisteredError,
11158
11323
  CredentialStorageError,
11159
11324
  CredentialsAccessorImpl,
11325
+ DEFAULT_INCREMENTAL_TICKET_TTL_MS,
11160
11326
  DEFAULT_RESUME_TTL_MS,
11161
11327
  DEFAULT_THEME,
11162
11328
  DcrClientRegistry,
@@ -11179,6 +11345,8 @@ var FetchCredentialMiddleware = class {
11179
11345
  InMemoryStoreRequiredError,
11180
11346
  InvalidClientIdUrlError,
11181
11347
  JwksService,
11348
+ JwtSecretRequiredError,
11349
+ JwtSecretWeakError,
11182
11350
  LazyCredentialLoader,
11183
11351
  NoProviderIdError,
11184
11352
  NullOrchestratedAuthAccessor,
@@ -11349,6 +11517,7 @@ var FetchCredentialMiddleware = class {
11349
11517
  isSoonExpiring,
11350
11518
  isSoonExpiringProvider,
11351
11519
  isSqliteTokenStorage,
11520
+ isStaticMode,
11352
11521
  isTransparentMode,
11353
11522
  jsonWebKeySetSchema,
11354
11523
  jwkParametersSchema,
@@ -11400,6 +11569,7 @@ var FetchCredentialMiddleware = class {
11400
11569
  sessionIdPayloadSchema,
11401
11570
  sessionJwtPayloadSchema,
11402
11571
  signCredentialResumeToken,
11572
+ signIncrementalAuthTicket,
11403
11573
  signSession,
11404
11574
  skippedAppBehaviorSchema,
11405
11575
  sseTransportStateSchema,
@@ -11407,6 +11577,7 @@ var FetchCredentialMiddleware = class {
11407
11577
  startNextProvider,
11408
11578
  statefulHttpTransportStateSchema,
11409
11579
  statelessHttpTransportStateSchema,
11580
+ staticAuthOptionsSchema,
11410
11581
  storedSessionSchema,
11411
11582
  streamableHttpTransportStateSchema,
11412
11583
  toEpochSeconds,
@@ -11428,6 +11599,7 @@ var FetchCredentialMiddleware = class {
11428
11599
  vaultConsentRecordSchema,
11429
11600
  vaultFederatedRecordSchema,
11430
11601
  verifyCredentialResumeToken,
11602
+ verifyIncrementalAuthTicket,
11431
11603
  verifyOrParseSession,
11432
11604
  verifyPkce,
11433
11605
  verifySession,