@fedify/fedify 2.0.8 → 2.0.10
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/{assert-MZs1qjMx.js → assert-ddO5KLpe.mjs} +5 -9
- package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Ew3jOFa3.mjs} +55 -69
- package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-C4Ri6VuN.mjs} +5 -9
- package/dist/{assert_not_equals-C80BG-_5.js → assert_not_equals--wG9hV7u.mjs} +6 -13
- package/dist/{assert_rejects-Ce45JcFg.js → assert_rejects-B-qJtC9Z.mjs} +6 -11
- package/dist/{assert_throws-BNXdRGWP.js → assert_throws-4NwKEy2q.mjs} +5 -10
- package/dist/{builder-B5cKln9v.js → builder-opzCVeXZ.mjs} +32 -41
- package/dist/{chunk-CGaQZ11T.cjs → chunk-DDcVe30Y.cjs} +23 -24
- package/dist/{chunk-DJNbSFdH.js → chunk-nlSIicah.js} +8 -8
- package/dist/{client-CoCIaTNO.js → client-A1UrnX6I.mjs} +9 -13
- package/dist/{client-BxMZiQaD.d.ts → client-AtlibPOU.d.ts} +1 -1
- package/dist/{client-C97KOq3x.d.cts → client-z-8dc-e1.d.cts} +1 -1
- package/dist/{collection-CcnIw1qY.js → collection-ChgDTHLz.mjs} +7 -12
- package/dist/compat/mod.cjs +5 -8
- package/dist/compat/mod.d.cts +78 -6
- package/dist/compat/mod.d.ts +78 -6
- package/dist/compat/mod.js +4 -8
- package/dist/compat/transformers.test.mjs +62 -0
- package/dist/{context-D3QkEtZd.d.cts → context-CNIt-Qn7.d.cts} +9 -18
- package/dist/{context-DZJhUmzF.d.ts → context-Dyg7P1qW.d.ts} +9 -18
- package/dist/{context-pa9aIrwp.js → context-Juj6bdHC.mjs} +7 -11
- package/dist/deno-CrjRl2cm.mjs +8 -0
- package/dist/{docloader-CBHh0rC5.js → docloader-35wi0JO1.mjs} +8 -14
- package/dist/{esm-nLm00z9V.js → esm-DVILvP5e.mjs} +50 -89
- package/dist/federation/builder.test.d.mts +2 -0
- package/dist/federation/{builder.test.js → builder.test.mjs} +19 -38
- package/dist/federation/collection.test.d.mts +2 -0
- package/dist/federation/collection.test.mjs +21 -0
- package/dist/federation/handler.test.d.mts +2 -0
- package/dist/federation/{handler.test.js → handler.test.mjs} +26 -56
- package/dist/federation/idempotency.test.d.mts +2 -0
- package/dist/federation/{idempotency.test.js → idempotency.test.mjs} +31 -62
- package/dist/federation/inbox.test.d.mts +2 -0
- package/dist/federation/{inbox.test.js → inbox.test.mjs} +8 -12
- package/dist/federation/keycache.test.d.mts +2 -0
- package/dist/federation/{keycache.test.js → keycache.test.mjs} +11 -15
- package/dist/federation/kv.test.d.mts +2 -0
- package/dist/federation/{kv.test.js → kv.test.mjs} +11 -22
- package/dist/federation/middleware.test.d.mts +2 -0
- package/dist/federation/{middleware.test.js → middleware.test.mjs} +146 -225
- package/dist/federation/mod.cjs +327 -16
- package/dist/federation/mod.d.cts +3 -6
- package/dist/federation/mod.d.ts +3 -6
- package/dist/federation/mod.js +322 -13
- package/dist/federation/mq.test.d.mts +2 -0
- package/dist/federation/{mq.test.js → mq.test.mjs} +21 -35
- package/dist/federation/negotiation.test.d.mts +2 -0
- package/dist/federation/{negotiation.test.js → negotiation.test.mjs} +9 -16
- package/dist/federation/retry.test.d.mts +2 -0
- package/dist/federation/{retry.test.js → retry.test.mjs} +8 -11
- package/dist/federation/router.test.d.mts +2 -0
- package/dist/federation/{router.test.js → router.test.mjs} +11 -16
- package/dist/federation/send.test.d.mts +2 -0
- package/dist/federation/{send.test.js → send.test.mjs} +22 -29
- package/dist/federation/webfinger.test.d.mts +2 -0
- package/dist/federation/{webfinger.test.js → webfinger.test.mjs} +22 -55
- package/dist/{http-DkHdFfrc.d.ts → http-B2wiNmSo.d.ts} +1 -6
- package/dist/{http-C_RwU_oN.js → http-BGjkvEDc.js} +25 -156
- package/dist/{http-Cz3MlXAZ.d.cts → http-C_tEAiZj.d.cts} +1 -6
- package/dist/{http-DGs_78tx.cjs → http-DLnqzOtY.cjs} +110 -235
- package/dist/{http-Br3-1dRf.js → http-VQAKycaZ.mjs} +17 -33
- package/dist/{inbox-3bZUqDLE.js → inbox-B6DfJ3h9.mjs} +18 -26
- package/dist/{key-D7Y_J9kt.js → key-C9oV7wk8.mjs} +12 -19
- package/dist/{keycache-BASM0rrX.js → keycache-DaQ3ndaJ.mjs} +5 -9
- package/dist/{keys-ZbcByPg9.js → keys-CtZLJq76.mjs} +5 -9
- package/dist/{kv-QzKcOQgP.js → kv-BrZHNugx.mjs} +6 -10
- package/dist/{kv-BL4nlICN.d.cts → kv-CbLNp3zQ.d.cts} +1 -1
- package/dist/{kv-DXEUEP6z.d.ts → kv-GFYnFoOl.d.ts} +1 -1
- package/dist/{kv-cache-9PANi4tA.cjs → kv-cache-BAEaVRvi.cjs} +27 -34
- package/dist/{kv-cache-El7We5sy.js → kv-cache-OWmRLHir.mjs} +4 -8
- package/dist/{kv-cache-CMM5VJsc.js → kv-cache-QxhhotWv.js} +6 -13
- package/dist/{ld-Bjq9Z4St.js → ld-BfEccFSP.mjs} +17 -31
- package/dist/{middleware-Bj30TZll.js → middleware-Bc4sY_YW.js} +320 -363
- package/dist/middleware-CGkdTPmX.mjs +5 -0
- package/dist/{middleware-CQeA5yF7.cjs → middleware-Dj7uT9F8.cjs} +513 -564
- package/dist/middleware-DuFvBMT2.cjs +4 -0
- package/dist/{middleware-DozhKfB6.js → middleware-ReZIkikn.mjs} +260 -292
- package/dist/{mod-DPkRU3EK.d.cts → mod-1xhgsHef.d.cts} +2 -2
- package/dist/{mod-DUWcVv49.d.ts → mod-BGtYJZKu.d.ts} +2 -2
- package/dist/{mod-DXsQakeS.d.cts → mod-Bld7oeqf.d.cts} +3 -3
- package/dist/{mod-DnSsduJF.d.ts → mod-BnAKGh2w.d.ts} +2 -2
- package/dist/{mod-CwZXZJ9d.d.ts → mod-DTOUyCce.d.ts} +3 -3
- package/dist/{mod-Di3W5OdP.d.cts → mod-DWoQffTD.d.cts} +2 -2
- package/dist/mod.cjs +29 -68
- package/dist/mod.d.cts +11 -14
- package/dist/mod.d.ts +11 -15
- package/dist/mod.js +17 -65
- package/dist/{negotiation-5NPJL6zp.js → negotiation-BehA2uul.mjs} +7 -11
- package/dist/nodeinfo/client.test.d.mts +2 -0
- package/dist/nodeinfo/{client.test.js → client.test.mjs} +22 -40
- package/dist/nodeinfo/handler.test.d.mts +2 -0
- package/dist/nodeinfo/{handler.test.js → handler.test.mjs} +13 -42
- package/dist/nodeinfo/mod.cjs +5 -8
- package/dist/nodeinfo/mod.d.cts +2 -3
- package/dist/nodeinfo/mod.d.ts +2 -3
- package/dist/nodeinfo/mod.js +4 -8
- package/dist/nodeinfo/types.test.d.mts +2 -0
- package/dist/nodeinfo/{types.test.js → types.test.mjs} +9 -16
- package/dist/otel/exporter.test.d.mts +2 -0
- package/dist/otel/{exporter.test.js → exporter.test.mjs} +117 -169
- package/dist/otel/mod.cjs +15 -20
- package/dist/otel/mod.d.cts +2 -2
- package/dist/otel/mod.d.ts +2 -2
- package/dist/otel/mod.js +8 -14
- package/dist/{owner-gd0Q9FuU.d.ts → owner-74ARJ5TL.d.ts} +1 -1
- package/dist/{owner-CImU2dKz.js → owner-CRLqJlP_.mjs} +11 -16
- package/dist/{owner-1AbPBOOZ.d.cts → owner-CptqhsOy.d.cts} +1 -1
- package/dist/{proof-DLL0MLmV.js → proof-9SGtq4tE.mjs} +21 -33
- package/dist/{proof-UhA5do8k.cjs → proof-B4SaJCmK.cjs} +133 -157
- package/dist/{proof-BygvN4r5.js → proof-DvQ28mUJ.js} +32 -58
- package/dist/{retry-D4GJ670a.js → retry-Ddbq3AcK.mjs} +4 -7
- package/dist/{router-D9eI0s4b.js → router-CrMLXoOr.mjs} +4 -8
- package/dist/runtime/mod.cjs +11 -13
- package/dist/runtime/mod.d.cts +6 -2
- package/dist/runtime/mod.d.ts +0 -1
- package/dist/runtime/mod.js +4 -7
- package/dist/{send-DbW03azY.js → send-DN2ywoe8.mjs} +8 -13
- package/dist/sig/http.test.d.mts +2 -0
- package/dist/sig/{http.test.js → http.test.mjs} +117 -199
- package/dist/sig/key.test.d.mts +2 -0
- package/dist/sig/{key.test.js → key.test.mjs} +11 -18
- package/dist/sig/ld.test.d.mts +2 -0
- package/dist/sig/{ld.test.js → ld.test.mjs} +22 -35
- package/dist/sig/mod.cjs +6 -9
- package/dist/sig/mod.d.cts +3 -3
- package/dist/sig/mod.d.ts +3 -3
- package/dist/sig/mod.js +5 -9
- package/dist/sig/owner.test.d.mts +2 -0
- package/dist/sig/{owner.test.js → owner.test.mjs} +19 -34
- package/dist/sig/proof.test.d.mts +2 -0
- package/dist/sig/{proof.test.js → proof.test.mjs} +16 -27
- package/dist/{std__assert-DWivtrGR.js → std__assert-Duiq_YC9.mjs} +12 -24
- package/dist/testing/{mod.d.ts → mod.d.mts} +26 -78
- package/dist/testing/mod.mjs +6 -0
- package/dist/{transformers-3g8GZwkZ.cjs → transformers-NeAONrAq.cjs} +20 -25
- package/dist/{transformers-C3FLHUd6.js → transformers-ve6e2xcg.js} +3 -7
- package/dist/{types-CPz01LGH.js → types-C37hquWI.mjs} +4 -7
- package/dist/{types-Cd_hszr_.cjs → types-KC4QAoxe.cjs} +29 -34
- package/dist/{types-C93Ob9cU.js → types-hvL8ElAs.js} +8 -13
- package/dist/utils/docloader.test.d.mts +2 -0
- package/dist/utils/{docloader.test.js → docloader.test.mjs} +14 -24
- package/dist/utils/kv-cache.test.d.mts +2 -0
- package/dist/utils/{kv-cache.test.js → kv-cache.test.mjs} +25 -40
- package/dist/utils/mod.cjs +5 -9
- package/dist/utils/mod.d.cts +1 -3
- package/dist/utils/mod.d.ts +1 -3
- package/dist/utils/mod.js +4 -9
- package/dist/vocab/cjs.test.d.mts +2 -0
- package/dist/vocab/cjs.test.mjs +14 -0
- package/dist/vocab/mod.cjs +10 -12
- package/dist/vocab/mod.js +3 -5
- package/package.json +8 -8
- package/dist/compat/transformers.test.d.ts +0 -3
- package/dist/compat/transformers.test.js +0 -87
- package/dist/compat-Bb4NuTUO.js +0 -4
- package/dist/compat-DmDDELst.cjs +0 -4
- package/dist/deno-4w047OFk.js +0 -121
- package/dist/federation/builder.test.d.ts +0 -3
- package/dist/federation/collection.test.d.ts +0 -3
- package/dist/federation/collection.test.js +0 -32
- package/dist/federation/handler.test.d.ts +0 -3
- package/dist/federation/idempotency.test.d.ts +0 -3
- package/dist/federation/inbox.test.d.ts +0 -3
- package/dist/federation/keycache.test.d.ts +0 -3
- package/dist/federation/kv.test.d.ts +0 -3
- package/dist/federation/middleware.test.d.ts +0 -3
- package/dist/federation/mq.test.d.ts +0 -3
- package/dist/federation/negotiation.test.d.ts +0 -3
- package/dist/federation/retry.test.d.ts +0 -3
- package/dist/federation/router.test.d.ts +0 -3
- package/dist/federation/send.test.d.ts +0 -3
- package/dist/federation/webfinger.test.d.ts +0 -3
- package/dist/federation-Bp3HI26G.cjs +0 -350
- package/dist/federation-DaMfqRm4.js +0 -332
- package/dist/middleware-B73ZyDmk.js +0 -12
- package/dist/middleware-Dr61i4Jo.cjs +0 -12
- package/dist/middleware-_1PYruC5.js +0 -26
- package/dist/mod-Bh8mqlYw.d.cts +0 -9
- package/dist/mod-D6HodEq7.d.ts +0 -7
- package/dist/mod-DVwHUI_x.d.cts +0 -80
- package/dist/mod-DosD6NsG.d.ts +0 -82
- package/dist/mod-gq_Xfdz8.d.cts +0 -1
- package/dist/nodeinfo/client.test.d.ts +0 -3
- package/dist/nodeinfo/handler.test.d.ts +0 -3
- package/dist/nodeinfo/types.test.d.ts +0 -3
- package/dist/nodeinfo-DoESQxq5.js +0 -4
- package/dist/nodeinfo-DuMYTpbZ.cjs +0 -4
- package/dist/otel/exporter.test.d.ts +0 -3
- package/dist/runtime-c2Njxsry.cjs +0 -17
- package/dist/runtime-poamPCMb.js +0 -13
- package/dist/sig/http.test.d.ts +0 -3
- package/dist/sig/key.test.d.ts +0 -3
- package/dist/sig/ld.test.d.ts +0 -3
- package/dist/sig/owner.test.d.ts +0 -3
- package/dist/sig/proof.test.d.ts +0 -3
- package/dist/sig-BNhspNOf.js +0 -4
- package/dist/sig-vX39WyWI.cjs +0 -4
- package/dist/testing/mod.js +0 -10
- package/dist/utils/docloader.test.d.ts +0 -3
- package/dist/utils/kv-cache.test.d.ts +0 -3
- package/dist/utils-BQ9KqEK9.cjs +0 -4
- package/dist/utils-Dn5OPdSW.js +0 -4
- /package/dist/{mod-AGjRfPjT.d.ts → compat/transformers.test.d.mts} +0 -0
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { deno_default } from "./deno-4w047OFk.js";
|
|
7
|
-
import { fetchKey, validateCryptoKey } from "./key-D7Y_J9kt.js";
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { n as version, t as name } from "./deno-CrjRl2cm.mjs";
|
|
5
|
+
import { a as validateCryptoKey, n as fetchKey } from "./key-C9oV7wk8.mjs";
|
|
8
6
|
import { CryptographicKey } from "@fedify/vocab";
|
|
7
|
+
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
8
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
10
9
|
import { getLogger } from "@logtape/logtape";
|
|
11
|
-
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
12
10
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
13
11
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
14
12
|
import { encodeHex } from "byte-encodings/hex";
|
|
15
13
|
import { Item, decodeDict, encodeItem } from "structured-field-values";
|
|
16
|
-
|
|
17
14
|
//#region src/sig/http.ts
|
|
18
15
|
const DEFAULT_MAX_REDIRECTION = 20;
|
|
19
16
|
/**
|
|
@@ -27,9 +24,7 @@ const DEFAULT_MAX_REDIRECTION = 20;
|
|
|
27
24
|
*/
|
|
28
25
|
async function signRequest(request, privateKey, keyId, options = {}) {
|
|
29
26
|
validateCryptoKey(privateKey, "private");
|
|
30
|
-
|
|
31
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
32
|
-
return await tracer.startActiveSpan("http_signatures.sign", async (span) => {
|
|
27
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.sign", async (span) => {
|
|
33
28
|
try {
|
|
34
29
|
const spec = options.spec ?? "draft-cavage-http-signatures-12";
|
|
35
30
|
let signed;
|
|
@@ -124,9 +119,7 @@ function createRfc9421SignatureBase(request, components, parameters) {
|
|
|
124
119
|
* @returns The formatted signature string.
|
|
125
120
|
*/
|
|
126
121
|
function formatRfc9421Signature(signature, components, parameters) {
|
|
127
|
-
|
|
128
|
-
const signatureValue = `sig1=:${encodeBase64(signature)}:`;
|
|
129
|
-
return [signatureInputValue, signatureValue];
|
|
122
|
+
return [`sig1=("${components.join("\" \"")}");${parameters}`, `sig1=:${encodeBase64(signature)}:`];
|
|
130
123
|
}
|
|
131
124
|
/**
|
|
132
125
|
* Parse RFC 9421 Signature-Input header.
|
|
@@ -256,9 +249,7 @@ const supportedHashAlgorithms = {
|
|
|
256
249
|
* could not be verified.
|
|
257
250
|
*/
|
|
258
251
|
async function verifyRequest(request, options = {}) {
|
|
259
|
-
|
|
260
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
261
|
-
return await tracer.startActiveSpan("http_signatures.verify", async (span) => {
|
|
252
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.verify", async (span) => {
|
|
262
253
|
if (span.isRecording()) {
|
|
263
254
|
span.setAttribute(ATTR_HTTP_REQUEST_METHOD, request.method);
|
|
264
255
|
span.setAttribute(ATTR_URL_FULL, request.url);
|
|
@@ -448,8 +439,7 @@ async function verifyRequestDraft(request, span, { documentLoader, contextLoader
|
|
|
448
439
|
const message = headerNames.map((name) => `${name}: ` + (name === "(request-target)" ? `${request.method.toLowerCase()} ${new URL(request.url).pathname}` : name === "(created)" ? sigValues.created ?? "" : name === "(expires)" ? sigValues.expires ?? "" : name === "host" ? request.headers.get("host") ?? new URL(request.url).host : request.headers.get(name))).join("\n");
|
|
449
440
|
const sig = decodeBase64(signature);
|
|
450
441
|
span?.setAttribute("http_signatures.signature", encodeHex(sig));
|
|
451
|
-
|
|
452
|
-
if (!verified) {
|
|
442
|
+
if (!await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, sig, new TextEncoder().encode(message))) {
|
|
453
443
|
if (cached) {
|
|
454
444
|
logger.debug("Failed to verify with the cached key {keyId}; signature {signature} is invalid. Retrying with the freshly fetched key...", {
|
|
455
445
|
keyId,
|
|
@@ -463,7 +453,7 @@ async function verifyRequestDraft(request, span, { documentLoader, contextLoader
|
|
|
463
453
|
currentTime,
|
|
464
454
|
keyCache: {
|
|
465
455
|
get: () => Promise.resolve(void 0),
|
|
466
|
-
set: async (keyId
|
|
456
|
+
set: async (keyId, key) => await keyCache?.set(keyId, key)
|
|
467
457
|
}
|
|
468
458
|
});
|
|
469
459
|
}
|
|
@@ -613,9 +603,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
|
|
|
613
603
|
logger.debug("Failed to verify; Content-Digest header required but not found.", { components: sigInput.components });
|
|
614
604
|
continue;
|
|
615
605
|
}
|
|
616
|
-
|
|
617
|
-
const digestValid = await verifyRfc9421ContentDigest(contentDigestHeader, body);
|
|
618
|
-
if (!digestValid) {
|
|
606
|
+
if (!await verifyRfc9421ContentDigest(contentDigestHeader, await request.arrayBuffer())) {
|
|
619
607
|
logger.debug("Failed to verify; Content-Digest verification failed.", { contentDigest: contentDigestHeader });
|
|
620
608
|
continue;
|
|
621
609
|
}
|
|
@@ -661,8 +649,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
|
|
|
661
649
|
const signatureBaseBytes = new TextEncoder().encode(signatureBase);
|
|
662
650
|
span?.setAttribute("http_signatures.signature", encodeHex(sigBytes));
|
|
663
651
|
try {
|
|
664
|
-
|
|
665
|
-
if (verified) {
|
|
652
|
+
if (await crypto.subtle.verify(algorithm, key.publicKey, sigBytes.slice(), signatureBaseBytes)) {
|
|
666
653
|
validKey = key;
|
|
667
654
|
break;
|
|
668
655
|
} else if (cached) {
|
|
@@ -674,7 +661,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
|
|
|
674
661
|
currentTime,
|
|
675
662
|
keyCache: {
|
|
676
663
|
get: () => Promise.resolve(void 0),
|
|
677
|
-
set: async (keyId, key
|
|
664
|
+
set: async (keyId, key) => await keyCache?.set(keyId, key)
|
|
678
665
|
},
|
|
679
666
|
spec: "rfc9421"
|
|
680
667
|
});
|
|
@@ -747,8 +734,7 @@ async function doubleKnockInternal(request, identity, options, redirected = 0, v
|
|
|
747
734
|
});
|
|
748
735
|
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
|
749
736
|
if (redirected >= DEFAULT_MAX_REDIRECTION) throw new FetchError(request.url, `Too many redirections (${redirected + 1})`);
|
|
750
|
-
const
|
|
751
|
-
const redirectRequest = createRedirectRequest(request, location, body);
|
|
737
|
+
const redirectRequest = createRedirectRequest(request, response.headers.get("Location"), body);
|
|
752
738
|
if (visited.has(redirectRequest.url)) throw new FetchError(request.url, `Redirect loop detected: ${redirectRequest.url}`);
|
|
753
739
|
return doubleKnockInternal(redirectRequest, identity, {
|
|
754
740
|
...options,
|
|
@@ -778,8 +764,7 @@ async function doubleKnockInternal(request, identity, options, redirected = 0, v
|
|
|
778
764
|
});
|
|
779
765
|
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
|
780
766
|
if (redirected >= DEFAULT_MAX_REDIRECTION) throw new FetchError(request.url, `Too many redirections (${redirected + 1})`);
|
|
781
|
-
const
|
|
782
|
-
const redirectRequest = createRedirectRequest(request, location, body);
|
|
767
|
+
const redirectRequest = createRedirectRequest(request, response.headers.get("Location"), body);
|
|
783
768
|
if (visited.has(redirectRequest.url)) throw new FetchError(request.url, `Redirect loop detected: ${redirectRequest.url}`);
|
|
784
769
|
return doubleKnockInternal(redirectRequest, identity, {
|
|
785
770
|
...options,
|
|
@@ -816,6 +801,5 @@ function timingSafeEqual(a, b) {
|
|
|
816
801
|
result |= lenA ^ lenB;
|
|
817
802
|
return result === 0;
|
|
818
803
|
}
|
|
819
|
-
|
|
820
804
|
//#endregion
|
|
821
|
-
export {
|
|
805
|
+
export { parseRfc9421Signature as a, timingSafeEqual as c, formatRfc9421SignatureParameters as i, verifyRequest as l, doubleKnock as n, parseRfc9421SignatureInput as o, formatRfc9421Signature as r, signRequest as s, createRfc9421SignatureBase as t };
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { deno_default } from "./deno-4w047OFk.js";
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { n as version, t as name } from "./deno-CrjRl2cm.mjs";
|
|
7
5
|
import { Activity, getTypeId } from "@fedify/vocab";
|
|
8
|
-
import { getLogger } from "@logtape/logtape";
|
|
9
6
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
10
|
-
|
|
7
|
+
import { getLogger } from "@logtape/logtape";
|
|
11
8
|
//#region src/federation/inbox.ts
|
|
12
9
|
var InboxListenerSet = class InboxListenerSet {
|
|
13
10
|
#listeners;
|
|
@@ -53,10 +50,8 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
53
50
|
const inboxContext = inboxContextFactory(recipient, json, activity.id?.href, getTypeId(activity).href);
|
|
54
51
|
const strategy = idempotencyStrategy ?? "per-inbox";
|
|
55
52
|
let keyString;
|
|
56
|
-
if (typeof strategy === "function")
|
|
57
|
-
|
|
58
|
-
keyString = result;
|
|
59
|
-
} else switch (strategy) {
|
|
53
|
+
if (typeof strategy === "function") keyString = await strategy(inboxContext, activity);
|
|
54
|
+
else switch (strategy) {
|
|
60
55
|
case "global":
|
|
61
56
|
keyString = activity.id.href;
|
|
62
57
|
break;
|
|
@@ -71,8 +66,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
71
66
|
if (keyString != null) cacheKey = [...kvPrefixes.activityIdempotence, keyString];
|
|
72
67
|
}
|
|
73
68
|
if (cacheKey != null) {
|
|
74
|
-
|
|
75
|
-
if (cached === true) {
|
|
69
|
+
if (await kv.get(cacheKey) === true) {
|
|
76
70
|
logger.debug("Activity {activityId} has already been processed.", {
|
|
77
71
|
activityId: activity.id?.href,
|
|
78
72
|
activity: json,
|
|
@@ -129,31 +123,30 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
129
123
|
return "enqueued";
|
|
130
124
|
}
|
|
131
125
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
132
|
-
|
|
133
|
-
return await tracer.startActiveSpan("activitypub.dispatch_inbox_listener", { kind: SpanKind.INTERNAL }, async (span$1) => {
|
|
126
|
+
return await tracerProvider.getTracer(name, version).startActiveSpan("activitypub.dispatch_inbox_listener", { kind: SpanKind.INTERNAL }, async (span) => {
|
|
134
127
|
const dispatched = inboxListeners?.dispatchWithClass(activity);
|
|
135
128
|
if (dispatched == null) {
|
|
136
129
|
logger.error("Unsupported activity type:\n{activity}", {
|
|
137
130
|
activity: json,
|
|
138
131
|
recipient
|
|
139
132
|
});
|
|
140
|
-
span
|
|
133
|
+
span.setStatus({
|
|
141
134
|
code: SpanStatusCode.UNSET,
|
|
142
135
|
message: `Unsupported activity type: ${getTypeId(activity).href}`
|
|
143
136
|
});
|
|
144
|
-
span
|
|
137
|
+
span.end();
|
|
145
138
|
return "unsupportedActivity";
|
|
146
139
|
}
|
|
147
140
|
const { class: cls, listener } = dispatched;
|
|
148
|
-
span
|
|
141
|
+
span.updateName(`activitypub.dispatch_inbox_listener ${cls.name}`);
|
|
149
142
|
try {
|
|
150
143
|
await listener(inboxContextFactory(recipient, json, activity?.id?.href, getTypeId(activity).href), activity);
|
|
151
144
|
} catch (error) {
|
|
152
145
|
try {
|
|
153
146
|
await inboxErrorHandler?.(ctx, error);
|
|
154
|
-
} catch (error
|
|
147
|
+
} catch (error) {
|
|
155
148
|
logger.error("An unexpected error occurred in inbox error handler:\n{error}", {
|
|
156
|
-
error
|
|
149
|
+
error,
|
|
157
150
|
activityId: activity.id?.href,
|
|
158
151
|
activity: json,
|
|
159
152
|
recipient
|
|
@@ -165,11 +158,11 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
165
158
|
activity: json,
|
|
166
159
|
recipient
|
|
167
160
|
});
|
|
168
|
-
span
|
|
161
|
+
span.setStatus({
|
|
169
162
|
code: SpanStatusCode.ERROR,
|
|
170
163
|
message: String(error)
|
|
171
164
|
});
|
|
172
|
-
span
|
|
165
|
+
span.end();
|
|
173
166
|
return "error";
|
|
174
167
|
}
|
|
175
168
|
if (cacheKey != null) await kv.set(cacheKey, true, { ttl: Temporal.Duration.from({ days: 1 }) });
|
|
@@ -178,10 +171,9 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
178
171
|
activity: json,
|
|
179
172
|
recipient
|
|
180
173
|
});
|
|
181
|
-
span
|
|
174
|
+
span.end();
|
|
182
175
|
return "success";
|
|
183
176
|
});
|
|
184
177
|
}
|
|
185
|
-
|
|
186
178
|
//#endregion
|
|
187
|
-
export {
|
|
179
|
+
export { routeActivity as n, InboxListenerSet as t };
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { deno_default } from "./deno-4w047OFk.js";
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { n as version, t as name } from "./deno-CrjRl2cm.mjs";
|
|
7
5
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
6
|
+
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
7
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
9
8
|
import { getLogger } from "@logtape/logtape";
|
|
10
|
-
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
11
|
-
|
|
12
9
|
//#region src/sig/key.ts
|
|
13
10
|
/**
|
|
14
11
|
* Checks if the given key is valid and supported. No-op if the key is valid,
|
|
@@ -23,8 +20,7 @@ function validateCryptoKey(key, type) {
|
|
|
23
20
|
if (!key.extractable) throw new TypeError("The key is not extractable.");
|
|
24
21
|
if (key.algorithm.name !== "RSASSA-PKCS1-v1_5" && key.algorithm.name !== "Ed25519") throw new TypeError("Currently only RSASSA-PKCS1-v1_5 and Ed25519 keys are supported. More algorithms will be added in the future!");
|
|
25
22
|
if (key.algorithm.name === "RSASSA-PKCS1-v1_5") {
|
|
26
|
-
|
|
27
|
-
if (algorithm.hash.name !== "SHA-256") throw new TypeError("For compatibility with the existing Fediverse software (e.g., Mastodon), hash algorithm for RSASSA-PKCS1-v1_5 keys must be SHA-256.");
|
|
23
|
+
if (key.algorithm.hash.name !== "SHA-256") throw new TypeError("For compatibility with the existing Fediverse software (e.g., Mastodon), hash algorithm for RSASSA-PKCS1-v1_5 keys must be SHA-256.");
|
|
28
24
|
}
|
|
29
25
|
}
|
|
30
26
|
/**
|
|
@@ -103,8 +99,7 @@ async function importJwk(jwk, type) {
|
|
|
103
99
|
* @since 1.3.0
|
|
104
100
|
*/
|
|
105
101
|
function fetchKey(keyId, cls, options = {}) {
|
|
106
|
-
const
|
|
107
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
102
|
+
const tracer = (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version);
|
|
108
103
|
keyId = typeof keyId === "string" ? new URL(keyId) : keyId;
|
|
109
104
|
return tracer.startActiveSpan("activitypub.fetch_key", {
|
|
110
105
|
kind: SpanKind.CLIENT,
|
|
@@ -160,8 +155,7 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
|
160
155
|
logger.debug("Fetching key {keyId} to verify signature...", { keyId });
|
|
161
156
|
let document;
|
|
162
157
|
try {
|
|
163
|
-
|
|
164
|
-
document = remoteDocument.document;
|
|
158
|
+
document = (await (documentLoader ?? getDocumentLoader())(keyId)).document;
|
|
165
159
|
} catch (_) {
|
|
166
160
|
logger.debug("Failed to fetch key {keyId}.", { keyId });
|
|
167
161
|
await keyCache?.set(cacheKey, null);
|
|
@@ -185,8 +179,8 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
|
185
179
|
contextLoader,
|
|
186
180
|
tracerProvider
|
|
187
181
|
});
|
|
188
|
-
} catch (e
|
|
189
|
-
if (e
|
|
182
|
+
} catch (e) {
|
|
183
|
+
if (e instanceof TypeError) {
|
|
190
184
|
logger.debug("Failed to verify; key {keyId} returned an invalid object.", { keyId });
|
|
191
185
|
await keyCache?.set(cacheKey, null);
|
|
192
186
|
return {
|
|
@@ -194,7 +188,7 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
|
194
188
|
cached: false
|
|
195
189
|
};
|
|
196
190
|
}
|
|
197
|
-
throw e
|
|
191
|
+
throw e;
|
|
198
192
|
}
|
|
199
193
|
}
|
|
200
194
|
let key = null;
|
|
@@ -257,6 +251,5 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
|
257
251
|
cached: false
|
|
258
252
|
};
|
|
259
253
|
}
|
|
260
|
-
|
|
261
254
|
//#endregion
|
|
262
|
-
export {
|
|
255
|
+
export { validateCryptoKey as a, importJwk as i, fetchKey as n, generateCryptoKeyPair as r, exportJwk as t };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
globalThis.addEventListener = () => {};
|
|
5
|
-
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
6
4
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
7
|
-
|
|
8
5
|
//#region src/federation/keycache.ts
|
|
9
6
|
const NULL_KEY_CACHE_VALUE = { _fedify: "key-unavailable" };
|
|
10
7
|
const NULL_KEY_CACHE_TTL = Temporal.Duration.from({ minutes: 5 });
|
|
@@ -37,7 +34,7 @@ var KvKeyCache = class {
|
|
|
37
34
|
return await Multikey.fromJsonLd(serialized, this.options);
|
|
38
35
|
} catch {
|
|
39
36
|
await this.kv.delete([...this.prefix, keyId.href]);
|
|
40
|
-
return
|
|
37
|
+
return;
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
}
|
|
@@ -52,6 +49,5 @@ var KvKeyCache = class {
|
|
|
52
49
|
await this.kv.set([...this.prefix, keyId.href], serialized);
|
|
53
50
|
}
|
|
54
51
|
};
|
|
55
|
-
|
|
56
52
|
//#endregion
|
|
57
|
-
export { KvKeyCache };
|
|
53
|
+
export { KvKeyCache as t };
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
globalThis.addEventListener = () => {};
|
|
5
|
-
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
6
4
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
7
5
|
import { importSpki } from "@fedify/vocab-runtime";
|
|
8
|
-
|
|
9
6
|
//#region src/testing/keys.ts
|
|
10
7
|
const rsaPublicKey1 = new CryptographicKey({
|
|
11
8
|
id: new URL("https://example.com/key"),
|
|
@@ -85,7 +82,7 @@ const rsaPublicKey3 = new CryptographicKey({
|
|
|
85
82
|
"hash": "SHA-256"
|
|
86
83
|
}, true, ["verify"])
|
|
87
84
|
});
|
|
88
|
-
|
|
85
|
+
new Multikey({
|
|
89
86
|
id: new URL("https://example.com/person2#key3"),
|
|
90
87
|
controller: new URL("https://example.com/person2"),
|
|
91
88
|
publicKey: rsaPublicKey3.publicKey
|
|
@@ -119,6 +116,5 @@ const ed25519Multikey = new Multikey({
|
|
|
119
116
|
controller: new URL("https://example.com/person2"),
|
|
120
117
|
publicKey: ed25519PublicKey.publicKey
|
|
121
118
|
});
|
|
122
|
-
|
|
123
119
|
//#endregion
|
|
124
|
-
export {
|
|
120
|
+
export { rsaPrivateKey3 as a, rsaPublicKey3 as c, rsaPrivateKey2 as i, rsaPublicKey5 as l, ed25519PrivateKey as n, rsaPublicKey1 as o, ed25519PublicKey as r, rsaPublicKey2 as s, ed25519Multikey as t };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
globalThis.addEventListener = () => {};
|
|
5
|
-
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
6
4
|
import { isEqual } from "es-toolkit";
|
|
7
|
-
|
|
8
5
|
//#region src/federation/kv.ts
|
|
9
6
|
/**
|
|
10
7
|
* A key–value store that stores values in memory.
|
|
@@ -57,8 +54,8 @@ var MemoryKvStore = class {
|
|
|
57
54
|
let currentValue;
|
|
58
55
|
if (entry == null) currentValue = void 0;
|
|
59
56
|
else {
|
|
60
|
-
const [value, expiration
|
|
61
|
-
if (expiration
|
|
57
|
+
const [value, expiration] = entry;
|
|
58
|
+
if (expiration != null && Temporal.Now.instant().until(expiration).sign < 0) {
|
|
62
59
|
delete this.#values[encodedKey];
|
|
63
60
|
currentValue = void 0;
|
|
64
61
|
} else currentValue = value;
|
|
@@ -91,6 +88,5 @@ var MemoryKvStore = class {
|
|
|
91
88
|
}
|
|
92
89
|
}
|
|
93
90
|
};
|
|
94
|
-
|
|
95
91
|
//#endregion
|
|
96
|
-
export { MemoryKvStore };
|
|
92
|
+
export { MemoryKvStore as t };
|
|
@@ -107,4 +107,4 @@ declare class MemoryKvStore implements KvStore {
|
|
|
107
107
|
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
108
108
|
}
|
|
109
109
|
//#endregion
|
|
110
|
-
export {
|
|
110
|
+
export { MemoryKvStore as a, KvStoreSetOptions as i, KvStore as n, KvStoreListEntry as r, KvKey as t };
|
|
@@ -110,4 +110,4 @@ declare class MemoryKvStore implements KvStore {
|
|
|
110
110
|
list(prefix?: KvKey): AsyncIterable<KvStoreListEntry>;
|
|
111
111
|
}
|
|
112
112
|
//#endregion
|
|
113
|
-
export {
|
|
113
|
+
export { MemoryKvStore as a, KvStoreSetOptions as i, KvStore as n, KvStoreListEntry as r, KvKey as t };
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const es_toolkit = require_chunk.__toESM(require("es-toolkit"));
|
|
9
|
-
const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
|
|
10
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
|
+
require("./chunk-DDcVe30Y.cjs");
|
|
4
|
+
const require_http = require("./http-DLnqzOtY.cjs");
|
|
5
|
+
let _logtape_logtape = require("@logtape/logtape");
|
|
6
|
+
let es_toolkit = require("es-toolkit");
|
|
7
|
+
let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
|
|
11
8
|
//#region src/utils/docloader.ts
|
|
12
|
-
const logger$1 = (0,
|
|
9
|
+
const logger$1 = (0, _logtape_logtape.getLogger)([
|
|
13
10
|
"fedify",
|
|
14
11
|
"utils",
|
|
15
12
|
"docloader"
|
|
@@ -29,29 +26,26 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
|
|
|
29
26
|
require_http.validateCryptoKey(identity.privateKey);
|
|
30
27
|
async function load(url, options) {
|
|
31
28
|
if (!allowPrivateAddress) try {
|
|
32
|
-
await (0,
|
|
29
|
+
await (0, _fedify_vocab_runtime.validatePublicUrl)(url);
|
|
33
30
|
} catch (error) {
|
|
34
|
-
if (error instanceof
|
|
31
|
+
if (error instanceof _fedify_vocab_runtime.UrlError) logger$1.error("Disallowed private URL: {url}", {
|
|
35
32
|
url,
|
|
36
33
|
error
|
|
37
34
|
});
|
|
38
35
|
throw error;
|
|
39
36
|
}
|
|
40
|
-
|
|
41
|
-
const response = await require_http.doubleKnock(originalRequest, identity, {
|
|
37
|
+
return (0, _fedify_vocab_runtime.getRemoteDocument)(url, await require_http.doubleKnock((0, _fedify_vocab_runtime.createActivityPubRequest)(url, { userAgent }), identity, {
|
|
42
38
|
specDeterminer,
|
|
43
|
-
log: (0, es_toolkit.curry)(
|
|
39
|
+
log: (0, es_toolkit.curry)(_fedify_vocab_runtime.logRequest)(logger$1),
|
|
44
40
|
tracerProvider,
|
|
45
41
|
signal: options?.signal
|
|
46
|
-
});
|
|
47
|
-
return (0, __fedify_vocab_runtime.getRemoteDocument)(url, response, load);
|
|
42
|
+
}), load);
|
|
48
43
|
}
|
|
49
44
|
return load;
|
|
50
45
|
}
|
|
51
|
-
|
|
52
46
|
//#endregion
|
|
53
47
|
//#region src/utils/kv-cache.ts
|
|
54
|
-
const logger = (0,
|
|
48
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
55
49
|
"fedify",
|
|
56
50
|
"utils",
|
|
57
51
|
"kv-cache"
|
|
@@ -66,11 +60,11 @@ function kvCache({ loader, kv, prefix, rules }) {
|
|
|
66
60
|
rules ??= [[new URLPattern({}), Temporal.Duration.from({ minutes: 5 })]];
|
|
67
61
|
for (const [p, duration] of rules) if (Temporal.Duration.compare(duration, { days: 30 }) > 0) throw new TypeError("The maximum cache duration is 30 days: " + (p instanceof URLPattern ? `${p.protocol}://${p.username}:${p.password}@${p.hostname}:${p.port}/${p.pathname}?${p.search}#${p.hash}` : p.toString()));
|
|
68
62
|
return async (url, options) => {
|
|
69
|
-
if (url in
|
|
63
|
+
if (url in _fedify_vocab_runtime.preloadedContexts) {
|
|
70
64
|
logger.debug("Using preloaded context: {url}.", { url });
|
|
71
65
|
return {
|
|
72
66
|
contextUrl: null,
|
|
73
|
-
document:
|
|
67
|
+
document: _fedify_vocab_runtime.preloadedContexts[url],
|
|
74
68
|
documentUrl: url
|
|
75
69
|
};
|
|
76
70
|
}
|
|
@@ -116,17 +110,16 @@ function matchRule(url, rules) {
|
|
|
116
110
|
}
|
|
117
111
|
return null;
|
|
118
112
|
}
|
|
119
|
-
|
|
120
113
|
//#endregion
|
|
121
|
-
Object.defineProperty(exports,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
114
|
+
Object.defineProperty(exports, "getAuthenticatedDocumentLoader", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function() {
|
|
117
|
+
return getAuthenticatedDocumentLoader;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "kvCache", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function() {
|
|
123
|
+
return kvCache;
|
|
124
|
+
}
|
|
126
125
|
});
|
|
127
|
-
Object.defineProperty(exports, 'kvCache', {
|
|
128
|
-
enumerable: true,
|
|
129
|
-
get: function () {
|
|
130
|
-
return kvCache;
|
|
131
|
-
}
|
|
132
|
-
});
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
globalThis.addEventListener = () => {};
|
|
5
|
-
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
6
4
|
import { preloadedContexts } from "@fedify/vocab-runtime";
|
|
7
5
|
import { getLogger } from "@logtape/logtape";
|
|
8
|
-
|
|
9
6
|
//#region src/utils/kv-cache.ts
|
|
10
7
|
const logger = getLogger([
|
|
11
8
|
"fedify",
|
|
@@ -102,6 +99,5 @@ function matchRule(url, rules) {
|
|
|
102
99
|
}
|
|
103
100
|
return null;
|
|
104
101
|
}
|
|
105
|
-
|
|
106
102
|
//#endregion
|
|
107
|
-
export {
|
|
103
|
+
export { kvCache as n, MockKvStore as t };
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { doubleKnock, validateCryptoKey } from "./http-C_RwU_oN.js";
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
+
import { c as validateCryptoKey, t as doubleKnock } from "./http-BGjkvEDc.js";
|
|
6
4
|
import { getLogger } from "@logtape/logtape";
|
|
7
5
|
import { curry } from "es-toolkit";
|
|
8
6
|
import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
9
|
-
|
|
10
7
|
//#region src/utils/docloader.ts
|
|
11
8
|
const logger$1 = getLogger([
|
|
12
9
|
"fedify",
|
|
@@ -36,18 +33,15 @@ function getAuthenticatedDocumentLoader(identity, { allowPrivateAddress, userAge
|
|
|
36
33
|
});
|
|
37
34
|
throw error;
|
|
38
35
|
}
|
|
39
|
-
|
|
40
|
-
const response = await doubleKnock(originalRequest, identity, {
|
|
36
|
+
return getRemoteDocument(url, await doubleKnock(createActivityPubRequest(url, { userAgent }), identity, {
|
|
41
37
|
specDeterminer,
|
|
42
38
|
log: curry(logRequest)(logger$1),
|
|
43
39
|
tracerProvider,
|
|
44
40
|
signal: options?.signal
|
|
45
|
-
});
|
|
46
|
-
return getRemoteDocument(url, response, load);
|
|
41
|
+
}), load);
|
|
47
42
|
}
|
|
48
43
|
return load;
|
|
49
44
|
}
|
|
50
|
-
|
|
51
45
|
//#endregion
|
|
52
46
|
//#region src/utils/kv-cache.ts
|
|
53
47
|
const logger = getLogger([
|
|
@@ -115,6 +109,5 @@ function matchRule(url, rules) {
|
|
|
115
109
|
}
|
|
116
110
|
return null;
|
|
117
111
|
}
|
|
118
|
-
|
|
119
112
|
//#endregion
|
|
120
|
-
export { getAuthenticatedDocumentLoader, kvCache };
|
|
113
|
+
export { getAuthenticatedDocumentLoader as n, kvCache as t };
|