@fedify/fedify 1.6.10 → 1.6.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-zJITiLGT.js → actor-7vCpWIGd.js} +1059 -2276
- package/dist/{actor-DIUXw3Jf.js → actor-BxaCJsn8.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-r__VtsYF.js → authdocloader-CVhMTbv4.js} +4 -4
- package/dist/{authdocloader-BcwoX8r4.js → authdocloader-niAJMnCQ.js} +3 -3
- package/dist/{builder-ec-rmcfn.js → builder-DboGa9iv.js} +7 -10
- package/dist/{chunk-HsBuZ-b2.js → chunk-Cx8LTkjm.js} +3 -1
- package/dist/{client-Ct6EJXY4.js → client-De_5-2EG.js} +6 -6
- package/dist/compat/transformers.test.js +27 -28
- package/dist/{context-B51aFJ33.js → context-KOy1fHBn.js} +2 -2
- package/dist/{docloader-Bk8yyKtx.js → docloader-CPBLJsVK.js} +4 -6
- package/dist/{docloader-D4xNpZfb.js → docloader-RFcxdgI8.js} +5 -9
- package/dist/{esm-Db4De7AS.js → esm-DO9PrujO.js} +23 -34
- package/dist/federation/builder.test.js +20 -23
- 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 +53 -68
- 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-3B6BDKCK.js → federation-DyRlaC4X.js} +1 -2
- package/dist/{http-BqI8l_zq.js → http-B__WhFrv.js} +8 -15
- package/dist/{http-BjXvFars.js → http-CnSGudcE.js} +8 -15
- package/dist/{inbox-BVf3oh4Y.js → inbox-L4MTtAQ4.js} +5 -7
- package/dist/{key-C_PfBuZC.js → key-BG_CTepE.js} +4 -4
- package/dist/{key-avTzmEfO.js → key-BQg3A7eo.js} +5 -8
- package/dist/key-CeY-eted.js +16 -0
- package/dist/{key-D_WrdfTP.js → key-Dlbuqhbr.js} +6 -9
- package/dist/{keycache-GLblHhov.js → keycache-BEb0DSk7.js} +2 -2
- package/dist/{keys-DDHFsLa-.js → keys-CqpeF-EG.js} +1 -1
- package/dist/{ld-yhnqjt2k.js → ld-45SsuOmB.js} +9 -16
- package/dist/{lookup-CIYoashs.js → lookup-CWdbkwKD.js} +7 -11
- package/dist/{lookup-Czw5r0oM.js → lookup-CdHTw-tQ.js} +2 -4
- package/dist/{lookup-CCdJ24ZP.js → lookup-HY083HcK.js} +3 -5
- package/dist/middleware-BP-XbRGC.js +17 -0
- package/dist/{middleware-C69vl3qG.js → middleware-Cg-eSyqX.js} +34 -58
- package/dist/{middleware-C9Y127V3.js → middleware-D2HU0DhQ.js} +34 -52
- package/dist/middleware-JoLpCiMC.js +33 -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-CqOZVri-.js → owner-BYxqeMiw.js} +3 -3
- package/dist/{proof-BYiV2_yo.js → proof-BjHA4H_1.js} +8 -14
- package/dist/{proof-BpBPpfw4.js → proof-DVYup76O.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-B7cv9i7f.js → send-BQA1p7vs.js} +3 -4
- package/dist/sig/http.test.js +39 -53
- 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-sw4Fdy78.js → types-D7_MRRa4.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 +68 -49
- package/dist/{vocab-CcGSU3Wf.js → vocab-DVEzP_bQ.js} +1057 -2270
- package/dist/{vocab-BT10fLiU.js → vocab-aaGb1Tji.js} +6 -10
- 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-C0_lA6sj.js +0 -16
- package/dist/middleware-BZY7OuAu.js +0 -17
- package/dist/middleware-CcsOhLqv.js +0 -33
|
@@ -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-RFcxdgI8.js";
|
|
7
|
+
import { Activity, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-7vCpWIGd.js";
|
|
8
|
+
import { lookupWebFinger } from "./lookup-CdHTw-tQ.js";
|
|
9
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-BQg3A7eo.js";
|
|
10
|
+
import { doubleKnock, verifyRequest } from "./http-B__WhFrv.js";
|
|
11
|
+
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-DVYup76O.js";
|
|
12
|
+
import { getNodeInfo, nodeInfoToJson } from "./types-D7_MRRa4.js";
|
|
13
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-niAJMnCQ.js";
|
|
14
|
+
import { lookupObject, traverseCollection } from "./vocab-aaGb1Tji.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-BP-XbRGC.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) => {
|
|
@@ -1962,12 +1950,11 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1962
1950
|
});
|
|
1963
1951
|
}
|
|
1964
1952
|
async #listenFanoutMessage(data, message) {
|
|
1965
|
-
|
|
1953
|
+
getLogger([
|
|
1966
1954
|
"fedify",
|
|
1967
1955
|
"federation",
|
|
1968
1956
|
"fanout"
|
|
1969
|
-
])
|
|
1970
|
-
logger$1.debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
|
|
1957
|
+
]).debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
|
|
1971
1958
|
activityId: message.activityId,
|
|
1972
1959
|
inboxes: globalThis.Object.keys(message.inboxes).length
|
|
1973
1960
|
});
|
|
@@ -2093,8 +2080,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2093
2080
|
activity.id.href
|
|
2094
2081
|
];
|
|
2095
2082
|
if (cacheKey != null) {
|
|
2096
|
-
|
|
2097
|
-
if (cached === true) {
|
|
2083
|
+
if (await this.kv.get(cacheKey) === true) {
|
|
2098
2084
|
logger$1.debug("Activity {activityId} has already been processed.", {
|
|
2099
2085
|
activityId: activity.id?.href,
|
|
2100
2086
|
activity: message.activity,
|
|
@@ -2327,8 +2313,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2327
2313
|
const { outboxQueue } = this;
|
|
2328
2314
|
if (outboxQueue.enqueueMany == null) {
|
|
2329
2315
|
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
2330
|
-
const
|
|
2331
|
-
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2316
|
+
const errors = (await Promise.allSettled(promises)).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2332
2317
|
if (errors.length > 0) {
|
|
2333
2318
|
logger$1.error("Failed to enqueue activity {activityId} to send later: {errors}", {
|
|
2334
2319
|
activityId: activity.id.href,
|
|
@@ -2727,7 +2712,6 @@ var ContextImpl = class ContextImpl {
|
|
|
2727
2712
|
identifier: void 0,
|
|
2728
2713
|
get handle() {
|
|
2729
2714
|
logger$1.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
2730
|
-
return void 0;
|
|
2731
2715
|
}
|
|
2732
2716
|
};
|
|
2733
2717
|
const identifier = "identifier" in route.values ? route.values.identifier : route.values.handle;
|
|
@@ -2910,8 +2894,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2910
2894
|
} else identifierPromise = Promise.resolve(identity.identifier);
|
|
2911
2895
|
return identifierPromise.then((identifier) => {
|
|
2912
2896
|
if (identifier == null) return this.documentLoader;
|
|
2913
|
-
|
|
2914
|
-
return keyPair.then((pair) => pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair));
|
|
2897
|
+
return this.getRsaKeyPairFromIdentifier(identifier).then((pair) => pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair));
|
|
2915
2898
|
});
|
|
2916
2899
|
}
|
|
2917
2900
|
return this.federation.authenticatedDocumentLoaderFactory(identity);
|
|
@@ -2953,8 +2936,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2953
2936
|
});
|
|
2954
2937
|
}
|
|
2955
2938
|
sendActivity(sender, recipients, activity, options = {}) {
|
|
2956
|
-
|
|
2957
|
-
return tracer.startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
|
2939
|
+
return this.tracerProvider.getTracer(deno_default.name, deno_default.version).startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
|
2958
2940
|
kind: this.federation.outboxQueue == null || options.immediate ? SpanKind.CLIENT : SpanKind.PRODUCER,
|
|
2959
2941
|
attributes: {
|
|
2960
2942
|
"activitypub.activity.type": getTypeId(activity).href,
|
|
@@ -3099,9 +3081,7 @@ var ContextImpl = class ContextImpl {
|
|
|
3099
3081
|
}
|
|
3100
3082
|
}
|
|
3101
3083
|
routeActivity(recipient, activity, options = {}) {
|
|
3102
|
-
|
|
3103
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
3104
|
-
return tracer.startActiveSpan("activitypub.inbox", {
|
|
3084
|
+
return (this.tracerProvider ?? this.tracerProvider).getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.inbox", {
|
|
3105
3085
|
kind: this.federation.inboxQueue == null || options.immediate ? SpanKind.INTERNAL : SpanKind.PRODUCER,
|
|
3106
3086
|
attributes: { "activitypub.activity.type": getTypeId(activity).href }
|
|
3107
3087
|
}, async (span) => {
|
|
@@ -3137,13 +3117,12 @@ var ContextImpl = class ContextImpl {
|
|
|
3137
3117
|
const contextLoader = options.contextLoader ?? this.contextLoader;
|
|
3138
3118
|
const json = await activity.toJsonLd({ contextLoader });
|
|
3139
3119
|
const keyCache = new KvKeyCache(this.federation.kv, this.federation.kvPrefixes.publicKey, this);
|
|
3140
|
-
|
|
3120
|
+
if (await verifyObject(Activity, json, {
|
|
3141
3121
|
contextLoader,
|
|
3142
3122
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
3143
3123
|
tracerProvider: options.tracerProvider ?? this.tracerProvider,
|
|
3144
3124
|
keyCache
|
|
3145
|
-
})
|
|
3146
|
-
if (verified == null) {
|
|
3125
|
+
}) == null) {
|
|
3147
3126
|
logger$1.debug("Object Integrity Proofs are not verified.", {
|
|
3148
3127
|
recipient,
|
|
3149
3128
|
activity: json
|
|
@@ -3317,8 +3296,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
3317
3296
|
});
|
|
3318
3297
|
}
|
|
3319
3298
|
forwardActivity(forwarder, recipients, options) {
|
|
3320
|
-
|
|
3321
|
-
return tracer.startActiveSpan("activitypub.outbox", {
|
|
3299
|
+
return this.tracerProvider.getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.outbox", {
|
|
3322
3300
|
kind: this.federation.outboxQueue == null || options?.immediate ? SpanKind.CLIENT : SpanKind.PRODUCER,
|
|
3323
3301
|
attributes: { "activitypub.activity.type": this.activityType }
|
|
3324
3302
|
}, async (span) => {
|
|
@@ -3369,8 +3347,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
3369
3347
|
if (!hasSignature(this.activity)) {
|
|
3370
3348
|
let hasProof;
|
|
3371
3349
|
try {
|
|
3372
|
-
|
|
3373
|
-
hasProof = await activity.getProof() != null;
|
|
3350
|
+
hasProof = await (await Activity.fromJsonLd(this.activity, this)).getProof() != null;
|
|
3374
3351
|
} catch {
|
|
3375
3352
|
hasProof = false;
|
|
3376
3353
|
}
|
|
@@ -3448,8 +3425,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
3448
3425
|
const { outboxQueue } = this.federation;
|
|
3449
3426
|
if (outboxQueue.enqueueMany == null) {
|
|
3450
3427
|
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
3451
|
-
const
|
|
3452
|
-
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
3428
|
+
const errors = (await Promise.allSettled(promises)).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
3453
3429
|
if (errors.length > 0) {
|
|
3454
3430
|
logger$1.error("Failed to enqueue activity {activityId} to forward later:\n{errors}", {
|
|
3455
3431
|
activityId: this.activityId,
|
|
@@ -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-CPBLJsVK.js";
|
|
7
|
+
import { getNodeInfo } from "./client-De_5-2EG.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-DVEzP_bQ.js";
|
|
11
|
+
import { lookupWebFinger } from "./lookup-HY083HcK.js";
|
|
12
|
+
import { getTypeId } from "./type-CFuiGLz9.js";
|
|
13
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-Dlbuqhbr.js";
|
|
14
|
+
import { verifyRequest } from "./http-CnSGudcE.js";
|
|
15
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-CVhMTbv4.js";
|
|
16
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-45SsuOmB.js";
|
|
17
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-BYxqeMiw.js";
|
|
18
|
+
import { signObject, verifyObject } from "./proof-BjHA4H_1.js";
|
|
19
|
+
import { lookupObject, traverseCollection } from "./lookup-CWdbkwKD.js";
|
|
20
|
+
import { routeActivity } from "./inbox-L4MTtAQ4.js";
|
|
21
|
+
import { FederationBuilderImpl } from "./builder-DboGa9iv.js";
|
|
22
22
|
import { buildCollectionSynchronizationHeader } from "./collection-Dfb0TPno.js";
|
|
23
|
-
import { KvKeyCache } from "./keycache-
|
|
23
|
+
import { KvKeyCache } from "./keycache-BEb0DSk7.js";
|
|
24
24
|
import { createExponentialBackoffPolicy } from "./retry-BiIhZWgD.js";
|
|
25
|
-
import { extractInboxes, sendActivity } from "./send-
|
|
25
|
+
import { extractInboxes, sendActivity } from "./send-BQA1p7vs.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
|
}
|
|
@@ -1097,12 +1091,11 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1097
1091
|
});
|
|
1098
1092
|
}
|
|
1099
1093
|
async #listenFanoutMessage(data, message) {
|
|
1100
|
-
|
|
1094
|
+
getLogger([
|
|
1101
1095
|
"fedify",
|
|
1102
1096
|
"federation",
|
|
1103
1097
|
"fanout"
|
|
1104
|
-
])
|
|
1105
|
-
logger$2.debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
|
|
1098
|
+
]).debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
|
|
1106
1099
|
activityId: message.activityId,
|
|
1107
1100
|
inboxes: globalThis.Object.keys(message.inboxes).length
|
|
1108
1101
|
});
|
|
@@ -1228,8 +1221,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1228
1221
|
activity.id.href
|
|
1229
1222
|
];
|
|
1230
1223
|
if (cacheKey != null) {
|
|
1231
|
-
|
|
1232
|
-
if (cached === true) {
|
|
1224
|
+
if (await this.kv.get(cacheKey) === true) {
|
|
1233
1225
|
logger$2.debug("Activity {activityId} has already been processed.", {
|
|
1234
1226
|
activityId: activity.id?.href,
|
|
1235
1227
|
activity: message.activity,
|
|
@@ -1462,8 +1454,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1462
1454
|
const { outboxQueue } = this;
|
|
1463
1455
|
if (outboxQueue.enqueueMany == null) {
|
|
1464
1456
|
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
1465
|
-
const
|
|
1466
|
-
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
1457
|
+
const errors = (await Promise.allSettled(promises)).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
1467
1458
|
if (errors.length > 0) {
|
|
1468
1459
|
logger$2.error("Failed to enqueue activity {activityId} to send later: {errors}", {
|
|
1469
1460
|
activityId: activity.id.href,
|
|
@@ -1862,7 +1853,6 @@ var ContextImpl = class ContextImpl {
|
|
|
1862
1853
|
identifier: void 0,
|
|
1863
1854
|
get handle() {
|
|
1864
1855
|
logger$2.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
1865
|
-
return void 0;
|
|
1866
1856
|
}
|
|
1867
1857
|
};
|
|
1868
1858
|
const identifier = "identifier" in route.values ? route.values.identifier : route.values.handle;
|
|
@@ -2045,8 +2035,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2045
2035
|
} else identifierPromise = Promise.resolve(identity.identifier);
|
|
2046
2036
|
return identifierPromise.then((identifier) => {
|
|
2047
2037
|
if (identifier == null) return this.documentLoader;
|
|
2048
|
-
|
|
2049
|
-
return keyPair.then((pair) => pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair));
|
|
2038
|
+
return this.getRsaKeyPairFromIdentifier(identifier).then((pair) => pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair));
|
|
2050
2039
|
});
|
|
2051
2040
|
}
|
|
2052
2041
|
return this.federation.authenticatedDocumentLoaderFactory(identity);
|
|
@@ -2088,8 +2077,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2088
2077
|
});
|
|
2089
2078
|
}
|
|
2090
2079
|
sendActivity(sender, recipients, activity, options = {}) {
|
|
2091
|
-
|
|
2092
|
-
return tracer.startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
|
2080
|
+
return this.tracerProvider.getTracer(deno_default.name, deno_default.version).startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
|
2093
2081
|
kind: this.federation.outboxQueue == null || options.immediate ? SpanKind.CLIENT : SpanKind.PRODUCER,
|
|
2094
2082
|
attributes: {
|
|
2095
2083
|
"activitypub.activity.type": getTypeId(activity).href,
|
|
@@ -2234,9 +2222,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2234
2222
|
}
|
|
2235
2223
|
}
|
|
2236
2224
|
routeActivity(recipient, activity, options = {}) {
|
|
2237
|
-
|
|
2238
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
2239
|
-
return tracer.startActiveSpan("activitypub.inbox", {
|
|
2225
|
+
return (this.tracerProvider ?? this.tracerProvider).getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.inbox", {
|
|
2240
2226
|
kind: this.federation.inboxQueue == null || options.immediate ? SpanKind.INTERNAL : SpanKind.PRODUCER,
|
|
2241
2227
|
attributes: { "activitypub.activity.type": getTypeId(activity).href }
|
|
2242
2228
|
}, async (span) => {
|
|
@@ -2272,13 +2258,12 @@ var ContextImpl = class ContextImpl {
|
|
|
2272
2258
|
const contextLoader = options.contextLoader ?? this.contextLoader;
|
|
2273
2259
|
const json = await activity.toJsonLd({ contextLoader });
|
|
2274
2260
|
const keyCache = new KvKeyCache(this.federation.kv, this.federation.kvPrefixes.publicKey, this);
|
|
2275
|
-
|
|
2261
|
+
if (await verifyObject(Activity, json, {
|
|
2276
2262
|
contextLoader,
|
|
2277
2263
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
2278
2264
|
tracerProvider: options.tracerProvider ?? this.tracerProvider,
|
|
2279
2265
|
keyCache
|
|
2280
|
-
})
|
|
2281
|
-
if (verified == null) {
|
|
2266
|
+
}) == null) {
|
|
2282
2267
|
logger$2.debug("Object Integrity Proofs are not verified.", {
|
|
2283
2268
|
recipient,
|
|
2284
2269
|
activity: json
|
|
@@ -2452,8 +2437,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
2452
2437
|
});
|
|
2453
2438
|
}
|
|
2454
2439
|
forwardActivity(forwarder, recipients, options) {
|
|
2455
|
-
|
|
2456
|
-
return tracer.startActiveSpan("activitypub.outbox", {
|
|
2440
|
+
return this.tracerProvider.getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.outbox", {
|
|
2457
2441
|
kind: this.federation.outboxQueue == null || options?.immediate ? SpanKind.CLIENT : SpanKind.PRODUCER,
|
|
2458
2442
|
attributes: { "activitypub.activity.type": this.activityType }
|
|
2459
2443
|
}, async (span) => {
|
|
@@ -2504,8 +2488,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
2504
2488
|
if (!hasSignature(this.activity)) {
|
|
2505
2489
|
let hasProof;
|
|
2506
2490
|
try {
|
|
2507
|
-
|
|
2508
|
-
hasProof = await activity.getProof() != null;
|
|
2491
|
+
hasProof = await (await Activity.fromJsonLd(this.activity, this)).getProof() != null;
|
|
2509
2492
|
} catch {
|
|
2510
2493
|
hasProof = false;
|
|
2511
2494
|
}
|
|
@@ -2583,8 +2566,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
2583
2566
|
const { outboxQueue } = this.federation;
|
|
2584
2567
|
if (outboxQueue.enqueueMany == null) {
|
|
2585
2568
|
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
2586
|
-
const
|
|
2587
|
-
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2569
|
+
const errors = (await Promise.allSettled(promises)).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2588
2570
|
if (errors.length > 0) {
|
|
2589
2571
|
logger$2.error("Failed to enqueue activity {activityId} to forward later:\n{errors}", {
|
|
2590
2572
|
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-D2HU0DhQ.js";
|
|
7
|
+
import "./docloader-CPBLJsVK.js";
|
|
8
|
+
import "./url-C2xuoQD1.js";
|
|
9
|
+
import "./semver-BNrOOAs9.js";
|
|
10
|
+
import "./client-De_5-2EG.js";
|
|
11
|
+
import "./router-D_aVZZUc.js";
|
|
12
|
+
import "./types-CJHS5pXl.js";
|
|
13
|
+
import "./multibase-CnLHszip.js";
|
|
14
|
+
import "./vocab-DVEzP_bQ.js";
|
|
15
|
+
import "./langstr-DbWheeIS.js";
|
|
16
|
+
import "./lookup-HY083HcK.js";
|
|
17
|
+
import "./type-CFuiGLz9.js";
|
|
18
|
+
import "./actor-BxaCJsn8.js";
|
|
19
|
+
import "./key-Dlbuqhbr.js";
|
|
20
|
+
import "./http-CnSGudcE.js";
|
|
21
|
+
import "./authdocloader-CVhMTbv4.js";
|
|
22
|
+
import "./ld-45SsuOmB.js";
|
|
23
|
+
import "./owner-BYxqeMiw.js";
|
|
24
|
+
import "./proof-BjHA4H_1.js";
|
|
25
|
+
import "./lookup-CWdbkwKD.js";
|
|
26
|
+
import "./inbox-L4MTtAQ4.js";
|
|
27
|
+
import "./builder-DboGa9iv.js";
|
|
28
|
+
import "./collection-Dfb0TPno.js";
|
|
29
|
+
import "./keycache-BEb0DSk7.js";
|
|
30
|
+
import "./retry-BiIhZWgD.js";
|
|
31
|
+
import "./send-BQA1p7vs.js";
|
|
32
|
+
|
|
33
|
+
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-RFcxdgI8.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-7vCpWIGd.js";
|
|
9
|
+
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "./middleware-Cg-eSyqX.js";
|
|
10
|
+
import { lookupWebFinger } from "./lookup-CdHTw-tQ.js";
|
|
11
|
+
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk } from "./key-BQg3A7eo.js";
|
|
12
|
+
import { signRequest, verifyRequest } from "./http-B__WhFrv.js";
|
|
13
|
+
import { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, getKeyOwner, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "./proof-DVYup76O.js";
|
|
14
|
+
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation-DyRlaC4X.js";
|
|
15
|
+
import { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer } from "./types-D7_MRRa4.js";
|
|
16
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-niAJMnCQ.js";
|
|
17
|
+
import { PUBLIC_COLLECTION, lookupObject, traverseCollection } from "./vocab-aaGb1Tji.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
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { assertEquals } from "../assert_equals-
|
|
7
|
-
import "../assert-
|
|
8
|
-
import "../assert_instance_of-
|
|
9
|
-
import "../docloader-
|
|
10
|
-
import "../url-
|
|
11
|
-
import "../semver-
|
|
12
|
-
import { getNodeInfo, parseInboundService, parseNodeInfo, parseOutboundService, parseProtocol, parseServices, parseSoftware, parseUsage } from "../client-
|
|
13
|
-
import { test } from "../testing-
|
|
14
|
-
import "../std__assert-
|
|
15
|
-
import "../assert_rejects-
|
|
16
|
-
import "../assert_is_error-
|
|
17
|
-
import "../assert_not_equals-
|
|
18
|
-
import "../assert_throws-
|
|
19
|
-
import { esm_default } from "../esm-
|
|
6
|
+
import { assertEquals } from "../assert_equals-B44MxcIj.js";
|
|
7
|
+
import "../assert-LOEeCUK5.js";
|
|
8
|
+
import "../assert_instance_of-XtuFevV_.js";
|
|
9
|
+
import "../docloader-CPBLJsVK.js";
|
|
10
|
+
import "../url-C2xuoQD1.js";
|
|
11
|
+
import "../semver-BNrOOAs9.js";
|
|
12
|
+
import { getNodeInfo, parseInboundService, parseNodeInfo, parseOutboundService, parseProtocol, parseServices, parseSoftware, parseUsage } from "../client-De_5-2EG.js";
|
|
13
|
+
import { test } from "../testing-DLyvtiiW.js";
|
|
14
|
+
import "../std__assert-o_r9vqm1.js";
|
|
15
|
+
import "../assert_rejects-DWQ4jaf9.js";
|
|
16
|
+
import "../assert_is_error-BTlryvT0.js";
|
|
17
|
+
import "../assert_not_equals-C685gKx6.js";
|
|
18
|
+
import "../assert_throws-YetpVSc-.js";
|
|
19
|
+
import { esm_default } from "../esm-DO9PrujO.js";
|
|
20
20
|
|
|
21
21
|
//#region nodeinfo/client.test.ts
|
|
22
22
|
test("getNodeInfo()", async (t) => {
|
|
@@ -446,7 +446,7 @@ test("parseSoftware()", () => {
|
|
|
446
446
|
});
|
|
447
447
|
});
|
|
448
448
|
test("parseProtocol()", () => {
|
|
449
|
-
const
|
|
449
|
+
for (const protocol of [
|
|
450
450
|
"activitypub",
|
|
451
451
|
"buddycloud",
|
|
452
452
|
"dfrn",
|
|
@@ -457,8 +457,7 @@ test("parseProtocol()", () => {
|
|
|
457
457
|
"tent",
|
|
458
458
|
"xmpp",
|
|
459
459
|
"zot"
|
|
460
|
-
];
|
|
461
|
-
for (const protocol of protocols) assertEquals(parseProtocol(protocol), protocol);
|
|
460
|
+
]) assertEquals(parseProtocol(protocol), protocol);
|
|
462
461
|
assertEquals(parseProtocol("foo"), null);
|
|
463
462
|
});
|
|
464
463
|
test("parseServices()", () => {
|
|
@@ -559,7 +558,7 @@ test("parseServices()", () => {
|
|
|
559
558
|
});
|
|
560
559
|
});
|
|
561
560
|
test("parseInboundService()", () => {
|
|
562
|
-
const
|
|
561
|
+
for (const service of [
|
|
563
562
|
"atom1.0",
|
|
564
563
|
"gnusocial",
|
|
565
564
|
"imap",
|
|
@@ -568,12 +567,11 @@ test("parseInboundService()", () => {
|
|
|
568
567
|
"pumpio",
|
|
569
568
|
"rss2.0",
|
|
570
569
|
"twitter"
|
|
571
|
-
];
|
|
572
|
-
for (const service of services) assertEquals(parseInboundService(service), service);
|
|
570
|
+
]) assertEquals(parseInboundService(service), service);
|
|
573
571
|
assertEquals(parseInboundService("foo"), null);
|
|
574
572
|
});
|
|
575
573
|
test("parseOutboundService()", () => {
|
|
576
|
-
const
|
|
574
|
+
for (const service of [
|
|
577
575
|
"atom1.0",
|
|
578
576
|
"blogger",
|
|
579
577
|
"buddycloud",
|
|
@@ -602,8 +600,7 @@ test("parseOutboundService()", () => {
|
|
|
602
600
|
"twitter",
|
|
603
601
|
"wordpress",
|
|
604
602
|
"xmpp"
|
|
605
|
-
];
|
|
606
|
-
for (const service of services) assertEquals(parseOutboundService(service), service);
|
|
603
|
+
]) assertEquals(parseOutboundService(service), service);
|
|
607
604
|
assertEquals(parseOutboundService("foo"), null);
|
|
608
605
|
});
|
|
609
606
|
test("parseUsage()", () => {
|