@vitemcp/server 1.9.15 → 1.9.17

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.
@@ -392,6 +392,7 @@ var oauthTransactionStorageSchema = _zod.z.object({
392
392
  clientCodeChallenge: _zod.z.string(),
393
393
  clientCodeChallengeMethod: _zod.z.string(),
394
394
  clientId: _zod.z.string(),
395
+ consentBinding: _zod.z.string().optional(),
395
396
  consentGiven: _zod.z.boolean().optional(),
396
397
  createdAt: storedDateSchema,
397
398
  expiresAt: storedDateSchema,
@@ -713,22 +714,31 @@ var ConsentManager = class {
713
714
  }
714
715
  /**
715
716
  * Create HTTP response with consent screen
717
+ *
718
+ * `cookie` is a `Set-Cookie` value that ties the request to the browser the
719
+ * screen is shown to. The screen may not be framed: a page that embeds it
720
+ * could have the user approve without seeing what they are approving.
716
721
  */
717
- createConsentResponse(transaction, provider) {
722
+ createConsentResponse(transaction, provider, options = {}) {
718
723
  const consentData = {
719
- clientName: "MCP Client",
724
+ clientName: options.clientName || "MCP Client",
720
725
  provider,
726
+ redirectUri: transaction.clientCallbackUrl,
721
727
  scope: transaction.scope,
722
728
  timestamp: Date.now(),
723
729
  transactionId: transaction.id
724
730
  };
725
731
  const html = this.generateConsentScreen(consentData);
726
- return new Response(html, {
727
- headers: {
728
- "Content-Type": "text/html; charset=utf-8"
729
- },
730
- status: 200
732
+ const headers = new Headers({
733
+ "Cache-Control": "no-store",
734
+ "Content-Security-Policy": "frame-ancestors 'none'",
735
+ "Content-Type": "text/html; charset=utf-8",
736
+ "X-Frame-Options": "DENY"
731
737
  });
738
+ if (options.cookie) {
739
+ headers.append("Set-Cookie", options.cookie);
740
+ }
741
+ return new Response(html, { headers, status: 200 });
732
742
  }
733
743
  /**
734
744
  * Generate HTML for consent screen
@@ -739,7 +749,8 @@ var ConsentManager = class {
739
749
  * one no route answers, and Approve came back 404.
740
750
  */
741
751
  generateConsentScreen(data) {
742
- const { clientName, provider, scope, transactionId } = data;
752
+ const { clientName, provider, redirectUri, scope, transactionId } = data;
753
+ const destination = redirectUri && this.describeDestination(redirectUri);
743
754
  return `
744
755
  <!DOCTYPE html>
745
756
  <html lang="en">
@@ -807,6 +818,12 @@ var ConsentManager = class {
807
818
  font-weight: 600;
808
819
  }
809
820
 
821
+ .destination {
822
+ color: #4a5568;
823
+ font-size: 14px;
824
+ overflow-wrap: anywhere;
825
+ }
826
+
810
827
  .permissions {
811
828
  margin-top: 16px;
812
829
  }
@@ -905,10 +922,15 @@ var ConsentManager = class {
905
922
 
906
923
  <div class="app-info">
907
924
  <h2>
908
- <span class="app-name">${this.escapeHtml(clientName || "An application")}</span>
925
+ <span class="app-name">${this.escapeHtml((clientName || "An application").slice(0, 100))}</span>
909
926
  requests access
910
927
  </h2>
911
-
928
+ ${destination ? `
929
+ <p class="destination">
930
+ If you approve, you will be sent to
931
+ <strong>${this.escapeHtml(destination)}</strong>
932
+ </p>
933
+ ` : ""}
912
934
  <div class="permissions">
913
935
  <h3>This will allow the app to:</h3>
914
936
  <ul>
@@ -978,6 +1000,23 @@ var ConsentManager = class {
978
1000
  return null;
979
1001
  }
980
1002
  }
1003
+ /**
1004
+ * Where a redirect URI leads, as the browser will read it rather than as it
1005
+ * was typed: the parsed host, so that a look-alike character, a tab or a
1006
+ * backslash shows for what it does. A long host keeps its end, which is the
1007
+ * part that says whose it is.
1008
+ */
1009
+ describeDestination(redirectUri) {
1010
+ let url;
1011
+ try {
1012
+ url = new URL(redirectUri);
1013
+ } catch (e6) {
1014
+ return void 0;
1015
+ }
1016
+ const host = url.host.length > 80 ? `\u2026${url.host.slice(-80)}` : url.host;
1017
+ const path = url.pathname.length > 80 ? `${url.pathname.slice(0, 80)}\u2026` : url.pathname;
1018
+ return host ? `${url.protocol}//${host}${path}` : `${url.protocol}${path}`;
1019
+ }
981
1020
  /**
982
1021
  * Escape HTML to prevent XSS
983
1022
  */
@@ -1185,7 +1224,7 @@ function isLoopbackHostname(hostname) {
1185
1224
  var parse = (uri) => {
1186
1225
  try {
1187
1226
  return new URL(uri);
1188
- } catch (e6) {
1227
+ } catch (e7) {
1189
1228
  return null;
1190
1229
  }
1191
1230
  };
@@ -1511,7 +1550,6 @@ var OAuthProxy = (_class4 = class {
1511
1550
  constructor(config) {;_class4.prototype.__init5.call(this);_class4.prototype.__init6.call(this);_class4.prototype.__init7.call(this);_class4.prototype.__init8.call(this);
1512
1551
  this.config = {
1513
1552
  authorizationCodeTtl: DEFAULT_AUTHORIZATION_CODE_TTL,
1514
- consentRequired: true,
1515
1553
  enableTokenSwap: true,
1516
1554
  // Enabled by default for security
1517
1555
  redirectPath: DEFAULT_REDIRECT_PATH,
@@ -1519,7 +1557,10 @@ var OAuthProxy = (_class4 = class {
1519
1557
  upstreamRequestTimeoutMs: DEFAULT_UPSTREAM_REQUEST_TIMEOUT_MS,
1520
1558
  upstreamTokenEndpointAuthMethod: "client_secret_basic",
1521
1559
  ...config,
1522
- baseUrl: withoutTrailingSlash(config.baseUrl)
1560
+ baseUrl: withoutTrailingSlash(config.baseUrl),
1561
+ // Spreading an explicit `undefined` over the default would turn consent
1562
+ // off for a caller that only meant to pass an option along.
1563
+ consentRequired: _nullishCoalesce(config.consentRequired, () => ( true))
1523
1564
  };
1524
1565
  let storage = config.tokenStorage;
1525
1566
  if (!storage) {
@@ -1560,8 +1601,13 @@ var OAuthProxy = (_class4 = class {
1560
1601
  }
1561
1602
  /**
1562
1603
  * OAuth authorization endpoint
1604
+ *
1605
+ * With consent required the response is the consent screen, and it sets the
1606
+ * cookie that the request is approved and finished with: return its headers
1607
+ * to the browser. Pass that browser's `request` as well, so that one with
1608
+ * several authorization requests open keeps a single cookie for all of them.
1563
1609
  */
1564
- async authorize(params) {
1610
+ async authorize(params, request2) {
1565
1611
  if (!params.client_id || !params.redirect_uri || !params.response_type) {
1566
1612
  throw new OAuthProxyError(
1567
1613
  "invalid_request",
@@ -1613,11 +1659,17 @@ var OAuthProxy = (_class4 = class {
1613
1659
  );
1614
1660
  }
1615
1661
  }
1616
- const transaction = await this.createTransaction(params);
1617
- if (this.config.consentRequired && !transaction.consentGiven) {
1662
+ const consentBinding = this.config.consentRequired ? _nullishCoalesce((request2 && this.consentCookieValue(request2)), () => ( this.generateId())) : void 0;
1663
+ const transaction = await this.createTransaction(params, consentBinding);
1664
+ if (consentBinding && !transaction.consentGiven) {
1665
+ const clientName = _optionalChain([registeredClient, 'access', _16 => _16.metadata, 'optionalAccess', _17 => _17.client_name]);
1618
1666
  return this.consentManager.createConsentResponse(
1619
1667
  transaction,
1620
- this.getProviderName()
1668
+ this.getProviderName(),
1669
+ {
1670
+ clientName: typeof clientName === "string" ? clientName : void 0,
1671
+ cookie: this.consentCookie(consentBinding)
1672
+ }
1621
1673
  );
1622
1674
  }
1623
1675
  return this.redirectToUpstream(transaction);
@@ -1630,7 +1682,7 @@ var OAuthProxy = (_class4 = class {
1630
1682
  clearInterval(this.cleanupInterval);
1631
1683
  this.cleanupInterval = null;
1632
1684
  }
1633
- _optionalChain([this, 'access', _16 => _16.ownedTokenStorage, 'optionalAccess', _17 => _17.destroy, 'call', _18 => _18()]);
1685
+ _optionalChain([this, 'access', _18 => _18.ownedTokenStorage, 'optionalAccess', _19 => _19.destroy, 'call', _20 => _20()]);
1634
1686
  this.registeredClientsByClientId.clear();
1635
1687
  }
1636
1688
  /**
@@ -1788,7 +1840,7 @@ var OAuthProxy = (_class4 = class {
1788
1840
  const error = url.searchParams.get("error");
1789
1841
  const description = url.searchParams.get("error_description") || void 0;
1790
1842
  if (error) {
1791
- if (!state || url.searchParams.getAll("state").length !== 1 || !GENERATED_ID.test(state) || await _asyncOptionalChain([(await this.stateStore.getTransaction(state)), 'optionalAccess', async _19 => _19.id]) !== state) {
1843
+ if (!state || url.searchParams.getAll("state").length !== 1 || !GENERATED_ID.test(state) || await _asyncOptionalChain([(await this.stateStore.getTransaction(state)), 'optionalAccess', async _21 => _21.id]) !== state) {
1792
1844
  throw new OAuthProxyError(error, description);
1793
1845
  }
1794
1846
  } else if (!code || !state) {
@@ -1801,6 +1853,12 @@ var OAuthProxy = (_class4 = class {
1801
1853
  if (!transaction) {
1802
1854
  throw new OAuthProxyError("invalid_request", "Invalid or expired state");
1803
1855
  }
1856
+ if (this.config.consentRequired && !(transaction.consentGiven && this.isConsentBoundTo(request2, transaction))) {
1857
+ throw new OAuthProxyError(
1858
+ "access_denied",
1859
+ "This authorization request was not approved in this browser"
1860
+ );
1861
+ }
1804
1862
  if (!await this.isTransactionCallbackRegistered(transaction)) {
1805
1863
  throw new OAuthProxyError(
1806
1864
  "invalid_request",
@@ -1850,6 +1908,12 @@ var OAuthProxy = (_class4 = class {
1850
1908
  "Invalid or expired transaction"
1851
1909
  );
1852
1910
  }
1911
+ if (!this.isConsentBoundTo(request2, transaction)) {
1912
+ throw new OAuthProxyError(
1913
+ "invalid_request",
1914
+ "Consent must be given in the browser that requested it"
1915
+ );
1916
+ }
1853
1917
  if (action === "deny") {
1854
1918
  await this.stateStore.deleteTransaction(transactionId);
1855
1919
  if (!await this.isTransactionCallbackRegistered(transaction)) {
@@ -1878,7 +1942,7 @@ var OAuthProxy = (_class4 = class {
1878
1942
  return null;
1879
1943
  }
1880
1944
  const result = await this.jwtIssuer.verify(vitemcpToken);
1881
- if (!result.valid || !_optionalChain([result, 'access', _20 => _20.claims, 'optionalAccess', _21 => _21.jti])) {
1945
+ if (!result.valid || !_optionalChain([result, 'access', _22 => _22.claims, 'optionalAccess', _23 => _23.jti])) {
1882
1946
  return null;
1883
1947
  }
1884
1948
  if (result.claims.token_use !== "access") {
@@ -2044,10 +2108,49 @@ var OAuthProxy = (_class4 = class {
2044
2108
  );
2045
2109
  });
2046
2110
  }
2111
+ /**
2112
+ * The cookie that ties consent requests to the browser they were shown to.
2113
+ * A browser holds one, shared by every request it has open, and it lasts as
2114
+ * long as a request does. `Lax` lets it travel with the provider's redirect
2115
+ * back to the callback, which is a cross-site navigation. Over HTTPS the
2116
+ * `__Host-` prefix keeps another host on the same site from setting it.
2117
+ */
2118
+ consentCookie(value) {
2119
+ return [
2120
+ `${this.consentCookieName()}=${value}`,
2121
+ "Path=/",
2122
+ `Max-Age=${this.config.transactionTtl || DEFAULT_TRANSACTION_TTL}`,
2123
+ "HttpOnly",
2124
+ "SameSite=Lax",
2125
+ ...this.isServedOverHttps() ? ["Secure"] : []
2126
+ ].join("; ");
2127
+ }
2128
+ consentCookieName() {
2129
+ return `${this.isServedOverHttps() ? "__Host-" : ""}vitemcp-consent`;
2130
+ }
2131
+ /**
2132
+ * The consent cookie `request` carries, if it carries a well-formed one.
2133
+ *
2134
+ * Only the spaces and tabs that may surround a cookie are dropped. Trimming
2135
+ * all white space would take a cookie whose name begins with, say, a
2136
+ * no-break space for this one, and a browser does not hold such a name to
2137
+ * the `__Host-` rules.
2138
+ */
2139
+ consentCookieValue(request2) {
2140
+ const name = this.consentCookieName();
2141
+ for (const pair of (_nullishCoalesce(request2.headers.get("cookie"), () => ( ""))).split(";")) {
2142
+ const separator = pair.indexOf("=");
2143
+ if (separator !== -1 && withoutOptionalWhitespace(pair.slice(0, separator)) === name) {
2144
+ const value = withoutOptionalWhitespace(pair.slice(separator + 1));
2145
+ return GENERATED_ID.test(value) ? value : void 0;
2146
+ }
2147
+ }
2148
+ return void 0;
2149
+ }
2047
2150
  /**
2048
2151
  * Create a new OAuth transaction
2049
2152
  */
2050
- async createTransaction(params) {
2153
+ async createTransaction(params, consentBinding) {
2051
2154
  const transactionId = this.generateId();
2052
2155
  const proxyPkce = PKCEUtils.generatePair("S256");
2053
2156
  const transaction = {
@@ -2055,6 +2158,7 @@ var OAuthProxy = (_class4 = class {
2055
2158
  clientCodeChallenge: params.code_challenge || "",
2056
2159
  clientCodeChallengeMethod: params.code_challenge_method || "plain",
2057
2160
  clientId: params.client_id,
2161
+ ...consentBinding && { consentBinding: sha256(consentBinding) },
2058
2162
  createdAt: /* @__PURE__ */ new Date(),
2059
2163
  expiresAt: new Date(
2060
2164
  Date.now() + (this.config.transactionTtl || 600) * 1e3
@@ -2095,10 +2199,10 @@ var OAuthProxy = (_class4 = class {
2095
2199
  let errorCode = "server_error";
2096
2200
  let errorDescription;
2097
2201
  try {
2098
- const error = await tokenResponse.json();
2202
+ const error = await this.readUpstreamError(tokenResponse);
2099
2203
  errorCode = error.error || "server_error";
2100
2204
  errorDescription = error.error_description;
2101
- } catch (e7) {
2205
+ } catch (e8) {
2102
2206
  errorDescription = `Upstream returned HTTP ${tokenResponse.status} ${tokenResponse.statusText}`;
2103
2207
  }
2104
2208
  throw new OAuthProxyError(errorCode, errorDescription);
@@ -2126,7 +2230,7 @@ var OAuthProxy = (_class4 = class {
2126
2230
  throw new Error("JWT issuer not initialized");
2127
2231
  }
2128
2232
  const result = await this.jwtIssuer.verify(token);
2129
- if (!result.valid || !_optionalChain([result, 'access', _22 => _22.claims, 'optionalAccess', _23 => _23.jti])) {
2233
+ if (!result.valid || !_optionalChain([result, 'access', _24 => _24.claims, 'optionalAccess', _25 => _25.jti])) {
2130
2234
  throw new Error("Failed to extract JTI from token");
2131
2235
  }
2132
2236
  return result.claims.jti;
@@ -2299,10 +2403,10 @@ var OAuthProxy = (_class4 = class {
2299
2403
  let errorCode = "invalid_grant";
2300
2404
  let errorDescription;
2301
2405
  try {
2302
- const error = await tokenResponse.json();
2406
+ const error = await this.readUpstreamError(tokenResponse);
2303
2407
  errorCode = error.error || "invalid_grant";
2304
2408
  errorDescription = error.error_description;
2305
- } catch (e8) {
2409
+ } catch (e9) {
2306
2410
  errorDescription = `Upstream returned HTTP ${tokenResponse.status} ${tokenResponse.statusText}`;
2307
2411
  }
2308
2412
  throw new OAuthProxyError(errorCode, errorDescription);
@@ -2425,6 +2529,21 @@ var OAuthProxy = (_class4 = class {
2425
2529
  throw error;
2426
2530
  }
2427
2531
  }
2532
+ /**
2533
+ * Whether `request` comes from the browser the transaction's consent screen
2534
+ * was shown to: it carries the cookie that screen set. A transaction that
2535
+ * never had a consent screen is bound to no browser.
2536
+ */
2537
+ isConsentBoundTo(request2, transaction) {
2538
+ const presented = this.consentCookieValue(request2);
2539
+ return Boolean(
2540
+ presented && transaction.consentBinding && secretsMatch(sha256(presented), transaction.consentBinding)
2541
+ );
2542
+ }
2543
+ /** Whether browsers reach this proxy over HTTPS, going by its `baseUrl`. */
2544
+ isServedOverHttps() {
2545
+ return /^https:/i.test(this.config.baseUrl);
2546
+ }
2428
2547
  /**
2429
2548
  * Issue swapped tokens (JWT pattern)
2430
2549
  * Issues short-lived ViteMCP JWTs and stores upstream tokens securely
@@ -2576,7 +2695,7 @@ var OAuthProxy = (_class4 = class {
2576
2695
  let client;
2577
2696
  try {
2578
2697
  client = await this.resolveClient(transaction.clientId);
2579
- } catch (e9) {
2698
+ } catch (e10) {
2580
2699
  return false;
2581
2700
  }
2582
2701
  return client.redirectUris.some(
@@ -2685,6 +2804,40 @@ var OAuthProxy = (_class4 = class {
2685
2804
  const digest = _crypto.createHash.call(void 0, "sha256").update(refreshToken).digest("base64url");
2686
2805
  return `passthrough-refresh:${this.issuerNs}:${digest}`;
2687
2806
  }
2807
+ /**
2808
+ * What a refusal from the token endpoint says: the `error` and
2809
+ * `error_description` RFC 6749 §5.2 gives it.
2810
+ *
2811
+ * §5.2 sends them as JSON, but a provider that answers a successful request
2812
+ * with a form — GitHub, by default — may refuse with one too, and read as
2813
+ * JSON that lost the provider's own code and description to a bare HTTP
2814
+ * status.
2815
+ *
2816
+ * What parses as JSON is read as JSON, whatever the response declares, as
2817
+ * every refusal was before. A form is read only when the response declares
2818
+ * one, by its media type alone: a 502 page can name that type in a parameter
2819
+ * and carry `error=` in a link, and is no provider's refusal. Rejects when
2820
+ * the body is neither, and the caller falls back to the HTTP status.
2821
+ */
2822
+ async readUpstreamError(response) {
2823
+ const text = await response.text();
2824
+ try {
2825
+ return JSON.parse(text);
2826
+ } catch (cause) {
2827
+ const mediaType = _optionalChain([response, 'access', _26 => _26.headers, 'access', _27 => _27.get, 'call', _28 => _28("content-type"), 'optionalAccess', _29 => _29.split, 'call', _30 => _30(";", 1), 'access', _31 => _31[0], 'optionalAccess', _32 => _32.trim, 'call', _33 => _33(), 'access', _34 => _34.toLowerCase, 'call', _35 => _35()]);
2828
+ if (mediaType === "application/x-www-form-urlencoded") {
2829
+ const params = new URLSearchParams(text);
2830
+ const error = params.get("error");
2831
+ if (error) {
2832
+ return {
2833
+ error,
2834
+ error_description: _nullishCoalesce(params.get("error_description"), () => ( void 0))
2835
+ };
2836
+ }
2837
+ }
2838
+ throw cause;
2839
+ }
2840
+ }
2688
2841
  /**
2689
2842
  * Send the user's browser back to the client's registered callback with how
2690
2843
  * its request came out: a code, or an error (RFC 6749 §4.1.2). The `state`
@@ -2770,10 +2923,10 @@ var OAuthProxy = (_class4 = class {
2770
2923
  let errorCode = "invalid_grant";
2771
2924
  let errorDescription = "Upstream refresh failed";
2772
2925
  try {
2773
- const error = await tokenResponse.json();
2926
+ const error = await this.readUpstreamError(tokenResponse);
2774
2927
  errorCode = error.error || "invalid_grant";
2775
2928
  errorDescription = error.error_description || "Upstream refresh failed";
2776
- } catch (e10) {
2929
+ } catch (e11) {
2777
2930
  errorDescription = `Upstream returned HTTP ${tokenResponse.status} ${tokenResponse.statusText}`;
2778
2931
  }
2779
2932
  throw new OAuthProxyError(errorCode, errorDescription);
@@ -2911,7 +3064,7 @@ var OAuthProxy = (_class4 = class {
2911
3064
  this.cleanupInterval = setInterval(() => {
2912
3065
  this.cleanup();
2913
3066
  }, 6e4);
2914
- _optionalChain([this, 'access', _24 => _24.cleanupInterval, 'access', _25 => _25.unref, 'optionalCall', _26 => _26()]);
3067
+ _optionalChain([this, 'access', _36 => _36.cleanupInterval, 'access', _37 => _37.unref, 'optionalCall', _38 => _38()]);
2915
3068
  }
2916
3069
  /**
2917
3070
  * PKCE challenge methods this proxy accepts, advertised in the authorization
@@ -2963,7 +3116,7 @@ var OAuthProxy = (_class4 = class {
2963
3116
  let url;
2964
3117
  try {
2965
3118
  url = new URL(uri);
2966
- } catch (e11) {
3119
+ } catch (e12) {
2967
3120
  return false;
2968
3121
  }
2969
3122
  if (url.username !== "" || url.password !== "") {
@@ -3028,7 +3181,7 @@ var isLoopbackRedirectUri = (uri) => {
3028
3181
  return isLoopbackHostname(url.hostname);
3029
3182
  }
3030
3183
  return url.protocol !== "";
3031
- } catch (e12) {
3184
+ } catch (e13) {
3032
3185
  return false;
3033
3186
  }
3034
3187
  };
@@ -3047,6 +3200,8 @@ var secretsMatch = (presented, expected) => _crypto.timingSafeEqual.call(void 0,
3047
3200
  _crypto.createHash.call(void 0, "sha256").update(presented).digest(),
3048
3201
  _crypto.createHash.call(void 0, "sha256").update(expected).digest()
3049
3202
  );
3203
+ var sha256 = (value) => _crypto.createHash.call(void 0, "sha256").update(value).digest("base64url");
3204
+ var withoutOptionalWhitespace = (value) => value.replace(/^[ \t]+|[ \t]+$/g, "");
3050
3205
  var OAuthProxyError = class extends Error {
3051
3206
  constructor(code, description, statusCode = 400) {
3052
3207
  super(code);
@@ -3110,11 +3265,12 @@ var AuthProvider = (_class5 = class {
3110
3265
  if (!request2) {
3111
3266
  return void 0;
3112
3267
  }
3113
- const authHeader = request2.headers.get("authorization");
3114
- if (!authHeader || !authHeader.startsWith("Bearer ")) {
3268
+ const token = _optionalChain([/^bearer +(\S.*)$/i, 'access', _39 => _39.exec, 'call', _40 => _40(
3269
+ _nullishCoalesce(request2.headers.get("authorization"), () => ( ""))
3270
+ ), 'optionalAccess', _41 => _41[1]]);
3271
+ if (!token) {
3115
3272
  return void 0;
3116
3273
  }
3117
- const token = authHeader.slice(7);
3118
3274
  const upstreamTokens = await this.proxy.loadUpstreamTokens(token);
3119
3275
  if (!upstreamTokens) {
3120
3276
  return void 0;
@@ -3140,7 +3296,7 @@ var AuthProvider = (_class5 = class {
3140
3296
  */
3141
3297
  destroy() {
3142
3298
  this._destroyed = true;
3143
- _optionalChain([this, 'access', _27 => _27._proxy, 'optionalAccess', _28 => _28.destroy, 'call', _29 => _29()]);
3299
+ _optionalChain([this, 'access', _42 => _42._proxy, 'optionalAccess', _43 => _43.destroy, 'call', _44 => _44()]);
3144
3300
  this._proxy = void 0;
3145
3301
  }
3146
3302
  /**
@@ -3355,7 +3511,7 @@ var DiskStore = (_class6 = class {
3355
3511
  this.cleanupInterval = setInterval(() => {
3356
3512
  void this.cleanup();
3357
3513
  }, cleanupIntervalMs);
3358
- _optionalChain([this, 'access', _30 => _30.cleanupInterval, 'access', _31 => _31.unref, 'optionalCall', _32 => _32()]);
3514
+ _optionalChain([this, 'access', _45 => _45.cleanupInterval, 'access', _46 => _46.unref, 'optionalCall', _47 => _47()]);
3359
3515
  }
3360
3516
  /**
3361
3517
  * Clean up expired entries.
@@ -3447,7 +3603,7 @@ var DiskStore = (_class6 = class {
3447
3603
  await this.ensureDirectory();
3448
3604
  const files = await _promises.readdir.call(void 0, this.directory);
3449
3605
  return files.filter((f) => f.endsWith(this.fileExtension)).length;
3450
- } catch (e13) {
3606
+ } catch (e14) {
3451
3607
  return 0;
3452
3608
  }
3453
3609
  }
@@ -3529,7 +3685,7 @@ var DiskStore = (_class6 = class {
3529
3685
  console.warn(`Failed to read/parse file ${file}, deleting:`, error);
3530
3686
  try {
3531
3687
  await _promises.rm.call(void 0, _path.join.call(void 0, this.directory, file));
3532
- } catch (e14) {
3688
+ } catch (e15) {
3533
3689
  }
3534
3690
  }
3535
3691
  }
@@ -3719,4 +3875,4 @@ Original error: ${error.message}`
3719
3875
 
3720
3876
 
3721
3877
  exports.withoutTrailingSlash = withoutTrailingSlash; exports.getAuthSession = getAuthSession; exports.requireAll = requireAll; exports.requireAny = requireAny; exports.requireAuth = requireAuth; exports.requireRole = requireRole; exports.requireScopes = requireScopes; exports.DEFAULT_ACCESS_TOKEN_TTL = DEFAULT_ACCESS_TOKEN_TTL; exports.DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH = DEFAULT_ACCESS_TOKEN_TTL_NO_REFRESH; exports.DEFAULT_REFRESH_TOKEN_TTL = DEFAULT_REFRESH_TOKEN_TTL; exports.DEFAULT_AUTHORIZATION_CODE_TTL = DEFAULT_AUTHORIZATION_CODE_TTL; exports.DEFAULT_TRANSACTION_TTL = DEFAULT_TRANSACTION_TTL; exports.ConsentManager = ConsentManager; exports.JWTIssuer = JWTIssuer; exports.PKCEUtils = PKCEUtils; exports.EncryptedTokenStorage = EncryptedTokenStorage; exports.MemoryTokenStorage = MemoryTokenStorage; exports.OAuthProxy = OAuthProxy; exports.OAuthProxyError = OAuthProxyError; exports.AuthProvider = AuthProvider; exports.AzureProvider = AzureProvider; exports.GitHubProvider = GitHubProvider; exports.GoogleProvider = GoogleProvider; exports.OAuthProvider = OAuthProvider; exports.DiskStore = DiskStore; exports.JWKSVerifier = JWKSVerifier;
3722
- //# sourceMappingURL=chunk-7XWK66ZT.cjs.map
3878
+ //# sourceMappingURL=chunk-ZEYQBA72.cjs.map