Files
klz-cables.com/.pnpm-store/v10/files/35/3155fdbfdcab04e5b6e9cb7904a5422c1c3a8a6102a019cbe19fb369165c23503a7f4ada78c5726412bb1753be7a80cadae92e5f0b6cc6d18aedd6a7b15ec3
Marc Mintel 5397309103
Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
fix(products): fix breadcrumbs and product filtering (backport from main)
2026-02-24 16:04:21 +01:00

46 lines
1.5 KiB
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const http = require("node:http");
const https = require("node:https");
const node_events_1 = require("node:events");
const errors_js_1 = require("../util/errors.js");
const buffer_utils_js_1 = require("../lib/buffer_utils.js");
const fetchJwks = async (url, timeout, options) => {
let get;
switch (url.protocol) {
case 'https:':
get = https.get;
break;
case 'http:':
get = http.get;
break;
default:
throw new TypeError('Unsupported URL protocol.');
}
const { agent, headers } = options;
const req = get(url.href, {
agent,
timeout,
headers,
});
const [response] = (await Promise.race([(0, node_events_1.once)(req, 'response'), (0, node_events_1.once)(req, 'timeout')]));
if (!response) {
req.destroy();
throw new errors_js_1.JWKSTimeout();
}
if (response.statusCode !== 200) {
throw new errors_js_1.JOSEError('Expected 200 OK from the JSON Web Key Set HTTP response');
}
const parts = [];
for await (const part of response) {
parts.push(part);
}
try {
return JSON.parse(buffer_utils_js_1.decoder.decode((0, buffer_utils_js_1.concat)(...parts)));
}
catch {
throw new errors_js_1.JOSEError('Failed to parse the JSON Web Key Set HTTP response as JSON');
}
};
exports.default = fetchJwks;