@fedify/fedify 2.4.0-dev.1964 → 2.4.0-dev.1995

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 (94) hide show
  1. package/dist/{builder-B4zpKIFU.mjs → builder-D0DxgOV5.mjs} +2 -2
  2. package/dist/{client-CtxvmazV.mjs → client-DpnpgjyX.mjs} +78 -4
  3. package/dist/compat/mod.d.cts +1 -1
  4. package/dist/compat/mod.d.ts +1 -1
  5. package/dist/compat/transformers.test.mjs +1 -1
  6. package/dist/compound-proof-CJnWc6c-.mjs +495 -0
  7. package/dist/{context-COLwHogJ.d.cts → context-BeDnDuF3.d.cts} +4 -3
  8. package/dist/{context-DiiCt4S7.d.ts → context-uyRUWoZQ.d.ts} +4 -3
  9. package/dist/{deno-CtG93ohj.mjs → deno-CABhzCb_.mjs} +1 -1
  10. package/dist/{docloader-dk_k3S8d.mjs → docloader-BbGSL0Xq.mjs} +2 -2
  11. package/dist/federation/builder.test.mjs +1 -1
  12. package/dist/federation/handler-compound-proof.test.d.mts +2 -0
  13. package/dist/federation/handler-compound-proof.test.mjs +152 -0
  14. package/dist/federation/handler.test.mjs +122 -4
  15. package/dist/federation/idempotency.test.mjs +2 -2
  16. package/dist/federation/keycache.test.mjs +52 -9
  17. package/dist/federation/metrics.test.mjs +1 -1
  18. package/dist/federation/middleware.test.mjs +111 -15
  19. package/dist/federation/mod.cjs +1 -1
  20. package/dist/federation/mod.d.cts +2 -2
  21. package/dist/federation/mod.d.ts +2 -2
  22. package/dist/federation/mod.js +1 -1
  23. package/dist/federation/send.test.mjs +139 -4
  24. package/dist/federation/tasks/enqueue.test.mjs +1 -1
  25. package/dist/federation/tasks/tasks.test.mjs +2 -2
  26. package/dist/federation/temporal.test.mjs +1 -1
  27. package/dist/federation/webfinger.test.mjs +1 -1
  28. package/dist/{federation-Drjlrrax.cjs → federation-DCEHQk4G.cjs} +632 -57
  29. package/dist/{http-6TI0tI03.d.cts → http-65PYi9jY.d.ts} +34 -2
  30. package/dist/{http-Dj4s1UQ0.js → http-9WyuldYh.js} +170 -8
  31. package/dist/{http-CdrSn2ip.d.ts → http-CP-7OdSq.d.cts} +34 -2
  32. package/dist/{http-B3skRvGo.cjs → http-CRFns-UE.cjs} +181 -7
  33. package/dist/{http-D7LX-BL9.mjs → http-D9urSO2D.mjs} +3 -3
  34. package/dist/{key-BVjgbs_9.mjs → key-Ccs8cnd7.mjs} +169 -7
  35. package/dist/{keycache-ZLqIfrkL.mjs → keycache-BUDHB5rY.mjs} +12 -4
  36. package/dist/{kv-cache-DtsjH_bY.cjs → kv-cache-DXT9vmIg.cjs} +2 -2
  37. package/dist/{kv-cache-tGNbvDCF.js → kv-cache-DtmXhPXG.js} +2 -2
  38. package/dist/{kv-cache-xRcC_xxP.mjs → kv-cache-lKyFn_Dn.mjs} +1 -1
  39. package/dist/{ld-OuCeQFny.mjs → ld-qup__MAW.mjs} +3 -3
  40. package/dist/map-local-context-conflict-DOYEEJ3u.mjs +204 -0
  41. package/dist/map-local-create-note-B0SeXJms.mjs +214 -0
  42. package/dist/{metrics-B9N27cCB.mjs → metrics-CISXCvB1.mjs} +1 -1
  43. package/dist/{middleware-TeLjzoxn.mjs → middleware-CzvJvPHK.mjs} +58 -15
  44. package/dist/{middleware-Cd_vPqDH.mjs → middleware-DkrU2WhY.mjs} +1 -1
  45. package/dist/{middleware-CPTDFMmJ.js → middleware-DsfWajaD.js} +593 -18
  46. package/dist/{mod-DypxPS9H.d.ts → mod-C0BYc0OU.d.ts} +1 -1
  47. package/dist/{mod-CnGLNoVw.d.cts → mod-CbKDOnCt.d.cts} +1 -1
  48. package/dist/{mod-CLHkCwLm.d.cts → mod-CyiSjRkk.d.cts} +1 -1
  49. package/dist/{mod-CSH1Ee-I.d.ts → mod-D882_Xsg.d.ts} +1 -1
  50. package/dist/{mod-DzRXACM5.d.ts → mod-UDwMjuHM.d.ts} +1 -1
  51. package/dist/{mod-BZldCEU0.d.cts → mod-x9W0d0Pk.d.cts} +1 -1
  52. package/dist/mod.cjs +20 -20
  53. package/dist/mod.d.cts +6 -6
  54. package/dist/mod.d.ts +6 -6
  55. package/dist/mod.js +5 -5
  56. package/dist/nodeinfo/client.test.mjs +28 -1
  57. package/dist/nodeinfo/handler.test.mjs +1 -1
  58. package/dist/nodeinfo/mod.cjs +1 -1
  59. package/dist/nodeinfo/mod.js +1 -1
  60. package/dist/{owner-DGSfntI-.d.ts → owner-BF0L9cMt.d.cts} +12 -1
  61. package/dist/{proof-BO_esQii.js → owner-BIPEZGiU.js} +1255 -1098
  62. package/dist/{owner-r_waTiQj.d.cts → owner-BSzr5-I8.d.ts} +12 -1
  63. package/dist/owner-CRoq8Spb.mjs +175 -0
  64. package/dist/{proof-Dua0d906.cjs → owner-CVA7L9MA.cjs} +1266 -1097
  65. package/dist/{proof-D5Ajk4DJ.mjs → proof-BDxNVZ3E.mjs} +186 -83
  66. package/dist/{send-DVXyUqhO.mjs → send-BzM5GLyn.mjs} +68 -11
  67. package/dist/sig/compound-proof-discovery.test.d.mts +2 -0
  68. package/dist/sig/compound-proof-discovery.test.mjs +331 -0
  69. package/dist/sig/compound-proof-verification.test.d.mts +2 -0
  70. package/dist/sig/compound-proof-verification.test.mjs +465 -0
  71. package/dist/sig/compound-proof.test.d.mts +2 -0
  72. package/dist/sig/compound-proof.test.mjs +324 -0
  73. package/dist/sig/http.test.mjs +2 -2
  74. package/dist/sig/key.test.mjs +169 -2
  75. package/dist/sig/ld.test.mjs +55 -2
  76. package/dist/sig/mod.cjs +17 -17
  77. package/dist/sig/mod.d.cts +3 -3
  78. package/dist/sig/mod.d.ts +3 -3
  79. package/dist/sig/mod.js +2 -2
  80. package/dist/sig/owner.test.mjs +103 -4
  81. package/dist/sig/proof.test.mjs +120 -1
  82. package/dist/{temporal-BoDw51A-.mjs → temporal-Dv6Qv-8k.mjs} +1 -1
  83. package/dist/testing/kv.test.mjs +1 -1
  84. package/dist/testing/mod.d.mts +2 -1
  85. package/dist/{types-RXm5YxpC.cjs → types-Be2zbyeG.cjs} +94 -2
  86. package/dist/{types-Dtyf8lVj.js → types-C_cNlNVK.js} +78 -4
  87. package/dist/utils/docloader.test.mjs +27 -3
  88. package/dist/utils/kv-cache.test.mjs +1 -1
  89. package/dist/utils/mod.cjs +1 -1
  90. package/dist/utils/mod.d.cts +1 -1
  91. package/dist/utils/mod.d.ts +1 -1
  92. package/dist/utils/mod.js +1 -1
  93. package/package.json +6 -6
  94. package/dist/owner-DTEqTzSr.mjs +0 -120
@@ -0,0 +1,331 @@
1
+ import "temporal-polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
5
+ import "../std__assert-CxFT0MNt.mjs";
6
+ import { n as inspectCompoundPortableObjectApplicability, t as discoverCompoundProofDocuments } from "../compound-proof-CJnWc6c-.mjs";
7
+ import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
8
+ import { test } from "@fedify/fixture";
9
+ //#region src/sig/compound-proof-discovery.test.ts
10
+ const limits = {
11
+ maxDepth: 16,
12
+ maxMaps: 32,
13
+ maxProofs: 8,
14
+ maxBytes: 16384
15
+ };
16
+ test("portable applicability is bounded and ignores metadata", () => {
17
+ assertEquals(inspectCompoundPortableObjectApplicability({
18
+ "@context": { id: "ap://did:key:context/object" },
19
+ proof: { id: "ap://did:key:proof/object" },
20
+ object: { id: "https://example.com/objects/1" }
21
+ }, limits), "absent");
22
+ assertEquals(inspectCompoundPortableObjectApplicability({ object: [{ "@id": "AP+EF61://did:key:child/objects/1" }] }, limits), "present");
23
+ assertEquals(inspectCompoundPortableObjectApplicability({ values: new Array(2e4).fill(0) }, {
24
+ ...limits,
25
+ maxBytes: 1e3
26
+ }), "indeterminate");
27
+ });
28
+ test("discoverCompoundProofDocuments() returns immutable deepest-first candidates", () => {
29
+ const input = {
30
+ id: "ap://example.test/activities/1",
31
+ object: {
32
+ id: "ap://example.test/objects/1",
33
+ content: "one",
34
+ proof: {
35
+ type: "DataIntegrityProof",
36
+ proofValue: "zInner"
37
+ }
38
+ },
39
+ items: [{
40
+ id: "ap://example.test/objects/2",
41
+ content: "two",
42
+ proof: {
43
+ type: "DataIntegrityProof",
44
+ proofValue: "zArray"
45
+ }
46
+ }],
47
+ "a/b~c": {
48
+ "@id": "ap://example.test/objects/3",
49
+ proof: {
50
+ type: "DataIntegrityProof",
51
+ proofValue: "zEscaped"
52
+ }
53
+ },
54
+ proof: {
55
+ type: "DataIntegrityProof",
56
+ proofValue: "zOuter",
57
+ proof: {
58
+ type: "DataIntegrityProof",
59
+ proofValue: "zNotADocument"
60
+ }
61
+ }
62
+ };
63
+ const before = structuredClone(input);
64
+ const result = discoverCompoundProofDocuments(input, limits);
65
+ assertEquals(input, before);
66
+ assertEquals(result.status, "ok");
67
+ if (result.status !== "ok") return;
68
+ assertEquals(result.documents.map(({ path, id, depth }) => ({
69
+ path,
70
+ id,
71
+ depth
72
+ })), [
73
+ {
74
+ path: "/items/0",
75
+ id: "ap://example.test/objects/2",
76
+ depth: 2
77
+ },
78
+ {
79
+ path: "/a~1b~0c",
80
+ id: "ap://example.test/objects/3",
81
+ depth: 1
82
+ },
83
+ {
84
+ path: "/object",
85
+ id: "ap://example.test/objects/1",
86
+ depth: 1
87
+ },
88
+ {
89
+ path: "",
90
+ id: "ap://example.test/activities/1",
91
+ depth: 0
92
+ }
93
+ ]);
94
+ assertEquals(result.documents[0].securedDocument, input.items[0]);
95
+ assertEquals(result.documents[0].proof, input.items[0].proof);
96
+ assertEquals(result.statistics.proofCount, 4);
97
+ input.items[0].content = "mutated after discovery";
98
+ assertEquals(result.documents[0].securedDocument.content, "two");
99
+ assertEquals(result.snapshot.items[0].content, "two");
100
+ });
101
+ test("discoverCompoundProofDocuments() is independent of member order", () => {
102
+ const first = {
103
+ z: {
104
+ id: "z",
105
+ proof: { proofValue: "z" }
106
+ },
107
+ a: {
108
+ id: "a",
109
+ proof: { proofValue: "a" }
110
+ },
111
+ proof: { proofValue: "root" }
112
+ };
113
+ const second = {
114
+ proof: { proofValue: "root" },
115
+ a: {
116
+ proof: { proofValue: "a" },
117
+ id: "a"
118
+ },
119
+ z: {
120
+ proof: { proofValue: "z" },
121
+ id: "z"
122
+ }
123
+ };
124
+ const firstResult = discoverCompoundProofDocuments(first, limits);
125
+ const secondResult = discoverCompoundProofDocuments(second, limits);
126
+ assertEquals(firstResult.status, "ok");
127
+ assertEquals(secondResult.status, "ok");
128
+ if (firstResult.status !== "ok" || secondResult.status !== "ok") return;
129
+ assertEquals(firstResult.documents.map((candidate) => candidate.path), [
130
+ "/a",
131
+ "/z",
132
+ ""
133
+ ]);
134
+ assertEquals(secondResult.documents.map((candidate) => candidate.path), [
135
+ "/a",
136
+ "/z",
137
+ ""
138
+ ]);
139
+ });
140
+ test("discoverCompoundProofDocuments() does not inspect context definitions", () => {
141
+ const result = discoverCompoundProofDocuments({
142
+ "@context": {
143
+ proof: "https://w3id.org/security#proof",
144
+ portable: {
145
+ "@id": "ap://did:key:z6MkContext/objects/1",
146
+ "@context": { proof: "https://example.com/nested-proof" }
147
+ }
148
+ },
149
+ id: "https://social.example/objects/1",
150
+ type: "Note"
151
+ }, limits);
152
+ assertEquals(result.status, "ok");
153
+ if (result.status !== "ok") return;
154
+ assertEquals(result.documents, []);
155
+ assertEquals(result.statistics.proofCount, 0);
156
+ });
157
+ test("discoverCompoundProofDocuments() preserves the recorded compound vector", () => {
158
+ const result = discoverCompoundProofDocuments(map_local_create_note_default.documents.finalSecuredCompound, limits);
159
+ assertEquals(result.status, "ok");
160
+ if (result.status !== "ok") return;
161
+ assertEquals(result.documents.map(({ path }) => path), ["/object", ""]);
162
+ assertEquals(result.documents[0].securedDocument, map_local_create_note_default.documents.securedInner);
163
+ assertEquals(result.documents[1].securedDocument, map_local_create_note_default.documents.finalSecuredCompound);
164
+ });
165
+ test("discoverCompoundProofDocuments() rejects unsupported proof shapes atomically", () => {
166
+ for (const proof of [
167
+ null,
168
+ "remote-proof",
169
+ [{ proofValue: "z" }]
170
+ ]) assertEquals(discoverCompoundProofDocuments({
171
+ object: { proof: { proofValue: "valid candidate" } },
172
+ other: { proof }
173
+ }, limits), {
174
+ status: "unsupported",
175
+ reason: {
176
+ type: "unsupportedProofShape",
177
+ path: "/other/proof"
178
+ }
179
+ });
180
+ });
181
+ test("discoverCompoundProofDocuments() applies resource limits atomically", () => {
182
+ const cases = [
183
+ {
184
+ input: { child: { child: { proof: {} } } },
185
+ limits: {
186
+ ...limits,
187
+ maxDepth: 1
188
+ },
189
+ limit: "depth",
190
+ maximum: 1
191
+ },
192
+ {
193
+ input: {
194
+ first: {},
195
+ second: { proof: {} }
196
+ },
197
+ limits: {
198
+ ...limits,
199
+ maxMaps: 2
200
+ },
201
+ limit: "maps",
202
+ maximum: 2
203
+ },
204
+ {
205
+ input: {
206
+ first: { proof: {} },
207
+ second: { proof: {} }
208
+ },
209
+ limits: {
210
+ ...limits,
211
+ maxProofs: 1
212
+ },
213
+ limit: "proofs",
214
+ maximum: 1
215
+ },
216
+ {
217
+ input: {
218
+ content: "too large",
219
+ proof: {}
220
+ },
221
+ limits: {
222
+ ...limits,
223
+ maxBytes: 8
224
+ },
225
+ limit: "bytes",
226
+ maximum: 8
227
+ }
228
+ ];
229
+ for (const fixture of cases) {
230
+ const result = discoverCompoundProofDocuments(fixture.input, fixture.limits);
231
+ assertEquals(result.status, "unsupported");
232
+ if (result.status !== "unsupported") continue;
233
+ assertEquals(result.reason.type, "limitExceeded");
234
+ if (result.reason.type !== "limitExceeded") continue;
235
+ assertEquals(result.reason.limit, fixture.limit);
236
+ assertEquals(result.reason.maximum, fixture.maximum);
237
+ }
238
+ });
239
+ test("discoverCompoundProofDocuments() rejects values that are not JSON trees", () => {
240
+ const cyclic = { proof: {} };
241
+ cyclic.self = cyclic;
242
+ const shared = { proof: {} };
243
+ const symbolKeyed = { [Symbol("hidden")]: { proof: {} } };
244
+ for (const input of [
245
+ [],
246
+ { value: void 0 },
247
+ { value: NaN },
248
+ cyclic,
249
+ {
250
+ first: shared,
251
+ second: shared
252
+ },
253
+ symbolKeyed
254
+ ]) {
255
+ const result = discoverCompoundProofDocuments(input, limits);
256
+ assertEquals(result.status, "unsupported");
257
+ if (result.status !== "unsupported") continue;
258
+ assertEquals(result.reason.type, "invalidJsonTree");
259
+ }
260
+ });
261
+ test("discoverCompoundProofDocuments() handles wide JSON containers", () => {
262
+ const input = { values: new Array(2e5).fill(0) };
263
+ const result = discoverCompoundProofDocuments(input, {
264
+ maxDepth: 2,
265
+ maxMaps: 1,
266
+ maxProofs: 0,
267
+ maxBytes: 1048576
268
+ });
269
+ assertEquals(result.status, "ok");
270
+ if (result.status !== "ok") return;
271
+ assertEquals(result.statistics.byteLength, JSON.stringify(input).length);
272
+ });
273
+ test("discoverCompoundProofDocuments() rejects accessors without invoking them", () => {
274
+ let getterCalls = 0;
275
+ const accessorMap = {};
276
+ Object.defineProperty(accessorMap, "object", {
277
+ enumerable: true,
278
+ get() {
279
+ getterCalls++;
280
+ return { proof: {} };
281
+ }
282
+ });
283
+ const accessorArray = [{}];
284
+ Object.defineProperty(accessorArray, 0, {
285
+ enumerable: true,
286
+ get() {
287
+ getterCalls++;
288
+ return { proof: {} };
289
+ }
290
+ });
291
+ for (const input of [accessorMap, { items: accessorArray }]) {
292
+ const result = discoverCompoundProofDocuments(input, limits);
293
+ assertEquals(result.status, "unsupported");
294
+ if (result.status !== "unsupported") continue;
295
+ assertEquals(result.reason.type, "invalidJsonTree");
296
+ }
297
+ assertEquals(getterCalls, 0);
298
+ });
299
+ test("discoverCompoundProofDocuments() rejects non-enumerable map properties", () => {
300
+ const input = {};
301
+ Object.defineProperty(input, "proof", {
302
+ value: {},
303
+ enumerable: false
304
+ });
305
+ const result = discoverCompoundProofDocuments(input, limits);
306
+ assertEquals(result.status, "unsupported");
307
+ if (result.status !== "unsupported") return;
308
+ assertEquals(result.reason.type, "invalidJsonTree");
309
+ });
310
+ test("discoverCompoundProofDocuments() rejects non-JSON array properties", () => {
311
+ const namedProperty = Object.assign([], { extra: { proof: {} } });
312
+ const sparse = new Array(2);
313
+ sparse[1] = null;
314
+ const nonEnumerableIndex = [];
315
+ Object.defineProperty(nonEnumerableIndex, 0, {
316
+ value: { proof: {} },
317
+ enumerable: false
318
+ });
319
+ for (const input of [
320
+ { items: namedProperty },
321
+ { items: sparse },
322
+ { items: nonEnumerableIndex }
323
+ ]) {
324
+ const result = discoverCompoundProofDocuments(input, limits);
325
+ assertEquals(result.status, "unsupported");
326
+ if (result.status !== "unsupported") continue;
327
+ assertEquals(result.reason.type, "invalidJsonTree");
328
+ }
329
+ });
330
+ //#endregion
331
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Temporal } from "temporal-polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";