@fedify/fedify 2.2.17 → 2.2.18

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 (63) hide show
  1. package/dist/{assert_rejects-B-qJtC9Z.mjs → assert_rejects-WyYSTDDX.mjs} +2 -20
  2. package/dist/{assert_throws-4NwKEy2q.mjs → assert_throws-D4DNWrux.mjs} +19 -1
  3. package/dist/{builder-a-kl29PE.mjs → builder-DAbQyxmb.mjs} +2 -2
  4. package/dist/compat/public-audience.test.mjs +1 -1
  5. package/dist/compat/transformers.test.mjs +1 -1
  6. package/dist/{deno-Cya0rbEr.mjs → deno-JUTr6LYC.mjs} +1 -1
  7. package/dist/{docloader-Dz0Z1Y07.mjs → docloader-BGjq1F5U.mjs} +4 -2
  8. package/dist/federation/builder.test.mjs +3 -3
  9. package/dist/federation/collection.test.mjs +1 -1
  10. package/dist/federation/handler.test.mjs +261 -8
  11. package/dist/federation/idempotency.test.mjs +3 -3
  12. package/dist/federation/inbox.test.mjs +25 -1
  13. package/dist/federation/kv.test.mjs +1 -1
  14. package/dist/federation/middleware.test.mjs +128 -10
  15. package/dist/federation/mod.cjs +1 -1
  16. package/dist/federation/mod.js +1 -1
  17. package/dist/federation/mq.test.mjs +2 -2
  18. package/dist/federation/negotiation.test.mjs +3 -3
  19. package/dist/federation/retry.test.mjs +2 -2
  20. package/dist/federation/router.test.mjs +2 -3
  21. package/dist/federation/send.test.mjs +7 -6
  22. package/dist/federation/temporal.test.mjs +3 -3
  23. package/dist/federation/webfinger.test.mjs +2 -2
  24. package/dist/{http-C_aA2Zx1.cjs → http-DEH_eppX.cjs} +1 -1
  25. package/dist/{http-DkzPSl5o.js → http-OSYYhKM8.js} +1 -1
  26. package/dist/{http-dobCLGG2.mjs → http-lCmKCZBI.mjs} +2 -2
  27. package/dist/inbox-DMATfdEI.mjs +162 -0
  28. package/dist/{key-BMHNd0gP.mjs → key-D0ahOVjf.mjs} +1 -1
  29. package/dist/{kv-cache-DVhfMtqE.js → kv-cache-B7X4p1y7.js} +3 -1
  30. package/dist/{kv-cache-Btp4kC_U.cjs → kv-cache-CPEV_4nZ.cjs} +3 -1
  31. package/dist/{ld-B_m0qw8j.mjs → ld-CJOXIehz.mjs} +2 -2
  32. package/dist/{middleware-BYxKsDHj.mjs → middleware-BgGJEcdp.mjs} +1 -1
  33. package/dist/{middleware-5qLdPLro.mjs → middleware-CHoUjmJm.mjs} +84 -167
  34. package/dist/{middleware-ZKHfZ7zj.cjs → middleware-D3hx1aiI.cjs} +1 -1
  35. package/dist/{middleware-C7mI18WE.cjs → middleware-QcuVRA-q.cjs} +96 -26
  36. package/dist/{middleware-BchkzbpG.js → middleware-aNUajYPY.js} +95 -25
  37. package/dist/mod.cjs +4 -4
  38. package/dist/mod.js +4 -4
  39. package/dist/nodeinfo/client.test.mjs +1 -1
  40. package/dist/nodeinfo/handler.test.mjs +2 -2
  41. package/dist/nodeinfo/types.test.mjs +2 -2
  42. package/dist/otel/exporter.test.mjs +1 -1
  43. package/dist/{owner-Dk85kXZz.mjs → owner-BUTMEkbn.mjs} +2 -2
  44. package/dist/{proof-ClpE9zhD.cjs → proof-BeY7TsiS.cjs} +1 -1
  45. package/dist/{proof-Bz6IdT2p.js → proof-Bm3xyn3D.js} +1 -1
  46. package/dist/{proof-DrGrnZVE.mjs → proof-DS1Zl6BX.mjs} +2 -2
  47. package/dist/{send-Co-E7yJn.mjs → send-fnPrh9Zm.mjs} +2 -2
  48. package/dist/sig/http.test.mjs +5 -5
  49. package/dist/sig/key.test.mjs +5 -5
  50. package/dist/sig/ld.test.mjs +4 -4
  51. package/dist/sig/mod.cjs +2 -2
  52. package/dist/sig/mod.js +2 -2
  53. package/dist/sig/owner.test.mjs +3 -3
  54. package/dist/sig/proof.test.mjs +4 -3
  55. package/dist/{std__assert-BVFj8-_V.mjs → std__assert-DNZ4Liil.mjs} +2 -2
  56. package/dist/{temporal-Bnwa_2NC.mjs → temporal-Biz6zK6e.mjs} +1 -1
  57. package/dist/utils/docloader.test.mjs +114 -39
  58. package/dist/utils/mod.cjs +1 -1
  59. package/dist/utils/mod.js +1 -1
  60. package/package.json +5 -5
  61. /package/dist/{assert_not_equals--wG9hV7u.mjs → assert_not_equals-BkxW5QJI.mjs} +0 -0
  62. /package/dist/{negotiation-BHtZN6Y1.mjs → negotiation-SQvQgUqe.mjs} +0 -0
  63. /package/dist/{retry-bMXBL97A.mjs → retry-v_sGLH1d.mjs} +0 -0
package/dist/mod.js CHANGED
@@ -3,11 +3,11 @@ import { URLPattern } from "urlpattern-polyfill";
3
3
  import "./chunk-CRNNMoPX.js";
4
4
  import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-BGMIq1cs.js";
5
5
  import "./compat/mod.js";
6
- import { _ as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, g as parseAcceptSignature, h as fulfillAcceptSignature, i as verifyRequest, l as fetchKeyDetailed, m as formatAcceptSignature, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "./http-DkzPSl5o.js";
7
- 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-BchkzbpG.js";
6
+ import { _ as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, g as parseAcceptSignature, h as fulfillAcceptSignature, i as verifyRequest, l as fetchKeyDetailed, m as formatAcceptSignature, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "./http-OSYYhKM8.js";
7
+ 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-aNUajYPY.js";
8
8
  import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-miAYfiGO.js";
9
- import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "./proof-Bz6IdT2p.js";
10
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-DVhfMtqE.js";
9
+ import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "./proof-Bm3xyn3D.js";
10
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-B7X4p1y7.js";
11
11
  import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation/mod.js";
12
12
  import "./nodeinfo/mod.js";
13
13
  import "./runtime/mod.js";
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as esm_default } from "../esm-DVILvP5e.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
- import "../std__assert-BVFj8-_V.mjs";
6
+ import "../std__assert-DNZ4Liil.mjs";
7
7
  import { n as assertInstanceOf } from "../assert-BhQd8QHP.mjs";
8
8
  import { a as parseProtocol, c as parseUsage, i as parseOutboundService, n as parseInboundService, o as parseServices, r as parseNodeInfo, s as parseSoftware, t as getNodeInfo } from "../client-9F_u23dc.mjs";
9
9
  import { test } from "@fedify/fixture";
@@ -3,9 +3,9 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { r as createRequestContext } from "../context-Dk_tacqz.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
- import "../std__assert-BVFj8-_V.mjs";
6
+ import "../std__assert-DNZ4Liil.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
8
- import { _ as handleNodeInfoJrd, g as handleNodeInfo, o as createFederation } from "../middleware-5qLdPLro.mjs";
8
+ import { _ as handleNodeInfoJrd, g as handleNodeInfo, o as createFederation } from "../middleware-CHoUjmJm.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  //#region src/nodeinfo/handler.test.ts
11
11
  test("handleNodeInfo()", async () => {
@@ -2,8 +2,8 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import "../std__assert-BVFj8-_V.mjs";
6
- import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
5
+ import "../std__assert-DNZ4Liil.mjs";
6
+ import { t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
7
7
  import { t as nodeInfoToJson } from "../types-J53Kw7so.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/nodeinfo/types.test.ts
@@ -2,7 +2,7 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import "../std__assert-BVFj8-_V.mjs";
5
+ import "../std__assert-DNZ4Liil.mjs";
6
6
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
7
7
  import { test } from "@fedify/fixture";
8
8
  import { SpanKind, SpanStatusCode, TraceFlags } from "@opentelemetry/api";
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-Cya0rbEr.mjs";
5
- import { c as verifyKeyOwnership, n as fetchActorDocument, t as exportJwk } from "./key-BMHNd0gP.mjs";
4
+ import { n as version, t as name } from "./deno-JUTr6LYC.mjs";
5
+ import { c as verifyKeyOwnership, n as fetchActorDocument, t as exportJwk } from "./key-D0ahOVjf.mjs";
6
6
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
7
7
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { 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
  const require_chunk = require("./chunk-DDcVe30Y.cjs");
4
- const require_http = require("./http-C_aA2Zx1.cjs");
4
+ const require_http = require("./http-DEH_eppX.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let _fedify_vocab = require("@fedify/vocab");
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { c as fetchKey, f as validateCryptoKey, o as exportJwk, p as verifyKeyOwnership, s as fetchActorDocument, v as name, y as version } from "./http-DkzPSl5o.js";
3
+ import { c as fetchKey, f as validateCryptoKey, o as exportJwk, p as verifyKeyOwnership, s as fetchActorDocument, v as name, y as version } from "./http-OSYYhKM8.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, PUBLIC_COLLECTION, getTypeId, isActor } from "@fedify/vocab";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
@@ -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-Cya0rbEr.mjs";
5
- import { r as fetchKey, s as validateCryptoKey } from "./key-BMHNd0gP.mjs";
4
+ import { n as version, t as name } from "./deno-JUTr6LYC.mjs";
5
+ import { r as fetchKey, s as validateCryptoKey } from "./key-D0ahOVjf.mjs";
6
6
  import { n as preloadedOnlyDocumentLoader } from "./public-audience-DpJqzPuh.mjs";
7
7
  import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-amccRMrV.mjs";
8
8
  import { Activity, DataIntegrityProof, Multikey, getTypeId } from "@fedify/vocab";
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-Cya0rbEr.mjs";
5
- import { n as doubleKnock } from "./http-dobCLGG2.mjs";
4
+ import { n as version, t as name } from "./deno-JUTr6LYC.mjs";
5
+ import { n as doubleKnock } from "./http-lCmKCZBI.mjs";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
7
7
  import { FetchError, UrlError, validatePublicUrl } from "@fedify/vocab-runtime";
8
8
  import { getLogger } from "@logtape/logtape";
@@ -3,12 +3,12 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as esm_default } from "../esm-DVILvP5e.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
- import { r as assertExists, t as assertStringIncludes } from "../std__assert-BVFj8-_V.mjs";
7
- import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
6
+ import { r as assertExists, t as assertStringIncludes } from "../std__assert-DNZ4Liil.mjs";
7
+ import { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
8
8
  import { t as assert } from "../assert-BhQd8QHP.mjs";
9
- import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
10
- import { t as exportJwk } from "../key-BMHNd0gP.mjs";
11
- import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase, u as verifyRequestDetailed } from "../http-dobCLGG2.mjs";
9
+ import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
10
+ import { t as exportJwk } from "../key-D0ahOVjf.mjs";
11
+ import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase, u as verifyRequestDetailed } from "../http-lCmKCZBI.mjs";
12
12
  import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-BAK-tUlf.mjs";
13
13
  import { t as KvKeyCache } from "../keycache-Dkc_sflV.mjs";
14
14
  import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
@@ -2,14 +2,14 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import "../std__assert-BVFj8-_V.mjs";
6
- import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
5
+ import "../std__assert-DNZ4Liil.mjs";
6
+ import { t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
7
7
  import { t as assert } from "../assert-BhQd8QHP.mjs";
8
- import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
8
+ import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
9
9
  import { t as assertStrictEquals } from "../assert_strict_equals-Dmjbg-bA.mjs";
10
- import { a as generateCryptoKeyPair, i as fetchKeyDetailed, o as importJwk, r as fetchKey, s as validateCryptoKey, t as exportJwk } from "../key-BMHNd0gP.mjs";
10
+ import { a as generateCryptoKeyPair, i as fetchKeyDetailed, o as importJwk, r as fetchKey, s as validateCryptoKey, t as exportJwk } from "../key-D0ahOVjf.mjs";
11
11
  import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
12
- import { _ as wrapContextLoaderForJsonLd } from "../ld-B_m0qw8j.mjs";
12
+ import { _ as wrapContextLoaderForJsonLd } from "../ld-CJOXIehz.mjs";
13
13
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
14
14
  import { CryptographicKey, Multikey, Person } from "@fedify/vocab";
15
15
  import { FetchError, UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
@@ -2,12 +2,12 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
5
+ import { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
6
6
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
7
- import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
8
- import { a as generateCryptoKeyPair } from "../key-BMHNd0gP.mjs";
7
+ import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
8
+ import { a as generateCryptoKeyPair } from "../key-D0ahOVjf.mjs";
9
9
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
10
- import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-B_m0qw8j.mjs";
10
+ import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-CJOXIehz.mjs";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { CryptographicKey } from "@fedify/vocab";
13
13
  import { encodeBase64 } from "byte-encodings/base64";
package/dist/sig/mod.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_http = require("../http-C_aA2Zx1.cjs");
5
- const require_proof = require("../proof-ClpE9zhD.cjs");
4
+ const require_http = require("../http-DEH_eppX.cjs");
5
+ const require_proof = require("../proof-BeY7TsiS.cjs");
6
6
  exports.attachSignature = require_proof.attachSignature;
7
7
  exports.createProof = require_proof.createProof;
8
8
  exports.createSignature = require_proof.createSignature;
package/dist/sig/mod.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { _ as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, g as parseAcceptSignature, h as fulfillAcceptSignature, i as verifyRequest, l as fetchKeyDetailed, m as formatAcceptSignature, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "../http-DkzPSl5o.js";
4
- import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "../proof-Bz6IdT2p.js";
3
+ import { _ as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, g as parseAcceptSignature, h as fulfillAcceptSignature, i as verifyRequest, l as fetchKeyDetailed, m as formatAcceptSignature, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "../http-OSYYhKM8.js";
4
+ import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "../proof-Bm3xyn3D.js";
5
5
  export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
@@ -2,11 +2,11 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import "../std__assert-BVFj8-_V.mjs";
6
- import { n as assertFalse } from "../assert_rejects-B-qJtC9Z.mjs";
5
+ import "../std__assert-DNZ4Liil.mjs";
6
+ import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
7
7
  import { t as assert } from "../assert-BhQd8QHP.mjs";
8
8
  import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-BAK-tUlf.mjs";
9
- import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-Dk85kXZz.mjs";
9
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-BUTMEkbn.mjs";
10
10
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
11
11
  import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
12
12
  //#region src/sig/owner.test.ts
@@ -2,12 +2,13 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import "../std__assert-BVFj8-_V.mjs";
6
- import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
5
+ import "../std__assert-DNZ4Liil.mjs";
6
+ import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
7
7
  import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
8
+ import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
8
9
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
9
10
  import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-amccRMrV.mjs";
10
- import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-DrGrnZVE.mjs";
11
+ import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-DS1Zl6BX.mjs";
11
12
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
13
  import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place } from "@fedify/vocab";
13
14
  import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
@@ -2,8 +2,8 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { l as AssertionError, s as format } from "./assert_equals-Ew3jOFa3.mjs";
5
- import "./assert_rejects-B-qJtC9Z.mjs";
6
- import "./assert_throws-4NwKEy2q.mjs";
5
+ import "./assert_throws-D4DNWrux.mjs";
6
+ import "./assert_rejects-WyYSTDDX.mjs";
7
7
  import "./assert_strict_equals-Dmjbg-bA.mjs";
8
8
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_exists.js
9
9
  /**
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { c as getNormalizationContextLoader } from "./ld-B_m0qw8j.mjs";
4
+ import { c as getNormalizationContextLoader } from "./ld-CJOXIehz.mjs";
5
5
  import jsonld from "@fedify/vocab-runtime/jsonld";
6
6
  //#region src/federation/temporal.ts
7
7
  function isPlainObject(value) {
@@ -3,11 +3,11 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as esm_default } from "../esm-DVILvP5e.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
- import "../std__assert-BVFj8-_V.mjs";
7
- import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
8
- import { l as verifyRequest } from "../http-dobCLGG2.mjs";
6
+ import "../std__assert-DNZ4Liil.mjs";
7
+ import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
8
+ import { l as verifyRequest } from "../http-lCmKCZBI.mjs";
9
9
  import { i as rsaPrivateKey2 } from "../keys-BAK-tUlf.mjs";
10
- import { t as getAuthenticatedDocumentLoader } from "../docloader-Dz0Z1Y07.mjs";
10
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-BGjq1F5U.mjs";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { FetchError, UrlError } from "@fedify/vocab-runtime";
13
13
  import { configure, reset } from "@logtape/logtape";
@@ -99,45 +99,50 @@ test("getAuthenticatedDocumentLoader() validates redirects", async (t) => {
99
99
  });
100
100
  esm_default.hardReset();
101
101
  });
102
- test("getAuthenticatedDocumentLoader() cancellation", {
103
- sanitizeResources: false,
104
- sanitizeOps: false
105
- }, async (t) => {
102
+ test("getAuthenticatedDocumentLoader() cancellation", async (t) => {
106
103
  esm_default.spyGlobal();
107
- await t.step("document loader cancellation", async () => {
108
- esm_default.get("https://example.com/slow-object", () => new Promise((resolve) => {
109
- setTimeout(() => {
110
- resolve({
111
- status: 200,
112
- headers: { "Content-Type": "application/activity+json" },
113
- body: {
114
- "@context": "https://www.w3.org/ns/activitystreams",
115
- type: "Note",
116
- content: "Slow response"
117
- }
104
+ try {
105
+ await t.step("document loader cancellation", async () => {
106
+ let responseTimer;
107
+ try {
108
+ esm_default.get("https://example.com/slow-object", () => new Promise((resolve) => {
109
+ responseTimer = setTimeout(() => {
110
+ resolve({
111
+ status: 200,
112
+ headers: { "Content-Type": "application/activity+json" },
113
+ body: {
114
+ "@context": "https://www.w3.org/ns/activitystreams",
115
+ type: "Note",
116
+ content: "Slow response"
117
+ }
118
+ });
119
+ }, 1e3);
120
+ }));
121
+ const loader = getAuthenticatedDocumentLoader({
122
+ keyId: new URL("https://example.com/key2"),
123
+ privateKey: rsaPrivateKey2
118
124
  });
119
- }, 1e3);
120
- }));
121
- const loader = getAuthenticatedDocumentLoader({
122
- keyId: new URL("https://example.com/key2"),
123
- privateKey: rsaPrivateKey2
125
+ const controller = new AbortController();
126
+ const promise = loader("https://example.com/slow-object", { signal: controller.signal });
127
+ controller.abort();
128
+ await assertRejects(() => promise, Error);
129
+ await assertRejects(() => loader("https://example.com/object", { signal: controller.signal }), Error);
130
+ } finally {
131
+ clearTimeout(responseTimer);
132
+ }
124
133
  });
125
- const controller = new AbortController();
126
- const promise = loader("https://example.com/slow-object", { signal: controller.signal });
127
- controller.abort();
128
- await assertRejects(() => promise, Error);
129
- await assertRejects(() => loader("https://example.com/object", { signal: controller.signal }), Error);
130
- });
131
- await t.step("immediate cancellation", async () => {
132
- const loader = getAuthenticatedDocumentLoader({
133
- keyId: new URL("https://example.com/key2"),
134
- privateKey: rsaPrivateKey2
134
+ await t.step("immediate cancellation", async () => {
135
+ const loader = getAuthenticatedDocumentLoader({
136
+ keyId: new URL("https://example.com/key2"),
137
+ privateKey: rsaPrivateKey2
138
+ });
139
+ const controller = new AbortController();
140
+ controller.abort();
141
+ await assertRejects(() => loader("https://example.com/object", { signal: controller.signal }), Error);
135
142
  });
136
- const controller = new AbortController();
137
- controller.abort();
138
- await assertRejects(() => loader("https://example.com/object", { signal: controller.signal }), Error);
139
- });
140
- esm_default.hardReset();
143
+ } finally {
144
+ esm_default.hardReset();
145
+ }
141
146
  });
142
147
  test("getAuthenticatedDocumentLoader() bounds JSON after redirects", async () => {
143
148
  esm_default.mockGlobal();
@@ -456,5 +461,75 @@ test("getAuthenticatedDocumentLoader() rejects cancellation before fetching", as
456
461
  esm_default.hardReset();
457
462
  }
458
463
  });
464
+ const unsupportedUrls = [
465
+ "ftp://example.com/collection",
466
+ "file:///collection",
467
+ `data:application/ld+json,${encodeURIComponent(JSON.stringify({ id: "https://example.com/data" }))}`
468
+ ];
469
+ function isUnsupportedProtocolError(error, url) {
470
+ return error instanceof UrlError && error.message === `Unsupported protocol: ${new URL(url).protocol}` && error.reason === "disallowed";
471
+ }
472
+ async function withFetchStub(respond, callback) {
473
+ const fetched = [];
474
+ const originalFetch = globalThis.fetch;
475
+ globalThis.fetch = ((input, init) => {
476
+ const request = input instanceof Request && init == null ? input : new Request(input, init);
477
+ fetched.push(request);
478
+ return Promise.resolve(respond(request));
479
+ });
480
+ try {
481
+ await callback(fetched);
482
+ } finally {
483
+ globalThis.fetch = originalFetch;
484
+ }
485
+ }
486
+ for (const url of unsupportedUrls) {
487
+ const scheme = new URL(url).protocol;
488
+ const loader = getAuthenticatedDocumentLoader({
489
+ keyId: new URL("https://example.com/key2"),
490
+ privateKey: rsaPrivateKey2
491
+ }, { allowPrivateAddress: true });
492
+ test(`getAuthenticatedDocumentLoader() rejects ${scheme} URLs with private addresses allowed before fetching`, async () => {
493
+ await withFetchStub(() => Response.json({}), async (fetched) => {
494
+ await rejects(loader(url), (e) => isUnsupportedProtocolError(e, url));
495
+ deepStrictEqual(fetched, []);
496
+ });
497
+ });
498
+ test(`getAuthenticatedDocumentLoader() rejects redirects to ${scheme} URLs with private addresses allowed`, async () => {
499
+ const start = "https://example.com/redirect-to-unsupported";
500
+ await withFetchStub(() => Response.redirect(url, 302), async (fetched) => {
501
+ await rejects(loader(start), (e) => isUnsupportedProtocolError(e, url));
502
+ deepStrictEqual(fetched.map((r) => r.url), [start]);
503
+ });
504
+ });
505
+ for (const firstSpec of ["rfc9421", "draft-cavage-http-signatures-12"]) test(`getAuthenticatedDocumentLoader() rejects redirects to ${scheme} URLs after signature fallback from ${firstSpec}`, async () => {
506
+ const start = "https://example.com/fallback-redirect-to-unsupported";
507
+ const fallbackLoader = getAuthenticatedDocumentLoader({
508
+ keyId: new URL("https://example.com/key2"),
509
+ privateKey: rsaPrivateKey2
510
+ }, {
511
+ allowPrivateAddress: true,
512
+ specDeterminer: {
513
+ determineSpec: () => firstSpec,
514
+ rememberSpec: () => {}
515
+ }
516
+ });
517
+ await withFetchStub((request) => request.headers.has("Signature-Input") === (firstSpec === "rfc9421") ? new Response("Unauthorized", { status: 401 }) : Response.redirect(url, 302), async (fetched) => {
518
+ await rejects(fallbackLoader(start), (e) => isUnsupportedProtocolError(e, url));
519
+ deepStrictEqual(fetched.map((r) => r.url), [start, start]);
520
+ deepStrictEqual(fetched.map((r) => r.headers.has("Signature-Input")), [firstSpec === "rfc9421", firstSpec !== "rfc9421"]);
521
+ });
522
+ });
523
+ for (const html of [false, true]) test(`getAuthenticatedDocumentLoader() rejects ${html ? "HTML" : "Link header"} alternates to ${scheme} URLs with private addresses allowed`, async () => {
524
+ const start = "https://example.com/alternate-to-unsupported";
525
+ await withFetchStub(() => html ? new Response(`<link rel="alternate" type="application/activity+json" href="${url}">`, { headers: { "Content-Type": "text/html" } }) : new Response("", { headers: {
526
+ "Content-Type": "text/plain",
527
+ Link: `<${url}>; rel="alternate"; type="application/activity+json"`
528
+ } }), async (fetched) => {
529
+ await rejects(loader(start), (e) => isUnsupportedProtocolError(e, url));
530
+ deepStrictEqual(fetched.map((r) => r.url), [start]);
531
+ });
532
+ });
533
+ }
459
534
  //#endregion
460
535
  export {};
@@ -1,6 +1,6 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_kv_cache = require("../kv-cache-Btp4kC_U.cjs");
4
+ const require_kv_cache = require("../kv-cache-CPEV_4nZ.cjs");
5
5
  exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
6
6
  exports.kvCache = require_kv_cache.kvCache;
package/dist/utils/mod.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-DVhfMtqE.js";
3
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-B7X4p1y7.js";
4
4
  export { getAuthenticatedDocumentLoader, kvCache };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "2.2.17",
3
+ "version": "2.2.18",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -153,9 +153,9 @@
153
153
  "uri-template-router": "^1.0.0",
154
154
  "url-template": "^3.1.1",
155
155
  "urlpattern-polyfill": "^10.1.0",
156
- "@fedify/vocab": "2.2.17",
157
- "@fedify/webfinger": "2.2.17",
158
- "@fedify/vocab-runtime": "2.2.17"
156
+ "@fedify/vocab": "2.2.18",
157
+ "@fedify/vocab-runtime": "2.2.18",
158
+ "@fedify/webfinger": "2.2.18"
159
159
  },
160
160
  "devDependencies": {
161
161
  "@std/assert": "npm:@jsr/std__assert@^0.226.0",
@@ -168,7 +168,7 @@
168
168
  "typescript": "^6.0.0",
169
169
  "wrangler": "^4.17.0",
170
170
  "@fedify/fixture": "2.0.0",
171
- "@fedify/vocab-tools": "^2.2.17"
171
+ "@fedify/vocab-tools": "^2.2.18"
172
172
  },
173
173
  "scripts": {
174
174
  "build:self": "tsdown",
File without changes