@fedify/fedify 2.4.0-dev.2035 → 2.4.0-dev.2047
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-CxB0RNUS.mjs → builder-Cue1kVHU.mjs} +12 -11
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-DAEfpSL-.mjs → compound-proof-YT4tajyj.mjs} +1 -1
- package/dist/{context-uyRUWoZQ.d.ts → context-BJPHhBmD.d.ts} +100 -2
- package/dist/{context-BeDnDuF3.d.cts → context-Bh_mJfbD.d.cts} +100 -2
- package/dist/{context-CbS35fLr.mjs → context-DG5QeQ8W.mjs} +3 -1
- package/dist/{deno-ByRFTNQR.mjs → deno-Dcj6O4LJ.mjs} +1 -1
- package/dist/{docloader-CQ8Edzd4.mjs → docloader-BRlNjHlQ.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 +4 -4
- package/dist/federation/handler.test.mjs +6 -6
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +8 -8
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +1 -1
- package/dist/federation/outgoing-proof.test.mjs +5 -5
- package/dist/federation/portable.test.d.mts +2 -0
- package/dist/federation/portable.test.mjs +430 -0
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/tasks/enqueue.test.mjs +2 -2
- package/dist/federation/tasks/tasks.test.mjs +3 -3
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +115 -2
- package/dist/{federation-Bxy5QoWo.cjs → federation-Bdu06LEl.cjs} +324 -26
- package/dist/{http-BMAvWfcv.js → http-BmdqHyms.js} +1 -1
- package/dist/{http--RCp5CRI.cjs → http-CGjvl34X.cjs} +1 -1
- package/dist/{http-BZl8ShOJ.mjs → http-CK6kjLnO.mjs} +3 -3
- package/dist/{key-BeFBBxpa.mjs → key-CzCAq6D9.mjs} +2 -2
- package/dist/{kv-cache-yChGryXN.cjs → kv-cache-CvEicbrf.cjs} +1 -1
- package/dist/{kv-cache-D_2ZatKb.mjs → kv-cache-YATuzCy-.mjs} +1 -1
- package/dist/{kv-cache-CnAYugy5.js → kv-cache-fi_-XZco.js} +1 -1
- package/dist/{ld-BepC--ab.mjs → ld-CNWm8mJc.mjs} +3 -3
- package/dist/{metrics-eZ0bEvxw.mjs → metrics-CDoBPWjf.mjs} +1 -1
- package/dist/{middleware-DDFdZjkU.mjs → middleware-CF6uz8wa.mjs} +1 -1
- package/dist/{middleware-8c3mI8D0.mjs → middleware-CtFNjIUD.mjs} +326 -28
- package/dist/{middleware-CeK467Oy.js → middleware-Drzx-OID.js} +325 -27
- package/dist/{mod-D882_Xsg.d.ts → mod-BofpDIcU.d.ts} +1 -1
- package/dist/{mod-x9W0d0Pk.d.cts → mod-DU8aVzQJ.d.cts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +4 -4
- package/dist/mod.d.ts +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +2 -2
- package/dist/{owner-DZOj3ivi.mjs → owner-B3PgGiJ1.mjs} +2 -2
- package/dist/{owner-DS-Bz_zW.js → owner-CMnmv7S9.js} +16 -3
- package/dist/{owner-DwF4aZoy.cjs → owner-Hurn_ocn.cjs} +16 -3
- package/dist/{proof-DyPuryze.mjs → proof-fKycdssC.mjs} +18 -5
- package/dist/{send-jgopmjWM.mjs → send-BqBILxYE.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/proof.test.mjs +208 -1
- package/dist/{temporal-DjFCwpqJ.mjs → temporal-SUiLJ0Co.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/testing/mod.d.mts +99 -1
- package/dist/testing/mod.mjs +2 -2
- package/dist/{testing-hbky2gMN.mjs → testing-By1YYsIK.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 +6 -6
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { r as createRequestContext } from "../context-
|
|
4
|
+
import { r as createRequestContext } from "../context-DG5QeQ8W.mjs";
|
|
5
5
|
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-CtFNjIUD.mjs";
|
|
10
10
|
import { Image, Link, Person, Tombstone } from "@fedify/vocab";
|
|
11
11
|
import { createTestMeterProvider, test } from "@fedify/fixture";
|
|
12
|
+
import { parseIri } from "@fedify/vocab-runtime";
|
|
12
13
|
//#region src/federation/webfinger.test.ts
|
|
13
14
|
test("handleWebFinger()", async (t) => {
|
|
14
15
|
const url = new URL("https://example.com/.well-known/webfinger");
|
|
@@ -739,5 +740,117 @@ test("handleWebFinger() records webfinger.handle counter and duration", async (t
|
|
|
739
740
|
assertEquals(recorder.getMeasurements("webfinger.handle.duration").length, 0);
|
|
740
741
|
});
|
|
741
742
|
});
|
|
743
|
+
test("handleWebFinger() for FEP-ef61 portable actors", async (t) => {
|
|
744
|
+
const did = "did:key:z6Mkabc";
|
|
745
|
+
const compatibleId = `https://example.com/.well-known/apgateway/${did}/actor`;
|
|
746
|
+
const gateways = {
|
|
747
|
+
alice: [new URL("https://example.com")],
|
|
748
|
+
secondary: [new URL("https://primary.example"), new URL("https://example.com")],
|
|
749
|
+
anonymous: [new URL("https://example.com")],
|
|
750
|
+
nogateway: []
|
|
751
|
+
};
|
|
752
|
+
const actorDispatcher = (_ctx, identifier) => {
|
|
753
|
+
if (!(identifier in gateways)) return null;
|
|
754
|
+
return new Person({
|
|
755
|
+
id: parseIri(`ap://${did}/actor`),
|
|
756
|
+
preferredUsername: identifier === "anonymous" ? null : "alice",
|
|
757
|
+
gateways: gateways[identifier]
|
|
758
|
+
});
|
|
759
|
+
};
|
|
760
|
+
const actorAliasMapper = (_ctx, resource) => {
|
|
761
|
+
if (resource.href === compatibleId) return { identifier: "alice" };
|
|
762
|
+
if (resource.protocol === "ap+ef61:") return { identifier: "anonymous" };
|
|
763
|
+
if (resource.href === "acct:anonymous") return { identifier: "anonymous" };
|
|
764
|
+
return null;
|
|
765
|
+
};
|
|
766
|
+
async function query(resource, host = "example.com") {
|
|
767
|
+
const url = new URL(`https://${host}/.well-known/webfinger`);
|
|
768
|
+
url.searchParams.set("resource", resource);
|
|
769
|
+
const context = createRequestContext({
|
|
770
|
+
federation: createFederation({ kv: new MemoryKvStore() }),
|
|
771
|
+
url,
|
|
772
|
+
data: void 0,
|
|
773
|
+
getActorUri(identifier) {
|
|
774
|
+
return new URL(`${url.origin}/users/${identifier}`);
|
|
775
|
+
},
|
|
776
|
+
parseUri: () => null
|
|
777
|
+
});
|
|
778
|
+
return await handleWebFinger(context.request, {
|
|
779
|
+
context,
|
|
780
|
+
actorDispatcher,
|
|
781
|
+
actorAliasMapper,
|
|
782
|
+
onNotFound: () => new Response("Not found", { status: 404 })
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
const selfLink = {
|
|
786
|
+
rel: "self",
|
|
787
|
+
href: compatibleId,
|
|
788
|
+
type: "application/activity+json"
|
|
789
|
+
};
|
|
790
|
+
await t.step("acct: on the first gateway", async () => {
|
|
791
|
+
const response = await query("acct:alice@example.com");
|
|
792
|
+
assertEquals(response.status, 200);
|
|
793
|
+
assertEquals(await response.json(), {
|
|
794
|
+
subject: "acct:alice@example.com",
|
|
795
|
+
aliases: [compatibleId],
|
|
796
|
+
links: [selfLink]
|
|
797
|
+
});
|
|
798
|
+
});
|
|
799
|
+
await t.step("acct: on a secondary gateway", async () => {
|
|
800
|
+
const response = await query("acct:secondary@example.com");
|
|
801
|
+
assertEquals(response.status, 200);
|
|
802
|
+
const primaryCompatibleId = `https://primary.example/.well-known/apgateway/${did}/actor`;
|
|
803
|
+
assertEquals(await response.json(), {
|
|
804
|
+
subject: "acct:alice@primary.example",
|
|
805
|
+
aliases: [primaryCompatibleId, "acct:secondary@example.com"],
|
|
806
|
+
links: [{
|
|
807
|
+
...selfLink,
|
|
808
|
+
href: primaryCompatibleId
|
|
809
|
+
}]
|
|
810
|
+
});
|
|
811
|
+
});
|
|
812
|
+
await t.step("compatible identifier", async () => {
|
|
813
|
+
const response = await query(compatibleId);
|
|
814
|
+
assertEquals(response.status, 200);
|
|
815
|
+
assertEquals(await response.json(), {
|
|
816
|
+
subject: "acct:alice@example.com",
|
|
817
|
+
aliases: [compatibleId],
|
|
818
|
+
links: [selfLink]
|
|
819
|
+
});
|
|
820
|
+
});
|
|
821
|
+
await t.step("portable ID without preferredUsername", async () => {
|
|
822
|
+
const response = await query(`ap://${did}/actor`);
|
|
823
|
+
assertEquals(response.status, 200);
|
|
824
|
+
assertEquals(await response.json(), {
|
|
825
|
+
subject: compatibleId,
|
|
826
|
+
aliases: [],
|
|
827
|
+
links: [selfLink]
|
|
828
|
+
});
|
|
829
|
+
});
|
|
830
|
+
await t.step("acct: without preferredUsername", async () => {
|
|
831
|
+
const response = await query("acct:anonymous@example.com");
|
|
832
|
+
assertEquals(response.status, 200);
|
|
833
|
+
assertEquals(await response.json(), {
|
|
834
|
+
subject: "acct:anonymous@example.com",
|
|
835
|
+
aliases: [compatibleId],
|
|
836
|
+
links: [selfLink]
|
|
837
|
+
});
|
|
838
|
+
});
|
|
839
|
+
await t.step("acct: without a host or preferredUsername", async () => {
|
|
840
|
+
const response = await query("acct:anonymous");
|
|
841
|
+
assertEquals(response.status, 200);
|
|
842
|
+
assertEquals(await response.json(), {
|
|
843
|
+
subject: "acct:anonymous",
|
|
844
|
+
aliases: [compatibleId],
|
|
845
|
+
links: [selfLink]
|
|
846
|
+
});
|
|
847
|
+
});
|
|
848
|
+
await t.step("no gateways", async () => {
|
|
849
|
+
assertEquals((await query("acct:nogateway@example.com")).status, 404);
|
|
850
|
+
});
|
|
851
|
+
await t.step("another host", async () => {
|
|
852
|
+
assertEquals((await query("acct:alice@primary.example")).status, 404);
|
|
853
|
+
});
|
|
854
|
+
});
|
|
742
855
|
//#endregion
|
|
743
856
|
export {};
|