@fedify/fedify 2.0.36-dev.2734 → 2.0.36-dev.2760

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.
Files changed (66) hide show
  1. package/dist/{builder-D0y_1xPt.mjs → builder-CyuiJaas.mjs} +3 -3
  2. package/dist/compat/transformers.test.mjs +2 -2
  3. package/dist/{deno-CvHOP0XE.mjs → deno-Bbso5CSl.mjs} +1 -1
  4. package/dist/{docloader-QmdzA0HA.mjs → docloader-CP5VuWA0.mjs} +2 -2
  5. package/dist/federation/builder.test.mjs +2 -2
  6. package/dist/federation/collection.test.mjs +1 -1
  7. package/dist/federation/handler.test.mjs +206 -15
  8. package/dist/federation/idempotency.test.mjs +3 -3
  9. package/dist/federation/inbox.test.mjs +1 -1
  10. package/dist/federation/keycache.test.mjs +2 -2
  11. package/dist/federation/kv.test.mjs +1 -1
  12. package/dist/federation/middleware.test.mjs +102 -8
  13. package/dist/federation/mod.cjs +1 -1
  14. package/dist/federation/mod.js +1 -1
  15. package/dist/federation/negotiation.test.mjs +1 -1
  16. package/dist/federation/retry.test.mjs +1 -1
  17. package/dist/federation/send.test.mjs +3 -3
  18. package/dist/federation/temporal.test.mjs +1 -1
  19. package/dist/federation/webfinger.test.mjs +2 -2
  20. package/dist/{http-DM--MHnA.mjs → http-Cp7sQLeG.mjs} +2 -2
  21. package/dist/{http-CacZaxQy.js → http-D03Qcwc-.js} +1 -1
  22. package/dist/{http-CIiwaoIn.cjs → http-DBBUPm9V.cjs} +1 -1
  23. package/dist/{inbox-BgsnvP5o.mjs → inbox-DTuh59nR.mjs} +1 -1
  24. package/dist/{key-RrdwitZu.mjs → key-CsY0Ifod.mjs} +1 -1
  25. package/dist/{kv-cache--kqYNgl4.cjs → kv-cache-BpjVni_0.cjs} +1 -1
  26. package/dist/{kv-cache-DO77nN26.js → kv-cache-CVxDhqGp.js} +1 -1
  27. package/dist/{ld-BpBoDQsD.mjs → ld-dYjiHKj1.mjs} +38 -8
  28. package/dist/ld-signature-_KYhPsqt.mjs +23 -0
  29. package/dist/{middleware-ByORyvfD.cjs → middleware-2zkNwQvz.cjs} +1 -1
  30. package/dist/{middleware-DoMxpm9r.mjs → middleware-3x7W0auZ.mjs} +31 -27
  31. package/dist/{middleware-DkQNfZyL.cjs → middleware-5EN1mHvx.cjs} +18 -14
  32. package/dist/{middleware-BcLbgxfC.js → middleware-DFR4tBL2.js} +17 -13
  33. package/dist/{middleware-j3sV7iws.mjs → middleware-DvCyN-xk.mjs} +1 -1
  34. package/dist/mod.cjs +4 -4
  35. package/dist/mod.js +4 -4
  36. package/dist/nodeinfo/client.test.mjs +1 -1
  37. package/dist/nodeinfo/handler.test.mjs +2 -2
  38. package/dist/nodeinfo/types.test.mjs +1 -1
  39. package/dist/otel/exporter.test.mjs +1 -1
  40. package/dist/{owner-zSUyR5Fs.mjs → owner-A1Xol6Zh.mjs} +2 -2
  41. package/dist/{proof-qxFPzf3D.cjs → proof-CCZCT2xF.cjs} +43 -22
  42. package/dist/{proof-C90umkRN.mjs → proof-DCqYLXDl.mjs} +2 -2
  43. package/dist/{proof-DJvdhpXO.js → proof-DGOXBmlo.js} +36 -21
  44. package/dist/{send-BE4hcPfe.mjs → send-yQno-6bP.mjs} +2 -2
  45. package/dist/sig/http.test.mjs +2 -2
  46. package/dist/sig/key-types.test.d.mts +1 -1
  47. package/dist/sig/key.test.mjs +2 -2
  48. package/dist/sig/ld.test.mjs +223 -4
  49. package/dist/sig/mod.cjs +2 -2
  50. package/dist/sig/mod.js +2 -2
  51. package/dist/sig/owner.test.mjs +1 -1
  52. package/dist/sig/proof.test.mjs +26 -3
  53. package/dist/{temporal-BQUGkj5T.mjs → temporal-C26UV3h7.mjs} +1 -1
  54. package/dist/testing/mod.d.mts +1 -1
  55. package/dist/utils/docloader.test.mjs +2 -2
  56. package/dist/utils/mod.cjs +1 -1
  57. package/dist/utils/mod.js +1 -1
  58. package/package.json +6 -6
  59. /package/dist/{callback-CJd-aCRE.d.mts → callback-BFMEE_9V.d.mts} +0 -0
  60. /package/dist/{client-DGNacEx_.mjs → client-DLAWT9ep.mjs} +0 -0
  61. /package/dist/{collection-DI6YzYpd.mjs → collection-ChgDTHLz.mjs} +0 -0
  62. /package/dist/{keycache-DBD6fzl1.mjs → keycache-crDMn2HK.mjs} +0 -0
  63. /package/dist/{kv-mI4Ix2EU.mjs → kv-BrZHNugx.mjs} +0 -0
  64. /package/dist/{negotiation-TWEs6Cl8.mjs → negotiation-BehA2uul.mjs} +0 -0
  65. /package/dist/{retry-Ddbq3AcK.mjs → retry-B_E3V_Dx.mjs} +0 -0
  66. /package/dist/{types-MNlFfxjv.mjs → types-C37hquWI.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-CvHOP0XE.mjs";
6
- import { t as InboxListenerSet } from "./inbox-BgsnvP5o.mjs";
5
+ import { n as version, t as name } from "./deno-Bbso5CSl.mjs";
6
+ import { t as InboxListenerSet } from "./inbox-DTuh59nR.mjs";
7
7
  import { getTypeId } from "@fedify/vocab";
8
8
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
9
9
  import { getLogger } from "@logtape/logtape";
@@ -43,7 +43,7 @@ var FederationBuilderImpl = class {
43
43
  this.collectionTypeIds = {};
44
44
  }
45
45
  async build(options) {
46
- const { FederationImpl } = await import("./middleware-j3sV7iws.mjs");
46
+ const { FederationImpl } = await import("./middleware-DvCyN-xk.mjs");
47
47
  const f = new FederationImpl(options);
48
48
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
49
49
  f.router = this.router.clone();
@@ -3,8 +3,8 @@ 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 MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
7
- import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-DoMxpm9r.mjs";
6
+ import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
7
+ import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-3x7W0auZ.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  import { Follow, Person } from "@fedify/vocab";
10
10
  //#region src/compat/transformers.test.ts
@@ -3,6 +3,6 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  //#region deno.json
5
5
  var name = "@fedify/fedify";
6
- var version = "2.0.36-dev.2734+3364869b";
6
+ var version = "2.0.36-dev.2760+4342c983";
7
7
  //#endregion
8
8
  export { version as n, name as t };
@@ -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-RrdwitZu.mjs";
5
- import { r as doubleKnockScoped } from "./http-DM--MHnA.mjs";
4
+ import { o as validateCryptoKey } from "./key-CsY0Ifod.mjs";
5
+ import { r as doubleKnockScoped } from "./http-Cp7sQLeG.mjs";
6
6
  import { curry } from "es-toolkit";
7
7
  import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest } from "@fedify/vocab-runtime";
8
8
  import { openDirectFetch, openPublicFetch } from "@fedify/vocab-runtime/internal";
@@ -4,8 +4,8 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { i as assertExists, n as assertStrictEquals } from "../std__assert-DflMZha5.mjs";
6
6
  import { t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
7
- import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
8
- import { n as createFederationBuilder } from "../builder-D0y_1xPt.mjs";
7
+ import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
8
+ import { n as createFederationBuilder } from "../builder-CyuiJaas.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  import { Activity, Note, Person } from "@fedify/vocab";
11
11
  //#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-DflMZha5.mjs";
6
- import { n as digest, t as buildCollectionSynchronizationHeader } from "../collection-DI6YzYpd.mjs";
6
+ import { n as digest, t as buildCollectionSynchronizationHeader } from "../collection-ChgDTHLz.mjs";
7
7
  import { test } from "@fedify/fixture";
8
8
  import { decodeHex } from "byte-encodings/hex";
9
9
  //#region src/federation/collection.test.ts
@@ -4,18 +4,21 @@ globalThis.addEventListener = () => {};
4
4
  import { n as createRequestContext, t as createInboxContext } from "../context-Juj6bdHC.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-DflMZha5.mjs";
7
+ import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
7
8
  import { t as assert } from "../assert-BhQd8QHP.mjs";
8
9
  import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
9
- import { i as generateCryptoKeyPair } from "../key-RrdwitZu.mjs";
10
- import { c as signRequest } from "../http-DM--MHnA.mjs";
10
+ import { i as generateCryptoKeyPair } from "../key-CsY0Ifod.mjs";
11
+ import { c as signRequest } from "../http-Cp7sQLeG.mjs";
11
12
  import { a as rsaPrivateKey3, c as rsaPublicKey3, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
12
- import { a as compactJsonLd, f as signJsonLd } from "../ld-BpBoDQsD.mjs";
13
- import { n as signObject } from "../proof-C90umkRN.mjs";
14
- import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
15
- import { a as createFederation, c as handleCollection, d as handleObject, f as respondWithObject, l as handleCustomCollection, p as respondWithObjectIfAcceptable, s as handleActor, u as handleInbox } from "../middleware-DoMxpm9r.mjs";
16
- import { t as InboxListenerSet } from "../inbox-BgsnvP5o.mjs";
13
+ import { a as compactJsonLd, m as signJsonLd } from "../ld-dYjiHKj1.mjs";
14
+ import { t as ldSignatureWithoutCreated } from "../ld-signature-_KYhPsqt.mjs";
15
+ import { n as signObject } from "../proof-DCqYLXDl.mjs";
16
+ import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
17
+ import { a as createFederation, c as handleCollection, d as handleObject, f as respondWithObject, l as handleCustomCollection, p as respondWithObjectIfAcceptable, s as handleActor, u as handleInbox } from "../middleware-3x7W0auZ.mjs";
18
+ import { t as InboxListenerSet } from "../inbox-DTuh59nR.mjs";
17
19
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
18
20
  import { Create, CryptographicKey, Multikey, Note, Person } from "@fedify/vocab";
21
+ import { configure, reset } from "@logtape/logtape";
19
22
  //#region src/federation/handler.test.ts
20
23
  test("handleActor()", async () => {
21
24
  let context = createRequestContext({
@@ -575,7 +578,13 @@ test("handleCollection()", async () => {
575
578
  "@id": "fedibird:emojiReactions",
576
579
  "@type": "@id"
577
580
  }
578
- }
581
+ },
582
+ { orderedItems: {
583
+ "@id": "https://www.w3.org/ns/activitystreams#items",
584
+ "@type": "@id",
585
+ "@container": "@list",
586
+ "@context": null
587
+ } }
579
588
  ],
580
589
  id: "https://example.com/users/someone",
581
590
  type: "OrderedCollection",
@@ -658,7 +667,13 @@ test("handleCollection()", async () => {
658
667
  "@id": "fedibird:emojiReactions",
659
668
  "@type": "@id"
660
669
  }
661
- }
670
+ },
671
+ { orderedItems: {
672
+ "@id": "https://www.w3.org/ns/activitystreams#items",
673
+ "@type": "@id",
674
+ "@container": "@list",
675
+ "@context": null
676
+ } }
662
677
  ],
663
678
  id: "https://example.com/users/someone",
664
679
  type: "OrderedCollection",
@@ -774,7 +789,13 @@ test("handleCollection()", async () => {
774
789
  "@id": "fedibird:emojiReactions",
775
790
  "@type": "@id"
776
791
  }
777
- }
792
+ },
793
+ { orderedItems: {
794
+ "@id": "https://www.w3.org/ns/activitystreams#items",
795
+ "@type": "@id",
796
+ "@container": "@list",
797
+ "@context": null
798
+ } }
778
799
  ],
779
800
  id: "https://example.com/users/someone?cursor=0",
780
801
  type: "OrderedCollectionPage",
@@ -832,7 +853,13 @@ test("handleCollection()", async () => {
832
853
  "@id": "fedibird:emojiReactions",
833
854
  "@type": "@id"
834
855
  }
835
- }
856
+ },
857
+ { orderedItems: {
858
+ "@id": "https://www.w3.org/ns/activitystreams#items",
859
+ "@type": "@id",
860
+ "@container": "@list",
861
+ "@context": null
862
+ } }
836
863
  ],
837
864
  id: "https://example.com/users/someone?cursor=2",
838
865
  type: "OrderedCollectionPage",
@@ -2108,6 +2135,165 @@ test("handleInbox()", async () => {
2108
2135
  assertEquals(onNotFoundCalled, null);
2109
2136
  assertEquals(response.status, 400);
2110
2137
  });
2138
+ test("handleInbox() verifies Linked Data signatures without created", async (t) => {
2139
+ const inserted = structuredClone(ldSignatureWithoutCreated);
2140
+ const withTimestamp = {
2141
+ ...inserted,
2142
+ signature: {
2143
+ ...inserted.signature,
2144
+ created: "2024-09-12T16:50:46Z"
2145
+ }
2146
+ };
2147
+ const tampered = structuredClone(ldSignatureWithoutCreated);
2148
+ tampered.object.content = "tampered";
2149
+ const invalid = structuredClone(ldSignatureWithoutCreated);
2150
+ invalid.signature.signatureValue = "AAAA";
2151
+ const { signature: _, ...unsigned } = ldSignatureWithoutCreated;
2152
+ for (const [name, body, expected] of [
2153
+ [
2154
+ "valid LD-only",
2155
+ ldSignatureWithoutCreated,
2156
+ 202
2157
+ ],
2158
+ [
2159
+ "inserted created",
2160
+ withTimestamp,
2161
+ 401
2162
+ ],
2163
+ [
2164
+ "tampered content",
2165
+ tampered,
2166
+ 401
2167
+ ],
2168
+ [
2169
+ "invalid signature",
2170
+ invalid,
2171
+ 401
2172
+ ],
2173
+ [
2174
+ "unsigned",
2175
+ unsigned,
2176
+ 401
2177
+ ],
2178
+ [
2179
+ "malformed created",
2180
+ {
2181
+ ...ldSignatureWithoutCreated,
2182
+ signature: {
2183
+ ...ldSignatureWithoutCreated.signature,
2184
+ created: 123
2185
+ }
2186
+ },
2187
+ 401
2188
+ ],
2189
+ [
2190
+ "malformed creator",
2191
+ {
2192
+ ...ldSignatureWithoutCreated,
2193
+ signature: {
2194
+ ...ldSignatureWithoutCreated.signature,
2195
+ creator: {}
2196
+ }
2197
+ },
2198
+ 401
2199
+ ],
2200
+ [
2201
+ "malformed null",
2202
+ {
2203
+ ...ldSignatureWithoutCreated,
2204
+ signature: null
2205
+ },
2206
+ 401
2207
+ ],
2208
+ [
2209
+ "malformed array",
2210
+ {
2211
+ ...ldSignatureWithoutCreated,
2212
+ signature: []
2213
+ },
2214
+ 401
2215
+ ],
2216
+ [
2217
+ "malformed primitive",
2218
+ {
2219
+ ...ldSignatureWithoutCreated,
2220
+ signature: "secret"
2221
+ },
2222
+ 401
2223
+ ]
2224
+ ]) await t.step(name, async () => {
2225
+ const kv = new MemoryKvStore();
2226
+ const federation = createFederation({ kv });
2227
+ const request = new Request("https://example.com/inbox", {
2228
+ method: "POST",
2229
+ body: JSON.stringify(body)
2230
+ });
2231
+ const context = createRequestContext({
2232
+ federation,
2233
+ request,
2234
+ url: new URL(request.url),
2235
+ data: void 0,
2236
+ documentLoader: mockDocumentLoader,
2237
+ contextLoader: mockDocumentLoader
2238
+ });
2239
+ let deliveries = 0;
2240
+ const inboxListeners = new InboxListenerSet();
2241
+ inboxListeners.add(Create, () => {
2242
+ deliveries++;
2243
+ });
2244
+ const records = [];
2245
+ await configure({
2246
+ sinks: { buffer: (record) => records.push(record) },
2247
+ loggers: [{
2248
+ category: ["fedify"],
2249
+ sinks: ["buffer"],
2250
+ lowestLevel: "debug"
2251
+ }, {
2252
+ category: ["logtape", "meta"],
2253
+ sinks: []
2254
+ }],
2255
+ reset: true
2256
+ });
2257
+ try {
2258
+ assertEquals((await handleInbox(request, {
2259
+ recipient: null,
2260
+ context,
2261
+ inboxContextFactory() {
2262
+ return createInboxContext({
2263
+ ...context,
2264
+ clone: void 0
2265
+ });
2266
+ },
2267
+ kv,
2268
+ kvPrefixes: {
2269
+ activityIdempotence: ["_fedify", "activityIdempotence"],
2270
+ publicKey: ["_fedify", "publicKey"]
2271
+ },
2272
+ actorDispatcher: () => null,
2273
+ inboxListeners,
2274
+ onNotFound: () => new Response("Not found", { status: 404 }),
2275
+ signatureTimeWindow: { minutes: 5 },
2276
+ skipSignatureVerification: false
2277
+ })).status, expected);
2278
+ assertEquals(deliveries, expected === 202 ? 1 : 0);
2279
+ const malformedRecords = records.filter((r) => r.rawMessage === "Linked Data Signature has an unsupported shape: {signatureKind}; properties: {signatureProperties}.");
2280
+ assertEquals(malformedRecords.length, name.startsWith("malformed") ? 1 : 0);
2281
+ for (const record of malformedRecords) {
2282
+ assertEquals(record.category, [
2283
+ "fedify",
2284
+ "federation",
2285
+ "inbox"
2286
+ ]);
2287
+ assertEquals(record.level, "debug");
2288
+ assertFalse(JSON.stringify(record).includes(ldSignatureWithoutCreated.signature.creator));
2289
+ assertFalse(JSON.stringify(record).includes(ldSignatureWithoutCreated.signature.signatureValue));
2290
+ assertFalse(JSON.stringify(record).includes("secret"));
2291
+ }
2292
+ } finally {
2293
+ await reset();
2294
+ }
2295
+ });
2296
+ });
2111
2297
  test("handleInbox() preserves the raw signed payload for inboxContextFactory", async () => {
2112
2298
  const federation = createFederation({ kv: new MemoryKvStore() });
2113
2299
  const remoteContextUrl = "https://remote.example/contexts/ext";
@@ -2866,8 +3052,13 @@ test("handleCustomCollection()", async () => {
2866
3052
  }
2867
3053
  }
2868
3054
  ];
3055
+ const ITEM_CONTEXT = [...CONTEXT, { items: {
3056
+ "@id": "https://www.w3.org/ns/activitystreams#items",
3057
+ "@type": "@id",
3058
+ "@context": null
3059
+ } }];
2869
3060
  assertEquals(await response.json(), {
2870
- "@context": CONTEXT,
3061
+ "@context": ITEM_CONTEXT,
2871
3062
  id: "https://example.com/",
2872
3063
  type: "Collection",
2873
3064
  items: [
@@ -2922,7 +3113,7 @@ test("handleCustomCollection()", async () => {
2922
3113
  assertEquals(response.status, 200);
2923
3114
  assertEquals(response.headers.get("Content-Type"), "application/activity+json");
2924
3115
  assertEquals(await response.json(), {
2925
- "@context": CONTEXT,
3116
+ "@context": ITEM_CONTEXT,
2926
3117
  id: "https://example.com/",
2927
3118
  type: "Collection",
2928
3119
  items: [
@@ -2980,7 +3171,7 @@ test("handleCustomCollection()", async () => {
2980
3171
  assertEquals(response.status, 200);
2981
3172
  assertEquals(response.headers.get("Content-Type"), "application/activity+json");
2982
3173
  assertEquals(await response.json(), {
2983
- "@context": CONTEXT,
3174
+ "@context": ITEM_CONTEXT,
2984
3175
  id: "https://example.com/?cursor=0",
2985
3176
  type: "CollectionPage",
2986
3177
  partOf: "https://example.com/",
@@ -3009,7 +3200,7 @@ test("handleCustomCollection()", async () => {
3009
3200
  assertEquals(response.status, 200);
3010
3201
  assertEquals(response.headers.get("Content-Type"), "application/activity+json");
3011
3202
  assertEquals(await response.json(), {
3012
- "@context": CONTEXT,
3203
+ "@context": ITEM_CONTEXT,
3013
3204
  id: "https://example.com/?cursor=2",
3014
3205
  type: "CollectionPage",
3015
3206
  partOf: "https://example.com/",
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import "../std__assert-DflMZha5.mjs";
6
6
  import { n as ed25519PrivateKey, r as ed25519PublicKey, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
7
- import { n as signObject } from "../proof-C90umkRN.mjs";
8
- import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
9
- import { a as createFederation } from "../middleware-DoMxpm9r.mjs";
7
+ import { n as signObject } from "../proof-DCqYLXDl.mjs";
8
+ import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
9
+ import { a as createFederation } from "../middleware-3x7W0auZ.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 { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
6
- import { n as actorsHaveSameOrigin, t as InboxListenerSet } from "../inbox-BgsnvP5o.mjs";
6
+ import { n as actorsHaveSameOrigin, t as InboxListenerSet } from "../inbox-DTuh59nR.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
@@ -3,8 +3,8 @@ 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 MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
7
- import { t as KvKeyCache } from "../keycache-DBD6fzl1.mjs";
6
+ import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
7
+ import { t as KvKeyCache } from "../keycache-crDMn2HK.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  import { CryptographicKey, Multikey } from "@fedify/vocab";
10
10
  //#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-DflMZha5.mjs";
6
- import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
6
+ import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
7
7
  import { test } from "@fedify/fixture";
8
8
  //#region src/federation/kv.test.ts
9
9
  test("MemoryKvStore", async (t) => {
@@ -9,15 +9,16 @@ 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 { c as signRequest, u as verifyRequest } from "../http-DM--MHnA.mjs";
12
+ import { c as signRequest, u as verifyRequest } from "../http-Cp7sQLeG.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-CCxRJhWa.mjs";
14
- import { n as getAuthenticatedDocumentLoader } from "../docloader-QmdzA0HA.mjs";
15
- import { a as compactJsonLd, f as signJsonLd, i as attachSignature, m as verifyJsonLd, s as detachSignature } from "../ld-BpBoDQsD.mjs";
16
- import { t as doesActorOwnKey } from "../owner-zSUyR5Fs.mjs";
17
- import { n as signObject, r as verifyObject } from "../proof-C90umkRN.mjs";
18
- import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
19
- import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-DoMxpm9r.mjs";
20
- import { t as SendActivityError } from "../send-BE4hcPfe.mjs";
14
+ import { n as getAuthenticatedDocumentLoader } from "../docloader-CP5VuWA0.mjs";
15
+ import { a as compactJsonLd, c as detachSignature, g as verifyJsonLd, i as attachSignature, m as signJsonLd } from "../ld-dYjiHKj1.mjs";
16
+ import { t as ldSignatureWithoutCreated } from "../ld-signature-_KYhPsqt.mjs";
17
+ import { t as doesActorOwnKey } from "../owner-A1Xol6Zh.mjs";
18
+ import { n as signObject, r as verifyObject } from "../proof-DCqYLXDl.mjs";
19
+ import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
20
+ import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-3x7W0auZ.mjs";
21
+ import { t as SendActivityError } from "../send-yQno-6bP.mjs";
21
22
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
22
23
  import * as vocab from "@fedify/vocab";
23
24
  import { Create, Offer, Person, getTypeId, lookupObject } from "@fedify/vocab";
@@ -1989,6 +1990,42 @@ test("ContextImpl.sendActivity() reports automatic queue startup failures", asyn
1989
1990
  }
1990
1991
  });
1991
1992
  });
1993
+ test("queued Linked Data signatures without created use normalization contexts", async (t) => {
1994
+ for (const legacy of [false, true]) await t.step(legacy ? "legacy compacted payload" : "verified normalized cache", async () => {
1995
+ const normalized = await compactJsonLd(ldSignatureWithoutCreated, mockDocumentLoader);
1996
+ const raw = legacy ? normalized : structuredClone(ldSignatureWithoutCreated);
1997
+ const federation = new FederationImpl({
1998
+ kv: new MemoryKvStore(),
1999
+ contextLoaderFactory: () => async (url) => {
2000
+ if (url === "https://www.w3.org/ns/activitystreams" || url === "https://w3id.org/identity/v1") return await mockDocumentLoader(url);
2001
+ throw new Error(`Unexpected context: ${url}`);
2002
+ }
2003
+ });
2004
+ let deliveries = 0;
2005
+ let receivedRaw;
2006
+ federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, (ctx, activity) => {
2007
+ deliveries++;
2008
+ receivedRaw = ctx.activity;
2009
+ assertEquals(activity.id?.href, ldSignatureWithoutCreated.id);
2010
+ });
2011
+ await federation.processQueuedTask(void 0, {
2012
+ type: "inbox",
2013
+ id: crypto.randomUUID(),
2014
+ baseUrl: "https://example.com",
2015
+ activity: raw,
2016
+ ...legacy ? {} : {
2017
+ normalizedActivity: normalized,
2018
+ ldSignatureVerified: true
2019
+ },
2020
+ started: (/* @__PURE__ */ new Date()).toISOString(),
2021
+ attempt: 0,
2022
+ identifier: null,
2023
+ traceContext: {}
2024
+ });
2025
+ assertEquals(deliveries, 1);
2026
+ assertEquals(receivedRaw, raw);
2027
+ });
2028
+ });
1992
2029
  test("FederationImpl.processQueuedTask()", async (t) => {
1993
2030
  await t.step("with MessageQueue having nativeRetrial", async () => {
1994
2031
  const kv = new MemoryKvStore();
@@ -5119,6 +5156,63 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
5119
5156
  });
5120
5157
  esm_default.hardReset();
5121
5158
  });
5159
+ test("InboxContextImpl.forwardActivity() without created", async (t) => {
5160
+ for (const immediate of [true, false]) await t.step(immediate ? "immediate delivery" : "queued delivery", async () => {
5161
+ const delivered = [];
5162
+ const queued = [];
5163
+ esm_default.spyGlobal();
5164
+ esm_default.post("https://example.com/inbox", async (call) => {
5165
+ delivered.push(await call.request.json());
5166
+ return new Response(null, { status: 202 });
5167
+ });
5168
+ try {
5169
+ const federation = new FederationImpl({
5170
+ kv: new MemoryKvStore(),
5171
+ allowPrivateAddress: true,
5172
+ manuallyStartQueue: true,
5173
+ queue: { outbox: {
5174
+ enqueue(message) {
5175
+ queued.push(message);
5176
+ return Promise.resolve();
5177
+ },
5178
+ async listen() {}
5179
+ } }
5180
+ });
5181
+ const activity = structuredClone(ldSignatureWithoutCreated);
5182
+ assert(await verifyJsonLd(activity, {
5183
+ documentLoader: mockDocumentLoader,
5184
+ contextLoader: mockDocumentLoader
5185
+ }));
5186
+ await new InboxContextImpl(null, activity, activity.id, "https://www.w3.org/ns/activitystreams#Create", {
5187
+ data: void 0,
5188
+ federation,
5189
+ url: new URL("https://example.com/"),
5190
+ documentLoader: mockDocumentLoader,
5191
+ contextLoader: mockDocumentLoader
5192
+ }).forwardActivity([{
5193
+ privateKey: rsaPrivateKey2,
5194
+ keyId: rsaPublicKey2.id
5195
+ }], {
5196
+ id: new URL("https://example.com/recipient"),
5197
+ inboxId: new URL("https://example.com/inbox")
5198
+ }, {
5199
+ skipIfUnsigned: true,
5200
+ immediate
5201
+ });
5202
+ if (immediate) {
5203
+ assertEquals(delivered, [activity]);
5204
+ assertEquals(queued, []);
5205
+ } else {
5206
+ assertEquals(delivered, []);
5207
+ assertEquals(queued.length, 1);
5208
+ assertEquals(queued[0].type, "outbox");
5209
+ assertEquals(queued[0].activity, activity);
5210
+ }
5211
+ } finally {
5212
+ esm_default.hardReset();
5213
+ }
5214
+ });
5215
+ });
5122
5216
  test("KvSpecDeterminer", async (t) => {
5123
5217
  await t.step("should use default spec when not found in KV", async () => {
5124
5218
  assertEquals(await new KvSpecDeterminer(new MemoryKvStore(), ["test", "spec"]).determineSpec("example.com"), "rfc9421");
@@ -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-DkQNfZyL.cjs");
5
+ const require_middleware = require("../middleware-5EN1mHvx.cjs");
6
6
  let es_toolkit = require("es-toolkit");
7
7
  //#region src/federation/kv.ts
8
8
  /**
@@ -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-BcLbgxfC.js";
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-DFR4tBL2.js";
4
4
  import { isEqual } from "es-toolkit";
5
5
  //#region src/federation/kv.ts
6
6
  /**
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import "../std__assert-DflMZha5.mjs";
5
5
  import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
6
6
  import { t as assert } from "../assert-BhQd8QHP.mjs";
7
- import { t as acceptsJsonLd } from "../negotiation-TWEs6Cl8.mjs";
7
+ import { t as acceptsJsonLd } from "../negotiation-BehA2uul.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-BkxW5QJI.mjs";
6
- import { t as createExponentialBackoffPolicy } from "../retry-Ddbq3AcK.mjs";
6
+ import { t as createExponentialBackoffPolicy } from "../retry-B_E3V_Dx.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 { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
8
8
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
9
9
  import { t as assertNotEquals } from "../assert_not_equals-BkxW5QJI.mjs";
10
10
  import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
11
- import { u as verifyRequest } from "../http-DM--MHnA.mjs";
11
+ import { u as verifyRequest } from "../http-Cp7sQLeG.mjs";
12
12
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
13
- import { t as doesActorOwnKey } from "../owner-zSUyR5Fs.mjs";
14
- import { i as sendActivity, n as extractInboxes, r as fetchWithValidatedRedirects, t as SendActivityError } from "../send-BE4hcPfe.mjs";
13
+ import { t as doesActorOwnKey } from "../owner-A1Xol6Zh.mjs";
14
+ import { i as sendActivity, n as extractInboxes, r as fetchWithValidatedRedirects, t as SendActivityError } from "../send-yQno-6bP.mjs";
15
15
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
16
16
  import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
17
17
  import { FetchError, UrlError } from "@fedify/vocab-runtime";
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import "../std__assert-DflMZha5.mjs";
5
5
  import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
6
6
  import { t as assert } from "../assert-BhQd8QHP.mjs";
7
- import { t as hasMalformedKnownTemporalLiteral } from "../temporal-BQUGkj5T.mjs";
7
+ import { t as hasMalformedKnownTemporalLiteral } from "../temporal-C26UV3h7.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/federation/temporal.test.ts
10
10
  test("hasMalformedKnownTemporalLiteral() detects expanded proof timestamps", async () => {
@@ -4,8 +4,8 @@ globalThis.addEventListener = () => {};
4
4
  import { n as createRequestContext } from "../context-Juj6bdHC.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-DflMZha5.mjs";
7
- import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
8
- import { a as createFederation, o as handleWebFinger } from "../middleware-DoMxpm9r.mjs";
7
+ import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
8
+ import { a as createFederation, o as handleWebFinger } from "../middleware-3x7W0auZ.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  import { Image, Link, Person } from "@fedify/vocab";
11
11
  //#region src/federation/webfinger.test.ts
@@ -1,8 +1,8 @@
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-CvHOP0XE.mjs";
5
- import { o as validateCryptoKey, r as fetchKey } from "./key-RrdwitZu.mjs";
4
+ import { n as version, t as name } from "./deno-Bbso5CSl.mjs";
5
+ import { o as validateCryptoKey, r as fetchKey } from "./key-CsY0Ifod.mjs";
6
6
  import { CryptographicKey } from "@fedify/vocab";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { FetchError } from "@fedify/vocab-runtime";
@@ -11,7 +11,7 @@ import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
11
11
  import { Item, decodeDict, encodeItem } from "structured-field-values";
12
12
  //#region deno.json
13
13
  var name = "@fedify/fedify";
14
- var version = "2.0.36-dev.2734+3364869b";
14
+ var version = "2.0.36-dev.2760+4342c983";
15
15
  //#endregion
16
16
  //#region src/sig/key.ts
17
17
  /** Classifies decoding failures without hiding unexpected loader errors. */