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

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-CnyFdlUn.mjs} +3 -3
  2. package/dist/compat/transformers.test.mjs +2 -2
  3. package/dist/{deno-CvHOP0XE.mjs → deno-DCXndlEx.mjs} +1 -1
  4. package/dist/{docloader-QmdzA0HA.mjs → docloader-7M06kit4.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 +169 -7
  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-CIiwaoIn.cjs → http-BhaAN2KG.cjs} +1 -1
  21. package/dist/{http-DM--MHnA.mjs → http-hi5IS6qw.mjs} +2 -2
  22. package/dist/{http-CacZaxQy.js → http-hjoPA7jZ.js} +1 -1
  23. package/dist/{inbox-BgsnvP5o.mjs → inbox-Bygi511A.mjs} +1 -1
  24. package/dist/{key-RrdwitZu.mjs → key-DYyRTxPH.mjs} +1 -1
  25. package/dist/{kv-cache--kqYNgl4.cjs → kv-cache-Bjnv9p9e.cjs} +1 -1
  26. package/dist/{kv-cache-DO77nN26.js → kv-cache-YZ2bpa_P.js} +1 -1
  27. package/dist/{ld-BpBoDQsD.mjs → ld-CKUnk1Ps.mjs} +38 -8
  28. package/dist/ld-signature-_KYhPsqt.mjs +23 -0
  29. package/dist/{middleware-ByORyvfD.cjs → middleware-BDCfPddM.cjs} +1 -1
  30. package/dist/{middleware-DkQNfZyL.cjs → middleware-C_4rWloR.cjs} +18 -14
  31. package/dist/{middleware-BcLbgxfC.js → middleware-D5uql06B.js} +17 -13
  32. package/dist/{middleware-j3sV7iws.mjs → middleware-dYPOyDLN.mjs} +1 -1
  33. package/dist/{middleware-DoMxpm9r.mjs → middleware-yx080dbw.mjs} +31 -27
  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-CqHBbNXl.mjs} +2 -2
  41. package/dist/{proof-C90umkRN.mjs → proof-CDalRU9r.mjs} +2 -2
  42. package/dist/{proof-DJvdhpXO.js → proof-D2RNLHHt.js} +36 -21
  43. package/dist/{proof-qxFPzf3D.cjs → proof-DLqGjdaL.cjs} +43 -22
  44. package/dist/{send-BE4hcPfe.mjs → send-XHpoZpxW.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 +2 -2
  53. package/dist/{temporal-BQUGkj5T.mjs → temporal-D3yEsvvS.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 +5 -5
  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-DCXndlEx.mjs";
6
+ import { t as InboxListenerSet } from "./inbox-Bygi511A.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-dYPOyDLN.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-yx080dbw.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.2746+2371871b";
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-DYyRTxPH.mjs";
5
+ import { r as doubleKnockScoped } from "./http-hi5IS6qw.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-CnyFdlUn.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-DYyRTxPH.mjs";
11
+ import { c as signRequest } from "../http-hi5IS6qw.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-CKUnk1Ps.mjs";
14
+ import { t as ldSignatureWithoutCreated } from "../ld-signature-_KYhPsqt.mjs";
15
+ import { n as signObject } from "../proof-CDalRU9r.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-yx080dbw.mjs";
18
+ import { t as InboxListenerSet } from "../inbox-Bygi511A.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({
@@ -2108,6 +2111,165 @@ test("handleInbox()", async () => {
2108
2111
  assertEquals(onNotFoundCalled, null);
2109
2112
  assertEquals(response.status, 400);
2110
2113
  });
2114
+ test("handleInbox() verifies Linked Data signatures without created", async (t) => {
2115
+ const inserted = structuredClone(ldSignatureWithoutCreated);
2116
+ const withTimestamp = {
2117
+ ...inserted,
2118
+ signature: {
2119
+ ...inserted.signature,
2120
+ created: "2024-09-12T16:50:46Z"
2121
+ }
2122
+ };
2123
+ const tampered = structuredClone(ldSignatureWithoutCreated);
2124
+ tampered.object.content = "tampered";
2125
+ const invalid = structuredClone(ldSignatureWithoutCreated);
2126
+ invalid.signature.signatureValue = "AAAA";
2127
+ const { signature: _, ...unsigned } = ldSignatureWithoutCreated;
2128
+ for (const [name, body, expected] of [
2129
+ [
2130
+ "valid LD-only",
2131
+ ldSignatureWithoutCreated,
2132
+ 202
2133
+ ],
2134
+ [
2135
+ "inserted created",
2136
+ withTimestamp,
2137
+ 401
2138
+ ],
2139
+ [
2140
+ "tampered content",
2141
+ tampered,
2142
+ 401
2143
+ ],
2144
+ [
2145
+ "invalid signature",
2146
+ invalid,
2147
+ 401
2148
+ ],
2149
+ [
2150
+ "unsigned",
2151
+ unsigned,
2152
+ 401
2153
+ ],
2154
+ [
2155
+ "malformed created",
2156
+ {
2157
+ ...ldSignatureWithoutCreated,
2158
+ signature: {
2159
+ ...ldSignatureWithoutCreated.signature,
2160
+ created: 123
2161
+ }
2162
+ },
2163
+ 401
2164
+ ],
2165
+ [
2166
+ "malformed creator",
2167
+ {
2168
+ ...ldSignatureWithoutCreated,
2169
+ signature: {
2170
+ ...ldSignatureWithoutCreated.signature,
2171
+ creator: {}
2172
+ }
2173
+ },
2174
+ 401
2175
+ ],
2176
+ [
2177
+ "malformed null",
2178
+ {
2179
+ ...ldSignatureWithoutCreated,
2180
+ signature: null
2181
+ },
2182
+ 401
2183
+ ],
2184
+ [
2185
+ "malformed array",
2186
+ {
2187
+ ...ldSignatureWithoutCreated,
2188
+ signature: []
2189
+ },
2190
+ 401
2191
+ ],
2192
+ [
2193
+ "malformed primitive",
2194
+ {
2195
+ ...ldSignatureWithoutCreated,
2196
+ signature: "secret"
2197
+ },
2198
+ 401
2199
+ ]
2200
+ ]) await t.step(name, async () => {
2201
+ const kv = new MemoryKvStore();
2202
+ const federation = createFederation({ kv });
2203
+ const request = new Request("https://example.com/inbox", {
2204
+ method: "POST",
2205
+ body: JSON.stringify(body)
2206
+ });
2207
+ const context = createRequestContext({
2208
+ federation,
2209
+ request,
2210
+ url: new URL(request.url),
2211
+ data: void 0,
2212
+ documentLoader: mockDocumentLoader,
2213
+ contextLoader: mockDocumentLoader
2214
+ });
2215
+ let deliveries = 0;
2216
+ const inboxListeners = new InboxListenerSet();
2217
+ inboxListeners.add(Create, () => {
2218
+ deliveries++;
2219
+ });
2220
+ const records = [];
2221
+ await configure({
2222
+ sinks: { buffer: (record) => records.push(record) },
2223
+ loggers: [{
2224
+ category: ["fedify"],
2225
+ sinks: ["buffer"],
2226
+ lowestLevel: "debug"
2227
+ }, {
2228
+ category: ["logtape", "meta"],
2229
+ sinks: []
2230
+ }],
2231
+ reset: true
2232
+ });
2233
+ try {
2234
+ assertEquals((await handleInbox(request, {
2235
+ recipient: null,
2236
+ context,
2237
+ inboxContextFactory() {
2238
+ return createInboxContext({
2239
+ ...context,
2240
+ clone: void 0
2241
+ });
2242
+ },
2243
+ kv,
2244
+ kvPrefixes: {
2245
+ activityIdempotence: ["_fedify", "activityIdempotence"],
2246
+ publicKey: ["_fedify", "publicKey"]
2247
+ },
2248
+ actorDispatcher: () => null,
2249
+ inboxListeners,
2250
+ onNotFound: () => new Response("Not found", { status: 404 }),
2251
+ signatureTimeWindow: { minutes: 5 },
2252
+ skipSignatureVerification: false
2253
+ })).status, expected);
2254
+ assertEquals(deliveries, expected === 202 ? 1 : 0);
2255
+ const malformedRecords = records.filter((r) => r.rawMessage === "Linked Data Signature has an unsupported shape: {signatureKind}; properties: {signatureProperties}.");
2256
+ assertEquals(malformedRecords.length, name.startsWith("malformed") ? 1 : 0);
2257
+ for (const record of malformedRecords) {
2258
+ assertEquals(record.category, [
2259
+ "fedify",
2260
+ "federation",
2261
+ "inbox"
2262
+ ]);
2263
+ assertEquals(record.level, "debug");
2264
+ assertFalse(JSON.stringify(record).includes(ldSignatureWithoutCreated.signature.creator));
2265
+ assertFalse(JSON.stringify(record).includes(ldSignatureWithoutCreated.signature.signatureValue));
2266
+ assertFalse(JSON.stringify(record).includes("secret"));
2267
+ }
2268
+ } finally {
2269
+ await reset();
2270
+ }
2271
+ });
2272
+ });
2111
2273
  test("handleInbox() preserves the raw signed payload for inboxContextFactory", async () => {
2112
2274
  const federation = createFederation({ kv: new MemoryKvStore() });
2113
2275
  const remoteContextUrl = "https://remote.example/contexts/ext";
@@ -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-CDalRU9r.mjs";
8
+ import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
9
+ import { a as createFederation } from "../middleware-yx080dbw.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-Bygi511A.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-hi5IS6qw.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-7M06kit4.mjs";
15
+ import { a as compactJsonLd, c as detachSignature, g as verifyJsonLd, i as attachSignature, m as signJsonLd } from "../ld-CKUnk1Ps.mjs";
16
+ import { t as ldSignatureWithoutCreated } from "../ld-signature-_KYhPsqt.mjs";
17
+ import { t as doesActorOwnKey } from "../owner-CqHBbNXl.mjs";
18
+ import { n as signObject, r as verifyObject } from "../proof-CDalRU9r.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-yx080dbw.mjs";
21
+ import { t as SendActivityError } from "../send-XHpoZpxW.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-C_4rWloR.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-D5uql06B.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-hi5IS6qw.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-CqHBbNXl.mjs";
14
+ import { i as sendActivity, n as extractInboxes, r as fetchWithValidatedRedirects, t as SendActivityError } from "../send-XHpoZpxW.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-D3yEsvvS.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-yx080dbw.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
@@ -12,7 +12,7 @@ let byte_encodings_base64 = require("byte-encodings/base64");
12
12
  let structured_field_values = require("structured-field-values");
13
13
  //#region deno.json
14
14
  var name = "@fedify/fedify";
15
- var version = "2.0.36-dev.2734+3364869b";
15
+ var version = "2.0.36-dev.2746+2371871b";
16
16
  //#endregion
17
17
  //#region src/sig/key.ts
18
18
  /** Classifies decoding failures without hiding unexpected loader errors. */
@@ -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-DCXndlEx.mjs";
5
+ import { o as validateCryptoKey, r as fetchKey } from "./key-DYyRTxPH.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.2746+2371871b";
15
15
  //#endregion
16
16
  //#region src/sig/key.ts
17
17
  /** Classifies decoding failures without hiding unexpected loader errors. */
@@ -1,7 +1,7 @@
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";
4
+ import { n as version, t as name } from "./deno-DCXndlEx.mjs";
5
5
  import { Activity, getTypeId } from "@fedify/vocab";
6
6
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
7
7
  import { getLogger } from "@logtape/logtape";
@@ -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-CvHOP0XE.mjs";
4
+ import { n as version, t as name } from "./deno-DCXndlEx.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, UrlError, getDocumentLoader } 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-CIiwaoIn.cjs");
4
+ const require_http = require("./http-BhaAN2KG.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,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { l as validateCryptoKey, t as doubleKnockScoped } from "./http-CacZaxQy.js";
3
+ import { l as validateCryptoKey, t as doubleKnockScoped } from "./http-hjoPA7jZ.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { curry } from "es-toolkit";
6
6
  import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts } from "@fedify/vocab-runtime";