cauthy-auth 0.24.2 → 0.24.3

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/dist/index.mjs CHANGED
@@ -1097,10 +1097,11 @@ function createCauthy(given = {}) {
1097
1097
  const clientIp = given.clientIp ?? ((request) => request.headers.get("x-forwarded-for")?.split(",").pop()?.trim() || void 0);
1098
1098
  let noProofUntil = 0;
1099
1099
  async function passedOn(request) {
1100
+ if (Date.now() < noProofUntil) return {};
1100
1101
  const ip = clientIp(request);
1101
- if (!ip || Date.now() < noProofUntil) return {};
1102
1102
  try {
1103
- return { "x-cauthy-client-ip": ip, "x-cauthy-system-token": await ownSystem.token() };
1103
+ const proof = { "x-cauthy-system-token": await ownSystem.token() };
1104
+ return ip ? { ...proof, "x-cauthy-client-ip": ip } : proof;
1104
1105
  } catch {
1105
1106
  noProofUntil = Date.now() + 5 * 6e4;
1106
1107
  return {};