@fedify/fedify 2.3.9-dev.2048 → 2.3.9

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 (73) hide show
  1. package/dist/{builder-BfY2wZ4V.mjs → builder-Dm72xfCy.mjs} +2 -2
  2. package/dist/{client-DYDoDpMa.mjs → client-Ccbsek6u.mjs} +7 -3
  3. package/dist/compat/transformers.test.mjs +1 -1
  4. package/dist/{context-BepjCFHN.mjs → context-CxbCIptr.mjs} +2 -1
  5. package/dist/{deno-ayal9buz.mjs → deno-Deo5dZf_.mjs} +1 -1
  6. package/dist/docloader-BAVVKXPl.mjs +79 -0
  7. package/dist/federation/builder.test.mjs +2 -2
  8. package/dist/federation/circuit-breaker.test.mjs +1 -1
  9. package/dist/federation/collection.test.mjs +1 -1
  10. package/dist/federation/handler.test.mjs +7 -7
  11. package/dist/federation/idempotency.test.mjs +3 -3
  12. package/dist/federation/kv.test.mjs +1 -1
  13. package/dist/federation/metrics.test.mjs +2 -2
  14. package/dist/federation/middleware.test.mjs +187 -8
  15. package/dist/federation/mod.cjs +1 -1
  16. package/dist/federation/mod.js +1 -1
  17. package/dist/federation/mq.test.mjs +98 -43
  18. package/dist/federation/negotiation.test.mjs +1 -1
  19. package/dist/federation/router.test.mjs +1 -1
  20. package/dist/federation/send.test.mjs +85 -4
  21. package/dist/federation/temporal.test.mjs +2 -2
  22. package/dist/federation/webfinger.test.mjs +3 -3
  23. package/dist/{http-B2u6PvNX.mjs → http-BqObaL32.mjs} +8 -4
  24. package/dist/{http-BGP2QCbe.cjs → http-CjvY7wBM.cjs} +6 -2
  25. package/dist/{http-BPPCh0xN.js → http-DuWPL6ic.js} +6 -2
  26. package/dist/{key-C9DkrWwb.mjs → key-D1TEfV4d.mjs} +2 -2
  27. package/dist/{kv-cache-C1TC_e9y.cjs → kv-cache-C_4ufNbl.cjs} +34 -8
  28. package/dist/{kv-cache-qJSjfLGm.mjs → kv-cache-DGnB9ZX_.mjs} +1 -1
  29. package/dist/{kv-cache-Cl1q1aA9.js → kv-cache-w0De7ODp.js} +35 -9
  30. package/dist/{ld-DNl7KwLY.mjs → ld-DnGqAKWi.mjs} +4 -4
  31. package/dist/{metrics-Ce55disp.mjs → metrics-jUJmtE2u.mjs} +1 -1
  32. package/dist/{middleware-C_utyVa_.js → middleware-A-SjayRO.js} +19 -5
  33. package/dist/{middleware-BZojifnF.cjs → middleware-BW5W0CTK.cjs} +19 -5
  34. package/dist/{middleware-C96wm_7x.mjs → middleware-C70IPcBw.mjs} +1 -1
  35. package/dist/{middleware-BCG2BX1n.mjs → middleware-XCr66VRe.mjs} +13 -13
  36. package/dist/{mod-DHgc4ygG.d.ts → mod-CQ8EjnN5.d.ts} +2 -0
  37. package/dist/{mod-1TuoXkGs.d.cts → mod-EbRFjVlY.d.cts} +2 -0
  38. package/dist/mod.cjs +5 -5
  39. package/dist/mod.d.cts +1 -1
  40. package/dist/mod.d.ts +1 -1
  41. package/dist/mod.js +5 -5
  42. package/dist/nodeinfo/client.test.mjs +50 -2
  43. package/dist/nodeinfo/handler.test.mjs +3 -3
  44. package/dist/nodeinfo/mod.cjs +1 -1
  45. package/dist/nodeinfo/mod.js +1 -1
  46. package/dist/nodeinfo/types.test.mjs +1 -1
  47. package/dist/otel/exporter.test.mjs +1 -1
  48. package/dist/{owner-DqqDBw-l.mjs → owner-C4iDnghj.mjs} +2 -2
  49. package/dist/{proof-D5vP7VIN.mjs → proof-CpU6r25U.mjs} +3 -3
  50. package/dist/{proof-Dz9ObvUq.js → proof-DqO9zYcc.js} +2 -2
  51. package/dist/{proof-I6YcKRRq.cjs → proof-DvVA2Bmk.cjs} +2 -2
  52. package/dist/{send-CBtR8DQK.mjs → send-YVatAj-a.mjs} +18 -4
  53. package/dist/sig/http.test.mjs +43 -3
  54. package/dist/sig/key.test.mjs +2 -2
  55. package/dist/sig/ld.test.mjs +5 -2
  56. package/dist/sig/mod.cjs +2 -2
  57. package/dist/sig/mod.js +2 -2
  58. package/dist/sig/owner.test.mjs +2 -2
  59. package/dist/sig/proof.test.mjs +2 -2
  60. package/dist/{std__assert-BBjXFNOb.mjs → std__assert-BvGuO4xO.mjs} +2 -27
  61. package/dist/{temporal-B9t2tY9A.mjs → temporal-BJ-5wxWU.mjs} +1 -1
  62. package/dist/testing/mod.mjs +1 -1
  63. package/dist/{types-DWs-qZaY.cjs → types-DRPjmHVV.cjs} +7 -3
  64. package/dist/{types-sXITXcWa.js → types-miAYfiGO.js} +7 -3
  65. package/dist/utils/docloader.test.mjs +299 -3
  66. package/dist/utils/kv-cache.test.mjs +1 -1
  67. package/dist/utils/mod.cjs +1 -1
  68. package/dist/utils/mod.d.cts +1 -1
  69. package/dist/utils/mod.d.ts +1 -1
  70. package/dist/utils/mod.js +1 -1
  71. package/dist/vocab/cjs.test.mjs +1 -1
  72. package/package.json +8 -8
  73. package/dist/docloader-C-JrNL14.mjs +0 -53
@@ -2,10 +2,10 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import { t as __exportAll } from "./chunk-CRNNMoPX.js";
4
4
  import { r as getDefaultActivityTransformers } from "./transformers-BGMIq1cs.js";
5
- import { A as recordWebFingerHandle, C as recordCollectionRequest, D as recordInboxActivity, E as recordFanoutRecipients, I as name, L as version, M as formatAcceptSignature, O as recordOutboxActivity, S as recordCollectionPageItems, _ as instrumentDocumentLoader, a as verifyRequestDetailed, b as recordCircuitBreakerStateChange, d as importJwk, f as validateCryptoKey, g as getRemoteHost, h as getFederationMetrics, i as verifyRequest, j as registerQueueDepthGauge, k as recordOutboxEnqueue, m as getDurationMs, n as parseRfc9421SignatureInput, o as exportJwk, t as doubleKnock, v as isAbortError, w as recordCollectionTotalItems, x as recordCollectionDispatchDuration } from "./http-BPPCh0xN.js";
6
- import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-sXITXcWa.js";
7
- import { _ as hasSignatureLike, b as signJsonLd, c as getKeyOwner, f as compactJsonLd, g as hasSignature, h as getNormalizationContextLoader, i as verifyObject, l as InvalidContextReferenceError, m as detachSignature, n as hasProofLike, o as normalizeOutgoingActivityJsonLd, r as signObject, s as doesActorOwnKey, u as assertSafeJsonLd, v as isClearlyMalformedContextReference, w as wrapContextLoaderForJsonLd, x as verifyCompactJsonLd, y as isInvalidUrlTypeError } from "./proof-Dz9ObvUq.js";
8
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-Cl1q1aA9.js";
5
+ import { A as recordWebFingerHandle, C as recordCollectionRequest, D as recordInboxActivity, E as recordFanoutRecipients, I as name, L as version, M as formatAcceptSignature, O as recordOutboxActivity, S as recordCollectionPageItems, _ as instrumentDocumentLoader, a as verifyRequestDetailed, b as recordCircuitBreakerStateChange, d as importJwk, f as validateCryptoKey, g as getRemoteHost, h as getFederationMetrics, i as verifyRequest, j as registerQueueDepthGauge, k as recordOutboxEnqueue, m as getDurationMs, n as parseRfc9421SignatureInput, o as exportJwk, t as doubleKnock, v as isAbortError, w as recordCollectionTotalItems, x as recordCollectionDispatchDuration } from "./http-DuWPL6ic.js";
6
+ import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-miAYfiGO.js";
7
+ import { _ as hasSignatureLike, b as signJsonLd, c as getKeyOwner, f as compactJsonLd, g as hasSignature, h as getNormalizationContextLoader, i as verifyObject, l as InvalidContextReferenceError, m as detachSignature, n as hasProofLike, o as normalizeOutgoingActivityJsonLd, r as signObject, s as doesActorOwnKey, u as assertSafeJsonLd, v as isClearlyMalformedContextReference, w as wrapContextLoaderForJsonLd, x as verifyCompactJsonLd, y as isInvalidUrlTypeError } from "./proof-DqO9zYcc.js";
8
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-w0De7ODp.js";
9
9
  import { getLogger, withContext } from "@logtape/logtape";
10
10
  import { Router, RouterError, assertPath } from "@fedify/uri-template";
11
11
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, Tombstone, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
@@ -3437,6 +3437,15 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
3437
3437
  if (!allowPrivateAddress) try {
3438
3438
  await validatePublicUrl(url);
3439
3439
  } catch (error) {
3440
+ if (error instanceof UrlError && error.reason === "dns") {
3441
+ logger.error("DNS resolution failed for URL: {url}", {
3442
+ url,
3443
+ error
3444
+ });
3445
+ const failure = new FetchError(url, error.message);
3446
+ failure.cause = error;
3447
+ throw failure;
3448
+ }
3440
3449
  if (error instanceof UrlError) logger.error("Disallowed private URL: {url}", {
3441
3450
  url,
3442
3451
  error
@@ -3444,7 +3453,12 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
3444
3453
  throw error;
3445
3454
  }
3446
3455
  }
3447
- await validateUrl(inbox.href);
3456
+ try {
3457
+ await validateUrl(inbox.href);
3458
+ } catch (error) {
3459
+ if (error instanceof FetchError) federationMetrics.recordDelivery(inbox, getDurationMs(started), false, activityType);
3460
+ throw error;
3461
+ }
3448
3462
  headers = new Headers(headers);
3449
3463
  headers.set("Content-Type", "application/activity+json");
3450
3464
  const request = new Request(inbox, {
@@ -2,10 +2,10 @@ const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  const require_chunk = require("./chunk-DDcVe30Y.cjs");
4
4
  const require_transformers = require("./transformers-NeAONrAq.cjs");
5
- const require_http = require("./http-BGP2QCbe.cjs");
6
- const require_types = require("./types-DWs-qZaY.cjs");
7
- const require_proof = require("./proof-I6YcKRRq.cjs");
8
- const require_kv_cache = require("./kv-cache-C1TC_e9y.cjs");
5
+ const require_http = require("./http-CjvY7wBM.cjs");
6
+ const require_types = require("./types-DRPjmHVV.cjs");
7
+ const require_proof = require("./proof-DvVA2Bmk.cjs");
8
+ const require_kv_cache = require("./kv-cache-C_4ufNbl.cjs");
9
9
  let _logtape_logtape = require("@logtape/logtape");
10
10
  let _fedify_uri_template = require("@fedify/uri-template");
11
11
  let _fedify_vocab = require("@fedify/vocab");
@@ -3438,6 +3438,15 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
3438
3438
  if (!allowPrivateAddress) try {
3439
3439
  await (0, _fedify_vocab_runtime.validatePublicUrl)(url);
3440
3440
  } catch (error) {
3441
+ if (error instanceof _fedify_vocab_runtime.UrlError && error.reason === "dns") {
3442
+ logger.error("DNS resolution failed for URL: {url}", {
3443
+ url,
3444
+ error
3445
+ });
3446
+ const failure = new _fedify_vocab_runtime.FetchError(url, error.message);
3447
+ failure.cause = error;
3448
+ throw failure;
3449
+ }
3441
3450
  if (error instanceof _fedify_vocab_runtime.UrlError) logger.error("Disallowed private URL: {url}", {
3442
3451
  url,
3443
3452
  error
@@ -3445,7 +3454,12 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
3445
3454
  throw error;
3446
3455
  }
3447
3456
  }
3448
- await validateUrl(inbox.href);
3457
+ try {
3458
+ await validateUrl(inbox.href);
3459
+ } catch (error) {
3460
+ if (error instanceof _fedify_vocab_runtime.FetchError) federationMetrics.recordDelivery(inbox, require_http.getDurationMs(started), false, activityType);
3461
+ throw error;
3462
+ }
3449
3463
  headers = new Headers(headers);
3450
3464
  headers.set("Content-Type", "application/activity+json");
3451
3465
  const request = new Request(inbox, {
@@ -1,5 +1,5 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as FederationImpl } from "./middleware-BCG2BX1n.mjs";
4
+ import { n as FederationImpl } from "./middleware-XCr66VRe.mjs";
5
5
  export { FederationImpl };
@@ -1,26 +1,26 @@
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-ayal9buz.mjs";
5
- import { a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, n as getDurationMs, o as isAbortError, r as getFederationMetrics, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "./metrics-Ce55disp.mjs";
4
+ import { n as version, t as name } from "./deno-Deo5dZf_.mjs";
5
+ import { a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, n as getDurationMs, o as isAbortError, r as getFederationMetrics, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "./metrics-jUJmtE2u.mjs";
6
6
  import { t as formatAcceptSignature } from "./accept-Dd__NiUL.mjs";
7
- import { o as importJwk, s as validateCryptoKey, t as exportJwk } from "./key-C9DkrWwb.mjs";
8
- import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-B2u6PvNX.mjs";
9
- import { t as getAuthenticatedDocumentLoader } from "./docloader-C-JrNL14.mjs";
10
- import { n as kvCache } from "./kv-cache-qJSjfLGm.mjs";
11
- import { _ as wrapContextLoaderForJsonLd, a as compactJsonLd, c as getNormalizationContextLoader, d as isClearlyMalformedContextReference, f as isInvalidUrlTypeError, l as hasSignature, m as verifyCompactJsonLd, p as signJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as hasSignatureLike } from "./ld-DNl7KwLY.mjs";
12
- import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-DqqDBw-l.mjs";
7
+ import { o as importJwk, s as validateCryptoKey, t as exportJwk } from "./key-D1TEfV4d.mjs";
8
+ import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-BqObaL32.mjs";
9
+ import { t as getAuthenticatedDocumentLoader } from "./docloader-BAVVKXPl.mjs";
10
+ import { n as kvCache } from "./kv-cache-DGnB9ZX_.mjs";
11
+ import { _ as wrapContextLoaderForJsonLd, a as compactJsonLd, c as getNormalizationContextLoader, d as isClearlyMalformedContextReference, f as isInvalidUrlTypeError, l as hasSignature, m as verifyCompactJsonLd, p as signJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as hasSignatureLike } from "./ld-DnGqAKWi.mjs";
12
+ import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-C4iDnghj.mjs";
13
13
  import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-HOAywiid.mjs";
14
- import { i as verifyObject, n as hasProofLike, r as signObject } from "./proof-D5vP7VIN.mjs";
15
- import { d as readBoundedText, l as BodyTooLargeError, t as getNodeInfo, u as MAX_BODY_SIZE } from "./client-DYDoDpMa.mjs";
14
+ import { i as verifyObject, n as hasProofLike, r as signObject } from "./proof-CpU6r25U.mjs";
15
+ import { d as readBoundedText, l as BodyTooLargeError, t as getNodeInfo, u as MAX_BODY_SIZE } from "./client-Ccbsek6u.mjs";
16
16
  import { t as nodeInfoToJson } from "./types-s4mCTGkT.mjs";
17
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-CBtR8DQK.mjs";
18
- import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-BfY2wZ4V.mjs";
17
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-YVatAj-a.mjs";
18
+ import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-Dm72xfCy.mjs";
19
19
  import { t as CircuitBreaker } from "./circuit-breaker-CDABzqVf.mjs";
20
20
  import { t as buildCollectionSynchronizationHeader } from "./collection-CA3V5zyK.mjs";
21
21
  import { t as KvKeyCache } from "./keycache-B3qRQNLj.mjs";
22
22
  import { t as acceptsJsonLd } from "./negotiation-CDW-_gUU.mjs";
23
- import { t as hasMalformedKnownTemporalLiteral } from "./temporal-B9t2tY9A.mjs";
23
+ import { t as hasMalformedKnownTemporalLiteral } from "./temporal-BJ-5wxWU.mjs";
24
24
  import { t as createExponentialBackoffPolicy } from "./retry-_VvV0h9f.mjs";
25
25
  import { getLogger, withContext } from "@logtape/logtape";
26
26
  import { RouterError } from "@fedify/uri-template";
@@ -30,6 +30,8 @@ interface GetAuthenticatedDocumentLoaderOptions extends DocumentLoaderFactoryOpt
30
30
  * Gets an authenticated {@link DocumentLoader} for the given identity.
31
31
  * Note that an authenticated document loader intentionally does not cache
32
32
  * the fetched documents.
33
+ * At most 20 HTTP redirects and alternate document links are followed in total
34
+ * per call. Revisiting a URL within that chain throws a {@link FetchError}.
33
35
  * @param identity The identity to get the document loader for.
34
36
  * The actor's key pair.
35
37
  * @param options The options for the document loader.
@@ -30,6 +30,8 @@ interface GetAuthenticatedDocumentLoaderOptions extends DocumentLoaderFactoryOpt
30
30
  * Gets an authenticated {@link DocumentLoader} for the given identity.
31
31
  * Note that an authenticated document loader intentionally does not cache
32
32
  * the fetched documents.
33
+ * At most 20 HTTP redirects and alternate document links are followed in total
34
+ * per call. Revisiting a URL within that chain throws a {@link FetchError}.
33
35
  * @param identity The identity to get the document loader for.
34
36
  * The actor's key pair.
35
37
  * @param options The options for the document loader.
package/dist/mod.cjs CHANGED
@@ -4,11 +4,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  require("./chunk-DDcVe30Y.cjs");
5
5
  const require_transformers = require("./transformers-NeAONrAq.cjs");
6
6
  require("./compat/mod.cjs");
7
- const require_http = require("./http-BGP2QCbe.cjs");
8
- const require_middleware = require("./middleware-BZojifnF.cjs");
9
- const require_types = require("./types-DWs-qZaY.cjs");
10
- const require_proof = require("./proof-I6YcKRRq.cjs");
11
- const require_kv_cache = require("./kv-cache-C1TC_e9y.cjs");
7
+ const require_http = require("./http-CjvY7wBM.cjs");
8
+ const require_middleware = require("./middleware-BW5W0CTK.cjs");
9
+ const require_types = require("./types-DRPjmHVV.cjs");
10
+ const require_proof = require("./proof-DvVA2Bmk.cjs");
11
+ const require_kv_cache = require("./kv-cache-C_4ufNbl.cjs");
12
12
  const require_federation_mod = require("./federation/mod.cjs");
13
13
  require("./nodeinfo/mod.cjs");
14
14
  require("./runtime/mod.cjs");
package/dist/mod.d.cts CHANGED
@@ -8,7 +8,7 @@ import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcess
8
8
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
9
9
  import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-PVR75MeU.cjs";
10
10
  import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-Bid79LFU.cjs";
11
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-1TuoXkGs.cjs";
11
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-EbRFjVlY.cjs";
12
12
  export * from "@fedify/vocab-runtime";
13
13
 
14
14
  //#region src/mod.d.ts
package/dist/mod.d.ts CHANGED
@@ -8,7 +8,7 @@ import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcess
8
8
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
9
9
  import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-CFuyfw3c.js";
10
10
  import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-TLEvgT1i.js";
11
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-DHgc4ygG.js";
11
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-CQ8EjnN5.js";
12
12
  export * from "@fedify/vocab-runtime";
13
13
 
14
14
  //#region src/mod.d.ts
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 { F as validateAcceptSignature, M as formatAcceptSignature, N as fulfillAcceptSignature, P as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, i as verifyRequest, l as fetchKeyDetailed, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "./http-BPPCh0xN.js";
7
- import { a as SendActivityError, c as buildCollectionSynchronizationHeader, d as normalizeCircuitBreakerOptions, f as parseCircuitBreakerKvState, i as createExponentialBackoffPolicy, l as digest, o as respondWithObject, p as createFederationBuilder, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as CircuitBreaker } from "./middleware-C_utyVa_.js";
8
- import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-sXITXcWa.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-Dz9ObvUq.js";
10
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-Cl1q1aA9.js";
6
+ import { F as validateAcceptSignature, M as formatAcceptSignature, N as fulfillAcceptSignature, P as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, i as verifyRequest, l as fetchKeyDetailed, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "./http-DuWPL6ic.js";
7
+ import { a as SendActivityError, c as buildCollectionSynchronizationHeader, d as normalizeCircuitBreakerOptions, f as parseCircuitBreakerKvState, i as createExponentialBackoffPolicy, l as digest, o as respondWithObject, p as createFederationBuilder, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as CircuitBreaker } from "./middleware-A-SjayRO.js";
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-DqO9zYcc.js";
10
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-w0De7ODp.js";
11
11
  import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError } from "./federation/mod.js";
12
12
  import "./nodeinfo/mod.js";
13
13
  import "./runtime/mod.js";
@@ -3,9 +3,13 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as esm_default } from "../esm-vrlUxr60.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
6
- import "../std__assert-BBjXFNOb.mjs";
7
- 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-DYDoDpMa.mjs";
6
+ import "../std__assert-BvGuO4xO.mjs";
7
+ import { n as assertInstanceOf } from "../assert-jSdZMYam.mjs";
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-Ccbsek6u.mjs";
9
+ import { configure, reset } from "@logtape/logtape";
8
10
  import { test } from "@fedify/fixture";
11
+ import { UrlError } from "@fedify/vocab-runtime";
12
+ import dns from "node:dns/promises";
9
13
  //#region src/nodeinfo/client.test.ts
10
14
  test("getNodeInfo()", async (t) => {
11
15
  esm_default.spyGlobal();
@@ -994,5 +998,49 @@ test("getNodeInfo() bounds both discovery and document responses", async () => {
994
998
  esm_default.hardReset();
995
999
  }
996
1000
  });
1001
+ test("getNodeInfo() logs DNS failures as such", { ignore: "Deno" in globalThis && (await Deno.permissions.query({ name: "net" })).state !== "granted" }, async (t) => {
1002
+ for (const result of [
1003
+ "throws",
1004
+ "empty",
1005
+ "private"
1006
+ ]) await t.step(result, async () => {
1007
+ const originalLookup = dns.lookup;
1008
+ dns.lookup = (() => result === "throws" ? Promise.reject(/* @__PURE__ */ new Error("Resolver unavailable")) : Promise.resolve(result === "empty" ? [] : [{
1009
+ address: "127.0.0.1",
1010
+ family: 4
1011
+ }]));
1012
+ const records = [];
1013
+ await configure({
1014
+ sinks: { buffer: (record) => records.push(record) },
1015
+ loggers: [{
1016
+ category: "fedify",
1017
+ sinks: ["buffer"],
1018
+ lowestLevel: "debug"
1019
+ }, {
1020
+ category: ["logtape", "meta"],
1021
+ sinks: []
1022
+ }],
1023
+ reset: true
1024
+ });
1025
+ try {
1026
+ assertEquals(await getNodeInfo("https://dns-failure.invalid/"), void 0);
1027
+ assertEquals(records.map((r) => [
1028
+ r.level,
1029
+ r.rawMessage,
1030
+ r.properties.url
1031
+ ]), [[
1032
+ "error",
1033
+ result === "private" ? "Refused to fetch a private or invalid URL {url}: {error}" : "DNS lookup failed for {url}: {error}",
1034
+ "https://dns-failure.invalid/.well-known/nodeinfo"
1035
+ ]]);
1036
+ const { error } = records[0].properties;
1037
+ assertInstanceOf(error, UrlError);
1038
+ assertEquals(error.reason, result === "private" ? "disallowed" : "dns");
1039
+ } finally {
1040
+ await reset();
1041
+ dns.lookup = originalLookup;
1042
+ }
1043
+ });
1044
+ });
997
1045
  //#endregion
998
1046
  export {};
@@ -1,11 +1,11 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { r as createRequestContext } from "../context-BepjCFHN.mjs";
4
+ import { r as createRequestContext } from "../context-CxbCIptr.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
6
- import "../std__assert-BBjXFNOb.mjs";
6
+ import "../std__assert-BvGuO4xO.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-CX8qfaad.mjs";
8
- import { _ as handleNodeInfo, o as createFederation, v as handleNodeInfoJrd } from "../middleware-BCG2BX1n.mjs";
8
+ import { _ as handleNodeInfo, o as createFederation, v as handleNodeInfoJrd } from "../middleware-XCr66VRe.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  //#region src/nodeinfo/handler.test.ts
11
11
  test("handleNodeInfo()", async () => {
@@ -1,7 +1,7 @@
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_types = require("../types-DWs-qZaY.cjs");
4
+ const require_types = require("../types-DRPjmHVV.cjs");
5
5
  exports.getNodeInfo = require_types.getNodeInfo;
6
6
  exports.nodeInfoToJson = require_types.nodeInfoToJson;
7
7
  exports.parseNodeInfo = require_types.parseNodeInfo;
@@ -1,4 +1,4 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "../types-sXITXcWa.js";
3
+ import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "../types-miAYfiGO.js";
4
4
  export { getNodeInfo, nodeInfoToJson, parseNodeInfo };
@@ -2,7 +2,7 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
- import "../std__assert-BBjXFNOb.mjs";
5
+ import "../std__assert-BvGuO4xO.mjs";
6
6
  import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
7
7
  import { t as nodeInfoToJson } from "../types-s4mCTGkT.mjs";
8
8
  import { test } from "@fedify/fixture";
@@ -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-C-ZRDbaf.mjs";
5
- import "../std__assert-BBjXFNOb.mjs";
5
+ import "../std__assert-BvGuO4xO.mjs";
6
6
  import { t as MemoryKvStore } from "../kv-CX8qfaad.mjs";
7
7
  import { getLogger } from "@logtape/logtape";
8
8
  import { ExportResultCode } from "@opentelemetry/core";
@@ -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-ayal9buz.mjs";
5
- import { c as verifyKeyOwnership, n as fetchActorDocument, t as exportJwk } from "./key-C9DkrWwb.mjs";
4
+ import { n as version, t as name } from "./deno-Deo5dZf_.mjs";
5
+ import { c as verifyKeyOwnership, n as fetchActorDocument, t as exportJwk } from "./key-D1TEfV4d.mjs";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
8
8
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,9 +1,9 @@
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-ayal9buz.mjs";
5
- import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-Ce55disp.mjs";
6
- import { r as fetchKey, s as validateCryptoKey } from "./key-C9DkrWwb.mjs";
4
+ import { n as version, t as name } from "./deno-Deo5dZf_.mjs";
5
+ import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-jUJmtE2u.mjs";
6
+ import { r as fetchKey, s as validateCryptoKey } from "./key-D1TEfV4d.mjs";
7
7
  import { n as preloadedOnlyDocumentLoader } from "./public-audience-jwoSIGUw.mjs";
8
8
  import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-HOAywiid.mjs";
9
9
  import { getLogger } from "@logtape/logtape";
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { I as name, L as version, c as fetchKey, f as validateCryptoKey, h as getFederationMetrics, m as getDurationMs, o as exportJwk, p as verifyKeyOwnership, s as fetchActorDocument, y as measureSignatureKeyFetch } from "./http-BPPCh0xN.js";
3
+ import { I as name, L as version, c as fetchKey, f as validateCryptoKey, h as getFederationMetrics, m as getDurationMs, o as exportJwk, p as verifyKeyOwnership, s as fetchActorDocument, y as measureSignatureKeyFetch } from "./http-DuWPL6ic.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";
@@ -204,7 +204,7 @@ function normalizeContextReference(reference, baseUrl) {
204
204
  /** @internal */
205
205
  function isInvalidUrlTypeError(error) {
206
206
  const code = error.code;
207
- return error instanceof TypeError && (code === "ERR_INVALID_URL" || /^Invalid URL(?::|$)/.test(error.message) || / cannot be parsed as a URL\.?$/.test(error.message));
207
+ return error instanceof TypeError && (code === "ERR_INVALID_URL" || error.message === "Invalid URL string." || /^Invalid URL(?::|$)/.test(error.message) || / cannot be parsed as a URL\.?$/.test(error.message));
208
208
  }
209
209
  async function applyGraphAliasContext(state, context, documentLoader, remoteContextCache, baseUrl = null, processingContexts = /* @__PURE__ */ new Set()) {
210
210
  if (context === null) return createGraphAliasContextState();
@@ -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-BGP2QCbe.cjs");
4
+ const require_http = require("./http-CjvY7wBM.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");
@@ -207,7 +207,7 @@ function normalizeContextReference(reference, baseUrl) {
207
207
  /** @internal */
208
208
  function isInvalidUrlTypeError(error) {
209
209
  const code = error.code;
210
- return error instanceof TypeError && (code === "ERR_INVALID_URL" || /^Invalid URL(?::|$)/.test(error.message) || / cannot be parsed as a URL\.?$/.test(error.message));
210
+ return error instanceof TypeError && (code === "ERR_INVALID_URL" || error.message === "Invalid URL string." || /^Invalid URL(?::|$)/.test(error.message) || / cannot be parsed as a URL\.?$/.test(error.message));
211
211
  }
212
212
  async function applyGraphAliasContext(state, context, documentLoader, remoteContextCache, baseUrl = null, processingContexts = /* @__PURE__ */ new Set()) {
213
213
  if (context === null) return createGraphAliasContextState();
@@ -1,9 +1,9 @@
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-ayal9buz.mjs";
5
- import { n as getDurationMs, r as getFederationMetrics } from "./metrics-Ce55disp.mjs";
6
- import { n as doubleKnock } from "./http-B2u6PvNX.mjs";
4
+ import { n as version, t as name } from "./deno-Deo5dZf_.mjs";
5
+ import { n as getDurationMs, r as getFederationMetrics } from "./metrics-jUJmtE2u.mjs";
6
+ import { n as doubleKnock } from "./http-BqObaL32.mjs";
7
7
  import { getLogger } from "@logtape/logtape";
8
8
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
9
9
  import { FetchError, UrlError, validatePublicUrl } from "@fedify/vocab-runtime";
@@ -125,6 +125,15 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
125
125
  if (!allowPrivateAddress) try {
126
126
  await validatePublicUrl(url);
127
127
  } catch (error) {
128
+ if (error instanceof UrlError && error.reason === "dns") {
129
+ logger.error("DNS resolution failed for URL: {url}", {
130
+ url,
131
+ error
132
+ });
133
+ const failure = new FetchError(url, error.message);
134
+ failure.cause = error;
135
+ throw failure;
136
+ }
128
137
  if (error instanceof UrlError) logger.error("Disallowed private URL: {url}", {
129
138
  url,
130
139
  error
@@ -132,7 +141,12 @@ async function sendActivityInternal({ activity, activityId, activityType, keys,
132
141
  throw error;
133
142
  }
134
143
  }
135
- await validateUrl(inbox.href);
144
+ try {
145
+ await validateUrl(inbox.href);
146
+ } catch (error) {
147
+ if (error instanceof FetchError) federationMetrics.recordDelivery(inbox, getDurationMs(started), false, activityType);
148
+ throw error;
149
+ }
136
150
  headers = new Headers(headers);
137
151
  headers.set("Content-Type", "application/activity+json");
138
152
  const request = new Request(inbox, {
@@ -3,12 +3,12 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as esm_default } from "../esm-vrlUxr60.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
6
- import { r as assertExists, t as assertStringIncludes } from "../std__assert-BBjXFNOb.mjs";
6
+ import { n as assertExists, t as assertStringIncludes } from "../std__assert-BvGuO4xO.mjs";
7
7
  import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
8
8
  import { t as assert } from "../assert-jSdZMYam.mjs";
9
9
  import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
10
- import { t as exportJwk } from "../key-C9DkrWwb.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-B2u6PvNX.mjs";
10
+ import { t as exportJwk } from "../key-D1TEfV4d.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-BqObaL32.mjs";
12
12
  import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-BAK-tUlf.mjs";
13
13
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
14
14
  import { FetchError, exportSpki } from "@fedify/vocab-runtime";
@@ -628,6 +628,46 @@ test("verifyRequest() [rfc9421] successful GET verification", async () => {
628
628
  currentTime: Temporal.Instant.from(`${(/* @__PURE__ */ new Date(currentTimestamp * 1e3)).toISOString()}`)
629
629
  }), rsaPublicKey2, "Valid signature should verify to the correct public key");
630
630
  });
631
+ for (const failure of [
632
+ "missing key",
633
+ "invalid signature",
634
+ "digest mismatch",
635
+ "empty body",
636
+ "cached key"
637
+ ]) test(`verifyRequest() [rfc9421] multiple POST signatures: ${failure}`, async () => {
638
+ const body = failure === "empty body" ? "" : "Hello, world!";
639
+ const currentTime = Temporal.Instant.from("2024-03-05T08:09:44Z");
640
+ const signed = await signRequest(new Request("https://example.com/inbox", {
641
+ method: "POST",
642
+ body
643
+ }), rsaPrivateKey2, new URL("https://example.com/key2"), {
644
+ spec: "rfc9421",
645
+ currentTime
646
+ });
647
+ const input = signed.headers.get("Signature-Input");
648
+ const signature = signed.headers.get("Signature");
649
+ const firstInput = failure === "missing key" ? input.replace("https://example.com/key2", "https://example.com/missing-key") : input;
650
+ signed.headers.set("Signature-Input", `${firstInput}, ${input.replace(/^sig1=/, "sig2=")}`);
651
+ signed.headers.set("Signature", `sig1=:AAAAAA==:, ${signature.replace(/^sig1=/, "sig2=")}`);
652
+ const request = failure === "digest mismatch" ? new Request(signed, { body: "Tampered body" }) : signed;
653
+ const loaded = [];
654
+ assertEquals(await verifyRequest(request, {
655
+ keyCache: failure === "cached key" ? {
656
+ get: () => Promise.resolve(rsaPublicKey1),
657
+ set: async () => {}
658
+ } : void 0,
659
+ spec: "rfc9421",
660
+ currentTime,
661
+ contextLoader: mockDocumentLoader,
662
+ documentLoader: (url, options) => {
663
+ loaded.push(url);
664
+ return mockDocumentLoader(url, options);
665
+ }
666
+ }), failure === "digest mismatch" ? null : rsaPublicKey2);
667
+ assertEquals(loaded, failure === "digest mismatch" ? [] : failure === "missing key" ? ["https://example.com/missing-key", "https://example.com/key2"] : ["https://example.com/key2", "https://example.com/key2"]);
668
+ assertFalse(request.bodyUsed);
669
+ assertEquals(await request.text(), failure === "digest mismatch" ? "Tampered body" : body);
670
+ });
631
671
  test("verifyRequest() [rfc9421] manual POST verification", async () => {
632
672
  const currentTimestamp = 1709626184;
633
673
  const currentTime = Temporal.Instant.from("2024-03-05T08:09:44Z");
@@ -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-C-ZRDbaf.mjs";
5
- import "../std__assert-BBjXFNOb.mjs";
5
+ import "../std__assert-BvGuO4xO.mjs";
6
6
  import { t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
7
7
  import { t as assert } from "../assert-jSdZMYam.mjs";
8
8
  import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
9
- import { a as generateCryptoKeyPair, i as fetchKeyDetailed, o as importJwk, r as fetchKey, s as validateCryptoKey, t as exportJwk } from "../key-C9DkrWwb.mjs";
9
+ import { a as generateCryptoKeyPair, i as fetchKeyDetailed, o as importJwk, r as fetchKey, s as validateCryptoKey, t as exportJwk } from "../key-D1TEfV4d.mjs";
10
10
  import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
11
11
  import { CryptographicKey, Multikey } from "@fedify/vocab";
12
12
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
@@ -5,14 +5,17 @@ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
5
  import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
6
6
  import { n as assertInstanceOf, t as assert } from "../assert-jSdZMYam.mjs";
7
7
  import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
8
- import { a as generateCryptoKeyPair } from "../key-C9DkrWwb.mjs";
8
+ import { a as generateCryptoKeyPair } from "../key-D1TEfV4d.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-DNl7KwLY.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-DnGqAKWi.mjs";
11
11
  import { CryptographicKey } from "@fedify/vocab";
12
12
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
13
13
  import { encodeBase64 } from "byte-encodings/base64";
14
14
  //#region src/sig/ld.test.ts
15
15
  test("isInvalidUrlTypeError()", () => {
16
+ assert(isInvalidUrlTypeError(/* @__PURE__ */ new TypeError("Invalid URL string.")));
17
+ assertFalse(isInvalidUrlTypeError(/* @__PURE__ */ new Error("Invalid URL string.")));
18
+ assertFalse(isInvalidUrlTypeError(/* @__PURE__ */ new TypeError("Invalid URL string. Other error")));
16
19
  assert(isInvalidUrlTypeError(/* @__PURE__ */ new TypeError("Invalid URL: http://[")));
17
20
  assert(isInvalidUrlTypeError(/* @__PURE__ */ new TypeError("\"http://[\" cannot be parsed as a URL.")));
18
21
  const error = /* @__PURE__ */ new TypeError("Failed to parse URL");
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-BGP2QCbe.cjs");
5
- const require_proof = require("../proof-I6YcKRRq.cjs");
4
+ const require_http = require("../http-CjvY7wBM.cjs");
5
+ const require_proof = require("../proof-DvVA2Bmk.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 { F as validateAcceptSignature, M as formatAcceptSignature, N as fulfillAcceptSignature, P as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, i as verifyRequest, l as fetchKeyDetailed, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "../http-BPPCh0xN.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-Dz9ObvUq.js";
3
+ import { F as validateAcceptSignature, M as formatAcceptSignature, N as fulfillAcceptSignature, P as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, i as verifyRequest, l as fetchKeyDetailed, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "../http-DuWPL6ic.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-DqO9zYcc.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-C-ZRDbaf.mjs";
5
- import "../std__assert-BBjXFNOb.mjs";
5
+ import "../std__assert-BvGuO4xO.mjs";
6
6
  import { r as assertFalse } from "../assert_rejects-DN60FHPX.mjs";
7
7
  import { t as assert } from "../assert-jSdZMYam.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-DqqDBw-l.mjs";
9
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-C4iDnghj.mjs";
10
10
  import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
11
11
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
12
12
  //#region src/sig/owner.test.ts
@@ -2,12 +2,12 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
- import "../std__assert-BBjXFNOb.mjs";
5
+ import "../std__assert-BvGuO4xO.mjs";
6
6
  import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
7
7
  import { n as assertInstanceOf, t as assert } from "../assert-jSdZMYam.mjs";
8
8
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
9
9
  import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-HOAywiid.mjs";
10
- import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-D5vP7VIN.mjs";
10
+ import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-CpU6r25U.mjs";
11
11
  import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place } from "@fedify/vocab";
12
12
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
13
13
  import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";