@fedify/fedify 2.4.0-dev.1848 → 2.4.0-dev.1873

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 (64) hide show
  1. package/dist/{builder-8WyrrBSI.mjs → builder-7ZvZ5ilC.mjs} +2 -2
  2. package/dist/{circuit-breaker-BT7CiPbz.mjs → circuit-breaker-C5NqoLBJ.mjs} +25 -5
  3. package/dist/{circuit-breaker-test-utils-BYIHoliq.mjs → circuit-breaker-test-utils-DW6YC_Pe.mjs} +1 -1
  4. package/dist/compat/mod.d.cts +1 -1
  5. package/dist/compat/mod.d.ts +1 -1
  6. package/dist/compat/transformers.test.mjs +1 -1
  7. package/dist/{context-B-dsBjZ9.d.cts → context-BOnn653X.d.cts} +3 -2
  8. package/dist/{context-DrLXudbA.d.ts → context-CmjP-cgJ.d.ts} +3 -2
  9. package/dist/{deno-CNYW2Ig8.mjs → deno-CxSfl_a4.mjs} +1 -1
  10. package/dist/{docloader-Dzbz3Js2.mjs → docloader-BA8lSYW0.mjs} +13 -9
  11. package/dist/federation/builder.test.mjs +1 -1
  12. package/dist/federation/circuit-breaker.test.mjs +184 -21
  13. package/dist/federation/handler.test.mjs +3 -3
  14. package/dist/federation/idempotency.test.mjs +2 -2
  15. package/dist/federation/metrics.test.mjs +1 -1
  16. package/dist/federation/middleware.test.mjs +10 -9
  17. package/dist/federation/mod.cjs +1 -1
  18. package/dist/federation/mod.d.cts +2 -2
  19. package/dist/federation/mod.d.ts +2 -2
  20. package/dist/federation/mod.js +1 -1
  21. package/dist/federation/send.test.mjs +3 -3
  22. package/dist/federation/tasks/enqueue.test.mjs +1 -1
  23. package/dist/federation/tasks/tasks.test.mjs +2 -2
  24. package/dist/federation/temporal.test.mjs +1 -1
  25. package/dist/federation/webfinger.test.mjs +1 -1
  26. package/dist/{federation-CChOD4m8.cjs → federation-EWi4e3XY.cjs} +28 -8
  27. package/dist/{http-CqXnYPxh.js → http-BQxL1lOO.js} +8 -6
  28. package/dist/{http-DpXPu64P.mjs → http-DlSUSFxF.mjs} +9 -7
  29. package/dist/{http-DcSh3Nkc.cjs → http-MQyitOvl.cjs} +8 -6
  30. package/dist/{key-hmby7gn5.mjs → key-6O7-nI4D.mjs} +3 -3
  31. package/dist/{kv-cache-BJ67yD69.cjs → kv-cache-AN6qSmg2.cjs} +12 -8
  32. package/dist/{kv-cache-AbW4Zb7B.js → kv-cache-BaLaRgP0.js} +12 -8
  33. package/dist/{kv-cache-Nl-t79NZ.mjs → kv-cache-DqiCo6_V.mjs} +1 -1
  34. package/dist/{ld-B8i_nYpF.mjs → ld-CwHaXyMi.mjs} +3 -3
  35. package/dist/{metrics-Pf5DoomU.mjs → metrics-DpjCXFvC.mjs} +1 -1
  36. package/dist/{middleware-Hgkr-t3e.js → middleware-Bcx74jmq.js} +28 -8
  37. package/dist/{middleware-DRGoAGNP.mjs → middleware-C8wXU20O.mjs} +13 -13
  38. package/dist/{middleware-kc0OTJOB.mjs → middleware-Cy6-svwn.mjs} +1 -1
  39. package/dist/{mod-D6O8C7eN.d.ts → mod-BYuZ0WXt.d.ts} +1 -1
  40. package/dist/{mod-D-abvu2C.d.cts → mod-kUSY5n3f.d.cts} +1 -1
  41. package/dist/mod.cjs +4 -4
  42. package/dist/mod.d.cts +2 -2
  43. package/dist/mod.d.ts +2 -2
  44. package/dist/mod.js +4 -4
  45. package/dist/nodeinfo/handler.test.mjs +1 -1
  46. package/dist/{owner-Bq-aDUI1.mjs → owner-CDshspna.mjs} +2 -2
  47. package/dist/{proof-BJ6kqGDQ.mjs → proof-C1uX5GYQ.mjs} +4 -4
  48. package/dist/{proof-Y3u5gsyU.cjs → proof-CwrJYody.cjs} +1 -1
  49. package/dist/{proof-CKKqEWUg.js → proof-D7aD6Hut.js} +1 -1
  50. package/dist/{send-DxAijVhs.mjs → send-BrW0OtvG.mjs} +3 -3
  51. package/dist/sig/http.test.mjs +65 -3
  52. package/dist/sig/key.test.mjs +46 -1
  53. package/dist/sig/ld.test.mjs +2 -2
  54. package/dist/sig/mod.cjs +2 -2
  55. package/dist/sig/mod.js +2 -2
  56. package/dist/sig/owner.test.mjs +1 -1
  57. package/dist/sig/proof.test.mjs +1 -1
  58. package/dist/{temporal-BB26MWBu.mjs → temporal-5ClDg1Qq.mjs} +1 -1
  59. package/dist/testing/mod.d.mts +3 -2
  60. package/dist/utils/docloader.test.mjs +35 -2
  61. package/dist/utils/kv-cache.test.mjs +1 -1
  62. package/dist/utils/mod.cjs +1 -1
  63. package/dist/utils/mod.js +1 -1
  64. package/package.json +6 -6
@@ -1,26 +1,26 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-CNYW2Ig8.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-Pf5DoomU.mjs";
4
+ import { n as version, t as name } from "./deno-CxSfl_a4.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-DpjCXFvC.mjs";
6
6
  import { t as formatAcceptSignature } from "./accept-CPVqki78.mjs";
7
- import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-hmby7gn5.mjs";
8
- import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-DpXPu64P.mjs";
9
- import { t as getAuthenticatedDocumentLoader } from "./docloader-Dzbz3Js2.mjs";
10
- import { n as kvCache } from "./kv-cache-Nl-t79NZ.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-B8i_nYpF.mjs";
12
- import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-Bq-aDUI1.mjs";
7
+ import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-6O7-nI4D.mjs";
8
+ import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-DlSUSFxF.mjs";
9
+ import { t as getAuthenticatedDocumentLoader } from "./docloader-BA8lSYW0.mjs";
10
+ import { n as kvCache } from "./kv-cache-DqiCo6_V.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-CwHaXyMi.mjs";
12
+ import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-CDshspna.mjs";
13
13
  import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-BQSHRLhg.mjs";
14
- import { i as verifyObject, n as hasProofLike, r as signObject } from "./proof-BJ6kqGDQ.mjs";
14
+ import { i as verifyObject, n as hasProofLike, r as signObject } from "./proof-C1uX5GYQ.mjs";
15
15
  import { t as getNodeInfo } from "./client-CtxvmazV.mjs";
16
16
  import { t as nodeInfoToJson } from "./types-DE_LV1JB.mjs";
17
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-DxAijVhs.mjs";
18
- import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-8WyrrBSI.mjs";
19
- import { t as CircuitBreaker } from "./circuit-breaker-BT7CiPbz.mjs";
17
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-BrW0OtvG.mjs";
18
+ import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-7ZvZ5ilC.mjs";
19
+ import { t as CircuitBreaker } from "./circuit-breaker-C5NqoLBJ.mjs";
20
20
  import { t as buildCollectionSynchronizationHeader } from "./collection-CnnP1UAv.mjs";
21
21
  import { t as KvKeyCache } from "./keycache-0Jk78XmB.mjs";
22
22
  import { t as acceptsJsonLd } from "./negotiation-CCocWT_N.mjs";
23
- import { t as hasMalformedKnownTemporalLiteral } from "./temporal-BB26MWBu.mjs";
23
+ import { t as hasMalformedKnownTemporalLiteral } from "./temporal-5ClDg1Qq.mjs";
24
24
  import { t as createExponentialBackoffPolicy } from "./retry-zX5xw5e0.mjs";
25
25
  import { t as TaskCodec } from "./codec-peqOdBaE.mjs";
26
26
  import { getLogger, withContext } from "@logtape/logtape";
@@ -1,5 +1,5 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as FederationImpl } from "./middleware-DRGoAGNP.mjs";
4
+ import { n as FederationImpl } from "./middleware-C8wXU20O.mjs";
5
5
  export { FederationImpl };
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { _t as ActorHandleMapper, gt as ActorDispatcher, ht as ActorAliasMapper, l as RequestContext, zt as WebFingerLinksDispatcher } from "./context-DrLXudbA.js";
2
+ import { _t as ActorHandleMapper, gt as ActorDispatcher, ht as ActorAliasMapper, l as RequestContext, zt as WebFingerLinksDispatcher } from "./context-CmjP-cgJ.js";
3
3
  import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
4
4
  import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
5
5
 
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { _t as ActorHandleMapper, gt as ActorDispatcher, ht as ActorAliasMapper, l as RequestContext, zt as WebFingerLinksDispatcher } from "./context-B-dsBjZ9.cjs";
2
+ import { _t as ActorHandleMapper, gt as ActorDispatcher, ht as ActorAliasMapper, l as RequestContext, zt as WebFingerLinksDispatcher } from "./context-BOnn653X.cjs";
3
3
  import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
4
4
  import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
5
5
 
package/dist/mod.cjs CHANGED
@@ -3,11 +3,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("./rolldown-runtime-Dmm3t92W.cjs");
4
4
  const require_transformers = require("./transformers-BalCrSsr.cjs");
5
5
  require("./compat/mod.cjs");
6
- const require_http = require("./http-DcSh3Nkc.cjs");
7
- const require_federation = require("./federation-CChOD4m8.cjs");
8
- const require_proof = require("./proof-Y3u5gsyU.cjs");
6
+ const require_http = require("./http-MQyitOvl.cjs");
7
+ const require_federation = require("./federation-EWi4e3XY.cjs");
8
+ const require_proof = require("./proof-CwrJYody.cjs");
9
9
  const require_types = require("./types-RXm5YxpC.cjs");
10
- const require_kv_cache = require("./kv-cache-BJ67yD69.cjs");
10
+ const require_kv_cache = require("./kv-cache-AN6qSmg2.cjs");
11
11
  require("./nodeinfo/mod.cjs");
12
12
  require("./runtime/mod.cjs");
13
13
  require("./sig/mod.cjs");
package/dist/mod.d.cts CHANGED
@@ -2,10 +2,10 @@
2
2
  import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-D-XP_Ccb.cjs";
3
3
  import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-6TI0tI03.cjs";
4
4
  import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-r_waTiQj.cjs";
5
- import { $ as MessageQueueDepth, A as OutboxListenerSetters, At as ObjectAuthorizePredicate, B as TaskEnqueueOptions, Bt as SendActivityError, C as FederationStartQueueOptions, Ct as CustomCollectionCounter, D as InboxListenerSetters, Dt as InboxListener, E as InboxChallengePolicy, Et as InboxErrorHandler, F as createFederation, Ft as OutboxPermanentFailureHandler, G as RetryPolicy, Gt as ActivityTransformer, H as TaskRegistry, Ht as PageItems, I as Message, It as SharedInboxKeyDispatcher, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as UnverifiedActivityHandler, M as FederationKvPrefixes, Mt as OutboxErrorHandler, N as FederationOrigin, Nt as OutboxListener, O as MediaUploaderSetters, Ot as MediaUploaderCallback, P as FederationQueueOptions, Pt as OutboxListenerErrorHandler, Q as MessageQueue, R as TaskDefinition, Rt as UnverifiedActivityReason, S as FederationOptions, St as CollectionDispatcher, T as IdempotencyStrategy, Tt as CustomCollectionDispatcher, U as CreateExponentialBackoffPolicyOptions, Ut as buildCollectionSynchronizationHeader, V as TaskHandler, Vt as SenderKeyPair, W as RetryContext, Wt as digest, X as InProcessMessageQueue, Y as respondWithObjectIfAcceptable, Z as InProcessMessageQueueOptions, _ as Federatable, _t as ActorHandleMapper, a as GetSignedKeyOptions, at as CircuitBreakerBeforeSendDecision, b as FederationBuilder, bt as CollectionCounter, c as ParseUriResult, ct as CircuitBreakerKvState, d as SendActivityOptions, dt as CircuitBreakerStateChange, et as MessageQueueEnqueueOptions, f as SendActivityOptionsForCollection, ft as NormalizedCircuitBreakerOptions, g as CustomCollectionCallbackSetters, gt as ActorDispatcher, h as ConstructorWithTypeId, ht as ActorAliasMapper, i as GetActorOptions, it as CircuitBreakerActivityDrop, j as Rfc6570Expression, jt as ObjectDispatcher, k as ObjectCallbackSetters, kt as NodeInfoDispatcher, l as RequestContext, lt as CircuitBreakerOptions, m as CollectionCallbackSetters, mt as parseCircuitBreakerKvState, n as Context, nt as ParallelMessageQueue, o as InboxContext, ot as CircuitBreakerCreateOptions, p as ActorCallbackSetters, pt as normalizeCircuitBreakerOptions, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreaker, s as OutboxContext, st as CircuitBreakerFailurePolicy, t as ActorKeyPair, tt as MessageQueueListenOptions, u as RouteActivityOptions, ut as CircuitBreakerState, v as Federation, vt as ActorKeyPairsDispatcher, w as IdempotencyKeyCallback, wt as CustomCollectionCursor, x as FederationFetchOptions, xt as CollectionCursor, y as FederationBenchmarkOptions, yt as AuthorizePredicate, z as TaskDefinitionOptions, zt as WebFingerLinksDispatcher } from "./context-B-dsBjZ9.cjs";
5
+ import { $ as MessageQueueDepth, A as OutboxListenerSetters, At as ObjectAuthorizePredicate, B as TaskEnqueueOptions, Bt as SendActivityError, C as FederationStartQueueOptions, Ct as CustomCollectionCounter, D as InboxListenerSetters, Dt as InboxListener, E as InboxChallengePolicy, Et as InboxErrorHandler, F as createFederation, Ft as OutboxPermanentFailureHandler, G as RetryPolicy, Gt as ActivityTransformer, H as TaskRegistry, Ht as PageItems, I as Message, It as SharedInboxKeyDispatcher, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as UnverifiedActivityHandler, M as FederationKvPrefixes, Mt as OutboxErrorHandler, N as FederationOrigin, Nt as OutboxListener, O as MediaUploaderSetters, Ot as MediaUploaderCallback, P as FederationQueueOptions, Pt as OutboxListenerErrorHandler, Q as MessageQueue, R as TaskDefinition, Rt as UnverifiedActivityReason, S as FederationOptions, St as CollectionDispatcher, T as IdempotencyStrategy, Tt as CustomCollectionDispatcher, U as CreateExponentialBackoffPolicyOptions, Ut as buildCollectionSynchronizationHeader, V as TaskHandler, Vt as SenderKeyPair, W as RetryContext, Wt as digest, X as InProcessMessageQueue, Y as respondWithObjectIfAcceptable, Z as InProcessMessageQueueOptions, _ as Federatable, _t as ActorHandleMapper, a as GetSignedKeyOptions, at as CircuitBreakerBeforeSendDecision, b as FederationBuilder, bt as CollectionCounter, c as ParseUriResult, ct as CircuitBreakerKvState, d as SendActivityOptions, dt as CircuitBreakerStateChange, et as MessageQueueEnqueueOptions, f as SendActivityOptionsForCollection, ft as NormalizedCircuitBreakerOptions, g as CustomCollectionCallbackSetters, gt as ActorDispatcher, h as ConstructorWithTypeId, ht as ActorAliasMapper, i as GetActorOptions, it as CircuitBreakerActivityDrop, j as Rfc6570Expression, jt as ObjectDispatcher, k as ObjectCallbackSetters, kt as NodeInfoDispatcher, l as RequestContext, lt as CircuitBreakerOptions, m as CollectionCallbackSetters, mt as parseCircuitBreakerKvState, n as Context, nt as ParallelMessageQueue, o as InboxContext, ot as CircuitBreakerCreateOptions, p as ActorCallbackSetters, pt as normalizeCircuitBreakerOptions, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreaker, s as OutboxContext, st as CircuitBreakerFailurePolicy, t as ActorKeyPair, tt as MessageQueueListenOptions, u as RouteActivityOptions, ut as CircuitBreakerState, v as Federation, vt as ActorKeyPairsDispatcher, w as IdempotencyKeyCallback, wt as CustomCollectionCursor, x as FederationFetchOptions, xt as CollectionCursor, y as FederationBenchmarkOptions, yt as AuthorizePredicate, z as TaskDefinitionOptions, zt as WebFingerLinksDispatcher } from "./context-BOnn653X.cjs";
6
6
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-BhNbN8Ed.cjs";
7
7
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
8
- import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-D-abvu2C.cjs";
8
+ import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-kUSY5n3f.cjs";
9
9
  import { C as verifyJsonLd, S as signJsonLd, _ as VerifySignatureOptions, a as VerifyPortableObjectProofOptions, b as detachSignature, c as createProof, d as verifyObject, f as verifyPortableObjectProof, g as VerifyJsonLdOptions, h as SignJsonLdOptions, i as VerifyPortableObjectProofFailureReason, l as hasProofLike, m as CreateSignatureOptions, n as SignObjectOptions, o as VerifyPortableObjectProofResult, p as verifyProof, r as VerifyObjectOptions, s as VerifyProofOptions, t as CreateProofOptions, u as signObject, v as attachSignature, w as verifySignature, x as hasSignatureLike, y as createSignature } from "./mod-CnGLNoVw.cjs";
10
10
  import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-CLHkCwLm.cjs";
11
11
  export * from "@fedify/vocab-runtime";
package/dist/mod.d.ts CHANGED
@@ -2,10 +2,10 @@
2
2
  import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-D-XP_Ccb.js";
3
3
  import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-CdrSn2ip.js";
4
4
  import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-DGSfntI-.js";
5
- import { $ as MessageQueueDepth, A as OutboxListenerSetters, At as ObjectAuthorizePredicate, B as TaskEnqueueOptions, Bt as SendActivityError, C as FederationStartQueueOptions, Ct as CustomCollectionCounter, D as InboxListenerSetters, Dt as InboxListener, E as InboxChallengePolicy, Et as InboxErrorHandler, F as createFederation, Ft as OutboxPermanentFailureHandler, G as RetryPolicy, Gt as ActivityTransformer, H as TaskRegistry, Ht as PageItems, I as Message, It as SharedInboxKeyDispatcher, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as UnverifiedActivityHandler, M as FederationKvPrefixes, Mt as OutboxErrorHandler, N as FederationOrigin, Nt as OutboxListener, O as MediaUploaderSetters, Ot as MediaUploaderCallback, P as FederationQueueOptions, Pt as OutboxListenerErrorHandler, Q as MessageQueue, R as TaskDefinition, Rt as UnverifiedActivityReason, S as FederationOptions, St as CollectionDispatcher, T as IdempotencyStrategy, Tt as CustomCollectionDispatcher, U as CreateExponentialBackoffPolicyOptions, Ut as buildCollectionSynchronizationHeader, V as TaskHandler, Vt as SenderKeyPair, W as RetryContext, Wt as digest, X as InProcessMessageQueue, Y as respondWithObjectIfAcceptable, Z as InProcessMessageQueueOptions, _ as Federatable, _t as ActorHandleMapper, a as GetSignedKeyOptions, at as CircuitBreakerBeforeSendDecision, b as FederationBuilder, bt as CollectionCounter, c as ParseUriResult, ct as CircuitBreakerKvState, d as SendActivityOptions, dt as CircuitBreakerStateChange, et as MessageQueueEnqueueOptions, f as SendActivityOptionsForCollection, ft as NormalizedCircuitBreakerOptions, g as CustomCollectionCallbackSetters, gt as ActorDispatcher, h as ConstructorWithTypeId, ht as ActorAliasMapper, i as GetActorOptions, it as CircuitBreakerActivityDrop, j as Rfc6570Expression, jt as ObjectDispatcher, k as ObjectCallbackSetters, kt as NodeInfoDispatcher, l as RequestContext, lt as CircuitBreakerOptions, m as CollectionCallbackSetters, mt as parseCircuitBreakerKvState, n as Context, nt as ParallelMessageQueue, o as InboxContext, ot as CircuitBreakerCreateOptions, p as ActorCallbackSetters, pt as normalizeCircuitBreakerOptions, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreaker, s as OutboxContext, st as CircuitBreakerFailurePolicy, t as ActorKeyPair, tt as MessageQueueListenOptions, u as RouteActivityOptions, ut as CircuitBreakerState, v as Federation, vt as ActorKeyPairsDispatcher, w as IdempotencyKeyCallback, wt as CustomCollectionCursor, x as FederationFetchOptions, xt as CollectionCursor, y as FederationBenchmarkOptions, yt as AuthorizePredicate, z as TaskDefinitionOptions, zt as WebFingerLinksDispatcher } from "./context-DrLXudbA.js";
5
+ import { $ as MessageQueueDepth, A as OutboxListenerSetters, At as ObjectAuthorizePredicate, B as TaskEnqueueOptions, Bt as SendActivityError, C as FederationStartQueueOptions, Ct as CustomCollectionCounter, D as InboxListenerSetters, Dt as InboxListener, E as InboxChallengePolicy, Et as InboxErrorHandler, F as createFederation, Ft as OutboxPermanentFailureHandler, G as RetryPolicy, Gt as ActivityTransformer, H as TaskRegistry, Ht as PageItems, I as Message, It as SharedInboxKeyDispatcher, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as UnverifiedActivityHandler, M as FederationKvPrefixes, Mt as OutboxErrorHandler, N as FederationOrigin, Nt as OutboxListener, O as MediaUploaderSetters, Ot as MediaUploaderCallback, P as FederationQueueOptions, Pt as OutboxListenerErrorHandler, Q as MessageQueue, R as TaskDefinition, Rt as UnverifiedActivityReason, S as FederationOptions, St as CollectionDispatcher, T as IdempotencyStrategy, Tt as CustomCollectionDispatcher, U as CreateExponentialBackoffPolicyOptions, Ut as buildCollectionSynchronizationHeader, V as TaskHandler, Vt as SenderKeyPair, W as RetryContext, Wt as digest, X as InProcessMessageQueue, Y as respondWithObjectIfAcceptable, Z as InProcessMessageQueueOptions, _ as Federatable, _t as ActorHandleMapper, a as GetSignedKeyOptions, at as CircuitBreakerBeforeSendDecision, b as FederationBuilder, bt as CollectionCounter, c as ParseUriResult, ct as CircuitBreakerKvState, d as SendActivityOptions, dt as CircuitBreakerStateChange, et as MessageQueueEnqueueOptions, f as SendActivityOptionsForCollection, ft as NormalizedCircuitBreakerOptions, g as CustomCollectionCallbackSetters, gt as ActorDispatcher, h as ConstructorWithTypeId, ht as ActorAliasMapper, i as GetActorOptions, it as CircuitBreakerActivityDrop, j as Rfc6570Expression, jt as ObjectDispatcher, k as ObjectCallbackSetters, kt as NodeInfoDispatcher, l as RequestContext, lt as CircuitBreakerOptions, m as CollectionCallbackSetters, mt as parseCircuitBreakerKvState, n as Context, nt as ParallelMessageQueue, o as InboxContext, ot as CircuitBreakerCreateOptions, p as ActorCallbackSetters, pt as normalizeCircuitBreakerOptions, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreaker, s as OutboxContext, st as CircuitBreakerFailurePolicy, t as ActorKeyPair, tt as MessageQueueListenOptions, u as RouteActivityOptions, ut as CircuitBreakerState, v as Federation, vt as ActorKeyPairsDispatcher, w as IdempotencyKeyCallback, wt as CustomCollectionCursor, x as FederationFetchOptions, xt as CollectionCursor, y as FederationBenchmarkOptions, yt as AuthorizePredicate, z as TaskDefinitionOptions, zt as WebFingerLinksDispatcher } from "./context-CmjP-cgJ.js";
6
6
  import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-BhNbN8Ed.js";
7
7
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
8
- import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-D6O8C7eN.js";
8
+ import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-BYuZ0WXt.js";
9
9
  import { C as verifyJsonLd, S as signJsonLd, _ as VerifySignatureOptions, a as VerifyPortableObjectProofOptions, b as detachSignature, c as createProof, d as verifyObject, f as verifyPortableObjectProof, g as VerifyJsonLdOptions, h as SignJsonLdOptions, i as VerifyPortableObjectProofFailureReason, l as hasProofLike, m as CreateSignatureOptions, n as SignObjectOptions, o as VerifyPortableObjectProofResult, p as verifyProof, r as VerifyObjectOptions, s as VerifyProofOptions, t as CreateProofOptions, u as signObject, v as attachSignature, w as verifySignature, x as hasSignatureLike, y as createSignature } from "./mod-DzRXACM5.js";
10
10
  import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-DypxPS9H.js";
11
11
  export * from "@fedify/vocab-runtime";
package/dist/mod.js CHANGED
@@ -3,11 +3,11 @@ import { URLPattern } from "urlpattern-polyfill";
3
3
  import "./rolldown-runtime-BC-Eo5Mj.js";
4
4
  import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-DAtXl_Kc.js";
5
5
  import "./compat/mod.js";
6
- import { A as formatAcceptSignature, M as parseAcceptSignature, N as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, j as fulfillAcceptSignature, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk } from "./http-CqXnYPxh.js";
7
- import { a as respondWithObject, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as SendActivityError, l as CircuitBreaker, n as handleWebFinger, o as respondWithObjectIfAcceptable, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "./middleware-Hgkr-t3e.js";
8
- import { C as verifyJsonLd, a as verifyPortableObjectProof, c as doesActorOwnKey, f as attachSignature, h as detachSignature, i as verifyObject, l as getKeyOwner, m as createSignature, n as hasProofLike, o as verifyProof, r as signObject, t as createProof, v as hasSignatureLike, w as verifySignature, x as signJsonLd } from "./proof-CKKqEWUg.js";
6
+ import { A as formatAcceptSignature, M as parseAcceptSignature, N as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, j as fulfillAcceptSignature, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk } from "./http-BQxL1lOO.js";
7
+ import { a as respondWithObject, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as SendActivityError, l as CircuitBreaker, n as handleWebFinger, o as respondWithObjectIfAcceptable, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "./middleware-Bcx74jmq.js";
8
+ import { C as verifyJsonLd, a as verifyPortableObjectProof, c as doesActorOwnKey, f as attachSignature, h as detachSignature, i as verifyObject, l as getKeyOwner, m as createSignature, n as hasProofLike, o as verifyProof, r as signObject, t as createProof, v as hasSignatureLike, w as verifySignature, x as signJsonLd } from "./proof-D7aD6Hut.js";
9
9
  import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-Dtyf8lVj.js";
10
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-AbW4Zb7B.js";
10
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-BaLaRgP0.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";
@@ -5,7 +5,7 @@ import { r as createRequestContext } from "../context-Dt36KFEJ.mjs";
5
5
  import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
6
6
  import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
7
7
  import "../std__assert-CxFT0MNt.mjs";
8
- import { _ as handleNodeInfo, o as createFederation, v as handleNodeInfoJrd } from "../middleware-DRGoAGNP.mjs";
8
+ import { _ as handleNodeInfo, o as createFederation, v as handleNodeInfoJrd } from "../middleware-C8wXU20O.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  //#region src/nodeinfo/handler.test.ts
11
11
  test("handleNodeInfo()", async () => {
@@ -1,8 +1,8 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-CNYW2Ig8.mjs";
5
- import "./key-hmby7gn5.mjs";
4
+ import { n as version, t as name } from "./deno-CxSfl_a4.mjs";
5
+ import "./key-6O7-nI4D.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,10 +1,10 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-CNYW2Ig8.mjs";
5
- import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-Pf5DoomU.mjs";
6
- import { n as fetchKey, o as validateCryptoKey } from "./key-hmby7gn5.mjs";
7
- import { c as getNormalizationContextLoader } from "./ld-B8i_nYpF.mjs";
4
+ import { n as version, t as name } from "./deno-CxSfl_a4.mjs";
5
+ import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-DpjCXFvC.mjs";
6
+ import { n as fetchKey, o as validateCryptoKey } from "./key-6O7-nI4D.mjs";
7
+ import { c as getNormalizationContextLoader } from "./ld-CwHaXyMi.mjs";
8
8
  import { n as preloadedOnlyDocumentLoader } from "./public-audience--9hx7IGx.mjs";
9
9
  import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-BQSHRLhg.mjs";
10
10
  import { getLogger } from "@logtape/logtape";
@@ -1,6 +1,6 @@
1
1
  const { URLPattern } = require("urlpattern-polyfill");
2
2
  const require_rolldown_runtime = require("./rolldown-runtime-Dmm3t92W.cjs");
3
- const require_http = require("./http-DcSh3Nkc.cjs");
3
+ const require_http = require("./http-MQyitOvl.cjs");
4
4
  let _logtape_logtape = require("@logtape/logtape");
5
5
  let _fedify_vocab = require("@fedify/vocab");
6
6
  let _opentelemetry_api = require("@opentelemetry/api");
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { F as version, P as name, _ as measureSignatureKeyFetch, d as validateCryptoKey, f as getDurationMs, p as getFederationMetrics, s as fetchKey } from "./http-CqXnYPxh.js";
3
+ import { F as version, P as name, _ as measureSignatureKeyFetch, d as validateCryptoKey, f as getDurationMs, p as getFederationMetrics, s as fetchKey } from "./http-BQxL1lOO.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,9 +1,9 @@
1
1
  import "temporal-polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-CNYW2Ig8.mjs";
5
- import { n as getDurationMs, r as getFederationMetrics } from "./metrics-Pf5DoomU.mjs";
6
- import { n as doubleKnock } from "./http-DpXPu64P.mjs";
4
+ import { n as version, t as name } from "./deno-CxSfl_a4.mjs";
5
+ import { n as getDurationMs, r as getFederationMetrics } from "./metrics-DpjCXFvC.mjs";
6
+ import { n as doubleKnock } from "./http-DlSUSFxF.mjs";
7
7
  import { getLogger } from "@logtape/logtape";
8
8
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
9
9
  import { FetchError } from "@fedify/vocab-runtime";
@@ -10,8 +10,8 @@ import { t as assertThrows } from "../assert_throws-BJ5wuvR2.mjs";
10
10
  import "../std__assert-CxFT0MNt.mjs";
11
11
  import { t as assertRejects } from "../assert_rejects-wFbSPn1O.mjs";
12
12
  import { t as assert } from "../assert-CebeUf0C.mjs";
13
- import { t as exportJwk } from "../key-hmby7gn5.mjs";
14
- 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-DpXPu64P.mjs";
13
+ import { t as exportJwk } from "../key-6O7-nI4D.mjs";
14
+ 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-DlSUSFxF.mjs";
15
15
  import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
16
16
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
17
17
  import { FetchError, exportSpki } from "@fedify/vocab-runtime";
@@ -1027,6 +1027,7 @@ test("doubleKnock() function with redirect handling", async () => {
1027
1027
  esm_default.spyGlobal();
1028
1028
  const requestedUrls = [];
1029
1029
  const responseCodes = [];
1030
+ const validatedRedirects = [];
1030
1031
  esm_default.post("https://example.com/redirect-endpoint", (cl) => {
1031
1032
  requestedUrls.push(cl.url);
1032
1033
  responseCodes.push(302);
@@ -1044,11 +1045,41 @@ test("doubleKnock() function with redirect handling", async () => {
1044
1045
  }), {
1045
1046
  keyId: rsaPublicKey2.id,
1046
1047
  privateKey: rsaPrivateKey2
1047
- })).status, 202, "Final response status should be 202 Accepted");
1048
+ }, { validateRedirect(url) {
1049
+ validatedRedirects.push(url);
1050
+ } })).status, 202, "Final response status should be 202 Accepted");
1048
1051
  assertEquals(requestedUrls.length, 2, "Two URLs should have been requested");
1049
1052
  assertEquals(requestedUrls[0], "https://example.com/redirect-endpoint", "First request should be to redirect-endpoint");
1050
1053
  assertEquals(requestedUrls[1], "https://example.com/final-endpoint", "Second request should be to final-endpoint");
1051
1054
  assertEquals(responseCodes, [302, 202], "Response status codes should match expected sequence");
1055
+ assertEquals(validatedRedirects, ["https://example.com/final-endpoint"]);
1056
+ esm_default.hardReset();
1057
+ });
1058
+ test("doubleKnock() validates redirects after signature fallback", async () => {
1059
+ esm_default.spyGlobal();
1060
+ let requestCount = 0;
1061
+ let privateRequestCount = 0;
1062
+ esm_default.post("https://example.com/redirect-after-fallback", (cl) => {
1063
+ requestCount++;
1064
+ if (cl.request.headers.has("Signature-Input")) return new Response("Unauthorized", { status: 401 });
1065
+ return Response.redirect("http://localhost/private", 302);
1066
+ });
1067
+ esm_default.post("http://localhost/private", () => {
1068
+ privateRequestCount++;
1069
+ return new Response("", { status: 202 });
1070
+ });
1071
+ const request = new Request("https://example.com/redirect-after-fallback", {
1072
+ method: "POST",
1073
+ body: "Test message"
1074
+ });
1075
+ await assertRejects(() => doubleKnock(request, {
1076
+ keyId: rsaPublicKey2.id,
1077
+ privateKey: rsaPrivateKey2
1078
+ }, { validateRedirect(url) {
1079
+ throw new Error(`Disallowed redirect: ${url}`);
1080
+ } }), Error, "Disallowed redirect: http://localhost/private");
1081
+ assertEquals(requestCount, 2);
1082
+ assertEquals(privateRequestCount, 0);
1052
1083
  esm_default.hardReset();
1053
1084
  });
1054
1085
  test("doubleKnock() function with both specs rejected", async () => {
@@ -1839,6 +1870,37 @@ test("doubleKnock(): Accept-Signature challenge retry succeeds", async () => {
1839
1870
  assertEquals(requestCount, 2);
1840
1871
  esm_default.hardReset();
1841
1872
  });
1873
+ test("doubleKnock(): validates redirects after Accept-Signature challenge retry", async () => {
1874
+ esm_default.spyGlobal();
1875
+ let requestCount = 0;
1876
+ let privateRequestCount = 0;
1877
+ esm_default.post("https://example.com/inbox-challenge-redirect", () => {
1878
+ requestCount++;
1879
+ if (requestCount === 1) return new Response("Not Authorized", {
1880
+ status: 401,
1881
+ headers: { "Accept-Signature": "sig1=(\"@method\" \"@target-uri\" \"@authority\" \"content-digest\");created;nonce=\"challenge-nonce-redirect\"" }
1882
+ });
1883
+ return Response.redirect("http://localhost/private", 302);
1884
+ });
1885
+ esm_default.post("http://localhost/private", () => {
1886
+ privateRequestCount++;
1887
+ return new Response("", { status: 202 });
1888
+ });
1889
+ const request = new Request("https://example.com/inbox-challenge-redirect", {
1890
+ method: "POST",
1891
+ body: "Test message",
1892
+ headers: { "Content-Type": "text/plain" }
1893
+ });
1894
+ await assertRejects(() => doubleKnock(request, {
1895
+ keyId: rsaPublicKey2.id,
1896
+ privateKey: rsaPrivateKey2
1897
+ }, { validateRedirect(url) {
1898
+ throw new Error(`Disallowed redirect: ${url}`);
1899
+ } }), Error, "Disallowed redirect: http://localhost/private");
1900
+ assertEquals(requestCount, 2);
1901
+ assertEquals(privateRequestCount, 0);
1902
+ esm_default.hardReset();
1903
+ });
1842
1904
  test("doubleKnock(): unfulfillable Accept-Signature falls to legacy fallback", async () => {
1843
1905
  esm_default.spyGlobal();
1844
1906
  let requestCount = 0;
@@ -5,7 +5,7 @@ import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
5
5
  import { t as assertThrows } from "../assert_throws-BJ5wuvR2.mjs";
6
6
  import "../std__assert-CxFT0MNt.mjs";
7
7
  import { t as assertRejects } from "../assert_rejects-wFbSPn1O.mjs";
8
- import { a as importJwk, i as generateCryptoKeyPair, n as fetchKey, o as validateCryptoKey, r as fetchKeyDetailed, t as exportJwk } from "../key-hmby7gn5.mjs";
8
+ import { a as importJwk, i as generateCryptoKeyPair, n as fetchKey, o as validateCryptoKey, r as fetchKeyDetailed, t as exportJwk } from "../key-6O7-nI4D.mjs";
9
9
  import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
10
10
  import { CryptographicKey, Multikey } from "@fedify/vocab";
11
11
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
@@ -584,6 +584,51 @@ test("fetchKey() works when meterProvider is omitted", async () => {
584
584
  contextLoader: mockDocumentLoader
585
585
  })).cached, false);
586
586
  });
587
+ test("fetchKey() rejects standalone keys with a mismatched id", async () => {
588
+ for (const { keyId, standaloneKey, fetch } of [{
589
+ keyId: "https://example.com/key",
590
+ standaloneKey: rsaPublicKey1,
591
+ fetch: (keyId, options) => fetchKey(keyId, CryptographicKey, options)
592
+ }, {
593
+ keyId: "https://example.com/multikey",
594
+ standaloneKey: ed25519Multikey,
595
+ fetch: (keyId, options) => fetchKey(keyId, Multikey, options)
596
+ }]) {
597
+ const cache = {};
598
+ const options = {
599
+ async documentLoader(resource) {
600
+ if (resource === keyId) return {
601
+ contextUrl: null,
602
+ documentUrl: resource,
603
+ document: {
604
+ ...await standaloneKey.toJsonLd({ contextLoader: mockDocumentLoader }),
605
+ id: "https://example.com/different-key"
606
+ }
607
+ };
608
+ return await mockDocumentLoader(resource);
609
+ },
610
+ contextLoader: mockDocumentLoader,
611
+ keyCache: {
612
+ get(keyId) {
613
+ return Promise.resolve(cache[keyId.href]);
614
+ },
615
+ set(keyId, key) {
616
+ cache[keyId.href] = key;
617
+ return Promise.resolve();
618
+ }
619
+ }
620
+ };
621
+ assertEquals(await fetch(keyId, options), {
622
+ key: null,
623
+ cached: false
624
+ });
625
+ assertEquals(cache, { [keyId]: null });
626
+ assertEquals(await fetch(keyId, options), {
627
+ key: null,
628
+ cached: true
629
+ });
630
+ }
631
+ });
587
632
  test("fetchKey() returns null for a malformed actor publicKey", async () => {
588
633
  const actorId = "https://example.com/malformed-public-key";
589
634
  const keyId = "https://example.com/malformed-public-key#main-key";
@@ -7,9 +7,9 @@ import { t as assertGreaterOrEqual } from "../assert_greater_or_equal-BApOTh1h.m
7
7
  import { t as assertThrows } from "../assert_throws-BJ5wuvR2.mjs";
8
8
  import { t as assertRejects } from "../assert_rejects-wFbSPn1O.mjs";
9
9
  import { t as assert } from "../assert-CebeUf0C.mjs";
10
- import { i as generateCryptoKeyPair } from "../key-hmby7gn5.mjs";
10
+ import { i as generateCryptoKeyPair } from "../key-6O7-nI4D.mjs";
11
11
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
12
- 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-B8i_nYpF.mjs";
12
+ 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-CwHaXyMi.mjs";
13
13
  import { CryptographicKey } from "@fedify/vocab";
14
14
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
15
15
  import { encodeBase64 } from "byte-encodings/base64";
package/dist/sig/mod.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  const { URLPattern } = require("urlpattern-polyfill");
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const require_http = require("../http-DcSh3Nkc.cjs");
4
- const require_proof = require("../proof-Y3u5gsyU.cjs");
3
+ const require_http = require("../http-MQyitOvl.cjs");
4
+ const require_proof = require("../proof-CwrJYody.cjs");
5
5
  exports.attachSignature = require_proof.attachSignature;
6
6
  exports.createProof = require_proof.createProof;
7
7
  exports.createSignature = require_proof.createSignature;
package/dist/sig/mod.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Temporal } from "temporal-polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { A as formatAcceptSignature, M as parseAcceptSignature, N as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, j as fulfillAcceptSignature, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk } from "../http-CqXnYPxh.js";
4
- import { C as verifyJsonLd, a as verifyPortableObjectProof, c as doesActorOwnKey, f as attachSignature, h as detachSignature, i as verifyObject, l as getKeyOwner, m as createSignature, n as hasProofLike, o as verifyProof, r as signObject, t as createProof, v as hasSignatureLike, w as verifySignature, x as signJsonLd } from "../proof-CKKqEWUg.js";
3
+ import { A as formatAcceptSignature, M as parseAcceptSignature, N as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, j as fulfillAcceptSignature, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk } from "../http-BQxL1lOO.js";
4
+ import { C as verifyJsonLd, a as verifyPortableObjectProof, c as doesActorOwnKey, f as attachSignature, h as detachSignature, i as verifyObject, l as getKeyOwner, m as createSignature, n as hasProofLike, o as verifyProof, r as signObject, t as createProof, v as hasSignatureLike, w as verifySignature, x as signJsonLd } from "../proof-D7aD6Hut.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, verifyPortableObjectProof, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
@@ -6,7 +6,7 @@ import { t as assertFalse } from "../assert_false-3pLLLsO4.mjs";
6
6
  import "../std__assert-CxFT0MNt.mjs";
7
7
  import { t as assert } from "../assert-CebeUf0C.mjs";
8
8
  import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
9
- import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-Bq-aDUI1.mjs";
9
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-CDshspna.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
@@ -10,7 +10,7 @@ import { t as assertRejects } from "../assert_rejects-wFbSPn1O.mjs";
10
10
  import { t as assert } from "../assert-CebeUf0C.mjs";
11
11
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
12
12
  import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-BQSHRLhg.mjs";
13
- import { a as verifyPortableObjectProof, i as verifyObject, n as hasProofLike, o as verifyProof, r as signObject, t as createProof } from "../proof-BJ6kqGDQ.mjs";
13
+ import { a as verifyPortableObjectProof, i as verifyObject, n as hasProofLike, o as verifyProof, r as signObject, t as createProof } from "../proof-C1uX5GYQ.mjs";
14
14
  import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place } from "@fedify/vocab";
15
15
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
16
16
  import { decodeMultibase, encodeMultibase, exportDidKey, exportMultibaseKey, formatIri, importMultibaseKey, parseIri } 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-B8i_nYpF.mjs";
4
+ import { c as getNormalizationContextLoader } from "./ld-CwHaXyMi.mjs";
5
5
  import jsonld from "@fedify/vocab-runtime/jsonld";
6
6
  //#region src/federation/temporal.ts
7
7
  function isPlainObject(value) {
@@ -788,8 +788,9 @@ type CircuitBreakerOptions = CircuitBreakerFailurePolicy & {
788
788
  *
789
789
  * When omitted, Fedify derives this from `failureWindow`, `recoveryDelay`, and
790
790
  * `heldActivityTtl` for the default numeric failure policy. Custom `failure`
791
- * callbacks do not have an inspectable time window, so custom policies do not
792
- * expire their stored state unless this option is provided.
791
+ * callbacks do not have an inspectable time window, so their state expires
792
+ * after `recoveryDelay` plus `heldActivityTtl` unless this option overrides
793
+ * it.
793
794
  */
794
795
  readonly stateTtl?: Temporal.Duration | Temporal.DurationLike;
795
796
  /**
@@ -5,9 +5,9 @@ import { t as esm_default } from "../esm-BHXXx4Wx.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
6
6
  import "../std__assert-CxFT0MNt.mjs";
7
7
  import { t as assertRejects } from "../assert_rejects-wFbSPn1O.mjs";
8
- import { l as verifyRequest } from "../http-DpXPu64P.mjs";
8
+ import { l as verifyRequest } from "../http-DlSUSFxF.mjs";
9
9
  import { i as rsaPrivateKey2 } from "../keys-DIJNHW-Y.mjs";
10
- import { t as getAuthenticatedDocumentLoader } from "../docloader-Dzbz3Js2.mjs";
10
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-BA8lSYW0.mjs";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { UrlError } from "@fedify/vocab-runtime";
13
13
  //#region src/utils/docloader.test.ts
@@ -63,6 +63,39 @@ test("getAuthenticatedDocumentLoader()", async (t) => {
63
63
  esm_default.hardReset();
64
64
  });
65
65
  });
66
+ test("getAuthenticatedDocumentLoader() validates redirects", async (t) => {
67
+ esm_default.spyGlobal();
68
+ let privateRequestCount = 0;
69
+ esm_default.get("https://example.com/redirect-to-private", () => Response.redirect("http://localhost/private", 302));
70
+ esm_default.get("http://localhost/private", () => {
71
+ privateRequestCount++;
72
+ return Response.json({ private: true });
73
+ });
74
+ await t.step("deny public-to-private redirects", async () => {
75
+ const loader = getAuthenticatedDocumentLoader({
76
+ keyId: new URL("https://example.com/key2"),
77
+ privateKey: rsaPrivateKey2
78
+ });
79
+ await assertRejects(() => loader("https://example.com/redirect-to-private"), UrlError);
80
+ assertEquals(privateRequestCount, 0);
81
+ });
82
+ esm_default.get("https://example.com/redirect-to-public", () => Response.redirect("https://www.example.com/document", 302));
83
+ esm_default.get("https://www.example.com/document", () => Response.json({ public: true }));
84
+ await t.step("allow public-to-public redirects", async () => {
85
+ assertEquals((await getAuthenticatedDocumentLoader({
86
+ keyId: new URL("https://example.com/key2"),
87
+ privateKey: rsaPrivateKey2
88
+ })("https://example.com/redirect-to-public")).document, { public: true });
89
+ });
90
+ await t.step("allow private redirects when explicitly enabled", async () => {
91
+ assertEquals((await getAuthenticatedDocumentLoader({
92
+ keyId: new URL("https://example.com/key2"),
93
+ privateKey: rsaPrivateKey2
94
+ }, { allowPrivateAddress: true })("https://example.com/redirect-to-private")).document, { private: true });
95
+ assertEquals(privateRequestCount, 1);
96
+ });
97
+ esm_default.hardReset();
98
+ });
66
99
  test("getAuthenticatedDocumentLoader() cancellation", {
67
100
  sanitizeResources: false,
68
101
  sanitizeOps: false
@@ -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-Nl-t79NZ.mjs";
4
+ import { n as kvCache, t as MockKvStore } from "../kv-cache-DqiCo6_V.mjs";
5
5
  import { deepStrictEqual, throws } from "node:assert";
6
6
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
7
7
  import { preloadedContexts } from "@fedify/vocab-runtime";
@@ -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-BJ67yD69.cjs");
3
+ const require_kv_cache = require("../kv-cache-AN6qSmg2.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-AbW4Zb7B.js";
3
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-BaLaRgP0.js";
4
4
  export { getAuthenticatedDocumentLoader, kvCache };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "2.4.0-dev.1848+1443269f",
3
+ "version": "2.4.0-dev.1873+f79eae3d",
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/vocab-runtime": "2.4.0-dev.1848+1443269f",
155
- "@fedify/uri-template": "2.4.0-dev.1848+1443269f",
156
- "@fedify/vocab": "2.4.0-dev.1848+1443269f",
157
- "@fedify/webfinger": "2.4.0-dev.1848+1443269f"
154
+ "@fedify/uri-template": "2.4.0-dev.1873+f79eae3d",
155
+ "@fedify/vocab-runtime": "2.4.0-dev.1873+f79eae3d",
156
+ "@fedify/vocab": "2.4.0-dev.1873+f79eae3d",
157
+ "@fedify/webfinger": "2.4.0-dev.1873+f79eae3d"
158
158
  },
159
159
  "devDependencies": {
160
160
  "@std/assert": "npm:@jsr/std__assert@^0.226.0",
@@ -167,7 +167,7 @@
167
167
  "typescript": "^6.0.0",
168
168
  "wrangler": "^4.17.0",
169
169
  "@fedify/fixture": "2.0.0",
170
- "@fedify/vocab-tools": "^2.4.0-dev.1848+1443269f"
170
+ "@fedify/vocab-tools": "^2.4.0-dev.1873+f79eae3d"
171
171
  },
172
172
  "scripts": {
173
173
  "build:self": "tsdown",