@fedify/fedify 2.4.0-dev.2219 → 2.4.0-dev.2233
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/{builder-C5rYBZ16.mjs → builder-BmoDmjWk.mjs} +2 -2
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-D0xY7MBs.mjs → compound-proof-Pn8766TV.mjs} +2 -2
- package/dist/{deno-Dj1TFhf4.mjs → deno-62DcBMwc.mjs} +1 -1
- package/dist/{docloader-CzyJe90o.mjs → docloader-Be9TaKa_.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +3 -3
- package/dist/federation/handler-compound-proof.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +73 -6
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +7 -7
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.js +1 -1
- package/dist/federation/outgoing-proof.test.mjs +248 -6
- package/dist/federation/portable-actor.test.mjs +3 -3
- package/dist/federation/portable-chain.test.mjs +3 -3
- package/dist/federation/portable-collection.test.mjs +4 -4
- package/dist/federation/portable-delivery.test.mjs +2 -2
- package/dist/federation/portable-gateway-keys.test.mjs +4 -4
- package/dist/federation/portable-inbox.test.mjs +4 -4
- package/dist/federation/portable-parse-uri.test.mjs +1 -1
- package/dist/federation/portable-route-activity.test.mjs +2 -2
- package/dist/federation/portable.test.mjs +80 -3
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/tasks/enqueue.test.mjs +1 -1
- package/dist/federation/tasks/tasks.test.mjs +2 -2
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-DC1yfb-8.cjs → federation-BVkPF8vF.cjs} +246 -31
- package/dist/{http-Cuk0w0rp.cjs → http-BbDZCEnR.cjs} +1 -1
- package/dist/{http-Dx7yMmfw.js → http-D4JQwy-3.js} +1 -1
- package/dist/{http-D-DpP4sd.mjs → http-SIEv_YGW.mjs} +4 -4
- package/dist/{key-Djyt1BFx.mjs → key-CtAhsSFI.mjs} +2 -2
- package/dist/{kv-cache-CUZOCSKZ.js → kv-cache-DXFAaMh2.js} +1 -1
- package/dist/{kv-cache-BmLTVLXc.cjs → kv-cache-DxLtK3Np.cjs} +1 -1
- package/dist/{kv-cache-ecUXfCqW.mjs → kv-cache-Fn7dxiMu.mjs} +1 -1
- package/dist/{ld-CNVWdooi.mjs → ld-BuI0RakW.mjs} +3 -3
- package/dist/{metrics-BnYleVpg.mjs → metrics-jr7IbGjd.mjs} +1 -1
- package/dist/{middleware-Bh592bk8.mjs → middleware-BWhRFmO0.mjs} +1 -1
- package/dist/{middleware-C2_LcbL3.mjs → middleware-BhtaUtlt.mjs} +243 -28
- package/dist/{middleware-BdzcazaN.js → middleware-D0t1NBIE.js} +246 -31
- package/dist/mod.cjs +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-D_BDPwm2.mjs → owner-CoNYVTQp.mjs} +3 -3
- package/dist/{portable-collection-hcONGyUs.mjs → portable-collection-CxP30PWK.mjs} +2 -2
- package/dist/{portable-collection-DwJ8YJP2.cjs → portable-collection-FLEUNFj5.cjs} +1 -1
- package/dist/{portable-collection-C0c0rUN9.js → portable-collection-ZczKiIeK.js} +1 -1
- package/dist/{portable-key-B880yVlC.mjs → portable-key-90Ux6h7F.mjs} +1 -1
- package/dist/{proof-z6Prgi5I.mjs → proof-Bhsb_KYD.mjs} +4 -4
- package/dist/{send-Cw545L_2.mjs → send-CdRJj10a.mjs} +3 -3
- package/dist/sig/compound-proof-discovery.test.mjs +1 -1
- package/dist/sig/compound-proof-producer.test.mjs +1 -1
- package/dist/sig/compound-proof-verification.test.mjs +2 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/portable-collection.test.mjs +1 -1
- package/dist/sig/portable-key.test.mjs +6 -6
- package/dist/sig/proof.test.mjs +5 -3
- package/dist/{temporal-Cy-8WCod.mjs → temporal-vBRC6bwu.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +7 -7
|
@@ -8,11 +8,11 @@ import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
|
|
|
8
8
|
import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
9
9
|
import "../std__assert-DvMDRPes.mjs";
|
|
10
10
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
11
|
-
import { p as signJsonLd } from "../ld-
|
|
12
|
-
import { a as signObject } from "../proof-
|
|
13
|
-
import { l as signRequest, p as verifyRequestDetailed } from "../http-
|
|
11
|
+
import { p as signJsonLd } from "../ld-BuI0RakW.mjs";
|
|
12
|
+
import { a as signObject } from "../proof-Bhsb_KYD.mjs";
|
|
13
|
+
import { l as signRequest, p as verifyRequestDetailed } from "../http-SIEv_YGW.mjs";
|
|
14
14
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
15
|
-
import { _ as coversDelivery, o as createFederation, v as forwardPortableInboxActivity, y as resolvePortableInboxForwardingOptions } from "../middleware-
|
|
15
|
+
import { _ as coversDelivery, o as createFederation, v as forwardPortableInboxActivity, y as resolvePortableInboxForwardingOptions } from "../middleware-BhtaUtlt.mjs";
|
|
16
16
|
import { Create, CryptographicKey, Follow, Note, Person, Tombstone } from "@fedify/vocab";
|
|
17
17
|
import { exportDidKey, formatIri, parseIri } from "@fedify/vocab-runtime";
|
|
18
18
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -7,7 +7,7 @@ import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
|
|
|
7
7
|
import "../std__assert-DvMDRPes.mjs";
|
|
8
8
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
9
9
|
import { r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
|
|
10
|
-
import { o as createFederation } from "../middleware-
|
|
10
|
+
import { o as createFederation } from "../middleware-BhtaUtlt.mjs";
|
|
11
11
|
import { Note, Object as Object$1, Person } from "@fedify/vocab";
|
|
12
12
|
import { exportDidKey, parseIri } from "@fedify/vocab-runtime";
|
|
13
13
|
import { test } from "@fedify/fixture";
|
|
@@ -6,9 +6,9 @@ import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
|
6
6
|
import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
|
|
7
7
|
import "../std__assert-DvMDRPes.mjs";
|
|
8
8
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
9
|
-
import { a as signObject } from "../proof-
|
|
9
|
+
import { a as signObject } from "../proof-Bhsb_KYD.mjs";
|
|
10
10
|
import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
|
|
11
|
-
import { o as createFederation } from "../middleware-
|
|
11
|
+
import { o as createFederation } from "../middleware-BhtaUtlt.mjs";
|
|
12
12
|
import { Create, Note } from "@fedify/vocab";
|
|
13
13
|
import { exportDidKey, formatIri, parseIri, toCompatibleEf61Id } from "@fedify/vocab-runtime";
|
|
14
14
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -8,10 +8,10 @@ import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
|
8
8
|
import "../std__assert-DvMDRPes.mjs";
|
|
9
9
|
import { t as assertStrictEquals } from "../assert_strict_equals-CYvBmkpC.mjs";
|
|
10
10
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
11
|
-
import { a as signObject, c as verifyPortableObjectProof } from "../proof-
|
|
12
|
-
import { l as signRequest } from "../http-
|
|
11
|
+
import { a as signObject, c as verifyPortableObjectProof } from "../proof-Bhsb_KYD.mjs";
|
|
12
|
+
import { l as signRequest } from "../http-SIEv_YGW.mjs";
|
|
13
13
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
14
|
-
import { b as PORTABLE_OBJECT_CONTENT_TYPE, o as createFederation } from "../middleware-
|
|
14
|
+
import { b as PORTABLE_OBJECT_CONTENT_TYPE, o as createFederation } from "../middleware-BhtaUtlt.mjs";
|
|
15
15
|
import { configure, reset } from "@logtape/logtape";
|
|
16
16
|
import { Collection, Create, Note, Object as Object$1, PUBLIC_COLLECTION, Person, Tombstone, lookupObject } from "@fedify/vocab";
|
|
17
17
|
import { exportDidKey, formatIri, parseIri, toCompatibleEf61Id } from "@fedify/vocab-runtime";
|
|
@@ -865,6 +865,83 @@ async function captureWarnings(run) {
|
|
|
865
865
|
}
|
|
866
866
|
return records.filter((record) => record.category[0] === "fedify");
|
|
867
867
|
}
|
|
868
|
+
test("object responses warn about compatible IDs off the owner's first gateway", async () => {
|
|
869
|
+
const federation = createTestFederation();
|
|
870
|
+
const ownerId = parseIri(`ap://${did}/users/alice`);
|
|
871
|
+
const gateways = [new URL("https://primary.example"), new URL("https://secondary.example")];
|
|
872
|
+
const secondary = await sign(new Note({
|
|
873
|
+
id: toCompatibleEf61Id(parseIri(`ap://${did}/notes/secondary`), gateways[1]),
|
|
874
|
+
attribution: ownerId,
|
|
875
|
+
to: PUBLIC_COLLECTION,
|
|
876
|
+
content: "Hello"
|
|
877
|
+
}));
|
|
878
|
+
let actorCalls = 0;
|
|
879
|
+
let actorLookupFails = false;
|
|
880
|
+
federation.setActorDispatcher("/users/{identifier}", (_ctx, identifier) => {
|
|
881
|
+
actorCalls++;
|
|
882
|
+
if (actorLookupFails) throw new Error("Actor storage unavailable");
|
|
883
|
+
return identifier === "alice" ? new Person({
|
|
884
|
+
id: ownerId,
|
|
885
|
+
gateways
|
|
886
|
+
}) : null;
|
|
887
|
+
});
|
|
888
|
+
federation.setObjectDispatcher(Note, "/notes/{id}", async (_ctx, values) => {
|
|
889
|
+
if (values.id === "secondary") return secondary;
|
|
890
|
+
const note = new Note({
|
|
891
|
+
id: values.id === "portable" ? parseIri(`ap://${did}/notes/portable`) : values.id === "ordinary" ? new URL("https://example.com/notes/ordinary") : toCompatibleEf61Id(parseIri(`ap://${did}/notes/${values.id}`), values.id === "secondary" || values.id === "retained" ? gateways[1] : gateways[0]),
|
|
892
|
+
attribution: ownerId,
|
|
893
|
+
to: PUBLIC_COLLECTION,
|
|
894
|
+
content: "Hello"
|
|
895
|
+
});
|
|
896
|
+
if (values.id === "retained") {
|
|
897
|
+
const raw = await (await sign(note)).toJsonLd({
|
|
898
|
+
format: "compact",
|
|
899
|
+
contextLoader: mockDocumentLoader
|
|
900
|
+
});
|
|
901
|
+
const parsed = await Note.fromJsonLd(raw, {
|
|
902
|
+
contextLoader: mockDocumentLoader,
|
|
903
|
+
documentLoader: mockDocumentLoader
|
|
904
|
+
});
|
|
905
|
+
parsed.id.hostname = "primary.example";
|
|
906
|
+
return parsed;
|
|
907
|
+
}
|
|
908
|
+
return note;
|
|
909
|
+
});
|
|
910
|
+
federation.setObjectDispatcher(Create, "/activities/{id}", (_ctx, values) => new Create({
|
|
911
|
+
id: toCompatibleEf61Id(parseIri(`ap://${did}/activities/${values.id}`), gateways[1]),
|
|
912
|
+
actor: ownerId
|
|
913
|
+
}));
|
|
914
|
+
for (const [id, expected] of [
|
|
915
|
+
["secondary", 1],
|
|
916
|
+
["retained", 1],
|
|
917
|
+
["primary", 0],
|
|
918
|
+
["portable", 0],
|
|
919
|
+
["ordinary", 0]
|
|
920
|
+
]) assertEquals((await captureWarnings(async () => {
|
|
921
|
+
const response = await federation.fetch(new Request(`https://example.com/notes/${id}`, { headers: { Accept: ACCEPT } }), { contextData: void 0 });
|
|
922
|
+
assertEquals(response.status, 200);
|
|
923
|
+
const body = await response.json();
|
|
924
|
+
assertEquals(body.type, "Note");
|
|
925
|
+
if (id === "retained") assertEquals(body.id, `https://secondary.example/.well-known/apgateway/${did}/notes/retained`);
|
|
926
|
+
})).filter((r) => r.properties.kind === "object").length, expected, id);
|
|
927
|
+
assertEquals((await captureWarnings(async () => {
|
|
928
|
+
assertEquals((await federation.fetch(new Request("https://example.com/activities/1", { headers: { Accept: ACCEPT } }), { contextData: void 0 })).status, 200);
|
|
929
|
+
})).filter((r) => r.properties.kind === "activity").length, 1);
|
|
930
|
+
for (const id of ["secondary", "retained"]) assertEquals((await captureWarnings(async () => {
|
|
931
|
+
assertEquals((await federation.fetch(gatewayRequest(`/notes/${id}`), { contextData: void 0 })).status, 200);
|
|
932
|
+
})).filter((r) => r.properties.kind === "object").length, 1);
|
|
933
|
+
actorLookupFails = true;
|
|
934
|
+
const expectedBody = await secondary.toJsonLd({
|
|
935
|
+
format: "compact",
|
|
936
|
+
contextLoader: mockDocumentLoader
|
|
937
|
+
});
|
|
938
|
+
for (const request of [new Request("https://example.com/notes/secondary", { headers: { Accept: ACCEPT } }), gatewayRequest("/notes/secondary")]) assertEquals((await captureWarnings(async () => {
|
|
939
|
+
const response = await federation.fetch(request, { contextData: void 0 });
|
|
940
|
+
assertEquals(response.status, 200);
|
|
941
|
+
assertEquals(await response.json(), expectedBody);
|
|
942
|
+
})).filter((r) => r.properties.kind != null), []);
|
|
943
|
+
assertEquals(actorCalls, 8);
|
|
944
|
+
});
|
|
868
945
|
test("Federation.fetch() serves compatible-ID actors", async (t) => {
|
|
869
946
|
const federation = createTestFederation();
|
|
870
947
|
const actorGateways = {
|
|
@@ -10,10 +10,10 @@ import { t as assertNotEquals } from "../assert_not_equals-CpPK2t89.mjs";
|
|
|
10
10
|
import "../std__assert-DvMDRPes.mjs";
|
|
11
11
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
12
12
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
13
|
-
import { f as verifyRequest } from "../http-
|
|
13
|
+
import { f as verifyRequest } from "../http-SIEv_YGW.mjs";
|
|
14
14
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
15
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
16
|
-
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-
|
|
15
|
+
import { t as doesActorOwnKey } from "../owner-CoNYVTQp.mjs";
|
|
16
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-CdRJj10a.mjs";
|
|
17
17
|
import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
|
|
18
18
|
import { FetchError, UrlError } from "@fedify/vocab-runtime";
|
|
19
19
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as MemoryKvStore } from "../../kv-DCHkaJ9-.mjs";
|
|
5
5
|
import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, t as MockQueue } from "../../tasks-IG3pHfvZ.mjs";
|
|
6
6
|
import "../../testing-t8xDeJZ5.mjs";
|
|
7
|
-
import { o as createFederation } from "../../middleware-
|
|
7
|
+
import { o as createFederation } from "../../middleware-BhtaUtlt.mjs";
|
|
8
8
|
import { n as ParallelMessageQueue } from "../../mq-Dm1Wmtm-.mjs";
|
|
9
9
|
import { configure, reset } from "@logtape/logtape";
|
|
10
10
|
import { delay } from "es-toolkit";
|
|
@@ -4,8 +4,8 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as MemoryKvStore } from "../../kv-DCHkaJ9-.mjs";
|
|
5
5
|
import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, t as MockQueue } from "../../tasks-IG3pHfvZ.mjs";
|
|
6
6
|
import "../../testing-t8xDeJZ5.mjs";
|
|
7
|
-
import { o as createFederation } from "../../middleware-
|
|
8
|
-
import { r as createFederationBuilder } from "../../builder-
|
|
7
|
+
import { o as createFederation } from "../../middleware-BhtaUtlt.mjs";
|
|
8
|
+
import { r as createFederationBuilder } from "../../builder-BmoDmjWk.mjs";
|
|
9
9
|
import { t as TaskCodec } from "../../codec-C6rTrpIp.mjs";
|
|
10
10
|
import { t as InProcessMessageQueue } from "../../mq-Dm1Wmtm-.mjs";
|
|
11
11
|
import { W3CTraceContextPropagator } from "@opentelemetry/core";
|
|
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
|
-
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-
|
|
7
|
+
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-vBRC6bwu.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/federation/temporal.test.ts
|
|
10
10
|
test("hasMalformedKnownTemporalLiteral() detects expanded proof timestamps", async () => {
|
|
@@ -6,7 +6,7 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
|
6
6
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
7
7
|
import { t as assertNotEquals } from "../assert_not_equals-CpPK2t89.mjs";
|
|
8
8
|
import "../std__assert-DvMDRPes.mjs";
|
|
9
|
-
import { o as createFederation, s as handleWebFinger } from "../middleware-
|
|
9
|
+
import { o as createFederation, s as handleWebFinger } from "../middleware-BhtaUtlt.mjs";
|
|
10
10
|
import { Image, Link, Person, Tombstone } from "@fedify/vocab";
|
|
11
11
|
import { parseIri } from "@fedify/vocab-runtime";
|
|
12
12
|
import { createTestMeterProvider, test } from "@fedify/fixture";
|