@orangecheck/me-client 0.53.2 → 0.53.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
@@ -993,11 +993,11 @@ async function fetchJwks(issuer, ttlMs, maxStaleMs = DEFAULT_MAX_STALE_MS) {
993
993
  if (!json || !Array.isArray(json.keys)) {
994
994
  throw new Error(`JWKS at ${url} did not return {keys:[\u2026]}`);
995
995
  }
996
- const keys = {};
996
+ const keys = /* @__PURE__ */ new Map();
997
997
  for (const k of json.keys) {
998
998
  if (typeof k.kid !== "string") continue;
999
999
  try {
1000
- keys[k.kid] = await importJWK(k, "EdDSA");
1000
+ keys.set(k.kid, await importJWK(k, "EdDSA"));
1001
1001
  } catch {
1002
1002
  }
1003
1003
  }
@@ -1072,11 +1072,11 @@ async function verify2(rawBody, sigHex, kid, options = {}) {
1072
1072
  const maxStale = options.jwksMaxStaleMs ?? DEFAULT_MAX_STALE_MS;
1073
1073
  try {
1074
1074
  let entry = await fetchJwks(issuer, ttl, maxStale);
1075
- key = entry.keys[kid];
1075
+ key = entry.keys.get(kid);
1076
1076
  if (!key && Date.now() - (lastForcedRefresh.get(issuer) ?? 0) >= FORCED_REFRESH_MIN_INTERVAL_MS) {
1077
1077
  lastForcedRefresh.set(issuer, Date.now());
1078
1078
  entry = await fetchJwks(issuer, 0, maxStale);
1079
- key = entry.keys[kid];
1079
+ key = entry.keys.get(kid);
1080
1080
  }
1081
1081
  } catch (err) {
1082
1082
  return { ok: false, reason: `jwks unavailable: ${err.message}` };
@@ -1265,11 +1265,11 @@ async function fetchEnvelopeJwks(issuer, ttlMs, maxStaleMs = DEFAULT_MAX_STALE_M
1265
1265
  if (!json || !Array.isArray(json.keys)) {
1266
1266
  throw new Error(`envelope JWKS at ${url} did not return {keys:[\u2026]}`);
1267
1267
  }
1268
- const keys = {};
1268
+ const keys = /* @__PURE__ */ new Map();
1269
1269
  for (const k of json.keys) {
1270
1270
  if (typeof k.kid !== "string") continue;
1271
1271
  try {
1272
- keys[k.kid] = await importJWK(k, "EdDSA");
1272
+ keys.set(k.kid, await importJWK(k, "EdDSA"));
1273
1273
  } catch {
1274
1274
  }
1275
1275
  }
@@ -1447,11 +1447,11 @@ async function verifyActivityAttestation(bundle, options = {}) {
1447
1447
  const maxStale = options.jwksMaxStaleMs ?? DEFAULT_MAX_STALE_MS2;
1448
1448
  try {
1449
1449
  let entry = await fetchEnvelopeJwks(issuer, ttl, maxStale);
1450
- key = entry.keys[bundle.kid] ?? null;
1450
+ key = entry.keys.get(bundle.kid) ?? null;
1451
1451
  if (!key && Date.now() - (lastForcedRefresh2.get(issuer) ?? 0) >= FORCED_REFRESH_MIN_INTERVAL_MS2) {
1452
1452
  lastForcedRefresh2.set(issuer, Date.now());
1453
1453
  entry = await fetchEnvelopeJwks(issuer, 0, maxStale);
1454
- key = entry.keys[bundle.kid] ?? null;
1454
+ key = entry.keys.get(bundle.kid) ?? null;
1455
1455
  }
1456
1456
  checks.push({
1457
1457
  ok: !!key,