@fedify/fedify 2.2.0-dev.898 → 2.2.0-dev.924
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-BxNYaOv9.mjs → builder-FoLsluZw.mjs} +3 -3
- package/dist/compat/public-audience.test.d.mts +2 -0
- package/dist/compat/public-audience.test.mjs +178 -0
- package/dist/compat/transformers.test.mjs +2 -2
- package/dist/{deno-DJv-tEfT.mjs → deno-BukNyK1t.mjs} +1 -1
- package/dist/{docloader-iGAzD_2N.mjs → docloader-BgBM76TI.mjs} +2 -2
- package/dist/federation/builder.test.mjs +2 -2
- package/dist/federation/collection.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +4 -4
- package/dist/federation/idempotency.test.mjs +3 -3
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/keycache.test.mjs +2 -2
- package/dist/federation/kv.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +17 -7
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.js +1 -1
- package/dist/federation/mq.test.mjs +15 -8
- package/dist/federation/negotiation.test.mjs +1 -1
- package/dist/federation/retry.test.mjs +1 -1
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/webfinger.test.mjs +2 -2
- package/dist/{http-COBccATS.cjs → http-1uLerNXX.cjs} +1 -1
- package/dist/{http-ETgJ0kEf.mjs → http-DSghOjS0.mjs} +2 -2
- package/dist/{http-IT-3f4WJ.js → http-DiNUVHGB.js} +1 -1
- package/dist/{key-BdVfyalZ.mjs → key-DAfSmMg7.mjs} +1 -1
- package/dist/{kv-cache-NdVl1dI9.js → kv-cache-Dq9VS_Jn.js} +1 -1
- package/dist/{kv-cache-DoM8wkoM.cjs → kv-cache-ia7oECIG.cjs} +1 -1
- package/dist/{ld-BIwbyijT.mjs → ld-DYpo7uUC.mjs} +2 -2
- package/dist/{middleware-D2WkRjr9.mjs → middleware-CjJ_aBdD.mjs} +1 -1
- package/dist/{middleware-AcyKcnPJ.cjs → middleware-Dt0fC6dK.cjs} +5 -4
- package/dist/{middleware-MrcBc-JA.mjs → middleware-aawr753E.mjs} +17 -15
- package/dist/{middleware-PwlQ2vwv.js → middleware-olp7n2S4.js} +4 -3
- package/dist/{middleware-BdLMFU46.cjs → middleware-rZ0jYYM9.cjs} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/client.test.mjs +1 -1
- package/dist/nodeinfo/handler.test.mjs +2 -2
- package/dist/nodeinfo/types.test.mjs +1 -1
- package/dist/otel/exporter.test.mjs +1 -1
- package/dist/{owner-ELkycVNn.mjs → owner-B0_w8O-Y.mjs} +2 -2
- package/dist/{proof-CdHJBGaI.mjs → proof-DDZ2W7TX.mjs} +36 -31
- package/dist/{proof-CngGDTG-.js → proof-DdnQ5edt.js} +218 -41
- package/dist/{proof-D3NCoYW3.cjs → proof-DgRfG4AE.cjs} +221 -38
- package/dist/public-audience-eovWqzOF.mjs +181 -0
- package/dist/{send-Bsg41P7e.mjs → send-DMLb0UwP.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 +60 -2
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +5 -5
- /package/dist/{activity-listener-Ck3JZ_hR.mjs → activity-listener-CFzUqoCS.mjs} +0 -0
- /package/dist/{client-DEpOVgY1.mjs → client-DVu6Fmom.mjs} +0 -0
- /package/dist/{collection-BD6-SZ6O.mjs → collection-BQRKGS7L.mjs} +0 -0
- /package/dist/{keycache-CCSwkQcY.mjs → keycache-C2t1kvP5.mjs} +0 -0
- /package/dist/{kv-tL2TOE9X.mjs → kv-C-TG81Sv.mjs} +0 -0
- /package/dist/{negotiation-DnsfFF8I.mjs → negotiation-xb0QR3u_.mjs} +0 -0
- /package/dist/{retry-B_E3V_Dx.mjs → retry-CJL0poaU.mjs} +0 -0
- /package/dist/{types-DCP0WLdt.mjs → types-CGUnLkU3.mjs} +0 -0
|
@@ -2,8 +2,8 @@ import "@js-temporal/polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { n as RouterError, t as Router } from "./router-CrMLXoOr.mjs";
|
|
5
|
-
import { n as version, t as name } from "./deno-
|
|
6
|
-
import { t as ActivityListenerSet } from "./activity-listener-
|
|
5
|
+
import { n as version, t as name } from "./deno-BukNyK1t.mjs";
|
|
6
|
+
import { t as ActivityListenerSet } from "./activity-listener-CFzUqoCS.mjs";
|
|
7
7
|
import { Tombstone, getTypeId } from "@fedify/vocab";
|
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -58,7 +58,7 @@ var FederationBuilderImpl = class {
|
|
|
58
58
|
this.collectionTypeIds = {};
|
|
59
59
|
}
|
|
60
60
|
async build(options) {
|
|
61
|
-
const { FederationImpl } = await import("./middleware-
|
|
61
|
+
const { FederationImpl } = await import("./middleware-CjJ_aBdD.mjs");
|
|
62
62
|
const f = new FederationImpl(options);
|
|
63
63
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
64
64
|
f.router = this.router.clone();
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
+
import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
|
|
6
|
+
import { t as normalizePublicAudience } from "../public-audience-eovWqzOF.mjs";
|
|
7
|
+
import { test } from "@fedify/fixture";
|
|
8
|
+
import { Create, Note, PUBLIC_COLLECTION } from "@fedify/vocab";
|
|
9
|
+
import { getDocumentLoader, preloadedContexts } from "@fedify/vocab-runtime";
|
|
10
|
+
//#region src/compat/public-audience.test.ts
|
|
11
|
+
const PUBLIC_URI = PUBLIC_COLLECTION.href;
|
|
12
|
+
const AS_CONTEXT = "https://www.w3.org/ns/activitystreams";
|
|
13
|
+
test("normalizePublicAudience() rewrites every addressing field and both CURIE forms", async () => {
|
|
14
|
+
const output = await normalizePublicAudience({
|
|
15
|
+
"@context": AS_CONTEXT,
|
|
16
|
+
type: "Note",
|
|
17
|
+
id: "https://example.com/notes/1",
|
|
18
|
+
to: "as:Public",
|
|
19
|
+
cc: ["as:Public", "https://example.com/bob"],
|
|
20
|
+
bto: "Public",
|
|
21
|
+
bcc: ["Public"],
|
|
22
|
+
audience: ["as:Public", "Public"]
|
|
23
|
+
});
|
|
24
|
+
assertEquals(output.to, PUBLIC_URI);
|
|
25
|
+
assertEquals(output.cc, [PUBLIC_URI, "https://example.com/bob"]);
|
|
26
|
+
assertEquals(output.bto, PUBLIC_URI);
|
|
27
|
+
assertEquals(output.bcc, [PUBLIC_URI]);
|
|
28
|
+
assertEquals(output.audience, [PUBLIC_URI, PUBLIC_URI]);
|
|
29
|
+
});
|
|
30
|
+
test("normalizePublicAudience() normalises activities serialized by @fedify/vocab", async () => {
|
|
31
|
+
const compact = await new Create({
|
|
32
|
+
id: new URL("https://example.com/activities/1"),
|
|
33
|
+
actor: new URL("https://example.com/alice"),
|
|
34
|
+
object: new Note({
|
|
35
|
+
id: new URL("https://example.com/notes/1"),
|
|
36
|
+
content: "Hello, world!",
|
|
37
|
+
tos: [PUBLIC_COLLECTION]
|
|
38
|
+
}),
|
|
39
|
+
tos: [PUBLIC_COLLECTION],
|
|
40
|
+
ccs: [new URL("https://example.com/followers")]
|
|
41
|
+
}).toJsonLd({ format: "compact" });
|
|
42
|
+
assertEquals(compact.to, "as:Public");
|
|
43
|
+
const normalized = await normalizePublicAudience(compact, getDocumentLoader());
|
|
44
|
+
assertEquals(normalized.to, PUBLIC_URI);
|
|
45
|
+
const nestedObject = normalized.object;
|
|
46
|
+
assertEquals(nestedObject.to, PUBLIC_URI);
|
|
47
|
+
});
|
|
48
|
+
test("normalizePublicAudience() is a no-op without the CURIE", async () => {
|
|
49
|
+
const input = {
|
|
50
|
+
"@context": AS_CONTEXT,
|
|
51
|
+
type: "Note",
|
|
52
|
+
id: "https://example.com/notes/3",
|
|
53
|
+
to: PUBLIC_URI
|
|
54
|
+
};
|
|
55
|
+
assertEquals(await normalizePublicAudience(input), input);
|
|
56
|
+
});
|
|
57
|
+
test("normalizePublicAudience() leaves non-addressing fields untouched", async () => {
|
|
58
|
+
const output = await normalizePublicAudience({
|
|
59
|
+
"@context": AS_CONTEXT,
|
|
60
|
+
type: "Note",
|
|
61
|
+
id: "https://example.com/notes/4",
|
|
62
|
+
name: "as:Public",
|
|
63
|
+
to: "as:Public"
|
|
64
|
+
});
|
|
65
|
+
assertEquals(output.name, "as:Public");
|
|
66
|
+
assertEquals(output.to, PUBLIC_URI);
|
|
67
|
+
});
|
|
68
|
+
test("normalizePublicAudience() rewrites without canonicalization for known-safe contexts", async () => {
|
|
69
|
+
const rejecting = () => {
|
|
70
|
+
throw new Error("contextLoader should not be called for a known-safe @context");
|
|
71
|
+
};
|
|
72
|
+
assertEquals((await normalizePublicAudience({
|
|
73
|
+
"@context": AS_CONTEXT,
|
|
74
|
+
type: "Note",
|
|
75
|
+
id: "https://example.com/notes/fast1",
|
|
76
|
+
to: "as:Public"
|
|
77
|
+
}, rejecting)).to, PUBLIC_URI);
|
|
78
|
+
assertEquals((await normalizePublicAudience({
|
|
79
|
+
"@context": [AS_CONTEXT, "https://w3id.org/security/data-integrity/v1"],
|
|
80
|
+
type: "Note",
|
|
81
|
+
id: "https://example.com/notes/fast2",
|
|
82
|
+
to: "as:Public"
|
|
83
|
+
}, rejecting)).to, PUBLIC_URI);
|
|
84
|
+
});
|
|
85
|
+
test("normalizePublicAudience() falls back to canonicalization for unknown-URL contexts", async () => {
|
|
86
|
+
let loaderCalls = 0;
|
|
87
|
+
const loader = (url) => {
|
|
88
|
+
loaderCalls++;
|
|
89
|
+
return Promise.resolve({
|
|
90
|
+
contextUrl: null,
|
|
91
|
+
documentUrl: url,
|
|
92
|
+
document: preloadedContexts[AS_CONTEXT]
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
assertEquals((await normalizePublicAudience({
|
|
96
|
+
"@context": [AS_CONTEXT, "https://custom.example/ctx"],
|
|
97
|
+
type: "Note",
|
|
98
|
+
id: "https://example.com/notes/unknown",
|
|
99
|
+
to: "as:Public"
|
|
100
|
+
}, loader)).to, PUBLIC_URI);
|
|
101
|
+
assertEquals(loaderCalls > 0, true);
|
|
102
|
+
});
|
|
103
|
+
test("normalizePublicAudience() leaves @context subtrees untouched", async () => {
|
|
104
|
+
const inlineCtx = (await normalizePublicAudience({
|
|
105
|
+
"@context": [AS_CONTEXT, { "customTerm": "as:Public" }],
|
|
106
|
+
type: "Note",
|
|
107
|
+
id: "https://example.com/notes/context",
|
|
108
|
+
to: PUBLIC_URI
|
|
109
|
+
}))["@context"][1];
|
|
110
|
+
assertEquals(inlineCtx.customTerm, "as:Public");
|
|
111
|
+
});
|
|
112
|
+
test("normalizePublicAudience() does not traverse prototype-polluted keys", async () => {
|
|
113
|
+
const polluted = Object.create({ to: "as:Public" });
|
|
114
|
+
polluted["@context"] = AS_CONTEXT;
|
|
115
|
+
polluted.type = "Note";
|
|
116
|
+
polluted.id = "https://example.com/notes/proto";
|
|
117
|
+
const output = await normalizePublicAudience(polluted);
|
|
118
|
+
assertEquals(Object.hasOwn(output, "to"), false);
|
|
119
|
+
});
|
|
120
|
+
test("normalizePublicAudience() stops before blowing the stack on pathological nesting", async () => {
|
|
121
|
+
let deep = { to: "as:Public" };
|
|
122
|
+
for (let i = 0; i < 256; i++) deep = { nested: deep };
|
|
123
|
+
assertEquals(typeof await normalizePublicAudience({
|
|
124
|
+
"@context": AS_CONTEXT,
|
|
125
|
+
type: "Note",
|
|
126
|
+
id: "https://example.com/notes/deep",
|
|
127
|
+
to: "as:Public",
|
|
128
|
+
object: deep
|
|
129
|
+
}), "object");
|
|
130
|
+
});
|
|
131
|
+
test("normalizePublicAudience() does not poison the global prototype via a __proto__ key", async () => {
|
|
132
|
+
await normalizePublicAudience(JSON.parse(`{
|
|
133
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
134
|
+
"type": "Note",
|
|
135
|
+
"id": "https://example.com/notes/proto-pollution",
|
|
136
|
+
"to": "as:Public",
|
|
137
|
+
"__proto__": { "polluted": true }
|
|
138
|
+
}`));
|
|
139
|
+
assertEquals(Object.prototype.polluted, void 0);
|
|
140
|
+
});
|
|
141
|
+
test("normalizePublicAudience() bails out on nested @context that redefines as:", async () => {
|
|
142
|
+
const output = await normalizePublicAudience({
|
|
143
|
+
"@context": AS_CONTEXT,
|
|
144
|
+
type: "Create",
|
|
145
|
+
id: "https://example.com/activities/nested",
|
|
146
|
+
actor: "https://example.com/alice",
|
|
147
|
+
to: "as:Public",
|
|
148
|
+
object: {
|
|
149
|
+
"@context": { "as": "https://not-activitystreams.example/" },
|
|
150
|
+
type: "https://www.w3.org/ns/activitystreams#Note",
|
|
151
|
+
id: "https://example.com/objects/nested",
|
|
152
|
+
to: "as:Public"
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
assertEquals(output.to, "as:Public");
|
|
156
|
+
const nested = output.object;
|
|
157
|
+
assertEquals(nested.to, "as:Public");
|
|
158
|
+
});
|
|
159
|
+
test("normalizePublicAudience() bails out when the rewrite changes semantics", async () => {
|
|
160
|
+
const output = await normalizePublicAudience({
|
|
161
|
+
"@context": {
|
|
162
|
+
"as": "https://not-activitystreams.example/",
|
|
163
|
+
"to": {
|
|
164
|
+
"@id": "https://www.w3.org/ns/activitystreams#to",
|
|
165
|
+
"@type": "@id"
|
|
166
|
+
},
|
|
167
|
+
"type": "@type",
|
|
168
|
+
"id": "@id"
|
|
169
|
+
},
|
|
170
|
+
type: "https://www.w3.org/ns/activitystreams#Note",
|
|
171
|
+
id: "https://example.com/notes/5",
|
|
172
|
+
to: "as:Public"
|
|
173
|
+
});
|
|
174
|
+
assertEquals(output.to, "as:Public");
|
|
175
|
+
assertNotEquals(output.to, PUBLIC_URI);
|
|
176
|
+
});
|
|
177
|
+
//#endregion
|
|
178
|
+
export {};
|
|
@@ -4,8 +4,8 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
|
|
6
6
|
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
7
|
-
import { t as MemoryKvStore } from "../kv-
|
|
8
|
-
import { n as FederationImpl, v as actorDehydrator, y as autoIdAssigner } from "../middleware-
|
|
7
|
+
import { t as MemoryKvStore } from "../kv-C-TG81Sv.mjs";
|
|
8
|
+
import { n as FederationImpl, v as actorDehydrator, y as autoIdAssigner } from "../middleware-aawr753E.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
import { Follow, Person } from "@fedify/vocab";
|
|
11
11
|
//#region src/compat/transformers.test.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { o as validateCryptoKey } from "./key-
|
|
5
|
-
import { n as doubleKnock } from "./http-
|
|
4
|
+
import { o as validateCryptoKey } from "./key-DAfSmMg7.mjs";
|
|
5
|
+
import { n as doubleKnock } from "./http-DSghOjS0.mjs";
|
|
6
6
|
import { curry } from "es-toolkit";
|
|
7
7
|
import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -5,8 +5,8 @@ import { n as RouterError } from "../router-CrMLXoOr.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
6
|
import { a as assertExists } from "../std__assert-Duiq_YC9.mjs";
|
|
7
7
|
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
8
|
-
import { t as MemoryKvStore } from "../kv-
|
|
9
|
-
import { n as createFederationBuilder } from "../builder-
|
|
8
|
+
import { t as MemoryKvStore } from "../kv-C-TG81Sv.mjs";
|
|
9
|
+
import { n as createFederationBuilder } from "../builder-FoLsluZw.mjs";
|
|
10
10
|
import { test } from "@fedify/fixture";
|
|
11
11
|
import { Activity, Note, Person } from "@fedify/vocab";
|
|
12
12
|
//#region src/federation/builder.test.ts
|
|
@@ -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 "../std__assert-Duiq_YC9.mjs";
|
|
6
|
-
import { n as digest, t as buildCollectionSynchronizationHeader } from "../collection-
|
|
6
|
+
import { n as digest, t as buildCollectionSynchronizationHeader } from "../collection-BQRKGS7L.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
import { decodeHex } from "byte-encodings/hex";
|
|
9
9
|
//#region src/federation/collection.test.ts
|
|
@@ -7,11 +7,11 @@ import "../std__assert-Duiq_YC9.mjs";
|
|
|
7
7
|
import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
|
|
8
8
|
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
9
9
|
import { r as parseAcceptSignature } from "../accept-Dd__NiUL.mjs";
|
|
10
|
-
import { s as signRequest } from "../http-
|
|
10
|
+
import { s as signRequest } from "../http-DSghOjS0.mjs";
|
|
11
11
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, s as rsaPublicKey2 } from "../keys-BAK-tUlf.mjs";
|
|
12
|
-
import { t as MemoryKvStore } from "../kv-
|
|
13
|
-
import { c as handleActor, d as handleInbox, f as handleObject, h as respondWithObjectIfAcceptable, l as handleCollection, m as respondWithObject, o as createFederation, p as handleOutbox, u as handleCustomCollection } from "../middleware-
|
|
14
|
-
import { t as ActivityListenerSet } from "../activity-listener-
|
|
12
|
+
import { t as MemoryKvStore } from "../kv-C-TG81Sv.mjs";
|
|
13
|
+
import { c as handleActor, d as handleInbox, f as handleObject, h as respondWithObjectIfAcceptable, l as handleCollection, m as respondWithObject, o as createFederation, p as handleOutbox, u as handleCustomCollection } from "../middleware-aawr753E.mjs";
|
|
14
|
+
import { t as ActivityListenerSet } from "../activity-listener-CFzUqoCS.mjs";
|
|
15
15
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
16
16
|
import { Activity, Create, Note, Person, Tombstone } from "@fedify/vocab";
|
|
17
17
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import "../std__assert-Duiq_YC9.mjs";
|
|
6
6
|
import { n as ed25519PrivateKey, r as ed25519PublicKey, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
7
|
-
import { r as signObject } from "../proof-
|
|
8
|
-
import { t as MemoryKvStore } from "../kv-
|
|
9
|
-
import { o as createFederation } from "../middleware-
|
|
7
|
+
import { r as signObject } from "../proof-DDZ2W7TX.mjs";
|
|
8
|
+
import { t as MemoryKvStore } from "../kv-C-TG81Sv.mjs";
|
|
9
|
+
import { o as createFederation } from "../middleware-aawr753E.mjs";
|
|
10
10
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
11
11
|
import { Create, Follow, Person } from "@fedify/vocab";
|
|
12
12
|
//#region src/federation/idempotency.test.ts
|
|
@@ -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 { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
6
|
-
import { t as ActivityListenerSet } from "../activity-listener-
|
|
6
|
+
import { t as ActivityListenerSet } from "../activity-listener-CFzUqoCS.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
import { Activity, Create, Invite, Offer, Update } from "@fedify/vocab";
|
|
9
9
|
//#region src/federation/inbox.test.ts
|
|
@@ -4,8 +4,8 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
|
|
6
6
|
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
7
|
-
import { t as MemoryKvStore } from "../kv-
|
|
8
|
-
import { t as KvKeyCache } from "../keycache-
|
|
7
|
+
import { t as MemoryKvStore } from "../kv-C-TG81Sv.mjs";
|
|
8
|
+
import { t as KvKeyCache } from "../keycache-C2t1kvP5.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
11
11
|
//#region src/federation/keycache.test.ts
|
|
@@ -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 "../std__assert-Duiq_YC9.mjs";
|
|
6
|
-
import { t as MemoryKvStore } from "../kv-
|
|
6
|
+
import { t as MemoryKvStore } from "../kv-C-TG81Sv.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
//#region src/federation/kv.test.ts
|
|
9
9
|
test("MemoryKvStore", async (t) => {
|
|
@@ -10,14 +10,14 @@ import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
|
|
|
10
10
|
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
11
11
|
import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
|
|
12
12
|
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
13
|
-
import { l as verifyRequest, s as signRequest } from "../http-
|
|
13
|
+
import { l as verifyRequest, s as signRequest } from "../http-DSghOjS0.mjs";
|
|
14
14
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
15
|
-
import { t as getAuthenticatedDocumentLoader } from "../docloader-
|
|
16
|
-
import { a as signJsonLd, o as verifyJsonLd, r as detachSignature } from "../ld-
|
|
17
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
18
|
-
import { i as verifyObject, r as signObject } from "../proof-
|
|
19
|
-
import { t as MemoryKvStore } from "../kv-
|
|
20
|
-
import { i as KvSpecDeterminer, n as FederationImpl, o as createFederation, r as InboxContextImpl, t as ContextImpl } from "../middleware-
|
|
15
|
+
import { t as getAuthenticatedDocumentLoader } from "../docloader-BgBM76TI.mjs";
|
|
16
|
+
import { a as signJsonLd, o as verifyJsonLd, r as detachSignature } from "../ld-DYpo7uUC.mjs";
|
|
17
|
+
import { t as doesActorOwnKey } from "../owner-B0_w8O-Y.mjs";
|
|
18
|
+
import { i as verifyObject, r as signObject } from "../proof-DDZ2W7TX.mjs";
|
|
19
|
+
import { t as MemoryKvStore } from "../kv-C-TG81Sv.mjs";
|
|
20
|
+
import { i as KvSpecDeterminer, n as FederationImpl, o as createFederation, r as InboxContextImpl, t as ContextImpl } from "../middleware-aawr753E.mjs";
|
|
21
21
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
22
22
|
import * as vocab from "@fedify/vocab";
|
|
23
23
|
import { getTypeId, lookupObject } from "@fedify/vocab";
|
|
@@ -1805,6 +1805,16 @@ test("FederationImpl.sendActivity()", async (t) => {
|
|
|
1805
1805
|
assertEquals(request?.url, "https://example.com/inbox");
|
|
1806
1806
|
assertEquals(request?.headers.get("Content-Type"), "application/activity+json");
|
|
1807
1807
|
verified = null;
|
|
1808
|
+
await federation.sendActivity([{
|
|
1809
|
+
privateKey: rsaPrivateKey3,
|
|
1810
|
+
keyId: rsaPublicKey3.id
|
|
1811
|
+
}], inboxes, activity.clone({
|
|
1812
|
+
actor: new URL("https://example.com/person2"),
|
|
1813
|
+
tos: [vocab.PUBLIC_COLLECTION]
|
|
1814
|
+
}), { context });
|
|
1815
|
+
assertEquals(verified, ["ld", "http"]);
|
|
1816
|
+
assertEquals((await request?.json())?.to, vocab.PUBLIC_COLLECTION.href);
|
|
1817
|
+
verified = null;
|
|
1808
1818
|
await federation.sendActivity([{
|
|
1809
1819
|
privateKey: rsaPrivateKey3,
|
|
1810
1820
|
keyId: rsaPublicKey3.id
|
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-Dt0fC6dK.cjs");
|
|
6
6
|
let es_toolkit = require("es-toolkit");
|
|
7
7
|
//#region src/federation/kv.ts
|
|
8
8
|
/**
|
package/dist/federation/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import "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-olp7n2S4.js";
|
|
4
4
|
import { isEqual } from "es-toolkit";
|
|
5
5
|
//#region src/federation/kv.ts
|
|
6
6
|
/**
|
|
@@ -238,6 +238,19 @@ var ParallelMessageQueue = class ParallelMessageQueue {
|
|
|
238
238
|
};
|
|
239
239
|
//#endregion
|
|
240
240
|
//#region src/federation/mq.test.ts
|
|
241
|
+
async function disposeMessageQueue(mq) {
|
|
242
|
+
if (Symbol.asyncDispose in mq) {
|
|
243
|
+
const dispose = mq[Symbol.asyncDispose];
|
|
244
|
+
if (typeof dispose === "function") {
|
|
245
|
+
await dispose.call(mq);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (Symbol.dispose in mq) {
|
|
250
|
+
const dispose = mq[Symbol.dispose];
|
|
251
|
+
if (typeof dispose === "function") dispose.call(mq);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
241
254
|
test("InProcessMessageQueue", async (t) => {
|
|
242
255
|
const mq = new InProcessMessageQueue();
|
|
243
256
|
await t.step("nativeRetrial property", () => {
|
|
@@ -367,10 +380,7 @@ test("MessageQueue.nativeRetrial", async (t) => {
|
|
|
367
380
|
const { DenoKvMessageQueue } = await import(packageName());
|
|
368
381
|
const mq = new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
|
|
369
382
|
assert(mq.nativeRetrial);
|
|
370
|
-
|
|
371
|
-
const dispose = mq[Symbol.dispose];
|
|
372
|
-
if (typeof dispose === "function") dispose.call(mq);
|
|
373
|
-
}
|
|
383
|
+
await disposeMessageQueue(mq);
|
|
374
384
|
});
|
|
375
385
|
await t.step("WorkersMessageQueue mock", () => {
|
|
376
386
|
class MockQueue {
|
|
@@ -453,10 +463,7 @@ for (const mqName in queues) test({
|
|
|
453
463
|
await waitFor(() => messages.length >= 20, 15e3);
|
|
454
464
|
controller.abort();
|
|
455
465
|
await listening;
|
|
456
|
-
|
|
457
|
-
const dispose = mq[Symbol.dispose];
|
|
458
|
-
if (typeof dispose === "function") dispose.call(mq);
|
|
459
|
-
}
|
|
466
|
+
await disposeMessageQueue(mq);
|
|
460
467
|
}
|
|
461
468
|
});
|
|
462
469
|
async function waitFor(predicate, timeoutMs) {
|
|
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import "../std__assert-Duiq_YC9.mjs";
|
|
5
5
|
import { n as assertFalse } from "../assert_rejects-B-qJtC9Z.mjs";
|
|
6
6
|
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
7
|
-
import { t as acceptsJsonLd } from "../negotiation-
|
|
7
|
+
import { t as acceptsJsonLd } from "../negotiation-xb0QR3u_.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/federation/negotiation.test.ts
|
|
10
10
|
test("acceptsJsonLd()", () => {
|
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { l as AssertionError, t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
|
|
6
|
-
import { t as createExponentialBackoffPolicy } from "../retry-
|
|
6
|
+
import { t as createExponentialBackoffPolicy } from "../retry-CJL0poaU.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
//#region src/federation/retry.test.ts
|
|
9
9
|
test("createExponentialBackoffPolicy()", () => {
|
|
@@ -8,10 +8,10 @@ import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z
|
|
|
8
8
|
import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
|
|
9
9
|
import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
|
|
10
10
|
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
11
|
-
import { l as verifyRequest } from "../http-
|
|
11
|
+
import { l as verifyRequest } from "../http-DSghOjS0.mjs";
|
|
12
12
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
13
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
14
|
-
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-
|
|
13
|
+
import { t as doesActorOwnKey } from "../owner-B0_w8O-Y.mjs";
|
|
14
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-DMLb0UwP.mjs";
|
|
15
15
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
16
16
|
import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
|
|
17
17
|
//#region src/federation/send.test.ts
|
|
@@ -4,8 +4,8 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { r as createRequestContext } from "../context-Dk_tacqz.mjs";
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
6
|
import "../std__assert-Duiq_YC9.mjs";
|
|
7
|
-
import { t as MemoryKvStore } from "../kv-
|
|
8
|
-
import { o as createFederation, s as handleWebFinger } from "../middleware-
|
|
7
|
+
import { t as MemoryKvStore } from "../kv-C-TG81Sv.mjs";
|
|
8
|
+
import { o as createFederation, s as handleWebFinger } from "../middleware-aawr753E.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
import { Image, Link, Person, Tombstone } from "@fedify/vocab";
|
|
11
11
|
//#region src/federation/webfinger.test.ts
|
|
@@ -11,7 +11,7 @@ let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conve
|
|
|
11
11
|
let byte_encodings_base64 = require("byte-encodings/base64");
|
|
12
12
|
//#region deno.json
|
|
13
13
|
var name = "@fedify/fedify";
|
|
14
|
-
var version = "2.2.0-dev.
|
|
14
|
+
var version = "2.2.0-dev.924+c82ee90a";
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/sig/accept.ts
|
|
17
17
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
4
|
+
import { n as version, t as name } from "./deno-BukNyK1t.mjs";
|
|
5
5
|
import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-Dd__NiUL.mjs";
|
|
6
|
-
import { o as validateCryptoKey, r as fetchKeyDetailed } from "./key-
|
|
6
|
+
import { o as validateCryptoKey, r as fetchKeyDetailed } from "./key-DAfSmMg7.mjs";
|
|
7
7
|
import { CryptographicKey } from "@fedify/vocab";
|
|
8
8
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
@@ -10,7 +10,7 @@ import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } fro
|
|
|
10
10
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
11
11
|
//#region deno.json
|
|
12
12
|
var name = "@fedify/fedify";
|
|
13
|
-
var version = "2.2.0-dev.
|
|
13
|
+
var version = "2.2.0-dev.924+c82ee90a";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/sig/accept.ts
|
|
16
16
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
4
|
+
import { n as version, t as name } from "./deno-BukNyK1t.mjs";
|
|
5
5
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
6
6
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
7
7
|
import { FetchError, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { d as validateCryptoKey, t as doubleKnock } from "./http-
|
|
3
|
+
import { d as validateCryptoKey, t as doubleKnock } from "./http-DiNUVHGB.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { curry } from "es-toolkit";
|
|
6
6
|
import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
require("./chunk-DDcVe30Y.cjs");
|
|
4
|
-
const require_http = require("./http-
|
|
4
|
+
const require_http = require("./http-1uLerNXX.cjs");
|
|
5
5
|
let _logtape_logtape = require("@logtape/logtape");
|
|
6
6
|
let es_toolkit = require("es-toolkit");
|
|
7
7
|
let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { n as fetchKey, o as validateCryptoKey } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-BukNyK1t.mjs";
|
|
5
|
+
import { n as fetchKey, o as validateCryptoKey } from "./key-DAfSmMg7.mjs";
|
|
6
6
|
import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
|
|
7
7
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -2,10 +2,10 @@ const { Temporal } = require("@js-temporal/polyfill");
|
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
require("./chunk-DDcVe30Y.cjs");
|
|
4
4
|
const require_transformers = require("./transformers-NeAONrAq.cjs");
|
|
5
|
-
const require_http = require("./http-
|
|
6
|
-
const require_proof = require("./proof-
|
|
5
|
+
const require_http = require("./http-1uLerNXX.cjs");
|
|
6
|
+
const require_proof = require("./proof-DgRfG4AE.cjs");
|
|
7
7
|
const require_types = require("./types-KC4QAoxe.cjs");
|
|
8
|
-
const require_kv_cache = require("./kv-cache-
|
|
8
|
+
const require_kv_cache = require("./kv-cache-ia7oECIG.cjs");
|
|
9
9
|
let _logtape_logtape = require("@logtape/logtape");
|
|
10
10
|
let _fedify_vocab = require("@fedify/vocab");
|
|
11
11
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
@@ -210,7 +210,7 @@ var FederationBuilderImpl = class {
|
|
|
210
210
|
this.collectionTypeIds = {};
|
|
211
211
|
}
|
|
212
212
|
async build(options) {
|
|
213
|
-
const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-
|
|
213
|
+
const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-rZ0jYYM9.cjs"));
|
|
214
214
|
const f = new FederationImpl(options);
|
|
215
215
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
216
216
|
f.router = this.router.clone();
|
|
@@ -3283,6 +3283,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3283
3283
|
format: "compact",
|
|
3284
3284
|
contextLoader
|
|
3285
3285
|
});
|
|
3286
|
+
jsonLd = await require_proof.normalizePublicAudience(jsonLd, contextLoader);
|
|
3286
3287
|
if (rsaKey == null) logger.warn("No supported key found to create a Linked Data signature for the activity {activityId}. The activity will be sent without a Linked Data signature. In order to create a Linked Data signature, at least one RSASSA-PKCS1-v1_5 key must be provided.", {
|
|
3287
3288
|
activityId,
|
|
3288
3289
|
keys: keys.map((pair) => ({
|