@fedify/fedify 1.7.11 → 1.7.12
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/{actor-DgWryCk8.js → actor-GZRoTRqg.js} +1059 -2276
- package/dist/{actor-2ENhJMd7.js → actor-TYqJGdVq.js} +6 -9
- package/dist/{assert-DmFG7ppO.js → assert-LOEeCUK5.js} +1 -1
- package/dist/{assert_equals-CTYbeopb.js → assert_equals-B44MxcIj.js} +2 -4
- package/dist/{assert_instance_of-CF09JHYM.js → assert_instance_of-XtuFevV_.js} +1 -1
- package/dist/{assert_is_error-nrwA1GeT.js → assert_is_error-BTlryvT0.js} +1 -1
- package/dist/{assert_not_equals-Dc7y-V5Q.js → assert_not_equals-C685gKx6.js} +1 -1
- package/dist/{assert_rejects-C-sxEMM5.js → assert_rejects-DWQ4jaf9.js} +2 -2
- package/dist/{assert_throws-Cn9C6Jur.js → assert_throws-YetpVSc-.js} +2 -2
- package/dist/{authdocloader-BUJAQQAE.js → authdocloader-BopfyipD.js} +3 -3
- package/dist/{authdocloader-CK17fG7y.js → authdocloader-hiFSyM7V.js} +4 -4
- package/dist/{builder-CZM8EtHh.js → builder-mi6RdzNE.js} +7 -10
- package/dist/{chunk-HsBuZ-b2.js → chunk-Cx8LTkjm.js} +3 -1
- package/dist/{client-D83KwIk4.js → client-DuUKk4pk.js} +6 -6
- package/dist/compat/transformers.test.js +27 -28
- package/dist/{context-MUHrGcK9.js → context-RMU32mk4.js} +2 -2
- package/dist/{docloader-BcyuO_kK.js → docloader-DJxET2fN.js} +5 -9
- package/dist/{docloader-D4wl8z_4.js → docloader-bgBm1Hd1.js} +4 -6
- package/dist/{esm-Db4De7AS.js → esm-DO9PrujO.js} +23 -34
- package/dist/federation/builder.test.js +23 -29
- package/dist/federation/collection.test.js +9 -9
- package/dist/federation/handler.test.js +33 -33
- package/dist/federation/inbox.test.js +10 -10
- package/dist/federation/keycache.test.js +9 -9
- package/dist/federation/kv.test.js +10 -9
- package/dist/federation/middleware.test.js +76 -99
- package/dist/federation/mod.js +11 -11
- package/dist/federation/mq.test.js +10 -11
- package/dist/federation/retry.test.js +3 -3
- package/dist/federation/router.test.js +9 -9
- package/dist/federation/send.test.js +22 -22
- package/dist/{federation-BRIQn-GV.js → federation-B0aljx0V.js} +1 -2
- package/dist/{http-DFHfa9tA.js → http-D2DkwsjA.js} +8 -15
- package/dist/{http-Dsj_eYDw.js → http-vqMAvOVs.js} +8 -15
- package/dist/{inbox-CltmHpHc.js → inbox-DAAZZl2k.js} +5 -7
- package/dist/key-5ssHQ67E.js +16 -0
- package/dist/{key-bBurC_PZ.js → key-DSJGnD10.js} +4 -4
- package/dist/{key-qFVeObG1.js → key-DmqJj57e.js} +5 -8
- package/dist/{key-bttcdrh5.js → key-KVhaUM92.js} +6 -9
- package/dist/{keycache-DijbBawF.js → keycache-C1pEuRyQ.js} +2 -2
- package/dist/{keys-DJ5t4jB4.js → keys-C4XQHW5_.js} +1 -1
- package/dist/{ld-U-lGfuzj.js → ld-DzlJ_IpT.js} +9 -16
- package/dist/{lookup-BlPHJ-Ff.js → lookup-CSngxuWm.js} +2 -4
- package/dist/{lookup-C8ZpflGI.js → lookup-D0je8AqR.js} +7 -11
- package/dist/{lookup-BGqnk7rW.js → lookup-DL62q3Xh.js} +3 -5
- package/dist/{middleware-D66R1UZl.js → middleware-3wVT6S9E.js} +34 -52
- package/dist/middleware-CxFoFBD8.js +33 -0
- package/dist/{middleware-BRzqW-QG.js → middleware-DlDXugwZ.js} +34 -58
- package/dist/middleware-w7_U3fFi.js +17 -0
- package/dist/mod.js +11 -11
- package/dist/{multibase-DeCHcK8L.js → multibase-CnLHszip.js} +1 -2
- package/dist/nodeinfo/client.test.js +20 -23
- package/dist/nodeinfo/handler.test.js +32 -32
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/nodeinfo/semver.test.js +23 -30
- package/dist/nodeinfo/types.test.js +11 -11
- package/dist/{owner-2zho-3Ew.js → owner-81ey_76X.js} +3 -3
- package/dist/{proof-BYHc1mMr.js → proof-BlULDH4H.js} +8 -14
- package/dist/{proof-3J23UdVg.js → proof-DlI7QNdn.js} +12 -25
- package/dist/runtime/authdocloader.test.js +21 -21
- package/dist/runtime/docloader.test.js +16 -18
- package/dist/runtime/key.test.js +17 -17
- package/dist/runtime/langstr.test.js +9 -9
- package/dist/runtime/mod.js +6 -6
- package/dist/runtime/multibase/multibase.test.js +11 -12
- package/dist/runtime/url.test.js +6 -6
- package/dist/{semver-DWClQt_5.js → semver-BNrOOAs9.js} +1 -3
- package/dist/{send-CW7iJ-b9.js → send-DdxfTHo6.js} +3 -4
- package/dist/sig/http.test.js +40 -54
- package/dist/sig/key.test.js +18 -18
- package/dist/sig/ld.test.js +20 -22
- package/dist/sig/mod.js +6 -6
- package/dist/sig/owner.test.js +20 -20
- package/dist/sig/proof.test.js +19 -19
- package/dist/{std__assert-vp0TKMS1.js → std__assert-o_r9vqm1.js} +1 -1
- package/dist/testing/docloader.test.js +9 -9
- package/dist/testing/mod.js +1 -1
- package/dist/{testing-BZ0dJ4qn.js → testing-DLyvtiiW.js} +3 -5
- package/dist/{type-D2s5lmbZ.js → type-CFuiGLz9.js} +1 -2
- package/dist/{types-C7C_l-jz.js → types-CJHS5pXl.js} +1 -1
- package/dist/{types-DXmLob1B.js → types-CmVV9LT1.js} +6 -8
- package/dist/{url-kTAI6_KP.js → url-C2xuoQD1.js} +2 -4
- package/dist/vocab/actor.test.js +104 -156
- package/dist/vocab/lookup.test.js +17 -17
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +11 -15
- package/dist/vocab/vocab.test.js +45 -49
- package/dist/{vocab-Cy9XhW_T.js → vocab-BebR0kAy.js} +6 -10
- package/dist/{vocab-BojAnGjI.js → vocab-DFlq4Wa6.js} +1057 -2270
- package/dist/webfinger/handler.test.js +33 -34
- package/dist/webfinger/lookup.test.js +13 -13
- package/dist/webfinger/mod.js +2 -2
- package/dist/x/cfworkers.test.js +9 -9
- package/package.json +1 -1
- package/dist/key-BROjrzkW.js +0 -16
- package/dist/middleware-BhqeOJrC.js +0 -17
- package/dist/middleware-DFra19vb.js +0 -33
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { deno_default, getUserAgent } from "./docloader-
|
|
7
|
-
import { UrlError, validatePublicUrl } from "./url-
|
|
6
|
+
import { deno_default, getUserAgent } from "./docloader-bgBm1Hd1.js";
|
|
7
|
+
import { UrlError, validatePublicUrl } from "./url-C2xuoQD1.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
|
|
@@ -23,9 +23,7 @@ const MAX_REDIRECTION = 5;
|
|
|
23
23
|
* @since 0.2.0
|
|
24
24
|
*/
|
|
25
25
|
async function lookupWebFinger(resource, options = {}) {
|
|
26
|
-
|
|
27
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
28
|
-
return await tracer.startActiveSpan("webfinger.lookup", {
|
|
26
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("webfinger.lookup", {
|
|
29
27
|
kind: SpanKind.CLIENT,
|
|
30
28
|
attributes: {
|
|
31
29
|
"webfinger.resource": resource.toString(),
|
|
@@ -3,26 +3,26 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { deno_default, getDocumentLoader, kvCache } from "./docloader-
|
|
7
|
-
import { getNodeInfo } from "./client-
|
|
6
|
+
import { deno_default, getDocumentLoader, kvCache } from "./docloader-bgBm1Hd1.js";
|
|
7
|
+
import { getNodeInfo } from "./client-DuUKk4pk.js";
|
|
8
8
|
import { RouterError } from "./router-D_aVZZUc.js";
|
|
9
|
-
import { nodeInfoToJson } from "./types-
|
|
10
|
-
import { Activity, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage } from "./vocab-
|
|
11
|
-
import { lookupWebFinger } from "./lookup-
|
|
12
|
-
import { getTypeId } from "./type-
|
|
13
|
-
import { exportJwk, importJwk, validateCryptoKey } from "./key-
|
|
14
|
-
import { verifyRequest } from "./http-
|
|
15
|
-
import { getAuthenticatedDocumentLoader } from "./authdocloader-
|
|
16
|
-
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-
|
|
17
|
-
import { doesActorOwnKey, getKeyOwner } from "./owner-
|
|
18
|
-
import { signObject, verifyObject } from "./proof-
|
|
19
|
-
import { lookupObject, traverseCollection } from "./lookup-
|
|
20
|
-
import { routeActivity } from "./inbox-
|
|
21
|
-
import { FederationBuilderImpl } from "./builder-
|
|
9
|
+
import { nodeInfoToJson } from "./types-CJHS5pXl.js";
|
|
10
|
+
import { Activity, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage } from "./vocab-DFlq4Wa6.js";
|
|
11
|
+
import { lookupWebFinger } from "./lookup-DL62q3Xh.js";
|
|
12
|
+
import { getTypeId } from "./type-CFuiGLz9.js";
|
|
13
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-KVhaUM92.js";
|
|
14
|
+
import { verifyRequest } from "./http-D2DkwsjA.js";
|
|
15
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-hiFSyM7V.js";
|
|
16
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-DzlJ_IpT.js";
|
|
17
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-81ey_76X.js";
|
|
18
|
+
import { signObject, verifyObject } from "./proof-BlULDH4H.js";
|
|
19
|
+
import { lookupObject, traverseCollection } from "./lookup-D0je8AqR.js";
|
|
20
|
+
import { routeActivity } from "./inbox-DAAZZl2k.js";
|
|
21
|
+
import { FederationBuilderImpl } from "./builder-mi6RdzNE.js";
|
|
22
22
|
import { buildCollectionSynchronizationHeader } from "./collection-Dfb0TPno.js";
|
|
23
|
-
import { KvKeyCache } from "./keycache-
|
|
23
|
+
import { KvKeyCache } from "./keycache-C1pEuRyQ.js";
|
|
24
24
|
import { createExponentialBackoffPolicy } from "./retry-BiIhZWgD.js";
|
|
25
|
-
import { extractInboxes, sendActivity } from "./send-
|
|
25
|
+
import { extractInboxes, sendActivity } from "./send-DdxfTHo6.js";
|
|
26
26
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
27
27
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
28
28
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
@@ -352,8 +352,7 @@ function getFullType(spec) {
|
|
|
352
352
|
return `${spec.type}/${spec.subtype}`;
|
|
353
353
|
}
|
|
354
354
|
function preferredMediaTypes(accept) {
|
|
355
|
-
|
|
356
|
-
return accepts.filter(isQuality).sort(compareSpecs).map(getFullType);
|
|
355
|
+
return parseAccept(accept === void 0 ? "*/*" : accept ?? "").filter(isQuality).sort(compareSpecs).map(getFullType);
|
|
357
356
|
}
|
|
358
357
|
|
|
359
358
|
//#endregion
|
|
@@ -444,8 +443,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
444
443
|
const spanName = name.trim().replace(/\s+/g, "_");
|
|
445
444
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
446
445
|
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
447
|
-
const
|
|
448
|
-
const cursor = url.searchParams.get("cursor");
|
|
446
|
+
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
449
447
|
if (collectionCallbacks == null) return await onNotFound(request);
|
|
450
448
|
let collection;
|
|
451
449
|
const baseUri = uriGetter(identifier);
|
|
@@ -605,9 +603,7 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
|
605
603
|
return result;
|
|
606
604
|
}
|
|
607
605
|
async function handleInbox(request, options) {
|
|
608
|
-
|
|
609
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
610
|
-
return await tracer.startActiveSpan("activitypub.inbox", {
|
|
606
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.inbox", {
|
|
611
607
|
kind: options.queue == null ? SpanKind.SERVER : SpanKind.PRODUCER,
|
|
612
608
|
attributes: { "activitypub.shared_inbox": options.recipient == null }
|
|
613
609
|
}, async (span) => {
|
|
@@ -639,8 +635,7 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
|
|
|
639
635
|
});
|
|
640
636
|
return await onNotFound(request);
|
|
641
637
|
} else if (recipient != null) {
|
|
642
|
-
|
|
643
|
-
if (actor == null) {
|
|
638
|
+
if (await actorDispatcher(ctx, recipient) == null) {
|
|
644
639
|
logger$2.error("Actor {recipient} not found.", { recipient });
|
|
645
640
|
span.setStatus({
|
|
646
641
|
code: SpanStatusCode.ERROR,
|
|
@@ -787,11 +782,10 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
|
|
|
787
782
|
code: SpanStatusCode.ERROR,
|
|
788
783
|
message: `Failed to verify the request's HTTP Signatures.`
|
|
789
784
|
});
|
|
790
|
-
|
|
785
|
+
return new Response("Failed to verify the request signature.", {
|
|
791
786
|
status: 401,
|
|
792
787
|
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
793
788
|
});
|
|
794
|
-
return response;
|
|
795
789
|
} else logger$2.debug("HTTP Signatures are verified.", { recipient });
|
|
796
790
|
httpSigKey = key;
|
|
797
791
|
}
|
|
@@ -1099,12 +1093,11 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1099
1093
|
});
|
|
1100
1094
|
}
|
|
1101
1095
|
async #listenFanoutMessage(data, message) {
|
|
1102
|
-
|
|
1096
|
+
getLogger([
|
|
1103
1097
|
"fedify",
|
|
1104
1098
|
"federation",
|
|
1105
1099
|
"fanout"
|
|
1106
|
-
])
|
|
1107
|
-
logger$2.debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
|
|
1100
|
+
]).debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
|
|
1108
1101
|
activityId: message.activityId,
|
|
1109
1102
|
inboxes: globalThis.Object.keys(message.inboxes).length
|
|
1110
1103
|
});
|
|
@@ -1237,8 +1230,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1237
1230
|
activity.id.href
|
|
1238
1231
|
];
|
|
1239
1232
|
if (cacheKey != null) {
|
|
1240
|
-
|
|
1241
|
-
if (cached === true) {
|
|
1233
|
+
if (await this.kv.get(cacheKey) === true) {
|
|
1242
1234
|
logger$2.debug("Activity {activityId} has already been processed.", {
|
|
1243
1235
|
activityId: activity.id?.href,
|
|
1244
1236
|
activity: message.activity,
|
|
@@ -1485,8 +1477,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1485
1477
|
const { outboxQueue } = this;
|
|
1486
1478
|
if (outboxQueue.enqueueMany == null) {
|
|
1487
1479
|
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
1488
|
-
const
|
|
1489
|
-
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
1480
|
+
const errors = (await Promise.allSettled(promises)).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
1490
1481
|
if (errors.length > 0) {
|
|
1491
1482
|
logger$2.error("Failed to enqueue activity {activityId} to send later: {errors}", {
|
|
1492
1483
|
activityId: activity.id.href,
|
|
@@ -1885,7 +1876,6 @@ var ContextImpl = class ContextImpl {
|
|
|
1885
1876
|
identifier: void 0,
|
|
1886
1877
|
get handle() {
|
|
1887
1878
|
logger$2.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
1888
|
-
return void 0;
|
|
1889
1879
|
}
|
|
1890
1880
|
};
|
|
1891
1881
|
const identifier = "identifier" in route.values ? route.values.identifier : route.values.handle;
|
|
@@ -2068,8 +2058,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2068
2058
|
} else identifierPromise = Promise.resolve(identity.identifier);
|
|
2069
2059
|
return identifierPromise.then((identifier) => {
|
|
2070
2060
|
if (identifier == null) return this.documentLoader;
|
|
2071
|
-
|
|
2072
|
-
return keyPair.then((pair) => pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair));
|
|
2061
|
+
return this.getRsaKeyPairFromIdentifier(identifier).then((pair) => pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair));
|
|
2073
2062
|
});
|
|
2074
2063
|
}
|
|
2075
2064
|
return this.federation.authenticatedDocumentLoaderFactory(identity);
|
|
@@ -2111,8 +2100,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2111
2100
|
});
|
|
2112
2101
|
}
|
|
2113
2102
|
sendActivity(sender, recipients, activity, options = {}) {
|
|
2114
|
-
|
|
2115
|
-
return tracer.startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
|
2103
|
+
return this.tracerProvider.getTracer(deno_default.name, deno_default.version).startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
|
2116
2104
|
kind: this.federation.outboxQueue == null || options.immediate ? SpanKind.CLIENT : SpanKind.PRODUCER,
|
|
2117
2105
|
attributes: {
|
|
2118
2106
|
"activitypub.activity.type": getTypeId(activity).href,
|
|
@@ -2257,9 +2245,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2257
2245
|
}
|
|
2258
2246
|
}
|
|
2259
2247
|
routeActivity(recipient, activity, options = {}) {
|
|
2260
|
-
|
|
2261
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
2262
|
-
return tracer.startActiveSpan("activitypub.inbox", {
|
|
2248
|
+
return (this.tracerProvider ?? this.tracerProvider).getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.inbox", {
|
|
2263
2249
|
kind: this.federation.inboxQueue == null || options.immediate ? SpanKind.INTERNAL : SpanKind.PRODUCER,
|
|
2264
2250
|
attributes: { "activitypub.activity.type": getTypeId(activity).href }
|
|
2265
2251
|
}, async (span) => {
|
|
@@ -2295,13 +2281,12 @@ var ContextImpl = class ContextImpl {
|
|
|
2295
2281
|
const contextLoader = options.contextLoader ?? this.contextLoader;
|
|
2296
2282
|
const json = await activity.toJsonLd({ contextLoader });
|
|
2297
2283
|
const keyCache = new KvKeyCache(this.federation.kv, this.federation.kvPrefixes.publicKey, this);
|
|
2298
|
-
|
|
2284
|
+
if (await verifyObject(Activity, json, {
|
|
2299
2285
|
contextLoader,
|
|
2300
2286
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
2301
2287
|
tracerProvider: options.tracerProvider ?? this.tracerProvider,
|
|
2302
2288
|
keyCache
|
|
2303
|
-
})
|
|
2304
|
-
if (verified == null) {
|
|
2289
|
+
}) == null) {
|
|
2305
2290
|
logger$2.debug("Object Integrity Proofs are not verified.", {
|
|
2306
2291
|
recipient,
|
|
2307
2292
|
activity: json
|
|
@@ -2475,8 +2460,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
2475
2460
|
});
|
|
2476
2461
|
}
|
|
2477
2462
|
forwardActivity(forwarder, recipients, options) {
|
|
2478
|
-
|
|
2479
|
-
return tracer.startActiveSpan("activitypub.outbox", {
|
|
2463
|
+
return this.tracerProvider.getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.outbox", {
|
|
2480
2464
|
kind: this.federation.outboxQueue == null || options?.immediate ? SpanKind.CLIENT : SpanKind.PRODUCER,
|
|
2481
2465
|
attributes: { "activitypub.activity.type": this.activityType }
|
|
2482
2466
|
}, async (span) => {
|
|
@@ -2527,8 +2511,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
2527
2511
|
if (!hasSignature(this.activity)) {
|
|
2528
2512
|
let hasProof;
|
|
2529
2513
|
try {
|
|
2530
|
-
|
|
2531
|
-
hasProof = await activity.getProof() != null;
|
|
2514
|
+
hasProof = await (await Activity.fromJsonLd(this.activity, this)).getProof() != null;
|
|
2532
2515
|
} catch {
|
|
2533
2516
|
hasProof = false;
|
|
2534
2517
|
}
|
|
@@ -2606,8 +2589,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
2606
2589
|
const { outboxQueue } = this.federation;
|
|
2607
2590
|
if (outboxQueue.enqueueMany == null) {
|
|
2608
2591
|
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
2609
|
-
const
|
|
2610
|
-
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2592
|
+
const errors = (await Promise.allSettled(promises)).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2611
2593
|
if (errors.length > 0) {
|
|
2612
2594
|
logger$2.error("Failed to enqueue activity {activityId} to forward later:\n{errors}", {
|
|
2613
2595
|
activityId: this.activityId,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
globalThis.addEventListener = () => {};
|
|
5
|
+
|
|
6
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-3wVT6S9E.js";
|
|
7
|
+
import "./docloader-bgBm1Hd1.js";
|
|
8
|
+
import "./url-C2xuoQD1.js";
|
|
9
|
+
import "./semver-BNrOOAs9.js";
|
|
10
|
+
import "./client-DuUKk4pk.js";
|
|
11
|
+
import "./router-D_aVZZUc.js";
|
|
12
|
+
import "./types-CJHS5pXl.js";
|
|
13
|
+
import "./multibase-CnLHszip.js";
|
|
14
|
+
import "./vocab-DFlq4Wa6.js";
|
|
15
|
+
import "./langstr-DbWheeIS.js";
|
|
16
|
+
import "./lookup-DL62q3Xh.js";
|
|
17
|
+
import "./type-CFuiGLz9.js";
|
|
18
|
+
import "./actor-TYqJGdVq.js";
|
|
19
|
+
import "./key-KVhaUM92.js";
|
|
20
|
+
import "./http-D2DkwsjA.js";
|
|
21
|
+
import "./authdocloader-hiFSyM7V.js";
|
|
22
|
+
import "./ld-DzlJ_IpT.js";
|
|
23
|
+
import "./owner-81ey_76X.js";
|
|
24
|
+
import "./proof-BlULDH4H.js";
|
|
25
|
+
import "./lookup-D0je8AqR.js";
|
|
26
|
+
import "./inbox-DAAZZl2k.js";
|
|
27
|
+
import "./builder-mi6RdzNE.js";
|
|
28
|
+
import "./collection-Dfb0TPno.js";
|
|
29
|
+
import "./keycache-C1pEuRyQ.js";
|
|
30
|
+
import "./retry-BiIhZWgD.js";
|
|
31
|
+
import "./send-DdxfTHo6.js";
|
|
32
|
+
|
|
33
|
+
export { FederationImpl };
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
5
|
import { getDefaultActivityTransformers } from "./transformers-ghwJuzGY.js";
|
|
6
|
-
import { deno_default, getDocumentLoader, kvCache } from "./docloader-
|
|
7
|
-
import { Activity, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-
|
|
8
|
-
import { lookupWebFinger } from "./lookup-
|
|
9
|
-
import { exportJwk, importJwk, validateCryptoKey } from "./key-
|
|
10
|
-
import { doubleKnock, verifyRequest } from "./http-
|
|
11
|
-
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-
|
|
12
|
-
import { getNodeInfo, nodeInfoToJson } from "./types-
|
|
13
|
-
import { getAuthenticatedDocumentLoader } from "./authdocloader-
|
|
14
|
-
import { lookupObject, traverseCollection } from "./vocab-
|
|
6
|
+
import { deno_default, getDocumentLoader, kvCache } from "./docloader-DJxET2fN.js";
|
|
7
|
+
import { Activity, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-GZRoTRqg.js";
|
|
8
|
+
import { lookupWebFinger } from "./lookup-CSngxuWm.js";
|
|
9
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-DmqJj57e.js";
|
|
10
|
+
import { doubleKnock, verifyRequest } from "./http-vqMAvOVs.js";
|
|
11
|
+
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-DlI7QNdn.js";
|
|
12
|
+
import { getNodeInfo, nodeInfoToJson } from "./types-CmVV9LT1.js";
|
|
13
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-BopfyipD.js";
|
|
14
|
+
import { lookupObject, traverseCollection } from "./vocab-BebR0kAy.js";
|
|
15
15
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
16
16
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
17
17
|
import { encodeHex } from "byte-encodings/hex";
|
|
@@ -67,8 +67,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
67
67
|
activity.id.href
|
|
68
68
|
];
|
|
69
69
|
if (cacheKey != null) {
|
|
70
|
-
|
|
71
|
-
if (cached === true) {
|
|
70
|
+
if (await kv.get(cacheKey) === true) {
|
|
72
71
|
logger$1.debug("Activity {activityId} has already been processed.", {
|
|
73
72
|
activityId: activity.id?.href,
|
|
74
73
|
activity: json,
|
|
@@ -125,8 +124,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
125
124
|
return "enqueued";
|
|
126
125
|
}
|
|
127
126
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
128
|
-
|
|
129
|
-
return await tracer.startActiveSpan("activitypub.dispatch_inbox_listener", { kind: SpanKind.INTERNAL }, async (span$1) => {
|
|
127
|
+
return await tracerProvider.getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.dispatch_inbox_listener", { kind: SpanKind.INTERNAL }, async (span$1) => {
|
|
130
128
|
const dispatched = inboxListeners?.dispatchWithClass(activity);
|
|
131
129
|
if (dispatched == null) {
|
|
132
130
|
logger$1.error("Unsupported activity type:\n{activity}", {
|
|
@@ -312,7 +310,7 @@ var FederationBuilderImpl = class {
|
|
|
312
310
|
this.objectTypeIds = {};
|
|
313
311
|
}
|
|
314
312
|
async build(options) {
|
|
315
|
-
const { FederationImpl: FederationImpl$1 } = await import("./middleware-
|
|
313
|
+
const { FederationImpl: FederationImpl$1 } = await import("./middleware-w7_U3fFi.js");
|
|
316
314
|
const f = new FederationImpl$1(options);
|
|
317
315
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
318
316
|
f.router = this.router.clone();
|
|
@@ -453,8 +451,7 @@ var FederationBuilderImpl = class {
|
|
|
453
451
|
}
|
|
454
452
|
setNodeInfoDispatcher(path, dispatcher) {
|
|
455
453
|
if (this.router.has("nodeInfo")) throw new RouterError("NodeInfo dispatcher already set.");
|
|
456
|
-
|
|
457
|
-
if (variables.size !== 0) throw new RouterError("Path for NodeInfo dispatcher must have no variables.");
|
|
454
|
+
if (this.router.add(path, "nodeInfo").size !== 0) throw new RouterError("Path for NodeInfo dispatcher must have no variables.");
|
|
458
455
|
this.nodeInfoDispatcher = dispatcher;
|
|
459
456
|
}
|
|
460
457
|
setObjectDispatcher(cls, path, dispatcher) {
|
|
@@ -464,8 +461,7 @@ var FederationBuilderImpl = class {
|
|
|
464
461
|
if (variables.size < 1) throw new RouterError("Path for object dispatcher must have at least one variable.");
|
|
465
462
|
const callbacks = {
|
|
466
463
|
dispatcher: (ctx, values) => {
|
|
467
|
-
|
|
468
|
-
return tracer.startActiveSpan("activitypub.dispatch_object", {
|
|
464
|
+
return this._getTracer().startActiveSpan("activitypub.dispatch_object", {
|
|
469
465
|
kind: SpanKind.SERVER,
|
|
470
466
|
attributes: {
|
|
471
467
|
"fedify.object.type": cls.typeId.href,
|
|
@@ -736,8 +732,7 @@ var FederationBuilderImpl = class {
|
|
|
736
732
|
]).warn("The {{handle}} variable in the inbox path is deprecated. Use {{identifier}} instead.");
|
|
737
733
|
}
|
|
738
734
|
if (sharedInboxPath != null) {
|
|
739
|
-
|
|
740
|
-
if (siVars.size !== 0) throw new RouterError("Path for shared inbox must have no variables.");
|
|
735
|
+
if (this.router.add(sharedInboxPath, "sharedInbox").size !== 0) throw new RouterError("Path for shared inbox must have no variables.");
|
|
741
736
|
}
|
|
742
737
|
const listeners = this.inboxListeners = new InboxListenerSet();
|
|
743
738
|
const setters = {
|
|
@@ -831,7 +826,7 @@ var KvKeyCache = class {
|
|
|
831
826
|
return await Multikey.fromJsonLd(serialized, this.options);
|
|
832
827
|
} catch {
|
|
833
828
|
await this.kv.delete([...this.prefix, keyId.href]);
|
|
834
|
-
return
|
|
829
|
+
return;
|
|
835
830
|
}
|
|
836
831
|
}
|
|
837
832
|
}
|
|
@@ -901,8 +896,7 @@ function getFullType(spec) {
|
|
|
901
896
|
return `${spec.type}/${spec.subtype}`;
|
|
902
897
|
}
|
|
903
898
|
function preferredMediaTypes(accept) {
|
|
904
|
-
|
|
905
|
-
return accepts.filter(isQuality).sort(compareSpecs).map(getFullType);
|
|
899
|
+
return parseAccept(accept === void 0 ? "*/*" : accept ?? "").filter(isQuality).sort(compareSpecs).map(getFullType);
|
|
906
900
|
}
|
|
907
901
|
|
|
908
902
|
//#endregion
|
|
@@ -993,8 +987,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
993
987
|
const spanName = name.trim().replace(/\s+/g, "_");
|
|
994
988
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
995
989
|
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
996
|
-
const
|
|
997
|
-
const cursor = url.searchParams.get("cursor");
|
|
990
|
+
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
998
991
|
if (collectionCallbacks == null) return await onNotFound(request);
|
|
999
992
|
let collection;
|
|
1000
993
|
const baseUri = uriGetter(identifier);
|
|
@@ -1154,9 +1147,7 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
|
1154
1147
|
return result;
|
|
1155
1148
|
}
|
|
1156
1149
|
async function handleInbox(request, options) {
|
|
1157
|
-
|
|
1158
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
1159
|
-
return await tracer.startActiveSpan("activitypub.inbox", {
|
|
1150
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.inbox", {
|
|
1160
1151
|
kind: options.queue == null ? SpanKind.SERVER : SpanKind.PRODUCER,
|
|
1161
1152
|
attributes: { "activitypub.shared_inbox": options.recipient == null }
|
|
1162
1153
|
}, async (span) => {
|
|
@@ -1188,8 +1179,7 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
|
|
|
1188
1179
|
});
|
|
1189
1180
|
return await onNotFound(request);
|
|
1190
1181
|
} else if (recipient != null) {
|
|
1191
|
-
|
|
1192
|
-
if (actor == null) {
|
|
1182
|
+
if (await actorDispatcher(ctx, recipient) == null) {
|
|
1193
1183
|
logger$1.error("Actor {recipient} not found.", { recipient });
|
|
1194
1184
|
span.setStatus({
|
|
1195
1185
|
code: SpanStatusCode.ERROR,
|
|
@@ -1336,11 +1326,10 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
|
|
|
1336
1326
|
code: SpanStatusCode.ERROR,
|
|
1337
1327
|
message: `Failed to verify the request's HTTP Signatures.`
|
|
1338
1328
|
});
|
|
1339
|
-
|
|
1329
|
+
return new Response("Failed to verify the request signature.", {
|
|
1340
1330
|
status: 401,
|
|
1341
1331
|
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
1342
1332
|
});
|
|
1343
|
-
return response;
|
|
1344
1333
|
} else logger$1.debug("HTTP Signatures are verified.", { recipient });
|
|
1345
1334
|
httpSigKey = key;
|
|
1346
1335
|
}
|
|
@@ -1666,8 +1655,7 @@ function extractInboxes({ recipients, preferSharedInbox, excludeBaseUris }) {
|
|
|
1666
1655
|
*/
|
|
1667
1656
|
function sendActivity(options) {
|
|
1668
1657
|
const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
|
|
1669
|
-
|
|
1670
|
-
return tracer.startActiveSpan("activitypub.send_activity", {
|
|
1658
|
+
return tracerProvider.getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.send_activity", {
|
|
1671
1659
|
kind: SpanKind.CLIENT,
|
|
1672
1660
|
attributes: { "activitypub.shared_inbox": options.sharedInbox ?? false }
|
|
1673
1661
|
}, async (span) => {
|
|
@@ -1964,12 +1952,11 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1964
1952
|
});
|
|
1965
1953
|
}
|
|
1966
1954
|
async #listenFanoutMessage(data, message) {
|
|
1967
|
-
|
|
1955
|
+
getLogger([
|
|
1968
1956
|
"fedify",
|
|
1969
1957
|
"federation",
|
|
1970
1958
|
"fanout"
|
|
1971
|
-
])
|
|
1972
|
-
logger$1.debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
|
|
1959
|
+
]).debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
|
|
1973
1960
|
activityId: message.activityId,
|
|
1974
1961
|
inboxes: globalThis.Object.keys(message.inboxes).length
|
|
1975
1962
|
});
|
|
@@ -2102,8 +2089,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2102
2089
|
activity.id.href
|
|
2103
2090
|
];
|
|
2104
2091
|
if (cacheKey != null) {
|
|
2105
|
-
|
|
2106
|
-
if (cached === true) {
|
|
2092
|
+
if (await this.kv.get(cacheKey) === true) {
|
|
2107
2093
|
logger$1.debug("Activity {activityId} has already been processed.", {
|
|
2108
2094
|
activityId: activity.id?.href,
|
|
2109
2095
|
activity: message.activity,
|
|
@@ -2350,8 +2336,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2350
2336
|
const { outboxQueue } = this;
|
|
2351
2337
|
if (outboxQueue.enqueueMany == null) {
|
|
2352
2338
|
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
2353
|
-
const
|
|
2354
|
-
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2339
|
+
const errors = (await Promise.allSettled(promises)).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2355
2340
|
if (errors.length > 0) {
|
|
2356
2341
|
logger$1.error("Failed to enqueue activity {activityId} to send later: {errors}", {
|
|
2357
2342
|
activityId: activity.id.href,
|
|
@@ -2750,7 +2735,6 @@ var ContextImpl = class ContextImpl {
|
|
|
2750
2735
|
identifier: void 0,
|
|
2751
2736
|
get handle() {
|
|
2752
2737
|
logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
2753
|
-
return void 0;
|
|
2754
2738
|
}
|
|
2755
2739
|
};
|
|
2756
2740
|
const identifier = "identifier" in route.values ? route.values.identifier : route.values.handle;
|
|
@@ -2933,8 +2917,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2933
2917
|
} else identifierPromise = Promise.resolve(identity.identifier);
|
|
2934
2918
|
return identifierPromise.then((identifier) => {
|
|
2935
2919
|
if (identifier == null) return this.documentLoader;
|
|
2936
|
-
|
|
2937
|
-
return keyPair.then((pair) => pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair));
|
|
2920
|
+
return this.getRsaKeyPairFromIdentifier(identifier).then((pair) => pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair));
|
|
2938
2921
|
});
|
|
2939
2922
|
}
|
|
2940
2923
|
return this.federation.authenticatedDocumentLoaderFactory(identity);
|
|
@@ -2976,8 +2959,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2976
2959
|
});
|
|
2977
2960
|
}
|
|
2978
2961
|
sendActivity(sender, recipients, activity, options = {}) {
|
|
2979
|
-
|
|
2980
|
-
return tracer.startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
|
2962
|
+
return this.tracerProvider.getTracer(deno_default.name, deno_default.version).startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
|
2981
2963
|
kind: this.federation.outboxQueue == null || options.immediate ? SpanKind.CLIENT : SpanKind.PRODUCER,
|
|
2982
2964
|
attributes: {
|
|
2983
2965
|
"activitypub.activity.type": getTypeId(activity).href,
|
|
@@ -3122,9 +3104,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3122
3104
|
}
|
|
3123
3105
|
}
|
|
3124
3106
|
routeActivity(recipient, activity, options = {}) {
|
|
3125
|
-
|
|
3126
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
3127
|
-
return tracer.startActiveSpan("activitypub.inbox", {
|
|
3107
|
+
return (this.tracerProvider ?? this.tracerProvider).getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.inbox", {
|
|
3128
3108
|
kind: this.federation.inboxQueue == null || options.immediate ? SpanKind.INTERNAL : SpanKind.PRODUCER,
|
|
3129
3109
|
attributes: { "activitypub.activity.type": getTypeId(activity).href }
|
|
3130
3110
|
}, async (span) => {
|
|
@@ -3160,13 +3140,12 @@ var ContextImpl = class ContextImpl {
|
|
|
3160
3140
|
const contextLoader = options.contextLoader ?? this.contextLoader;
|
|
3161
3141
|
const json = await activity.toJsonLd({ contextLoader });
|
|
3162
3142
|
const keyCache = new KvKeyCache(this.federation.kv, this.federation.kvPrefixes.publicKey, this);
|
|
3163
|
-
|
|
3143
|
+
if (await verifyObject(Activity, json, {
|
|
3164
3144
|
contextLoader,
|
|
3165
3145
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
3166
3146
|
tracerProvider: options.tracerProvider ?? this.tracerProvider,
|
|
3167
3147
|
keyCache
|
|
3168
|
-
})
|
|
3169
|
-
if (verified == null) {
|
|
3148
|
+
}) == null) {
|
|
3170
3149
|
logger$1.debug("Object Integrity Proofs are not verified.", {
|
|
3171
3150
|
recipient,
|
|
3172
3151
|
activity: json
|
|
@@ -3340,8 +3319,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
3340
3319
|
});
|
|
3341
3320
|
}
|
|
3342
3321
|
forwardActivity(forwarder, recipients, options) {
|
|
3343
|
-
|
|
3344
|
-
return tracer.startActiveSpan("activitypub.outbox", {
|
|
3322
|
+
return this.tracerProvider.getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.outbox", {
|
|
3345
3323
|
kind: this.federation.outboxQueue == null || options?.immediate ? SpanKind.CLIENT : SpanKind.PRODUCER,
|
|
3346
3324
|
attributes: { "activitypub.activity.type": this.activityType }
|
|
3347
3325
|
}, async (span) => {
|
|
@@ -3392,8 +3370,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
3392
3370
|
if (!hasSignature(this.activity)) {
|
|
3393
3371
|
let hasProof;
|
|
3394
3372
|
try {
|
|
3395
|
-
|
|
3396
|
-
hasProof = await activity.getProof() != null;
|
|
3373
|
+
hasProof = await (await Activity.fromJsonLd(this.activity, this)).getProof() != null;
|
|
3397
3374
|
} catch {
|
|
3398
3375
|
hasProof = false;
|
|
3399
3376
|
}
|
|
@@ -3471,8 +3448,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
3471
3448
|
const { outboxQueue } = this.federation;
|
|
3472
3449
|
if (outboxQueue.enqueueMany == null) {
|
|
3473
3450
|
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
3474
|
-
const
|
|
3475
|
-
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
3451
|
+
const errors = (await Promise.allSettled(promises)).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
3476
3452
|
if (errors.length > 0) {
|
|
3477
3453
|
logger$1.error("Failed to enqueue activity {activityId} to forward later:\n{errors}", {
|
|
3478
3454
|
activityId: this.activityId,
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
|
|
5
|
+
import "./transformers-ghwJuzGY.js";
|
|
6
|
+
import "./docloader-DJxET2fN.js";
|
|
7
|
+
import "./actor-GZRoTRqg.js";
|
|
8
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-DlDXugwZ.js";
|
|
9
|
+
import "./lookup-CSngxuWm.js";
|
|
10
|
+
import "./key-DmqJj57e.js";
|
|
11
|
+
import "./http-vqMAvOVs.js";
|
|
12
|
+
import "./proof-DlI7QNdn.js";
|
|
13
|
+
import "./types-CmVV9LT1.js";
|
|
14
|
+
import "./authdocloader-BopfyipD.js";
|
|
15
|
+
import "./vocab-BebR0kAy.js";
|
|
16
|
+
|
|
17
|
+
export { FederationImpl };
|
package/dist/mod.js
CHANGED
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./transformers-ghwJuzGY.js";
|
|
6
6
|
import "./compat-Bb5myD13.js";
|
|
7
|
-
import { FetchError, fetchDocumentLoader, getDocumentLoader, getUserAgent, kvCache } from "./docloader-
|
|
8
|
-
import { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, LanguageString, Leave, Like, Link, Listen, Mention, Move, Multikey, Note, Object as Object$1, Offer, OrderedCollection, OrderedCollectionPage, Organization, Page, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View, exportMultibaseKey, exportSpki, getActorClassByTypeName, getActorHandle, getActorTypeName, getTypeId, importMultibaseKey, importPem, importPkcs1, importSpki, isActor, normalizeActorHandle } from "./actor-
|
|
9
|
-
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "./middleware-
|
|
10
|
-
import { lookupWebFinger } from "./lookup-
|
|
11
|
-
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk } from "./key-
|
|
12
|
-
import { signRequest, verifyRequest } from "./http-
|
|
13
|
-
import { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, getKeyOwner, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "./proof-
|
|
14
|
-
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation-
|
|
15
|
-
import { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer } from "./types-
|
|
16
|
-
import { getAuthenticatedDocumentLoader } from "./authdocloader-
|
|
17
|
-
import { PUBLIC_COLLECTION, lookupObject, traverseCollection } from "./vocab-
|
|
7
|
+
import { FetchError, fetchDocumentLoader, getDocumentLoader, getUserAgent, kvCache } from "./docloader-DJxET2fN.js";
|
|
8
|
+
import { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, LanguageString, Leave, Like, Link, Listen, Mention, Move, Multikey, Note, Object as Object$1, Offer, OrderedCollection, OrderedCollectionPage, Organization, Page, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View, exportMultibaseKey, exportSpki, getActorClassByTypeName, getActorHandle, getActorTypeName, getTypeId, importMultibaseKey, importPem, importPkcs1, importSpki, isActor, normalizeActorHandle } from "./actor-GZRoTRqg.js";
|
|
9
|
+
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "./middleware-DlDXugwZ.js";
|
|
10
|
+
import { lookupWebFinger } from "./lookup-CSngxuWm.js";
|
|
11
|
+
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk } from "./key-DmqJj57e.js";
|
|
12
|
+
import { signRequest, verifyRequest } from "./http-vqMAvOVs.js";
|
|
13
|
+
import { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, getKeyOwner, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "./proof-DlI7QNdn.js";
|
|
14
|
+
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation-B0aljx0V.js";
|
|
15
|
+
import { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer } from "./types-CmVV9LT1.js";
|
|
16
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-BopfyipD.js";
|
|
17
|
+
import { PUBLIC_COLLECTION, lookupObject, traverseCollection } from "./vocab-BebR0kAy.js";
|
|
18
18
|
import "./nodeinfo-CyEbLjHs.js";
|
|
19
19
|
import "./runtime-BSkOVUWM.js";
|
|
20
20
|
import "./sig-BXJO--F9.js";
|
|
@@ -299,8 +299,7 @@ function decode(data) {
|
|
|
299
299
|
"k",
|
|
300
300
|
"K"
|
|
301
301
|
].includes(prefix)) data = data.toLowerCase();
|
|
302
|
-
|
|
303
|
-
return enc.decode(data.substring(1));
|
|
302
|
+
return encoding(data[0]).decode(data.substring(1));
|
|
304
303
|
}
|
|
305
304
|
/**
|
|
306
305
|
* Get the encoding by name or code
|