@fedify/fedify 2.5.0-dev.2448 → 2.5.0-dev.2492
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/README.md +3 -0
- package/dist/{builder-DbC8bn6k.mjs → builder-DphK9v7f.mjs} +2 -2
- package/dist/{client-D-XP_Ccb.d.cts → client-3InDZbba.d.cts} +0 -1
- package/dist/{client-D-XP_Ccb.d.ts → client-3InDZbba.d.ts} +0 -1
- package/dist/{client-CEnNz8O7.mjs → client-5SIFzW3q.mjs} +113 -64
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-heeXW2_A.mjs → compound-proof-cYtvlTgF.mjs} +2 -2
- package/dist/{context-GlHrzdSP.d.ts → context-DQJE9YfH.d.ts} +29 -3
- package/dist/{context-BazwQrHn.d.cts → context-DSuL3YWx.d.cts} +29 -3
- package/dist/{deno-Dpewt_jJ.mjs → deno-iOAA7iRN.mjs} +1 -1
- package/dist/docloader-DCZkiTeF.mjs +136 -0
- package/dist/{exporter-DThFfe7P.mjs → exporter-DVG68ozH.mjs} +36 -30
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +6 -3
- package/dist/federation/handler-compound-proof.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +5 -5
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox-actorless.test.mjs +5 -5
- package/dist/federation/inbox-report.test.mjs +5 -5
- package/dist/federation/inbox-view.test.mjs +1 -1
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +468 -33
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +1 -1
- package/dist/federation/mq.test.mjs +1 -1
- package/dist/federation/outgoing-proof.test.mjs +9 -6
- package/dist/federation/portable-actor.test.mjs +3 -3
- package/dist/federation/portable-chain.test.mjs +3 -3
- package/dist/federation/portable-collection.test.mjs +4 -4
- package/dist/federation/portable-delivery.test.mjs +2 -2
- package/dist/federation/portable-gateway-keys.test.mjs +11 -5
- package/dist/federation/portable-inbox.test.mjs +4 -4
- package/dist/federation/portable-parse-uri.test.mjs +1 -1
- package/dist/federation/portable-route-activity.test.mjs +2 -2
- package/dist/federation/portable.test.mjs +3 -3
- package/dist/federation/send.test.mjs +502 -93
- package/dist/federation/tasks/enqueue.test.mjs +1 -1
- package/dist/federation/tasks/tasks.test.mjs +2 -2
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-D8YexkP1.cjs → federation-D0AZw_aw.cjs} +246 -108
- package/dist/{http-BZkyQIkb.mjs → http-BoJCMnjY.mjs} +204 -106
- package/dist/{http-BBr-VLil.js → http-ChXUU_3c.js} +178 -109
- package/dist/{http-CAl7Num5.cjs → http-kv1LZw-r.cjs} +179 -110
- package/dist/{inbox-wDuMKaFW.mjs → inbox-BjihTKLo.mjs} +2 -2
- package/dist/{inbox-view-NE9wXdLo.mjs → inbox-view-D-skypg-.mjs} +1 -1
- package/dist/{key-nYGY4QB9.d.cts → key-DbLNT-vA.d.ts} +1 -2
- package/dist/{key-DhsBxxZN.d.ts → key-DlHT4R6k.d.cts} +1 -2
- package/dist/{kv-cache-CTQSfkmp.mjs → kv-cache-Cmsyke4d.mjs} +1 -1
- package/dist/{kv-cache-U7uz5nx4.js → kv-cache-DQcte7ES.js} +73 -28
- package/dist/{kv-cache-CjgCOz3i.cjs → kv-cache-Ddh5sMxH.cjs} +72 -27
- package/dist/{ld-Cel1RRZ5.d.cts → ld-CWVpo_NM.d.cts} +1 -1
- package/dist/{ld-CQFuiah9.mjs → ld-CdvcOEXQ.mjs} +2 -2
- package/dist/{ld-CcuZ4NZa.d.ts → ld-Inagww4R.d.ts} +1 -1
- package/dist/{metrics-B-QxRSSR.mjs → metrics-CpxvUrBz.mjs} +1 -1
- package/dist/{middleware-P-AZEQMn.js → middleware-BHb5toqA.js} +247 -109
- package/dist/{middleware-BdlNa8BD.mjs → middleware-BKs2DLUF.mjs} +1 -1
- package/dist/{middleware-CuVa0UuS.mjs → middleware-CoBLrTKX.mjs} +89 -49
- package/dist/{mod-DvWOv2Ho.d.cts → mod-6TQ4UQZb.d.cts} +1 -1
- package/dist/{mod-BHQE-7WQ.d.ts → mod-B4kBw1-8.d.ts} +1 -1
- package/dist/{mod-DkhfZC1u.d.ts → mod-B7j30IQf.d.ts} +2 -9
- package/dist/{mod-B2783_3v.d.cts → mod-C1nT74IG.d.cts} +1 -1
- package/dist/{mod-DjZfJj9R.d.ts → mod-CIeBgsOC.d.ts} +1 -1
- package/dist/{mod-B5-wdzmJ.d.cts → mod-YvA4Rk8J.d.cts} +2 -9
- package/dist/mod.cjs +5 -5
- package/dist/mod.d.cts +7 -7
- package/dist/mod.d.ts +7 -7
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/client.test.mjs +337 -19
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/nodeinfo/mod.cjs +1 -1
- package/dist/nodeinfo/mod.d.cts +1 -1
- package/dist/nodeinfo/mod.d.ts +1 -1
- package/dist/nodeinfo/mod.js +1 -1
- package/dist/otel/exporter.test.mjs +257 -1
- package/dist/otel/mod.cjs +36 -30
- package/dist/otel/mod.d.cts +13 -0
- package/dist/otel/mod.d.ts +13 -0
- package/dist/otel/mod.js +36 -30
- package/dist/{owner-ccKkQOAf.mjs → owner-DTnVpUKA.mjs} +3 -3
- package/dist/{portable-collection-CndnpXfo.mjs → portable-collection-CJeYTL61.mjs} +2 -2
- package/dist/{portable-collection-TC-kvkVI.cjs → portable-collection-DciwBIia.cjs} +1 -1
- package/dist/{portable-collection-DUlQ3s2M.js → portable-collection-TmtpzD4E.js} +1 -1
- package/dist/{portable-key-D5tFOoV-.mjs → portable-key-DcYok4ki.mjs} +1 -1
- package/dist/{proof-DPoF06nz.mjs → proof-GH7Poos_.mjs} +3 -3
- package/dist/{send-CF44O1Df.mjs → send-BgGJh6pv.mjs} +174 -76
- package/dist/sig/compound-proof-discovery.test.mjs +1 -1
- package/dist/sig/compound-proof-producer.test.mjs +1 -1
- package/dist/sig/compound-proof-verification.test.mjs +2 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +553 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +1 -1
- package/dist/sig/mitra-receive-interop.test.mjs +4 -4
- package/dist/sig/mitra-send-interop.test.mjs +3 -3
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +3 -3
- package/dist/sig/mod.d.ts +3 -3
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/portable-collection.test.mjs +1 -1
- package/dist/sig/portable-interop.test.mjs +3 -3
- package/dist/sig/portable-key.test.mjs +5 -5
- package/dist/sig/proof.test.mjs +4 -4
- package/dist/sig/tootik-request-interop.test.mjs +4 -4
- package/dist/sig/tootik-send-interop.test.mjs +3 -3
- package/dist/sig/verification.test.mjs +3 -3
- package/dist/{temporal-XlZ4Wb94.mjs → temporal-gJINzcL4.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/testing/mod.d.mts +26 -0
- package/dist/{types-_S2_MeLF.js → types-DUjZb4i6.js} +112 -63
- package/dist/{types-poIao40f.cjs → types-hKCCjii0.cjs} +111 -62
- package/dist/utils/docloader.test.mjs +344 -36
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +8 -8
- package/dist/docloader-CpsDyqVN.mjs +0 -91
|
@@ -15,7 +15,7 @@ import serialize from "json-canon";
|
|
|
15
15
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
16
16
|
//#region deno.json
|
|
17
17
|
var name = "@fedify/fedify";
|
|
18
|
-
var version = "2.5.0-dev.
|
|
18
|
+
var version = "2.5.0-dev.2492+4648c04e";
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/sig/portable-key-id.ts
|
|
21
21
|
const COMPATIBLE_KEY_ID_PATH_PATTERN = /^\/\.well-known\/apgateway\/did(?::|%3A)/i;
|
|
@@ -6595,10 +6595,10 @@ async function createRedirectRequest(request, location, body, validateRedirect)
|
|
|
6595
6595
|
cache: request.cache
|
|
6596
6596
|
});
|
|
6597
6597
|
}
|
|
6598
|
-
async function fetchDoubleKnockRequest(request, signedRequest, signal) {
|
|
6598
|
+
async function fetchDoubleKnockRequest(session, request, signedRequest, signal) {
|
|
6599
6599
|
const maxAttempts = request.method === "GET" || request.method === "HEAD" ? 2 : 1;
|
|
6600
6600
|
for (let attempt = 1;; attempt++) try {
|
|
6601
|
-
return await fetch(signedRequest, {
|
|
6601
|
+
return await session.fetch(signedRequest, {
|
|
6602
6602
|
redirect: "manual",
|
|
6603
6603
|
signal
|
|
6604
6604
|
});
|
|
@@ -6649,125 +6649,194 @@ function getAbortReason(signal) {
|
|
|
6649
6649
|
return signal.reason ?? new DOMException("The operation was aborted.", "AbortError");
|
|
6650
6650
|
}
|
|
6651
6651
|
/**
|
|
6652
|
-
* Performs a double-knock request
|
|
6653
|
-
*
|
|
6654
|
-
*
|
|
6652
|
+
* Performs a double-knock request like {@link doubleKnock}, opening a session
|
|
6653
|
+
* for every hop with the given function, and passes the final response to
|
|
6654
|
+
* the given function. The final session is closed after `consume` settles,
|
|
6655
|
+
* so `consume` must read or cancel the response body before it returns.
|
|
6656
|
+
* This is not exported from any entry point.
|
|
6655
6657
|
* @param request The request to send.
|
|
6656
6658
|
* @param identity The identity to use for signing the request.
|
|
6657
6659
|
* @param options The options for double-knock requests.
|
|
6658
|
-
* @
|
|
6659
|
-
*
|
|
6660
|
+
* @param openHop The function to open a session for each hop. The session of
|
|
6661
|
+
* a hop is closed before the next hop is opened.
|
|
6662
|
+
* @param consume The function to consume the final response.
|
|
6663
|
+
* @returns The value returned by `consume`.
|
|
6660
6664
|
*/
|
|
6661
|
-
async function
|
|
6662
|
-
|
|
6665
|
+
async function doubleKnockScoped(request, identity, options, openHop, consume) {
|
|
6666
|
+
const { response, session } = await doubleKnockCore(request, identity, options, openHop);
|
|
6667
|
+
try {
|
|
6668
|
+
return await consume(response);
|
|
6669
|
+
} catch (error) {
|
|
6670
|
+
getLogger([
|
|
6671
|
+
"fedify",
|
|
6672
|
+
"sig",
|
|
6673
|
+
"http"
|
|
6674
|
+
]).debug("Failed to consume the response from {url}; closing the session: {error}", {
|
|
6675
|
+
url: request.url,
|
|
6676
|
+
error
|
|
6677
|
+
});
|
|
6678
|
+
throw error;
|
|
6679
|
+
} finally {
|
|
6680
|
+
await session.close();
|
|
6681
|
+
}
|
|
6682
|
+
}
|
|
6683
|
+
function isRedirectResponse(response) {
|
|
6684
|
+
return response.status >= 300 && response.status < 400 && response.headers.has("Location");
|
|
6663
6685
|
}
|
|
6664
|
-
|
|
6686
|
+
/**
|
|
6687
|
+
* Starts cancelling the body of a response that is not passed to the caller,
|
|
6688
|
+
* without waiting for it to settle. The cancellation of a branch of a tee
|
|
6689
|
+
* (e.g., a body cloned by a fetch mock) settles only after the other branch
|
|
6690
|
+
* is cancelled too, per the Streams standard, so awaiting it could block
|
|
6691
|
+
* forever. Failures are only logged.
|
|
6692
|
+
*/
|
|
6693
|
+
function cancelResponseBody(response, url) {
|
|
6694
|
+
response.body?.cancel().catch((error) => {
|
|
6695
|
+
getLogger([
|
|
6696
|
+
"fedify",
|
|
6697
|
+
"sig",
|
|
6698
|
+
"http"
|
|
6699
|
+
]).debug("Failed to cancel the response body from {url}: {error}", {
|
|
6700
|
+
url,
|
|
6701
|
+
error
|
|
6702
|
+
});
|
|
6703
|
+
});
|
|
6704
|
+
}
|
|
6705
|
+
async function doubleKnockCore(request, identity, options, openHop) {
|
|
6665
6706
|
const { specDeterminer, log, tracerProvider, signal } = options;
|
|
6666
6707
|
signal?.throwIfAborted();
|
|
6667
6708
|
const maximumRedirection = options.maxRedirection ?? DEFAULT_MAX_REDIRECTION;
|
|
6668
|
-
visited
|
|
6669
|
-
const origin = new URL(request.url).origin;
|
|
6670
|
-
const firstTrySpec = specDeterminer == null ? "rfc9421" : await specDeterminer.determineSpec(origin);
|
|
6671
|
-
signal?.throwIfAborted();
|
|
6709
|
+
const visited = /* @__PURE__ */ new Set();
|
|
6672
6710
|
const body = options.body !== void 0 ? options.body : request.method !== "GET" && request.method !== "HEAD" ? await request.clone().arrayBuffer() : null;
|
|
6673
|
-
let
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6714
|
-
|
|
6715
|
-
|
|
6711
|
+
let session = await openHop(request.url);
|
|
6712
|
+
try {
|
|
6713
|
+
for (let redirected = 0;; redirected++) {
|
|
6714
|
+
visited.add(request.url);
|
|
6715
|
+
const origin = new URL(request.url).origin;
|
|
6716
|
+
const firstTrySpec = specDeterminer == null ? "rfc9421" : await specDeterminer.determineSpec(origin);
|
|
6717
|
+
signal?.throwIfAborted();
|
|
6718
|
+
let signedRequest = await signRequest(request, identity.privateKey, identity.keyId, {
|
|
6719
|
+
spec: firstTrySpec,
|
|
6720
|
+
tracerProvider,
|
|
6721
|
+
body
|
|
6722
|
+
});
|
|
6723
|
+
signal?.throwIfAborted();
|
|
6724
|
+
log?.(signedRequest);
|
|
6725
|
+
let response = await fetchDoubleKnockRequest(session, request, signedRequest, signal);
|
|
6726
|
+
const firstRedirected = isRedirectResponse(response);
|
|
6727
|
+
if (!firstRedirected && (response.status === 400 || response.status === 401 || response.status > 401)) {
|
|
6728
|
+
const logger = getLogger([
|
|
6729
|
+
"fedify",
|
|
6730
|
+
"sig",
|
|
6731
|
+
"http"
|
|
6732
|
+
]);
|
|
6733
|
+
const acceptSigHeader = response.headers.get("Accept-Signature");
|
|
6734
|
+
if (acceptSigHeader != null) {
|
|
6735
|
+
const entries = validateAcceptSignature(parseAcceptSignature(acceptSigHeader));
|
|
6736
|
+
const localKeyId = identity.keyId.href;
|
|
6737
|
+
const localAlg = "rsa-v1_5-sha256";
|
|
6738
|
+
let fulfilled = false;
|
|
6739
|
+
let challengeRequest;
|
|
6740
|
+
for (const entry of entries) {
|
|
6741
|
+
signal?.throwIfAborted();
|
|
6742
|
+
const rfc9421 = fulfillAcceptSignature(entry, localKeyId, localAlg);
|
|
6743
|
+
if (rfc9421 == null) continue;
|
|
6744
|
+
logger.debug("Received Accept-Signature challenge; accumulating label {label} and components {components}.", {
|
|
6745
|
+
label: rfc9421.label,
|
|
6746
|
+
components: rfc9421.components
|
|
6747
|
+
});
|
|
6748
|
+
try {
|
|
6749
|
+
challengeRequest = await signRequest(challengeRequest ?? request, identity.privateKey, identity.keyId, {
|
|
6750
|
+
spec: "rfc9421",
|
|
6751
|
+
tracerProvider,
|
|
6752
|
+
body,
|
|
6753
|
+
rfc9421
|
|
6754
|
+
});
|
|
6755
|
+
fulfilled = true;
|
|
6756
|
+
} catch (error) {
|
|
6757
|
+
logger.debug("Failed to fulfill Accept-Signature challenge entry {label}: {error}", {
|
|
6758
|
+
label: entry.label,
|
|
6759
|
+
error
|
|
6760
|
+
});
|
|
6761
|
+
}
|
|
6762
|
+
}
|
|
6763
|
+
if (fulfilled && challengeRequest != null) {
|
|
6764
|
+
signal?.throwIfAborted();
|
|
6765
|
+
cancelResponseBody(response, request.url);
|
|
6766
|
+
signedRequest = challengeRequest;
|
|
6767
|
+
log?.(signedRequest);
|
|
6768
|
+
response = await session.fetch(signedRequest, {
|
|
6769
|
+
redirect: "manual",
|
|
6770
|
+
signal
|
|
6771
|
+
});
|
|
6772
|
+
}
|
|
6773
|
+
if (fulfilled && !isRedirectResponse(response)) {
|
|
6774
|
+
if (response.status < 300) {
|
|
6775
|
+
await specDeterminer?.rememberSpec(origin, "rfc9421");
|
|
6776
|
+
return {
|
|
6777
|
+
response,
|
|
6778
|
+
session
|
|
6779
|
+
};
|
|
6780
|
+
}
|
|
6781
|
+
if (response.status !== 400 && response.status !== 401) return {
|
|
6782
|
+
response,
|
|
6783
|
+
session
|
|
6784
|
+
};
|
|
6785
|
+
}
|
|
6786
|
+
}
|
|
6787
|
+
if (!isRedirectResponse(response)) {
|
|
6788
|
+
const spec = firstTrySpec === "draft-cavage-http-signatures-12" ? "rfc9421" : "draft-cavage-http-signatures-12";
|
|
6789
|
+
getLogger([
|
|
6790
|
+
"fedify",
|
|
6791
|
+
"sig",
|
|
6792
|
+
"http"
|
|
6793
|
+
]).debug("Failed to verify with the spec {spec} ({status} {statusText}); retrying with spec {secondSpec}... (double-knocking)", {
|
|
6794
|
+
spec: firstTrySpec,
|
|
6795
|
+
secondSpec: spec,
|
|
6796
|
+
status: response.status,
|
|
6797
|
+
statusText: response.statusText
|
|
6716
6798
|
});
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6799
|
+
cancelResponseBody(response, request.url);
|
|
6800
|
+
signal?.throwIfAborted();
|
|
6801
|
+
signedRequest = await signRequest(request, identity.privateKey, identity.keyId, {
|
|
6802
|
+
spec,
|
|
6803
|
+
tracerProvider,
|
|
6804
|
+
body
|
|
6722
6805
|
});
|
|
6806
|
+
signal?.throwIfAborted();
|
|
6807
|
+
log?.(signedRequest);
|
|
6808
|
+
response = await fetchDoubleKnockRequest(session, request, signedRequest, signal);
|
|
6809
|
+
if (!isRedirectResponse(response) && response.status !== 400 && response.status !== 401) await specDeterminer?.rememberSpec(origin, spec);
|
|
6723
6810
|
}
|
|
6724
|
-
}
|
|
6725
|
-
if (
|
|
6726
|
-
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
signal
|
|
6732
|
-
});
|
|
6733
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) return doubleKnock(await createRedirectRequest(request, response.headers.get("Location"), body, options.validateRedirect), identity, {
|
|
6734
|
-
...options,
|
|
6735
|
-
body
|
|
6736
|
-
});
|
|
6737
|
-
}
|
|
6738
|
-
if (fulfilled && response.status < 300) {
|
|
6739
|
-
await specDeterminer?.rememberSpec(origin, "rfc9421");
|
|
6740
|
-
return response;
|
|
6741
|
-
}
|
|
6742
|
-
if (fulfilled && response.status !== 400 && response.status !== 401) return response;
|
|
6743
|
-
}
|
|
6744
|
-
const spec = firstTrySpec === "draft-cavage-http-signatures-12" ? "rfc9421" : "draft-cavage-http-signatures-12";
|
|
6745
|
-
logger.debug("Failed to verify with the spec {spec} ({status} {statusText}); retrying with spec {secondSpec}... (double-knocking)", {
|
|
6746
|
-
spec: firstTrySpec,
|
|
6747
|
-
secondSpec: spec,
|
|
6748
|
-
status: response.status,
|
|
6749
|
-
statusText: response.statusText
|
|
6750
|
-
});
|
|
6751
|
-
signal?.throwIfAborted();
|
|
6752
|
-
signedRequest = await signRequest(request, identity.privateKey, identity.keyId, {
|
|
6753
|
-
spec,
|
|
6754
|
-
tracerProvider,
|
|
6755
|
-
body
|
|
6756
|
-
});
|
|
6757
|
-
signal?.throwIfAborted();
|
|
6758
|
-
log?.(signedRequest);
|
|
6759
|
-
response = await fetchDoubleKnockRequest(request, signedRequest, signal);
|
|
6760
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
|
6811
|
+
} else if (!firstRedirected) await specDeterminer?.rememberSpec(origin, firstTrySpec);
|
|
6812
|
+
if (!isRedirectResponse(response)) return {
|
|
6813
|
+
response,
|
|
6814
|
+
session
|
|
6815
|
+
};
|
|
6816
|
+
cancelResponseBody(response, request.url);
|
|
6817
|
+
await session.close();
|
|
6761
6818
|
if (redirected >= maximumRedirection) throw new FetchError(request.url, `Too many redirections (${redirected + 1})`);
|
|
6762
|
-
const
|
|
6819
|
+
const location = response.headers.get("Location");
|
|
6820
|
+
const redirectRequest = await createRedirectRequest(request, location, body, options.validateRedirect);
|
|
6763
6821
|
if (visited.has(redirectRequest.url)) throw new FetchError(request.url, `Redirect loop detected: ${redirectRequest.url}`);
|
|
6764
|
-
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
|
|
6768
|
-
|
|
6769
|
-
|
|
6770
|
-
|
|
6822
|
+
request = redirectRequest;
|
|
6823
|
+
session = await openHop(request.url);
|
|
6824
|
+
}
|
|
6825
|
+
} catch (error) {
|
|
6826
|
+
try {
|
|
6827
|
+
await session.close();
|
|
6828
|
+
} catch (closeError) {
|
|
6829
|
+
getLogger([
|
|
6830
|
+
"fedify",
|
|
6831
|
+
"sig",
|
|
6832
|
+
"http"
|
|
6833
|
+
]).debug("Failed to close the session for {url}: {error}", {
|
|
6834
|
+
url: request.url,
|
|
6835
|
+
error: closeError
|
|
6836
|
+
});
|
|
6837
|
+
}
|
|
6838
|
+
throw error;
|
|
6839
|
+
}
|
|
6771
6840
|
}
|
|
6772
6841
|
/**
|
|
6773
6842
|
* Performs a timing-safe equality comparison between two `Uint8Array` values.
|
|
@@ -6797,4 +6866,4 @@ function timingSafeEqual(a, b) {
|
|
|
6797
6866
|
return result === 0;
|
|
6798
6867
|
}
|
|
6799
6868
|
//#endregion
|
|
6800
|
-
export { getVerifiedKeyOwnerEvidence as $, compactJsonLd as A, getRawCanonicalPortableId as At, verifyCompactJsonLdDetailed as B, verifyPortableObjectProofWithRoot as C, observeAttempt as Ct, InvalidContextReferenceError as D, getCanonicalPortableId as Dt, normalizeOutgoingActivityJsonLd as E, getAuthenticationOrigin as Et, hasSignatureLike as F, isPortableUri as Ft, fetchActorDocument as G, verifySignature as H, isClearlyMalformedContextReference as I, isSameObjectId as It, generateCryptoKeyPair as J, fetchKey as K, isInvalidUrlTypeError as L, isSamePublicKey as Lt, detachSignature as M, isCompatibleKeyId as Mt, getNormalizationContextLoader as N, isPortableId as Nt, assertSafeJsonLd as O, getGatewayKeyBase as Ot, hasSignature as P, isPortableKeyId as Pt, MAX_PORTABLE_KEY_TTL as Q, markEffectiveContextLoader as R, name as Rt, verifyPortableObjectProofPolicy as S, validateAcceptSignature as St, verifyProof as T, verificationObservation as Tt, wrapContextLoaderForJsonLd as U, verifyJsonLd as V, exportJwk as W, validateCryptoKey as X, importJwk as Y, verifyKeyOwnership as Z, signObject as _, registerQueueDepthGauge as _t, signRequest as a, isAbortError$1 as at, verifyObjectDetailed as b, fulfillAcceptSignature as bt, verifyRequestDetailed as c, recordCollectionPageItems as ct, InvalidPortableObjectIdError as d, recordDocumentCache as dt, parseKeyOwnerEvidence as et, classifyFep2277CoreType as f, recordFanoutRecipients as ft, preparePortableObjectProofPolicy as g, recordWebFingerHandle as gt, hasProofLike as h, recordOutboxEnqueue as ht, selectRequestSignature as i, instrumentDocumentLoader as it, createSignature as j, hasPortableActor as jt, attachSignature as k, getPortableDid as kt, fetchPortableGatewayKey as l, recordCollectionRequest as lt, getProofSigner as m, recordOutboxActivity as mt, listRequestSignatures as n, getFederationMetrics as nt, validateMaxSignatures as o, recordCircuitBreakerStateChange as ot, createProof as p, recordInboxActivity as pt, fetchKeyDetailed as q, parseRfc9421SignatureInput as r, getRemoteHost as rt, verifyRequest as s, recordCollectionDispatchDuration as st,
|
|
6869
|
+
export { getVerifiedKeyOwnerEvidence as $, compactJsonLd as A, getRawCanonicalPortableId as At, verifyCompactJsonLdDetailed as B, verifyPortableObjectProofWithRoot as C, observeAttempt as Ct, InvalidContextReferenceError as D, getCanonicalPortableId as Dt, normalizeOutgoingActivityJsonLd as E, getAuthenticationOrigin as Et, hasSignatureLike as F, isPortableUri as Ft, fetchActorDocument as G, verifySignature as H, isClearlyMalformedContextReference as I, isSameObjectId as It, generateCryptoKeyPair as J, fetchKey as K, isInvalidUrlTypeError as L, isSamePublicKey as Lt, detachSignature as M, isCompatibleKeyId as Mt, getNormalizationContextLoader as N, isPortableId as Nt, assertSafeJsonLd as O, getGatewayKeyBase as Ot, hasSignature as P, isPortableKeyId as Pt, MAX_PORTABLE_KEY_TTL as Q, markEffectiveContextLoader as R, name as Rt, verifyPortableObjectProofPolicy as S, validateAcceptSignature as St, verifyProof as T, verificationObservation as Tt, wrapContextLoaderForJsonLd as U, verifyJsonLd as V, exportJwk as W, validateCryptoKey as X, importJwk as Y, verifyKeyOwnership as Z, signObject as _, registerQueueDepthGauge as _t, signRequest as a, isAbortError$1 as at, verifyObjectDetailed as b, fulfillAcceptSignature as bt, verifyRequestDetailed as c, recordCollectionPageItems as ct, InvalidPortableObjectIdError as d, recordDocumentCache as dt, parseKeyOwnerEvidence as et, classifyFep2277CoreType as f, recordFanoutRecipients as ft, preparePortableObjectProofPolicy as g, recordWebFingerHandle as gt, hasProofLike as h, recordOutboxEnqueue as ht, selectRequestSignature as i, instrumentDocumentLoader as it, createSignature as j, hasPortableActor as jt, attachSignature as k, getPortableDid as kt, fetchPortableGatewayKey as l, recordCollectionRequest as lt, getProofSigner as m, recordOutboxActivity as mt, listRequestSignatures as n, getFederationMetrics as nt, validateMaxSignatures as o, recordCircuitBreakerStateChange as ot, createProof as p, recordInboxActivity as pt, fetchKeyDetailed as q, parseRfc9421SignatureInput as r, getRemoteHost as rt, verifyRequest as s, recordCollectionDispatchDuration as st, doubleKnockScoped as t, getDurationMs as tt, resolvePortableActorKey as u, recordCollectionTotalItems as ut, verifyMapLocalProof as v, preloadedOnlyDocumentLoader as vt, verifyPreparedPortableObjectProofPolicy as w, snapshotKey as wt, verifyPortableObjectProof as x, parseAcceptSignature as xt, verifyObject as y, formatAcceptSignature as yt, signJsonLd as z, version as zt };
|