@fedify/fedify 2.5.0-dev.2332 → 2.5.0-dev.2355

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 (82) hide show
  1. package/dist/{builder-B5FCQEIY.mjs → builder-CQLrtVXj.mjs} +2 -2
  2. package/dist/compat/transformers.test.mjs +1 -1
  3. package/dist/{compound-proof-BOfX5ZI_.mjs → compound-proof-BVVJ7l69.mjs} +2 -2
  4. package/dist/{deno-BAG_1fYL.mjs → deno-ocYJ306k.mjs} +1 -1
  5. package/dist/{docloader-RGQuuAB3.mjs → docloader-kq9Chx_S.mjs} +2 -2
  6. package/dist/exporter-DThFfe7P.mjs +257 -0
  7. package/dist/federation/builder.test.mjs +1 -1
  8. package/dist/federation/compound-fanout.test.mjs +3 -3
  9. package/dist/federation/handler-compound-proof.test.mjs +3 -3
  10. package/dist/federation/handler.test.mjs +224 -5
  11. package/dist/federation/hashlink-media.test.mjs +2 -2
  12. package/dist/federation/idempotency.test.mjs +2 -2
  13. package/dist/federation/inbox-report.test.mjs +5 -5
  14. package/dist/federation/metrics.test.mjs +1 -1
  15. package/dist/federation/middleware.test.mjs +101 -8
  16. package/dist/federation/mod.cjs +1 -1
  17. package/dist/federation/mod.js +1 -1
  18. package/dist/federation/outgoing-proof.test.mjs +5 -5
  19. package/dist/federation/portable-actor.test.mjs +3 -3
  20. package/dist/federation/portable-chain.test.mjs +3 -3
  21. package/dist/federation/portable-collection.test.mjs +4 -4
  22. package/dist/federation/portable-delivery.test.mjs +2 -2
  23. package/dist/federation/portable-gateway-keys.test.mjs +4 -4
  24. package/dist/federation/portable-inbox.test.mjs +4 -4
  25. package/dist/federation/portable-parse-uri.test.mjs +1 -1
  26. package/dist/federation/portable-route-activity.test.mjs +2 -2
  27. package/dist/federation/portable.test.mjs +3 -3
  28. package/dist/federation/send.test.mjs +199 -3
  29. package/dist/federation/tasks/enqueue.test.mjs +1 -1
  30. package/dist/federation/tasks/tasks.test.mjs +2 -2
  31. package/dist/federation/temporal.test.mjs +1 -1
  32. package/dist/federation/webfinger.test.mjs +1 -1
  33. package/dist/{federation-B-XVudLj.cjs → federation-B6F8dIFG.cjs} +22 -14
  34. package/dist/{http-CV-U1gzt.mjs → http-C5xWwbV0.mjs} +4 -4
  35. package/dist/{http-BuLngk1F.cjs → http-C9T0cjbd.cjs} +1 -1
  36. package/dist/{http-DWdmr99_.js → http-Dxp3npYk.js} +1 -1
  37. package/dist/{key-eelLmVSs.mjs → key-DAA9n2ms.mjs} +2 -2
  38. package/dist/{kv-cache-DcyE1x0o.js → kv-cache-CKyL3Ut3.js} +1 -1
  39. package/dist/{kv-cache-BrkL2HsF.cjs → kv-cache-CrFiG0QG.cjs} +1 -1
  40. package/dist/{kv-cache-B92sMeCi.mjs → kv-cache-D1Ch4Ju7.mjs} +1 -1
  41. package/dist/{ld-xCF3uib3.mjs → ld-BV-KJnt5.mjs} +3 -3
  42. package/dist/{metrics-T82E15nn.mjs → metrics-B18PswRN.mjs} +1 -1
  43. package/dist/{middleware-BSr1-eGB.mjs → middleware-B1BK4Z48.mjs} +1 -1
  44. package/dist/{middleware-CZ3h4285.mjs → middleware-BYr3Msfi.mjs} +27 -23
  45. package/dist/{middleware-DcZ2-tQo.js → middleware-By5J1vr9.js} +22 -14
  46. package/dist/mod.cjs +4 -4
  47. package/dist/mod.js +4 -4
  48. package/dist/nodeinfo/handler.test.mjs +1 -1
  49. package/dist/otel/exporter.test.mjs +1 -253
  50. package/dist/{owner-CWP8TJYf.mjs → owner-nshRE6qk.mjs} +3 -3
  51. package/dist/{portable-collection-CyWhsaoF.js → portable-collection-BBURTikf.js} +1 -1
  52. package/dist/{portable-collection-7KpElui5.cjs → portable-collection-CpKPNP9k.cjs} +1 -1
  53. package/dist/{portable-collection-D0IFtR34.mjs → portable-collection-DNXfqNoX.mjs} +2 -2
  54. package/dist/{portable-key-D2OWixay.mjs → portable-key-DfeemJ18.mjs} +1 -1
  55. package/dist/{proof-DJEy_0Hi.mjs → proof-DaG_j0Bu.mjs} +4 -4
  56. package/dist/{send-LUMcW-S0.mjs → send-CQ_EZEOl.mjs} +10 -6
  57. package/dist/sig/compound-proof-discovery.test.mjs +1 -1
  58. package/dist/sig/compound-proof-producer.test.mjs +1 -1
  59. package/dist/sig/compound-proof-verification.test.mjs +2 -2
  60. package/dist/sig/compound-proof.test.mjs +2 -2
  61. package/dist/sig/http.test.mjs +2 -2
  62. package/dist/sig/key.test.mjs +1 -1
  63. package/dist/sig/ld.test.mjs +2 -2
  64. package/dist/sig/mitra-receive-interop.test.mjs +4 -4
  65. package/dist/sig/mitra-send-interop.test.mjs +3 -3
  66. package/dist/sig/mod.cjs +2 -2
  67. package/dist/sig/mod.js +2 -2
  68. package/dist/sig/owner.test.mjs +1 -1
  69. package/dist/sig/portable-collection.test.mjs +1 -1
  70. package/dist/sig/portable-interop.test.mjs +3 -3
  71. package/dist/sig/portable-key.test.mjs +6 -6
  72. package/dist/sig/proof.test.mjs +82 -3
  73. package/dist/sig/tootik-request-interop.test.mjs +4 -4
  74. package/dist/sig/tootik-send-interop.test.mjs +3 -3
  75. package/dist/sig/verification.test.mjs +3 -3
  76. package/dist/{temporal-DfSP6Egi.mjs → temporal-B2lL-04X.mjs} +1 -1
  77. package/dist/testing/kv.test.mjs +1 -1
  78. package/dist/utils/docloader.test.mjs +2 -2
  79. package/dist/utils/kv-cache.test.mjs +1 -1
  80. package/dist/utils/mod.cjs +1 -1
  81. package/dist/utils/mod.js +1 -1
  82. package/package.json +7 -7
@@ -11,10 +11,10 @@ import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
11
11
  import { t as assert } from "../assert-D1Eafmd_.mjs";
12
12
  import { a as verificationObservation } from "../verification-Dpfcw8ml.mjs";
13
13
  import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-4IJqPYos.mjs";
14
- import { a as signObject, c as verifyPortableObjectProof, d as verifyProof, i as hasProofLike, o as verifyMapLocalProof, r as createProof, s as verifyObject } from "../proof-DJEy_0Hi.mjs";
15
- import { f as verifyRequest } from "../http-CV-U1gzt.mjs";
14
+ import { a as signObject, c as verifyPortableObjectProof, d as verifyProof, i as hasProofLike, o as verifyMapLocalProof, r as createProof, s as verifyObject } from "../proof-DaG_j0Bu.mjs";
15
+ import { f as verifyRequest } from "../http-C5xWwbV0.mjs";
16
16
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
17
- import { t as getAuthenticatedDocumentLoader } from "../docloader-RGQuuAB3.mjs";
17
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-kq9Chx_S.mjs";
18
18
  import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place, Translation } from "@fedify/vocab";
19
19
  import { decodeMultibase, encodeMultibase, exportDidKey, exportMultibaseKey, formatIri, importMultibaseKey, parseIri } from "@fedify/vocab-runtime";
20
20
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
@@ -2265,6 +2265,85 @@ test("signObject() preserves FEP-22cd contexts through proof verification", asyn
2265
2265
  assertInstanceOf(verified, Note);
2266
2266
  assertEquals(verified.translations[0].language?.baseName, "ko");
2267
2267
  });
2268
+ async function signLicensedNote(license, context = []) {
2269
+ return await signPortableJsonLd({
2270
+ "@context": [...portableContext, ...context],
2271
+ id: `ap+ef61://${portableDid}/objects/licensed`,
2272
+ type: "Note",
2273
+ attributedTo: `ap+ef61://${portableDid}/actor`,
2274
+ content: "A licensed note",
2275
+ ...license
2276
+ });
2277
+ }
2278
+ const licenseVerifyOptions = {
2279
+ documentLoader() {
2280
+ throw new Error("No document fetch expected");
2281
+ },
2282
+ contextLoader: mockDocumentLoader
2283
+ };
2284
+ test("verifyObject() keeps FEP-6757 license synonyms of a parsed object", async () => {
2285
+ const license = "https://creativecommons.org/licenses/by/4.0/";
2286
+ const signed = await signLicensedNote({ "schema:license": license }, [{ schema: "https://schema.org/" }]);
2287
+ const verified = await verifyObject(Note, signed, licenseVerifyOptions);
2288
+ assertInstanceOf(verified, Note);
2289
+ assertEquals(verified.licenses, [new URL(license)]);
2290
+ const json = await (await Note.fromJsonLd(signed, licenseVerifyOptions)).toJsonLd();
2291
+ assertEquals(json, signed);
2292
+ assertFalse("license" in json);
2293
+ assertInstanceOf(await verifyObject(Note, json, licenseVerifyOptions), Note);
2294
+ });
2295
+ test("signObject() signs FEP-6757 licenses", async () => {
2296
+ const license = new URL("https://creativecommons.org/licenses/by/4.0/");
2297
+ const signed = await signObject(new Note({
2298
+ id: parseIri(`ap://${portableDid}/objects/licensed`),
2299
+ attribution: parseIri(`ap://${portableDid}/actor`),
2300
+ content: "A licensed note",
2301
+ licenses: [license]
2302
+ }), ed25519PrivateKey, portableKeyId, { contextLoader: mockDocumentLoader });
2303
+ const json = await signed.toJsonLd({
2304
+ format: "compact",
2305
+ contextLoader: mockDocumentLoader
2306
+ });
2307
+ assertEquals(json.license, license.href);
2308
+ assert(json["@context"].includes("https://w3id.org/fep/6757"));
2309
+ const verified = await verifyObject(Note, json, licenseVerifyOptions);
2310
+ assertInstanceOf(verified, Note);
2311
+ assertEquals(verified.licenses, [license]);
2312
+ const create = await new Create({
2313
+ actor: parseIri(`ap://${portableDid}/actor`),
2314
+ object: signed
2315
+ }).toJsonLd({ contextLoader: mockDocumentLoader });
2316
+ assertEquals(create.object, json);
2317
+ assertInstanceOf(await verifyObject(Note, create.object, licenseVerifyOptions), Note);
2318
+ const relicensed = signed.clone({ licenses: [new URL("https://creativecommons.org/publicdomain/zero/1.0/")] });
2319
+ assertEquals(await verifyObject(Note, await relicensed.toJsonLd({ contextLoader: mockDocumentLoader }), licenseVerifyOptions), null);
2320
+ assertInstanceOf(await verifyObject(Note, await (await signObject(relicensed.clone({ proofs: [] }), ed25519PrivateKey, portableKeyId, { contextLoader: mockDocumentLoader })).toJsonLd({ contextLoader: mockDocumentLoader }), licenseVerifyOptions), Note);
2321
+ });
2322
+ test("verifyObject() and FEP-6757 licenses that cannot be preserved", async () => {
2323
+ const license = "https://creativecommons.org/licenses/by/4.0/";
2324
+ const contexts = ["https://w3id.org/fep/6757"];
2325
+ const aliased = await signLicensedNote({ "schema:license": license }, [{ schema: "https://schema.org/" }]);
2326
+ const create = await new Create({
2327
+ actor: parseIri(`ap://${portableDid}/actor`),
2328
+ object: await Note.fromJsonLd(aliased, licenseVerifyOptions)
2329
+ }).toJsonLd({
2330
+ format: "compact",
2331
+ contextLoader: mockDocumentLoader
2332
+ });
2333
+ const object = create.object;
2334
+ assertEquals(object.license, license);
2335
+ assertEquals(await verifyObject(Note, {
2336
+ ...object,
2337
+ "@context": create["@context"]
2338
+ }, licenseVerifyOptions), null);
2339
+ const invalid = await signLicensedNote({ license: ["CC-BY-4.0", license] }, contexts);
2340
+ const verified = await verifyObject(Note, invalid, licenseVerifyOptions);
2341
+ assertInstanceOf(verified, Note);
2342
+ assertEquals(verified.licenses, [new URL(license)]);
2343
+ const json = await (await Note.fromJsonLd(invalid, licenseVerifyOptions)).toJsonLd();
2344
+ assertEquals(json.license, license);
2345
+ assertEquals(await verifyObject(Note, json, licenseVerifyOptions), null);
2346
+ });
2268
2347
  test("verifyObject() rejects a key that claims a forged controller", async () => {
2269
2348
  const keyId = new URL("https://attacker.example/multikey");
2270
2349
  const impersonated = "https://example.com/person2";
@@ -5,10 +5,10 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
6
6
  import "../std__assert-DvMDRPes.mjs";
7
7
  import { t as assert } from "../assert-D1Eafmd_.mjs";
8
- import { c as verifyPortableObjectProof } from "../proof-DJEy_0Hi.mjs";
9
- import { p as verifyRequestDetailed } from "../http-CV-U1gzt.mjs";
10
- import { o as createFederation } from "../middleware-CZ3h4285.mjs";
11
- import { t as doesActorOwnKey } from "../owner-CWP8TJYf.mjs";
8
+ import { c as verifyPortableObjectProof } from "../proof-DaG_j0Bu.mjs";
9
+ import { p as verifyRequestDetailed } from "../http-C5xWwbV0.mjs";
10
+ import { o as createFederation } from "../middleware-BYr3Msfi.mjs";
11
+ import { t as doesActorOwnKey } from "../owner-nshRE6qk.mjs";
12
12
  import { Follow, Person } from "@fedify/vocab";
13
13
  import { mockDocumentLoader, test } from "@fedify/fixture";
14
14
  import { encodeHex } from "byte-encodings/hex";
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
5
5
  import "../std__assert-DvMDRPes.mjs";
6
6
  import { t as assert } from "../assert-D1Eafmd_.mjs";
7
- import { c as verifyPortableObjectProof } from "../proof-DJEy_0Hi.mjs";
8
- import { p as verifyRequestDetailed } from "../http-CV-U1gzt.mjs";
9
- import { t as doesActorOwnKey } from "../owner-CWP8TJYf.mjs";
7
+ import { c as verifyPortableObjectProof } from "../proof-DaG_j0Bu.mjs";
8
+ import { p as verifyRequestDetailed } from "../http-C5xWwbV0.mjs";
9
+ import { t as doesActorOwnKey } from "../owner-nshRE6qk.mjs";
10
10
  import { Create } from "@fedify/vocab";
11
11
  import { decodeMultibase, importDidKey } from "@fedify/vocab-runtime";
12
12
  import { mockDocumentLoader, test } from "@fedify/fixture";
@@ -2,9 +2,9 @@ import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { a as verificationObservation } from "../verification-Dpfcw8ml.mjs";
5
- import { h as verifyJsonLd, p as signJsonLd } from "../ld-xCF3uib3.mjs";
6
- import { a as signObject, s as verifyObject } from "../proof-DJEy_0Hi.mjs";
7
- import { l as signRequest, p as verifyRequestDetailed } from "../http-CV-U1gzt.mjs";
5
+ import { h as verifyJsonLd, p as signJsonLd } from "../ld-BV-KJnt5.mjs";
6
+ import { a as signObject, s as verifyObject } from "../proof-DaG_j0Bu.mjs";
7
+ import { l as signRequest, p as verifyRequestDetailed } from "../http-C5xWwbV0.mjs";
8
8
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
9
9
  import { Activity, Create, CryptographicKey, Multikey } from "@fedify/vocab";
10
10
  import { FetchError } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { c as getNormalizationContextLoader } from "./ld-xCF3uib3.mjs";
4
+ import { c as getNormalizationContextLoader } from "./ld-BV-KJnt5.mjs";
5
5
  import jsonld from "@fedify/vocab-runtime/jsonld";
6
6
  //#region src/federation/temporal.ts
7
7
  function isPlainObject(value) {
@@ -6,7 +6,7 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
6
6
  import { t as ManualClockKvStore } from "../kv-DBRWVx3Q.mjs";
7
7
  import { n as baseOptions, o as stringSchema, t as MockQueue } from "../tasks-IG3pHfvZ.mjs";
8
8
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
9
- import { o as createFederation } from "../middleware-CZ3h4285.mjs";
9
+ import { o as createFederation } from "../middleware-BYr3Msfi.mjs";
10
10
  //#region src/testing/kv.test.ts
11
11
  test("ManualClockKvStore keeps an entry at its exact expiration instant", async () => {
12
12
  const kv = new ManualClockKvStore();
@@ -5,9 +5,9 @@ import { t as esm_default } from "../esm-BHXXx4Wx.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
6
6
  import "../std__assert-DvMDRPes.mjs";
7
7
  import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
8
- import { f as verifyRequest } from "../http-CV-U1gzt.mjs";
8
+ import { f as verifyRequest } from "../http-C5xWwbV0.mjs";
9
9
  import { i as rsaPrivateKey2 } from "../keys-DIJNHW-Y.mjs";
10
- import { t as getAuthenticatedDocumentLoader } from "../docloader-RGQuuAB3.mjs";
10
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-kq9Chx_S.mjs";
11
11
  import { configure, reset } from "@logtape/logtape";
12
12
  import { FetchError, UrlError } from "@fedify/vocab-runtime";
13
13
  import { mockDocumentLoader, test } from "@fedify/fixture";
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as kvCache, t as MockKvStore } from "../kv-cache-B92sMeCi.mjs";
4
+ import { n as kvCache, t as MockKvStore } from "../kv-cache-D1Ch4Ju7.mjs";
5
5
  import { preloadedContexts } from "@fedify/vocab-runtime";
6
6
  import { deepStrictEqual, throws } from "node:assert";
7
7
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
@@ -1,5 +1,5 @@
1
1
  const { URLPattern } = require("urlpattern-polyfill");
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_kv_cache = require("../kv-cache-BrkL2HsF.cjs");
3
+ const require_kv_cache = require("../kv-cache-CrFiG0QG.cjs");
4
4
  exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
5
5
  exports.kvCache = require_kv_cache.kvCache;
package/dist/utils/mod.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-DcyE1x0o.js";
3
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-CKyL3Ut3.js";
4
4
  export { getAuthenticatedDocumentLoader, kvCache };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "2.5.0-dev.2332+d4e3f91f",
3
+ "version": "2.5.0-dev.2355+c92a1cb1",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -151,10 +151,10 @@
151
151
  "structured-field-values": "^2.0.4",
152
152
  "temporal-polyfill": "^1.0.1",
153
153
  "urlpattern-polyfill": "^10.1.0",
154
- "@fedify/uri-template": "2.5.0-dev.2332+d4e3f91f",
155
- "@fedify/vocab-runtime": "2.5.0-dev.2332+d4e3f91f",
156
- "@fedify/vocab": "2.5.0-dev.2332+d4e3f91f",
157
- "@fedify/webfinger": "2.5.0-dev.2332+d4e3f91f"
154
+ "@fedify/uri-template": "2.5.0-dev.2355+c92a1cb1",
155
+ "@fedify/vocab": "2.5.0-dev.2355+c92a1cb1",
156
+ "@fedify/vocab-runtime": "2.5.0-dev.2355+c92a1cb1",
157
+ "@fedify/webfinger": "2.5.0-dev.2355+c92a1cb1"
158
158
  },
159
159
  "devDependencies": {
160
160
  "@std/assert": "npm:@jsr/std__assert@^0.226.0",
@@ -166,8 +166,8 @@
166
166
  "tsx": "^4.21.0",
167
167
  "typescript": "^6.0.0",
168
168
  "wrangler": "^4.17.0",
169
- "@fedify/vocab-tools": "^2.5.0-dev.2332+d4e3f91f",
170
- "@fedify/fixture": "2.0.0"
169
+ "@fedify/fixture": "2.0.0",
170
+ "@fedify/vocab-tools": "^2.5.0-dev.2355+c92a1cb1"
171
171
  },
172
172
  "scripts": {
173
173
  "build:self": "tsdown",