@fedify/fedify 2.1.29 → 2.1.31
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-Mg2G3qj8.mjs → builder-isMRh_I6.mjs} +3 -3
- package/dist/{client-CAM_bQXx.d.cts → client-BIBzqEIp.d.cts} +0 -1
- package/dist/{client-CjDMsn4a.mjs → client-BZr7TGyu.mjs} +113 -64
- package/dist/{client-CSddvgWN.d.ts → client-jE7oGvRh.d.ts} +0 -1
- 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/{context-DLLaDau8.d.ts → context-C0uGVzgk.d.ts} +28 -2
- package/dist/{context-BNwv9Q1v.d.cts → context-CLaLxi49.d.cts} +28 -2
- package/dist/{deno-BiYv5RT5.mjs → deno-CiaJqTcu.mjs} +1 -1
- package/dist/docloader-DOrwedT7.mjs +124 -0
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +6 -6
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/keycache.test.mjs +18 -7
- package/dist/federation/middleware.test.mjs +380 -24
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +2 -2
- package/dist/federation/mod.d.ts +2 -2
- package/dist/federation/mod.js +1 -1
- package/dist/federation/send.test.mjs +445 -70
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{http-Dl00HXr4.d.ts → http-9IFUxdkp.d.cts} +1 -2
- package/dist/{http-C1ga9WQu.mjs → http-A9mP2uM7.mjs} +194 -96
- package/dist/{http-Cginz7L0.cjs → http-CRiVlZd5.cjs} +188 -105
- package/dist/{http-B3rSb2GQ.js → http-Crml3gei.js} +187 -104
- package/dist/{http-DqZhyEso.d.cts → http-SbfezERn.d.ts} +1 -2
- package/dist/{inbox-BWzL0xMU.mjs → inbox-KESLudq4.mjs} +1 -1
- package/dist/{key-O-ATwIGS.mjs → key-Dg6-DV_O.mjs} +17 -3
- package/dist/{keycache-RFlZObU3.mjs → keycache-DahCaG_m.mjs} +1 -1
- package/dist/{kv-cache-BdylAE9w.cjs → kv-cache-Cqmm-yQa.cjs} +59 -15
- package/dist/{kv-cache-8Kg2CHiD.js → kv-cache-DQcyZL5T.js} +60 -16
- package/dist/{ld-C-fCGM-z.mjs → ld-COjDN6Nb.mjs} +2 -2
- package/dist/{middleware-CVRFS7PZ.cjs → middleware-BbgR7xOI.cjs} +185 -60
- package/dist/{middleware-VvrqPwHL.cjs → middleware-BtDQUCcz.cjs} +1 -1
- package/dist/{middleware-C9UCWOqw.mjs → middleware-COFlKeYn.mjs} +79 -39
- package/dist/{middleware-CxgFiKI3.mjs → middleware-CuQvczZd.mjs} +1 -1
- package/dist/{middleware-41MkquTV.js → middleware-DIW5S_5L.js} +185 -60
- package/dist/{mod-DNEgTI8M.d.ts → mod-BRnwh2oy.d.ts} +2 -7
- package/dist/{mod-BLDHhuW0.d.ts → mod-C7w-QVUv.d.ts} +1 -1
- package/dist/{mod-CWJNbyju.d.ts → mod-CFRocFeQ.d.ts} +1 -1
- package/dist/{mod-BmlfRBmU.d.cts → mod-CGUH8Ujp.d.cts} +1 -1
- package/dist/{mod-Cn9GJ5ex.d.cts → mod-Co7LEK9X.d.cts} +2 -7
- package/dist/{mod-DiuFTYUt.d.cts → mod-LOEOKbYd.d.cts} +1 -1
- package/dist/mod.cjs +5 -5
- package/dist/mod.d.cts +6 -6
- package/dist/mod.d.ts +6 -6
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/client.test.mjs +337 -19
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/nodeinfo/mod.cjs +1 -1
- package/dist/nodeinfo/mod.d.cts +1 -1
- package/dist/nodeinfo/mod.d.ts +1 -1
- package/dist/nodeinfo/mod.js +1 -1
- package/dist/otel/exporter.test.mjs +292 -30
- package/dist/otel/mod.cjs +36 -30
- package/dist/otel/mod.d.cts +13 -0
- package/dist/otel/mod.d.ts +13 -0
- package/dist/otel/mod.js +36 -30
- package/dist/{owner-C8IVASD3.mjs → owner-CFHq61cq.mjs} +2 -2
- package/dist/{proof-BbHMAkPG.cjs → proof-0JkSC_pT.cjs} +1 -1
- package/dist/{proof-cGfRPTiV.js → proof-DzksJFK7.js} +1 -1
- package/dist/{proof-CUdcBgvg.mjs → proof-KSHlbPCG.mjs} +2 -2
- package/dist/{send-BoV4dyVO.mjs → send-DaDe2YCb.mjs} +117 -32
- package/dist/sig/http.test.mjs +507 -3
- package/dist/sig/key.test.mjs +197 -3
- package/dist/sig/ld.test.mjs +47 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +46 -1
- package/dist/sig/proof.test.mjs +52 -1
- package/dist/{temporal-BJlnku_d.mjs → temporal-DNGH8o2E.mjs} +1 -1
- package/dist/testing/mod.d.mts +26 -1
- package/dist/{types-miAYfiGO.js → types-B1_pRFE_.js} +112 -63
- package/dist/{types-DRPjmHVV.cjs → types-DOvyymM4.cjs} +111 -62
- package/dist/utils/docloader.test.mjs +380 -32
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +7 -7
- package/dist/docloader-DrxXBFL8.mjs +0 -80
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
|
|
6
|
-
import { t as KvKeyCache } from "../keycache-
|
|
6
|
+
import { t as KvKeyCache } from "../keycache-DahCaG_m.mjs";
|
|
7
7
|
import { t as MemoryKvStore } from "../kv-HvthQAHr.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
@@ -14,7 +14,7 @@ test("KvKeyCache.set()", async () => {
|
|
|
14
14
|
await cache.set(new URL("https://example.com/key"), new CryptographicKey({ id: new URL("https://example.com/key") }));
|
|
15
15
|
assertEquals(await kv.get([
|
|
16
16
|
"pk",
|
|
17
|
-
"
|
|
17
|
+
"3",
|
|
18
18
|
"https://example.com/key"
|
|
19
19
|
]), {
|
|
20
20
|
"@context": "https://w3id.org/security/v1",
|
|
@@ -24,7 +24,7 @@ test("KvKeyCache.set()", async () => {
|
|
|
24
24
|
await cache.set(new URL("https://example.com/key2"), new Multikey({ id: new URL("https://example.com/key2") }));
|
|
25
25
|
assertEquals(await kv.get([
|
|
26
26
|
"pk",
|
|
27
|
-
"
|
|
27
|
+
"3",
|
|
28
28
|
"https://example.com/key2"
|
|
29
29
|
]), {
|
|
30
30
|
"@context": "https://w3id.org/security/multikey/v1",
|
|
@@ -35,7 +35,7 @@ test("KvKeyCache.set()", async () => {
|
|
|
35
35
|
assert(cache.nullKeys.has("https://example.com/null"));
|
|
36
36
|
assertEquals(await kv.get([
|
|
37
37
|
"pk",
|
|
38
|
-
"
|
|
38
|
+
"3",
|
|
39
39
|
"https://example.com/null"
|
|
40
40
|
]), null);
|
|
41
41
|
});
|
|
@@ -44,7 +44,7 @@ test("KvKeyCache.get()", async () => {
|
|
|
44
44
|
const cache = new KvKeyCache(kv, ["pk"]);
|
|
45
45
|
await kv.set([
|
|
46
46
|
"pk",
|
|
47
|
-
"
|
|
47
|
+
"3",
|
|
48
48
|
"https://example.com/key"
|
|
49
49
|
], {
|
|
50
50
|
"@context": "https://w3id.org/security/v1",
|
|
@@ -56,7 +56,7 @@ test("KvKeyCache.get()", async () => {
|
|
|
56
56
|
assertEquals(cryptoKey?.id?.href, "https://example.com/key");
|
|
57
57
|
await kv.set([
|
|
58
58
|
"pk",
|
|
59
|
-
"
|
|
59
|
+
"3",
|
|
60
60
|
"https://example.com/key2"
|
|
61
61
|
], {
|
|
62
62
|
"@context": "https://w3id.org/security/multikey/v1",
|
|
@@ -70,7 +70,7 @@ test("KvKeyCache.get()", async () => {
|
|
|
70
70
|
assertEquals(await cache.get(new URL("https://example.com/null")), null);
|
|
71
71
|
await kv.set([
|
|
72
72
|
"pk",
|
|
73
|
-
"
|
|
73
|
+
"3",
|
|
74
74
|
"https://example.com/null2"
|
|
75
75
|
], null);
|
|
76
76
|
assertEquals(await new KvKeyCache(kv, ["pk"]).get(new URL("https://example.com/null2")), null);
|
|
@@ -154,6 +154,17 @@ test("KvKeyCache.get() ignores entries from an earlier generation", async () =>
|
|
|
154
154
|
type: "CryptographicKey"
|
|
155
155
|
});
|
|
156
156
|
assertEquals(await cache.get(new URL("https://example.com/key")), void 0);
|
|
157
|
+
await kv.set([
|
|
158
|
+
"pk",
|
|
159
|
+
"2",
|
|
160
|
+
"https://example.com/key2"
|
|
161
|
+
], {
|
|
162
|
+
"@context": "https://w3id.org/security/v1",
|
|
163
|
+
id: "https://example.com/key2",
|
|
164
|
+
owner: "https://example.com/impersonated",
|
|
165
|
+
type: "CryptographicKey"
|
|
166
|
+
});
|
|
167
|
+
assertEquals(await cache.get(new URL("https://example.com/key2")), void 0);
|
|
157
168
|
});
|
|
158
169
|
//#endregion
|
|
159
170
|
export {};
|
|
@@ -9,15 +9,15 @@ import { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.m
|
|
|
9
9
|
import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
|
|
10
10
|
import { t as assertNotEquals } from "../assert_not_equals-BkxW5QJI.mjs";
|
|
11
11
|
import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
|
|
12
|
-
import {
|
|
12
|
+
import { c as signRequest, u as verifyRequest } from "../http-A9mP2uM7.mjs";
|
|
13
13
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
|
|
14
|
-
import {
|
|
14
|
+
import { n as getAuthenticatedDocumentLoader } from "../docloader-DOrwedT7.mjs";
|
|
15
15
|
import { t as MemoryKvStore } from "../kv-HvthQAHr.mjs";
|
|
16
|
-
import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-
|
|
17
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
18
|
-
import { n as signObject, r as verifyObject } from "../proof-
|
|
19
|
-
import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-
|
|
20
|
-
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
16
|
+
import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-COjDN6Nb.mjs";
|
|
17
|
+
import { t as doesActorOwnKey } from "../owner-CFHq61cq.mjs";
|
|
18
|
+
import { n as signObject, r as verifyObject } from "../proof-KSHlbPCG.mjs";
|
|
19
|
+
import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-COFlKeYn.mjs";
|
|
20
|
+
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
21
21
|
import * as vocab from "@fedify/vocab";
|
|
22
22
|
import { Create, Offer, Person, getTypeId, lookupObject } from "@fedify/vocab";
|
|
23
23
|
import { FetchError, UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -86,7 +86,7 @@ var person2_default = {
|
|
|
86
86
|
};
|
|
87
87
|
//#endregion
|
|
88
88
|
//#region src/federation/middleware.test.ts
|
|
89
|
-
const documentLoader = getDocumentLoader();
|
|
89
|
+
const documentLoader = getDocumentLoader({ allowPrivateAddress: true });
|
|
90
90
|
test("createFederation()", async (t) => {
|
|
91
91
|
const kv = new MemoryKvStore();
|
|
92
92
|
await t.step("allowPrivateAddress", () => {
|
|
@@ -216,7 +216,8 @@ test({
|
|
|
216
216
|
const federation = createFederation({
|
|
217
217
|
kv,
|
|
218
218
|
documentLoaderFactory: () => rejectingLoader,
|
|
219
|
-
contextLoaderFactory: () => mockDocumentLoader
|
|
219
|
+
contextLoaderFactory: () => mockDocumentLoader,
|
|
220
|
+
authenticatedDocumentLoaderFactory: (identity) => getAuthenticatedDocumentLoader(identity, { allowPrivateAddress: true })
|
|
220
221
|
});
|
|
221
222
|
let ctx = federation.createContext(new URL("https://example.com:1234/"), 123);
|
|
222
223
|
assertEquals(ctx.data, 123);
|
|
@@ -321,7 +322,7 @@ test({
|
|
|
321
322
|
documentUrl: "https://example.com/auth-check",
|
|
322
323
|
document: true
|
|
323
324
|
});
|
|
324
|
-
assertEquals(await ctx.lookupObject("https://example.com/object"), null);
|
|
325
|
+
assertEquals(await withDnsLookup(() => Promise.reject(/* @__PURE__ */ new Error("Resolver unavailable")), () => ctx.lookupObject("https://example.com/object")), null);
|
|
325
326
|
await assertRejects(() => ctx.sendActivity({ identifier: "handle" }, [], new vocab.Create({})), TypeError, "The activity to send must have at least one actor property.");
|
|
326
327
|
await ctx.sendActivity({ identifier: "handle" }, [], new vocab.Create({ actor: new URL("https://example.com/users/handle") }));
|
|
327
328
|
esm_default.get("https://example.com/object", () => new Response(JSON.stringify({
|
|
@@ -570,7 +571,7 @@ test({
|
|
|
570
571
|
assertStrictEquals(clone.contextLoader, ctx.contextLoader);
|
|
571
572
|
assertStrictEquals(clone.federation, ctx.federation);
|
|
572
573
|
});
|
|
573
|
-
esm_default.get("
|
|
574
|
+
esm_default.get("path:/.well-known/nodeinfo", (cl) => {
|
|
574
575
|
const headers = cl.options.headers ?? {};
|
|
575
576
|
assertEquals(new Headers(headers).get("User-Agent"), "CustomUserAgent/1.2.3");
|
|
576
577
|
return new Response(JSON.stringify({ links: [{
|
|
@@ -578,7 +579,7 @@ test({
|
|
|
578
579
|
href: "https://example.com/nodeinfo/2.1"
|
|
579
580
|
}] }));
|
|
580
581
|
});
|
|
581
|
-
esm_default.get("
|
|
582
|
+
esm_default.get("path:/nodeinfo/2.1", (cl) => {
|
|
582
583
|
const headers = cl.options.headers ?? {};
|
|
583
584
|
assertEquals(new Headers(headers).get("User-Agent"), "CustomUserAgent/1.2.3");
|
|
584
585
|
return new Response(JSON.stringify({
|
|
@@ -599,7 +600,11 @@ test({
|
|
|
599
600
|
kv,
|
|
600
601
|
userAgent: "CustomUserAgent/1.2.3"
|
|
601
602
|
}).createContext(new URL("https://example.com/"), 123);
|
|
602
|
-
|
|
603
|
+
const lookupExample = () => Promise.resolve([{
|
|
604
|
+
address: "93.184.215.14",
|
|
605
|
+
family: 4
|
|
606
|
+
}]);
|
|
607
|
+
assertEquals(await withDnsLookup(lookupExample, () => ctx.lookupNodeInfo("https://example.com/")), {
|
|
603
608
|
software: {
|
|
604
609
|
name: "foo",
|
|
605
610
|
version: "1.2.3"
|
|
@@ -611,7 +616,7 @@ test({
|
|
|
611
616
|
localComments: 456
|
|
612
617
|
}
|
|
613
618
|
});
|
|
614
|
-
assertEquals(await ctx.lookupNodeInfo("https://example.com/", { parse: "none" }), {
|
|
619
|
+
assertEquals(await withDnsLookup(lookupExample, () => ctx.lookupNodeInfo("https://example.com/", { parse: "none" })), {
|
|
615
620
|
software: {
|
|
616
621
|
name: "foo",
|
|
617
622
|
version: "1.2.3"
|
|
@@ -718,6 +723,343 @@ test({
|
|
|
718
723
|
esm_default.hardReset();
|
|
719
724
|
}
|
|
720
725
|
});
|
|
726
|
+
test("RequestContext signature checks", async (t) => {
|
|
727
|
+
const [tracerProvider, exporter] = createTestTracerProvider();
|
|
728
|
+
const keyId = rsaPublicKey3.id.href;
|
|
729
|
+
const ownerId = rsaPublicKey3.ownerId.href;
|
|
730
|
+
const request = await signRequest(new Request("https://example.com/"), rsaPrivateKey3, rsaPublicKey3.id);
|
|
731
|
+
function setup(options = {}) {
|
|
732
|
+
const loads = {
|
|
733
|
+
key: 0,
|
|
734
|
+
owner: 0
|
|
735
|
+
};
|
|
736
|
+
const loader = async (url, loaderOptions) => {
|
|
737
|
+
if (url === keyId) loads.key++;
|
|
738
|
+
else if (url === ownerId) loads.owner++;
|
|
739
|
+
await options.gate;
|
|
740
|
+
return await (options.load ?? mockDocumentLoader)(url, loaderOptions);
|
|
741
|
+
};
|
|
742
|
+
const federation = createFederation({
|
|
743
|
+
kv: new MemoryKvStore(),
|
|
744
|
+
documentLoaderFactory: () => loader,
|
|
745
|
+
contextLoaderFactory: () => mockDocumentLoader,
|
|
746
|
+
tracerProvider: options.tracerProvider ?? tracerProvider
|
|
747
|
+
});
|
|
748
|
+
return {
|
|
749
|
+
ctx: federation.createContext(options.request ?? new Request(request), void 0),
|
|
750
|
+
loads,
|
|
751
|
+
loader,
|
|
752
|
+
federation
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
try {
|
|
756
|
+
for (const mode of [
|
|
757
|
+
"keys",
|
|
758
|
+
"owners",
|
|
759
|
+
"warm owners",
|
|
760
|
+
"mixed"
|
|
761
|
+
]) await t.step(`coalesces ${mode}`, async () => {
|
|
762
|
+
exporter.clear();
|
|
763
|
+
let release;
|
|
764
|
+
const { ctx, loads, loader } = setup({ gate: new Promise((resolve) => release = resolve) });
|
|
765
|
+
if (mode === "warm owners") {
|
|
766
|
+
release();
|
|
767
|
+
assert(await ctx.getSignedKey());
|
|
768
|
+
}
|
|
769
|
+
const results = Promise.all(Array.from({ length: 8 }, (_, i) => {
|
|
770
|
+
const options = i % 2 === 0 ? {} : {
|
|
771
|
+
documentLoader: loader,
|
|
772
|
+
contextLoader: ctx.contextLoader,
|
|
773
|
+
tracerProvider
|
|
774
|
+
};
|
|
775
|
+
return mode === "keys" || mode === "mixed" && i % 2 === 0 ? ctx.getSignedKey(options) : ctx.getSignedKeyOwner(options);
|
|
776
|
+
}));
|
|
777
|
+
release();
|
|
778
|
+
for (const result of await results) assert(result != null);
|
|
779
|
+
assertEquals(loads, {
|
|
780
|
+
key: 1,
|
|
781
|
+
owner: mode === "keys" ? 0 : 1
|
|
782
|
+
});
|
|
783
|
+
assertEquals(exporter.getSpans("http_signatures.verify").length, 1);
|
|
784
|
+
assert(await ctx.getSignedKey());
|
|
785
|
+
if (mode !== "keys") assert(await ctx.getSignedKeyOwner());
|
|
786
|
+
assertEquals(loads, {
|
|
787
|
+
key: 1,
|
|
788
|
+
owner: mode === "keys" ? 0 : 1
|
|
789
|
+
});
|
|
790
|
+
});
|
|
791
|
+
await t.step("memoizes null keys", async () => {
|
|
792
|
+
exporter.clear();
|
|
793
|
+
const { ctx, loads } = setup({ load: () => Promise.reject(/* @__PURE__ */ new Error("unavailable")) });
|
|
794
|
+
for (let i = 0; i < 3; i++) {
|
|
795
|
+
assertEquals(await ctx.getSignedKey(), null);
|
|
796
|
+
assertEquals(await ctx.getSignedKeyOwner(), null);
|
|
797
|
+
}
|
|
798
|
+
assertEquals(loads, {
|
|
799
|
+
key: 1,
|
|
800
|
+
owner: 0
|
|
801
|
+
});
|
|
802
|
+
assertEquals(exporter.getSpans("http_signatures.verify").length, 1);
|
|
803
|
+
assert(await ctx.getSignedKey({ documentLoader: mockDocumentLoader }));
|
|
804
|
+
assert(await ctx.getSignedKeyOwner({ documentLoader: mockDocumentLoader }));
|
|
805
|
+
});
|
|
806
|
+
await t.step("coalesces key-owner FetchError results", async () => {
|
|
807
|
+
const { ctx, loads } = setup({ load: async (url, options) => {
|
|
808
|
+
if (url === ownerId) throw new FetchError(new URL(url), "HTTP 401: Unauthorized");
|
|
809
|
+
return await mockDocumentLoader(url, options);
|
|
810
|
+
} });
|
|
811
|
+
assert(await ctx.getSignedKey());
|
|
812
|
+
assertEquals(await Promise.all(Array.from({ length: 8 }, () => ctx.getSignedKeyOwner())), Array(8).fill(null));
|
|
813
|
+
assertEquals(await ctx.getSignedKeyOwner(), null);
|
|
814
|
+
assertEquals(loads, {
|
|
815
|
+
key: 1,
|
|
816
|
+
owner: 1
|
|
817
|
+
});
|
|
818
|
+
assert(await ctx.getSignedKeyOwner({ documentLoader: mockDocumentLoader }));
|
|
819
|
+
});
|
|
820
|
+
await t.step("memoizes unsigned requests", async () => {
|
|
821
|
+
exporter.clear();
|
|
822
|
+
const { ctx, loads } = setup({ request: new Request("https://example.com/") });
|
|
823
|
+
for (let i = 0; i < 3; i++) {
|
|
824
|
+
assertEquals(await ctx.getSignedKey(), null);
|
|
825
|
+
assertEquals(await ctx.getSignedKeyOwner(), null);
|
|
826
|
+
}
|
|
827
|
+
assertEquals(loads, {
|
|
828
|
+
key: 0,
|
|
829
|
+
owner: 0
|
|
830
|
+
});
|
|
831
|
+
assertEquals(exporter.getSpans("http_signatures.verify").length, 1);
|
|
832
|
+
});
|
|
833
|
+
await t.step("memoizes null owners without trusting a key's owner claim", async () => {
|
|
834
|
+
const { ctx, loads } = setup({ load: async (url, options) => url === ownerId ? {
|
|
835
|
+
documentUrl: url,
|
|
836
|
+
contextUrl: null,
|
|
837
|
+
document: {
|
|
838
|
+
...person2_default,
|
|
839
|
+
publicKey: []
|
|
840
|
+
}
|
|
841
|
+
} : await mockDocumentLoader(url, options) });
|
|
842
|
+
assert(await ctx.getSignedKey());
|
|
843
|
+
assertEquals(await Promise.all(Array.from({ length: 8 }, () => ctx.getSignedKeyOwner())), Array(8).fill(null));
|
|
844
|
+
for (let i = 0; i < 3; i++) assertEquals(await ctx.getSignedKeyOwner(), null);
|
|
845
|
+
assertEquals(loads, {
|
|
846
|
+
key: 1,
|
|
847
|
+
owner: 1
|
|
848
|
+
});
|
|
849
|
+
assert(await ctx.getSignedKeyOwner({ documentLoader: mockDocumentLoader }));
|
|
850
|
+
assert(await ctx.getSignedKeyOwner());
|
|
851
|
+
});
|
|
852
|
+
await t.step("isolates concurrent document loaders before success", async () => {
|
|
853
|
+
const { ctx, loads } = setup();
|
|
854
|
+
let otherLoads = 0;
|
|
855
|
+
const otherLoader = async (url, options) => {
|
|
856
|
+
otherLoads++;
|
|
857
|
+
if (url === ownerId) return {
|
|
858
|
+
documentUrl: url,
|
|
859
|
+
contextUrl: null,
|
|
860
|
+
document: {
|
|
861
|
+
...person2_default,
|
|
862
|
+
name: "Other view"
|
|
863
|
+
}
|
|
864
|
+
};
|
|
865
|
+
return await mockDocumentLoader(url, options);
|
|
866
|
+
};
|
|
867
|
+
const [first, second] = await Promise.all([ctx.getSignedKeyOwner(), ctx.getSignedKeyOwner({ documentLoader: otherLoader })]);
|
|
868
|
+
assertEquals(first?.name, "Jane Doe");
|
|
869
|
+
assertEquals(second?.name, "Other view");
|
|
870
|
+
const cached = await ctx.getSignedKeyOwner();
|
|
871
|
+
assert(cached === first || cached === second);
|
|
872
|
+
assertStrictEquals(await ctx.getSignedKeyOwner({ documentLoader: otherLoader }), cached);
|
|
873
|
+
assertEquals(loads, {
|
|
874
|
+
key: 1,
|
|
875
|
+
owner: 1
|
|
876
|
+
});
|
|
877
|
+
assertEquals(otherLoads, 2);
|
|
878
|
+
});
|
|
879
|
+
await t.step("preserves in-flight null while another loader succeeds", async () => {
|
|
880
|
+
exporter.clear();
|
|
881
|
+
let release;
|
|
882
|
+
const gate = new Promise((resolve) => release = resolve);
|
|
883
|
+
const { ctx, loads } = setup({ load: async () => {
|
|
884
|
+
await gate;
|
|
885
|
+
throw new TypeError("fetch failed");
|
|
886
|
+
} });
|
|
887
|
+
const failed = Promise.all([ctx.getSignedKey(), ctx.getSignedKeyOwner()]);
|
|
888
|
+
const owner = await ctx.getSignedKeyOwner({ documentLoader: mockDocumentLoader });
|
|
889
|
+
assert(owner);
|
|
890
|
+
release();
|
|
891
|
+
assertEquals(await failed, [null, null]);
|
|
892
|
+
assertStrictEquals(await ctx.getSignedKeyOwner(), owner);
|
|
893
|
+
assert(await ctx.getSignedKey());
|
|
894
|
+
assertEquals(loads, {
|
|
895
|
+
key: 1,
|
|
896
|
+
owner: 0
|
|
897
|
+
});
|
|
898
|
+
assertEquals(exporter.getSpans("http_signatures.verify").length, 2);
|
|
899
|
+
});
|
|
900
|
+
await t.step("isolates context loaders", async () => {
|
|
901
|
+
exporter.clear();
|
|
902
|
+
const { ctx, loads } = setup();
|
|
903
|
+
const otherContextLoader = (url, options) => mockDocumentLoader(url, options);
|
|
904
|
+
await Promise.all([ctx.getSignedKeyOwner(), ctx.getSignedKeyOwner({ contextLoader: otherContextLoader })]);
|
|
905
|
+
assertEquals(loads, {
|
|
906
|
+
key: 2,
|
|
907
|
+
owner: 2
|
|
908
|
+
});
|
|
909
|
+
assertEquals(exporter.getSpans("http_signatures.verify").length, 2);
|
|
910
|
+
});
|
|
911
|
+
await t.step("shares work across tracer providers", async () => {
|
|
912
|
+
exporter.clear();
|
|
913
|
+
const [otherProvider, otherExporter] = createTestTracerProvider();
|
|
914
|
+
try {
|
|
915
|
+
const { ctx, loads } = setup();
|
|
916
|
+
await Promise.all([
|
|
917
|
+
ctx.getSignedKeyOwner(),
|
|
918
|
+
ctx.getSignedKeyOwner({ tracerProvider: otherProvider }),
|
|
919
|
+
ctx.getSignedKey(),
|
|
920
|
+
ctx.getSignedKey({ tracerProvider: otherProvider })
|
|
921
|
+
]);
|
|
922
|
+
assert(await ctx.getSignedKeyOwner({ tracerProvider: otherProvider }));
|
|
923
|
+
assertEquals(loads, {
|
|
924
|
+
key: 1,
|
|
925
|
+
owner: 1
|
|
926
|
+
});
|
|
927
|
+
assertEquals(exporter.getSpans("http_signatures.verify").length, 1);
|
|
928
|
+
assertEquals(otherExporter.getSpans("http_signatures.verify").length, 0);
|
|
929
|
+
} finally {
|
|
930
|
+
await otherProvider.shutdown();
|
|
931
|
+
}
|
|
932
|
+
});
|
|
933
|
+
await t.step("reuses success with a fresh authorization loader", async () => {
|
|
934
|
+
exporter.clear();
|
|
935
|
+
const { ctx, loads } = setup();
|
|
936
|
+
let freshLoads = 0;
|
|
937
|
+
const freshLoader = (url, options) => {
|
|
938
|
+
freshLoads++;
|
|
939
|
+
return mockDocumentLoader(url, options);
|
|
940
|
+
};
|
|
941
|
+
const key = await ctx.getSignedKey({ documentLoader: freshLoader });
|
|
942
|
+
assert(key);
|
|
943
|
+
assertStrictEquals(await ctx.getSignedKey(), key);
|
|
944
|
+
const owner = await ctx.getSignedKeyOwner();
|
|
945
|
+
assert(owner);
|
|
946
|
+
assertStrictEquals(await ctx.getSignedKeyOwner({ documentLoader: freshLoader }), owner);
|
|
947
|
+
assertEquals(loads, {
|
|
948
|
+
key: 0,
|
|
949
|
+
owner: 1
|
|
950
|
+
});
|
|
951
|
+
assertEquals(freshLoads, 1);
|
|
952
|
+
assertEquals(exporter.getSpans("http_signatures.verify").length, 1);
|
|
953
|
+
});
|
|
954
|
+
await t.step("retains a transient owner lookup failure as null", async () => {
|
|
955
|
+
let fail = true;
|
|
956
|
+
const { ctx, loads } = setup({ load: async (url, options) => {
|
|
957
|
+
if (url === ownerId && fail) throw new TypeError("fetch failed");
|
|
958
|
+
return await mockDocumentLoader(url, options);
|
|
959
|
+
} });
|
|
960
|
+
assert(await ctx.getSignedKey());
|
|
961
|
+
assertEquals(await ctx.getSignedKeyOwner(), null);
|
|
962
|
+
fail = false;
|
|
963
|
+
assertEquals(await ctx.getSignedKeyOwner(), null);
|
|
964
|
+
assertEquals(loads, {
|
|
965
|
+
key: 1,
|
|
966
|
+
owner: 1
|
|
967
|
+
});
|
|
968
|
+
assert(await ctx.getSignedKeyOwner({ documentLoader: mockDocumentLoader }));
|
|
969
|
+
});
|
|
970
|
+
await t.step("rechecks an owner after another loader verifies the key", async () => {
|
|
971
|
+
let fail = true;
|
|
972
|
+
const { ctx, loads } = setup({ load: async (url, options) => {
|
|
973
|
+
if (url === keyId && fail) throw new TypeError("fetch failed");
|
|
974
|
+
return await mockDocumentLoader(url, options);
|
|
975
|
+
} });
|
|
976
|
+
assertEquals(await ctx.getSignedKeyOwner(), null);
|
|
977
|
+
fail = false;
|
|
978
|
+
assertEquals(await ctx.getSignedKeyOwner(), null);
|
|
979
|
+
assertEquals(loads, {
|
|
980
|
+
key: 1,
|
|
981
|
+
owner: 0
|
|
982
|
+
});
|
|
983
|
+
assert(await ctx.getSignedKey({ documentLoader: mockDocumentLoader }));
|
|
984
|
+
assertEquals((await ctx.getSignedKeyOwner())?.id?.href, ownerId);
|
|
985
|
+
assertEquals(loads, {
|
|
986
|
+
key: 1,
|
|
987
|
+
owner: 1
|
|
988
|
+
});
|
|
989
|
+
});
|
|
990
|
+
await t.step("retries unexpected key rejections from a rejection handler", async () => {
|
|
991
|
+
exporter.clear();
|
|
992
|
+
const failure = /* @__PURE__ */ new Error("transient context loader failure");
|
|
993
|
+
let rejectContext = true;
|
|
994
|
+
const contextLoader = async (url, options) => {
|
|
995
|
+
if (rejectContext) throw failure;
|
|
996
|
+
return await mockDocumentLoader(url, options);
|
|
997
|
+
};
|
|
998
|
+
const { ctx, loads } = setup();
|
|
999
|
+
const options = { contextLoader };
|
|
1000
|
+
const failedKeys = Promise.allSettled([
|
|
1001
|
+
ctx.getSignedKey(options),
|
|
1002
|
+
ctx.getSignedKeyOwner(options),
|
|
1003
|
+
ctx.getSignedKey(options)
|
|
1004
|
+
]);
|
|
1005
|
+
const recovery = ctx.getSignedKey(options).catch(() => {
|
|
1006
|
+
rejectContext = false;
|
|
1007
|
+
return ctx.getSignedKey(options);
|
|
1008
|
+
});
|
|
1009
|
+
for (const result of await failedKeys) assertEquals(result.status, "rejected");
|
|
1010
|
+
assert(await recovery);
|
|
1011
|
+
assertEquals(loads, {
|
|
1012
|
+
key: 2,
|
|
1013
|
+
owner: 0
|
|
1014
|
+
});
|
|
1015
|
+
assertEquals(exporter.getSpans("http_signatures.verify").length, 2);
|
|
1016
|
+
});
|
|
1017
|
+
await t.step("retries owner rejections while retaining the verified key", async () => {
|
|
1018
|
+
exporter.clear();
|
|
1019
|
+
let rejectContext = false;
|
|
1020
|
+
const contextLoader = async (url, options) => {
|
|
1021
|
+
if (rejectContext) throw new Error("transient owner context failure");
|
|
1022
|
+
return await mockDocumentLoader(url, options);
|
|
1023
|
+
};
|
|
1024
|
+
const { ctx, loads } = setup();
|
|
1025
|
+
const options = { contextLoader };
|
|
1026
|
+
assert(await ctx.getSignedKey(options));
|
|
1027
|
+
assertEquals(loads, {
|
|
1028
|
+
key: 1,
|
|
1029
|
+
owner: 0
|
|
1030
|
+
});
|
|
1031
|
+
rejectContext = true;
|
|
1032
|
+
const failures = await Promise.allSettled([ctx.getSignedKeyOwner(options), ctx.getSignedKeyOwner(options)]);
|
|
1033
|
+
for (const result of failures) assertEquals(result.status, "rejected");
|
|
1034
|
+
assertEquals(loads, {
|
|
1035
|
+
key: 1,
|
|
1036
|
+
owner: 1
|
|
1037
|
+
});
|
|
1038
|
+
rejectContext = false;
|
|
1039
|
+
assert(await ctx.getSignedKeyOwner(options));
|
|
1040
|
+
assertEquals(loads, {
|
|
1041
|
+
key: 1,
|
|
1042
|
+
owner: 2
|
|
1043
|
+
});
|
|
1044
|
+
assertEquals(exporter.getSpans("http_signatures.verify").length, 1);
|
|
1045
|
+
});
|
|
1046
|
+
await t.step("keeps clones and separate requests independent", async () => {
|
|
1047
|
+
exporter.clear();
|
|
1048
|
+
const { ctx, loads, federation } = setup();
|
|
1049
|
+
assert(await ctx.getSignedKeyOwner());
|
|
1050
|
+
const clone = ctx.clone(void 0);
|
|
1051
|
+
const separate = federation.createContext(new Request(request), void 0);
|
|
1052
|
+
await Promise.all([clone.getSignedKeyOwner(), separate.getSignedKeyOwner()]);
|
|
1053
|
+
assertEquals(loads, {
|
|
1054
|
+
key: 3,
|
|
1055
|
+
owner: 3
|
|
1056
|
+
});
|
|
1057
|
+
assertEquals(exporter.getSpans("http_signatures.verify").length, 3);
|
|
1058
|
+
});
|
|
1059
|
+
} finally {
|
|
1060
|
+
await tracerProvider.shutdown();
|
|
1061
|
+
}
|
|
1062
|
+
});
|
|
721
1063
|
test("Federation.fetch() [rfc9421] multiple POST signatures", async (t) => {
|
|
722
1064
|
for (const validSecond of [true, false]) await t.step(validSecond ? "valid second signature" : "both signatures invalid", async () => {
|
|
723
1065
|
const inbox = [];
|
|
@@ -761,7 +1103,7 @@ test("Federation.fetch()", async (t) => {
|
|
|
761
1103
|
kv,
|
|
762
1104
|
documentLoaderFactory: () => mockDocumentLoader,
|
|
763
1105
|
authenticatedDocumentLoaderFactory(identity) {
|
|
764
|
-
const docLoader = getAuthenticatedDocumentLoader(identity);
|
|
1106
|
+
const docLoader = getAuthenticatedDocumentLoader(identity, { allowPrivateAddress: true });
|
|
765
1107
|
return (url) => {
|
|
766
1108
|
if (new URL(url).host === "example.com") return docLoader(url);
|
|
767
1109
|
return mockDocumentLoader(url);
|
|
@@ -928,7 +1270,7 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
|
928
1270
|
kv,
|
|
929
1271
|
documentLoaderFactory: () => mockDocumentLoader,
|
|
930
1272
|
authenticatedDocumentLoaderFactory(identity) {
|
|
931
|
-
const docLoader = getAuthenticatedDocumentLoader(identity);
|
|
1273
|
+
const docLoader = getAuthenticatedDocumentLoader(identity, { allowPrivateAddress: true });
|
|
932
1274
|
return (url) => {
|
|
933
1275
|
const urlObj = new URL(url);
|
|
934
1276
|
authenticatedRequests.push([url, identity.keyId.href]);
|
|
@@ -1251,7 +1593,7 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
|
1251
1593
|
kv,
|
|
1252
1594
|
documentLoaderFactory: () => mockDocumentLoader,
|
|
1253
1595
|
authenticatedDocumentLoaderFactory(identity) {
|
|
1254
|
-
const docLoader = getAuthenticatedDocumentLoader(identity);
|
|
1596
|
+
const docLoader = getAuthenticatedDocumentLoader(identity, { allowPrivateAddress: true });
|
|
1255
1597
|
return (url) => {
|
|
1256
1598
|
if (new URL(url).host === "example.com") return docLoader(url);
|
|
1257
1599
|
return mockDocumentLoader(url);
|
|
@@ -1386,7 +1728,7 @@ test("FederationImpl.sendActivity()", async (t) => {
|
|
|
1386
1728
|
});
|
|
1387
1729
|
const federation = new FederationImpl({
|
|
1388
1730
|
kv: new MemoryKvStore(),
|
|
1389
|
-
|
|
1731
|
+
allowPrivateAddress: true
|
|
1390
1732
|
});
|
|
1391
1733
|
const context = federation.createContext(new URL("https://example.com/"));
|
|
1392
1734
|
await t.step("success", async () => {
|
|
@@ -3353,7 +3695,7 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
3353
3695
|
const kv = new MemoryKvStore();
|
|
3354
3696
|
const federation = new FederationImpl({
|
|
3355
3697
|
kv,
|
|
3356
|
-
|
|
3698
|
+
allowPrivateAddress: true
|
|
3357
3699
|
});
|
|
3358
3700
|
federation.setActorDispatcher("/{identifier}", async (ctx, identifier) => {
|
|
3359
3701
|
if (identifier !== "1") return null;
|
|
@@ -3462,7 +3804,7 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
3462
3804
|
};
|
|
3463
3805
|
const federation2 = new FederationImpl({
|
|
3464
3806
|
kv,
|
|
3465
|
-
|
|
3807
|
+
allowPrivateAddress: true,
|
|
3466
3808
|
queue
|
|
3467
3809
|
});
|
|
3468
3810
|
federation2.setActorDispatcher("/{identifier}", async (ctx, identifier) => {
|
|
@@ -3585,7 +3927,7 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
3585
3927
|
const asyncEnqueued = [];
|
|
3586
3928
|
const fed = new FederationImpl({
|
|
3587
3929
|
kv,
|
|
3588
|
-
|
|
3930
|
+
allowPrivateAddress: true,
|
|
3589
3931
|
queue: {
|
|
3590
3932
|
enqueue(message) {
|
|
3591
3933
|
return new Promise((resolve) => {
|
|
@@ -3752,10 +4094,10 @@ test({
|
|
|
3752
4094
|
const signedInvite = await signObject(new vocab.Invite({ actor: new URL("https://example.com/person2") }), ed25519PrivateKey, ed25519Multikey.id);
|
|
3753
4095
|
assert(await ctx.routeActivity("id", signedInvite));
|
|
3754
4096
|
assertEquals(activities, [[null, signedOffer], ["id", signedInvite]]);
|
|
3755
|
-
assertFalse(await ctx.routeActivity(null, new vocab.Create({
|
|
4097
|
+
assertFalse(await withDnsLookup(() => Promise.reject(/* @__PURE__ */ new Error("Resolver unavailable")), () => ctx.routeActivity(null, new vocab.Create({
|
|
3756
4098
|
id: new URL("https://example.com/not-found"),
|
|
3757
4099
|
actor: new URL("https://example.com/person")
|
|
3758
|
-
})));
|
|
4100
|
+
}))));
|
|
3759
4101
|
assertEquals(activities, [[null, signedOffer], ["id", signedInvite]]);
|
|
3760
4102
|
assertFalse(await ctx.routeActivity(null, new vocab.Create({
|
|
3761
4103
|
id: new URL("https://example.com/person"),
|
|
@@ -4113,7 +4455,7 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
4113
4455
|
});
|
|
4114
4456
|
const federation = new FederationImpl({
|
|
4115
4457
|
kv: new MemoryKvStore(),
|
|
4116
|
-
|
|
4458
|
+
allowPrivateAddress: true
|
|
4117
4459
|
});
|
|
4118
4460
|
await t.step("skip", async () => {
|
|
4119
4461
|
await new InboxContextImpl(null, {
|
|
@@ -4315,5 +4657,19 @@ test("Federation.fetch() bounds inbox bodies before dispatch", async () => {
|
|
|
4315
4657
|
}), { contextData: void 0 })).status, 202);
|
|
4316
4658
|
assert(dispatched);
|
|
4317
4659
|
});
|
|
4660
|
+
/**
|
|
4661
|
+
* Runs the given function while `node:dns/promises`' `lookup()`, which the
|
|
4662
|
+
* default public fetch resolves hostnames with, is replaced, so that no test
|
|
4663
|
+
* depends on the real DNS.
|
|
4664
|
+
*/
|
|
4665
|
+
async function withDnsLookup(lookup, fn) {
|
|
4666
|
+
const originalLookup = dns.lookup;
|
|
4667
|
+
dns.lookup = lookup;
|
|
4668
|
+
try {
|
|
4669
|
+
return await fn();
|
|
4670
|
+
} finally {
|
|
4671
|
+
dns.lookup = originalLookup;
|
|
4672
|
+
}
|
|
4673
|
+
}
|
|
4318
4674
|
//#endregion
|
|
4319
4675
|
export {};
|
package/dist/federation/mod.cjs
CHANGED
|
@@ -2,7 +2,7 @@ const { Temporal } = require("@js-temporal/polyfill");
|
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
require("../chunk-DDcVe30Y.cjs");
|
|
5
|
-
const require_middleware = require("../middleware-
|
|
5
|
+
const require_middleware = require("../middleware-BbgR7xOI.cjs");
|
|
6
6
|
let es_toolkit = require("es-toolkit");
|
|
7
7
|
//#region src/federation/kv.ts
|
|
8
8
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { $ as ActorKeyPairsDispatcher, A as createFederation, B as RouterRouteResult, C as InboxChallengePolicy, D as FederationKvPrefixes, E as Rfc6570Expression, F as Message, G as InProcessMessageQueueOptions, H as respondWithObject, I as createFederationBuilder, J as MessageQueueListenOptions, K as MessageQueue, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as ActorHandleMapper, R as RouterError, S as IdempotencyStrategy, St as digest, T as ObjectCallbackSetters, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as InProcessMessageQueue, X as ActorAliasMapper, Y as ParallelMessageQueue, Z as ActorDispatcher, _ as FederationBuilder, _t as WebFingerLinksDispatcher, a as InboxContext, at as CustomCollectionCursor, b as FederationStartQueueOptions, bt as PageItems, c as RouteActivityOptions, ct as InboxListener, d as ActorCallbackSetters, dt as ObjectDispatcher, et as AuthorizePredicate, f as CollectionCallbackSetters, ft as OutboxErrorHandler, g as Federation, gt as UnverifiedActivityReason, h as Federatable, ht as UnverifiedActivityHandler, i as GetSignedKeyOptions, it as CustomCollectionCounter, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as NodeInfoDispatcher, m as CustomCollectionCallbackSetters, mt as SharedInboxKeyDispatcher, n as Context, nt as CollectionCursor, o as ParseUriResult, ot as CustomCollectionDispatcher, p as ConstructorWithTypeId, pt as OutboxPermanentFailureHandler, q as MessageQueueEnqueueOptions, r as ForwardActivityOptions, rt as CollectionDispatcher, s as RequestContext, st as InboxErrorHandler, t as ActorKeyPair, tt as CollectionCounter, u as SendActivityOptionsForCollection, ut as ObjectAuthorizePredicate, v as FederationFetchOptions, vt as SendActivityError, w as InboxListenerSetters, x as IdempotencyKeyCallback, xt as buildCollectionSynchronizationHeader, y as FederationOptions, yt as SenderKeyPair, z as RouterOptions } from "../context-
|
|
2
|
+
import { $ as ActorKeyPairsDispatcher, A as createFederation, B as RouterRouteResult, C as InboxChallengePolicy, D as FederationKvPrefixes, E as Rfc6570Expression, F as Message, G as InProcessMessageQueueOptions, H as respondWithObject, I as createFederationBuilder, J as MessageQueueListenOptions, K as MessageQueue, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as ActorHandleMapper, R as RouterError, S as IdempotencyStrategy, St as digest, T as ObjectCallbackSetters, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as InProcessMessageQueue, X as ActorAliasMapper, Y as ParallelMessageQueue, Z as ActorDispatcher, _ as FederationBuilder, _t as WebFingerLinksDispatcher, a as InboxContext, at as CustomCollectionCursor, b as FederationStartQueueOptions, bt as PageItems, c as RouteActivityOptions, ct as InboxListener, d as ActorCallbackSetters, dt as ObjectDispatcher, et as AuthorizePredicate, f as CollectionCallbackSetters, ft as OutboxErrorHandler, g as Federation, gt as UnverifiedActivityReason, h as Federatable, ht as UnverifiedActivityHandler, i as GetSignedKeyOptions, it as CustomCollectionCounter, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as NodeInfoDispatcher, m as CustomCollectionCallbackSetters, mt as SharedInboxKeyDispatcher, n as Context, nt as CollectionCursor, o as ParseUriResult, ot as CustomCollectionDispatcher, p as ConstructorWithTypeId, pt as OutboxPermanentFailureHandler, q as MessageQueueEnqueueOptions, r as ForwardActivityOptions, rt as CollectionDispatcher, s as RequestContext, st as InboxErrorHandler, t as ActorKeyPair, tt as CollectionCounter, u as SendActivityOptionsForCollection, ut as ObjectAuthorizePredicate, v as FederationFetchOptions, vt as SendActivityError, w as InboxListenerSetters, x as IdempotencyKeyCallback, xt as buildCollectionSynchronizationHeader, y as FederationOptions, yt as SenderKeyPair, z as RouterOptions } from "../context-CLaLxi49.cjs";
|
|
3
3
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-CZKl1IUS.cjs";
|
|
4
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-
|
|
4
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-CGUH8Ujp.cjs";
|
|
5
5
|
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { $ as ActorKeyPairsDispatcher, A as createFederation, B as RouterRouteResult, C as InboxChallengePolicy, D as FederationKvPrefixes, E as Rfc6570Expression, F as Message, G as InProcessMessageQueueOptions, H as respondWithObject, I as createFederationBuilder, J as MessageQueueListenOptions, K as MessageQueue, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as ActorHandleMapper, R as RouterError, S as IdempotencyStrategy, St as digest, T as ObjectCallbackSetters, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as InProcessMessageQueue, X as ActorAliasMapper, Y as ParallelMessageQueue, Z as ActorDispatcher, _ as FederationBuilder, _t as WebFingerLinksDispatcher, a as InboxContext, at as CustomCollectionCursor, b as FederationStartQueueOptions, bt as PageItems, c as RouteActivityOptions, ct as InboxListener, d as ActorCallbackSetters, dt as ObjectDispatcher, et as AuthorizePredicate, f as CollectionCallbackSetters, ft as OutboxErrorHandler, g as Federation, gt as UnverifiedActivityReason, h as Federatable, ht as UnverifiedActivityHandler, i as GetSignedKeyOptions, it as CustomCollectionCounter, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as NodeInfoDispatcher, m as CustomCollectionCallbackSetters, mt as SharedInboxKeyDispatcher, n as Context, nt as CollectionCursor, o as ParseUriResult, ot as CustomCollectionDispatcher, p as ConstructorWithTypeId, pt as OutboxPermanentFailureHandler, q as MessageQueueEnqueueOptions, r as ForwardActivityOptions, rt as CollectionDispatcher, s as RequestContext, st as InboxErrorHandler, t as ActorKeyPair, tt as CollectionCounter, u as SendActivityOptionsForCollection, ut as ObjectAuthorizePredicate, v as FederationFetchOptions, vt as SendActivityError, w as InboxListenerSetters, x as IdempotencyKeyCallback, xt as buildCollectionSynchronizationHeader, y as FederationOptions, yt as SenderKeyPair, z as RouterOptions } from "../context-
|
|
2
|
+
import { $ as ActorKeyPairsDispatcher, A as createFederation, B as RouterRouteResult, C as InboxChallengePolicy, D as FederationKvPrefixes, E as Rfc6570Expression, F as Message, G as InProcessMessageQueueOptions, H as respondWithObject, I as createFederationBuilder, J as MessageQueueListenOptions, K as MessageQueue, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as ActorHandleMapper, R as RouterError, S as IdempotencyStrategy, St as digest, T as ObjectCallbackSetters, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as InProcessMessageQueue, X as ActorAliasMapper, Y as ParallelMessageQueue, Z as ActorDispatcher, _ as FederationBuilder, _t as WebFingerLinksDispatcher, a as InboxContext, at as CustomCollectionCursor, b as FederationStartQueueOptions, bt as PageItems, c as RouteActivityOptions, ct as InboxListener, d as ActorCallbackSetters, dt as ObjectDispatcher, et as AuthorizePredicate, f as CollectionCallbackSetters, ft as OutboxErrorHandler, g as Federation, gt as UnverifiedActivityReason, h as Federatable, ht as UnverifiedActivityHandler, i as GetSignedKeyOptions, it as CustomCollectionCounter, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as NodeInfoDispatcher, m as CustomCollectionCallbackSetters, mt as SharedInboxKeyDispatcher, n as Context, nt as CollectionCursor, o as ParseUriResult, ot as CustomCollectionDispatcher, p as ConstructorWithTypeId, pt as OutboxPermanentFailureHandler, q as MessageQueueEnqueueOptions, r as ForwardActivityOptions, rt as CollectionDispatcher, s as RequestContext, st as InboxErrorHandler, t as ActorKeyPair, tt as CollectionCounter, u as SendActivityOptionsForCollection, ut as ObjectAuthorizePredicate, v as FederationFetchOptions, vt as SendActivityError, w as InboxListenerSetters, x as IdempotencyKeyCallback, xt as buildCollectionSynchronizationHeader, y as FederationOptions, yt as SenderKeyPair, z as RouterOptions } from "../context-C0uGVzgk.js";
|
|
3
3
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-CxaI4eGo.js";
|
|
4
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-
|
|
4
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "../mod-CFRocFeQ.js";
|
|
5
5
|
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-
|
|
3
|
+
import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-DIW5S_5L.js";
|
|
4
4
|
import { isEqual } from "es-toolkit";
|
|
5
5
|
//#region src/federation/kv.ts
|
|
6
6
|
/**
|