@fedify/fedify 2.3.16-dev.2845 → 2.3.16
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.
- package/dist/attachment-arrays-BlfpZlWF.mjs +16 -0
- package/dist/{builder-B9apzaoK.mjs → builder-D4GE1Gmi.mjs} +3 -3
- package/dist/callback-kR_sx2zZ.d.mts +2661 -0
- package/dist/{client-BIBzqEIp.d.cts → client-9DPcy_Yx.d.ts} +16 -0
- package/dist/{client-jE7oGvRh.d.ts → client-B3ruDgWg.d.cts} +16 -0
- package/dist/{client-DpUNYKla.mjs → client-DFgYVbUA.mjs} +86 -11
- package/dist/compat/attachment-arrays.test.d.mts +2 -0
- package/dist/compat/attachment-arrays.test.mjs +255 -0
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/outgoing-jsonld.test.mjs +1 -1
- package/dist/compat/public-audience.test.mjs +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{context-CE_Tj_Oc.d.cts → context-CEE8vl-b.d.cts} +31 -14
- package/dist/{context-H_5tZXg-.d.ts → context-CTJwXHRu.d.ts} +31 -14
- package/dist/{deno-CgHxPWA-.mjs → deno-FtdqgHJA.mjs} +1 -1
- package/dist/{docloader-CYscMv4m.mjs → docloader-B9iU4DP2.mjs} +2 -2
- package/dist/federation/attachment-responses.test.d.mts +2 -0
- package/dist/federation/attachment-responses.test.mjs +182 -0
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/circuit-breaker.test.mjs +2 -2
- package/dist/federation/collection.test.mjs +1 -1
- package/dist/federation/delivery-attachments.test.d.mts +2 -0
- package/dist/federation/delivery-attachments.test.mjs +288 -0
- package/dist/federation/handler.test.mjs +208 -16
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +1191 -16
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +2 -2
- package/dist/federation/mod.d.ts +2 -2
- package/dist/federation/mod.js +1 -1
- package/dist/federation/negotiation.test.mjs +1 -1
- package/dist/federation/retry.test.mjs +1 -1
- package/dist/federation/send.test.mjs +293 -3
- package/dist/federation/temporal.test.mjs +25 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{http-CfxAK-RL.cjs → http-2RyDQ0tE.cjs} +6 -4
- package/dist/{http-DmP0sr2l.d.ts → http-Bs5mXWlH.d.ts} +3 -3
- package/dist/{http-CZPYFK3b.d.cts → http-D8DgRhHU.d.cts} +3 -3
- package/dist/{http-dzXtCtOp.mjs → http-D8tiOrZf.mjs} +7 -5
- package/dist/{http-BzIb8Gk0.js → http-mLeLYFj-.js} +6 -4
- package/dist/{inbox-BMytDl21.mjs → inbox-Dy8awbi8.mjs} +2 -2
- package/dist/{key-fdTPEBhG.mjs → key-o1SmN5s0.mjs} +4 -3
- package/dist/{kv-cache-ShxnSuNt.mjs → kv-cache-BwUrzCVO.mjs} +1 -1
- package/dist/{kv-cache-dQUFD_pa.cjs → kv-cache-CI6Z0WiS.cjs} +1 -1
- package/dist/{kv-cache-CwqJUNNd.js → kv-cache-Dsq8C8D8.js} +1 -1
- package/dist/{ld-B8mU49Dg.mjs → ld-DCKrqj9y.mjs} +155 -22
- package/dist/ld-signature-Dgz_b89j.mjs +23 -0
- package/dist/{metrics-C0ZYkgVy.mjs → metrics-CaoYRhNH.mjs} +1 -1
- package/dist/{middleware-DK_kGeMl.mjs → middleware-4p3opEMT.mjs} +1 -1
- package/dist/{middleware-9mBkHYci.cjs → middleware-CP-8P7kk.cjs} +492 -117
- package/dist/{middleware-D0GPqg_7.js → middleware-Cce0nLDw.js} +491 -117
- package/dist/{middleware-Hr9ci9uD.mjs → middleware-D31fNcY4.mjs} +399 -109
- package/dist/{mod-C_gFmeNq.d.cts → mod-BD0-_vya.d.ts} +31 -13
- package/dist/{mod-HQXFvOHs.d.ts → mod-BMX6nsHP.d.cts} +31 -13
- package/dist/{mod-CDFFESfL.d.ts → mod-BTvP5Hva.d.ts} +1 -1
- package/dist/{mod-DMjhnFbg.d.ts → mod-DgMTlwUO.d.ts} +3 -3
- package/dist/{mod-DDVkmZ_h.d.cts → mod-Q1Fo3FJk.d.cts} +3 -3
- package/dist/{mod-DDjtbkZO.d.cts → mod-n51LED4J.d.cts} +1 -1
- package/dist/mod.cjs +5 -5
- package/dist/mod.d.cts +8 -8
- package/dist/mod.d.ts +8 -8
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/client.test.mjs +432 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/nodeinfo/mod.cjs +1 -1
- package/dist/nodeinfo/mod.d.cts +1 -1
- package/dist/nodeinfo/mod.d.ts +1 -1
- package/dist/nodeinfo/mod.js +1 -1
- package/dist/nodeinfo/types.test.mjs +1 -1
- package/dist/{outgoing-jsonld-D4iTv7uM.mjs → outgoing-jsonld-BZEAVK_Q.mjs} +38 -8
- package/dist/{owner-BqnaV4zl.mjs → owner-Bdj0nHhf.mjs} +2 -2
- package/dist/{proof-BSRF2hIP.js → proof-B9XJiyz-.js} +1030 -858
- package/dist/{proof-D9VX-J1n.cjs → proof-CmcP8yqP.cjs} +1243 -1059
- package/dist/{proof-BvpOtXRD.mjs → proof-DrbjYma9.mjs} +41 -16
- package/dist/{send-BPel6SCW.mjs → send-VD_WG3dN.mjs} +100 -22
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key-types.test.d.mts +218 -0
- package/dist/sig/key-types.test.mjs +8 -0
- package/dist/sig/key.test.mjs +2 -2
- package/dist/sig/ld.test.mjs +573 -8
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +3 -3
- package/dist/sig/mod.d.ts +3 -3
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +96 -4
- package/dist/{temporal-CaD1O1QX.mjs → temporal-CMvoB-vD.mjs} +3 -5
- package/dist/testing/mod.d.mts +2 -2476
- package/dist/{types-DOvyymM4.cjs → types-BWx7zw3Y.cjs} +85 -10
- package/dist/{types-B1_pRFE_.js → types-Dx_w2JSM.js} +86 -11
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +6 -6
- /package/dist/{activity-listener-tztVvlNb.mjs → activity-listener-BeTGV3wc.mjs} +0 -0
- /package/dist/{circuit-breaker-D1fxthDI.mjs → circuit-breaker-B1fLHmg2.mjs} +0 -0
- /package/dist/{circuit-breaker-test-utils-CAdwjgMi.mjs → circuit-breaker-test-utils-BGHm_MsT.mjs} +0 -0
- /package/dist/{collection-Cc3DVAhE.mjs → collection-Dp5ky45w.mjs} +0 -0
- /package/dist/{negotiation-DDstyBvc.mjs → negotiation-DC8nG6J_.mjs} +0 -0
- /package/dist/{public-audience-Dp4ZScSr.mjs → public-audience-rnYUGj8a.mjs} +0 -0
- /package/dist/{retry-CXg_MBI-.mjs → retry-C4G_vIgv.mjs} +0 -0
- /package/dist/{types-J53Kw7so.mjs → types-BFowWFTT.mjs} +0 -0
package/dist/federation/mod.cjs
CHANGED
|
@@ -2,7 +2,7 @@ const { Temporal } = require("@js-temporal/polyfill");
|
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
require("../chunk-DDcVe30Y.cjs");
|
|
5
|
-
const require_middleware = require("../middleware-
|
|
5
|
+
const require_middleware = require("../middleware-CP-8P7kk.cjs");
|
|
6
6
|
let _logtape_logtape = require("@logtape/logtape");
|
|
7
7
|
let _fedify_uri_template = require("@fedify/uri-template");
|
|
8
8
|
let es_toolkit = require("es-toolkit");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "../context-
|
|
2
|
+
import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "../context-CEE8vl-b.cjs";
|
|
3
3
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-CZKl1IUS.cjs";
|
|
4
4
|
import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcessMessageQueueOptions, o as MessageQueueListenOptions, r as MessageQueue, s as ParallelMessageQueue, t as InProcessMessageQueue } from "../mq-D8uSFzxe.cjs";
|
|
5
|
-
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-
|
|
5
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-n51LED4J.cjs";
|
|
6
6
|
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CircuitBreaker, CircuitBreakerActivityDrop, CircuitBreakerBeforeSendDecision, CircuitBreakerCreateOptions, CircuitBreakerFailurePolicy, CircuitBreakerKvState, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStateChange, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBenchmarkOptions, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetActorOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, normalizeCircuitBreakerOptions, parseCircuitBreakerKvState, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "../context-
|
|
2
|
+
import { $ as CustomCollectionCursor, A as Rfc6570Expression, At as parseCircuitBreakerKvState, B as createFederationBuilder, C as FederationStartQueueOptions, Ct as CircuitBreakerFailurePolicy, D as InboxListenerSetters, Dt as CircuitBreakerStateChange, E as InboxChallengePolicy, Et as CircuitBreakerState, F as CreateExponentialBackoffPolicyOptions, G as ActorDispatcher, H as respondWithObject, I as RetryContext, J as AuthorizePredicate, K as ActorHandleMapper, L as RetryPolicy, M as FederationOrigin, N as FederationQueueOptions, O as ObjectCallbackSetters, Ot as NormalizedCircuitBreakerOptions, P as createFederation, Q as CustomCollectionCounter, R as createExponentialBackoffPolicy, S as FederationOptions, St as CircuitBreakerCreateOptions, T as IdempotencyStrategy, Tt as CircuitBreakerOptions, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as ActorAliasMapper, X as CollectionCursor, Y as CollectionCounter, Z as CollectionDispatcher, _ as Federatable, _t as buildCollectionSynchronizationHeader, a as GetSignedKeyOptions, at as ObjectDispatcher, b as FederationBuilder, bt as CircuitBreakerActivityDrop, c as ParseUriResult, ct as OutboxListenerErrorHandler, d as SendActivityOptions, dt as UnverifiedActivityHandler, et as CustomCollectionDispatcher, f as SendActivityOptionsForCollection, ft as UnverifiedActivityReason, g as CustomCollectionCallbackSetters, gt as PageItems, h as ConstructorWithTypeId, ht as SenderKeyPair, i as GetActorOptions, it as ObjectAuthorizePredicate, j as FederationKvPrefixes, k as OutboxListenerSetters, kt as normalizeCircuitBreakerOptions, l as RequestContext, lt as OutboxPermanentFailureHandler, m as CollectionCallbackSetters, mt as SendActivityError, n as Context, nt as InboxListener, o as InboxContext, ot as OutboxErrorHandler, p as ActorCallbackSetters, pt as WebFingerLinksDispatcher, q as ActorKeyPairsDispatcher, r as ForwardActivityOptions, rt as NodeInfoDispatcher, s as OutboxContext, st as OutboxListener, t as ActorKeyPair, tt as InboxErrorHandler, u as RouteActivityOptions, ut as SharedInboxKeyDispatcher, v as Federation, vt as digest, w as IdempotencyKeyCallback, wt as CircuitBreakerKvState, x as FederationFetchOptions, xt as CircuitBreakerBeforeSendDecision, y as FederationBenchmarkOptions, yt as CircuitBreaker, z as Message } from "../context-CTJwXHRu.js";
|
|
3
3
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-CxaI4eGo.js";
|
|
4
4
|
import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcessMessageQueueOptions, o as MessageQueueListenOptions, r as MessageQueue, s as ParallelMessageQueue, t as InProcessMessageQueue } from "../mq-D-nlpY04.js";
|
|
5
|
-
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-
|
|
5
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-BTvP5Hva.js";
|
|
6
6
|
export { ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CircuitBreaker, CircuitBreakerActivityDrop, CircuitBreakerBeforeSendDecision, CircuitBreakerCreateOptions, CircuitBreakerFailurePolicy, CircuitBreakerKvState, CircuitBreakerOptions, CircuitBreakerState, CircuitBreakerStateChange, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, Federatable, Federation, FederationBenchmarkOptions, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, ForwardActivityOptions, GetActorOptions, GetSignedKeyOptions, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, normalizeCircuitBreakerOptions, parseCircuitBreakerKvState, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
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-
|
|
3
|
+
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-Cce0nLDw.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { Router as Router$1, RouterError as RouterError$1, assertPath, isPath } from "@fedify/uri-template";
|
|
6
6
|
import { isEqual } from "es-toolkit";
|
|
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import "../std__assert-BjJn2daJ.mjs";
|
|
5
5
|
import { r as assertFalse } from "../assert_throws-BbSMEFKo.mjs";
|
|
6
6
|
import { t as assert } from "../assert-CEO06XCw.mjs";
|
|
7
|
-
import { t as acceptsJsonLd } from "../negotiation-
|
|
7
|
+
import { t as acceptsJsonLd } from "../negotiation-DC8nG6J_.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/federation/negotiation.test.ts
|
|
10
10
|
test("acceptsJsonLd()", () => {
|
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { l as AssertionError, t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
5
5
|
import { t as assertNotEquals } from "../assert_not_equals-DkVK8oqV.mjs";
|
|
6
|
-
import { t as createExponentialBackoffPolicy } from "../retry-
|
|
6
|
+
import { t as createExponentialBackoffPolicy } from "../retry-C4G_vIgv.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
//#region src/federation/retry.test.ts
|
|
9
9
|
test("createExponentialBackoffPolicy()", () => {
|
|
@@ -8,10 +8,10 @@ import { r as assertFalse } from "../assert_throws-BbSMEFKo.mjs";
|
|
|
8
8
|
import { n as assertGreaterOrEqual, t as assertRejects } from "../assert_rejects-D1HYAik3.mjs";
|
|
9
9
|
import { n as assertInstanceOf, t as assert } from "../assert-CEO06XCw.mjs";
|
|
10
10
|
import { t as assertNotEquals } from "../assert_not_equals-DkVK8oqV.mjs";
|
|
11
|
-
import { u as verifyRequest } from "../http-
|
|
11
|
+
import { u as verifyRequest } from "../http-D8tiOrZf.mjs";
|
|
12
12
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
13
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
14
|
-
import { i as sendActivity, n as extractInboxes, r as fetchWithValidatedRedirects, t as SendActivityError } from "../send-
|
|
13
|
+
import { t as doesActorOwnKey } from "../owner-Bdj0nHhf.mjs";
|
|
14
|
+
import { i as sendActivity, n as extractInboxes, r as fetchWithValidatedRedirects, t as SendActivityError } from "../send-VD_WG3dN.mjs";
|
|
15
15
|
import { configure, reset } from "@logtape/logtape";
|
|
16
16
|
import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
|
|
17
17
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -815,6 +815,296 @@ const unsignedKeys = [{
|
|
|
815
815
|
privateKey: ed25519PrivateKey,
|
|
816
816
|
keyId: ed25519Multikey.id
|
|
817
817
|
}];
|
|
818
|
+
test("sendActivity() bounds slow response headers on both signing paths", async (t) => {
|
|
819
|
+
for (const signed of [false, true]) await t.step(`signed: ${signed}`, async () => {
|
|
820
|
+
let requests = 0;
|
|
821
|
+
let closes = 0;
|
|
822
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
823
|
+
const error = await assertRejects(() => sendActivity({
|
|
824
|
+
activity: lifecycleActivity,
|
|
825
|
+
meterProvider,
|
|
826
|
+
keys: signed ? signedKeys : unsignedKeys,
|
|
827
|
+
inbox: new URL("https://example.com/slow-headers")
|
|
828
|
+
}, {
|
|
829
|
+
timeoutMs: 100,
|
|
830
|
+
openHop: (url) => Promise.resolve({
|
|
831
|
+
url: new URL(url),
|
|
832
|
+
fetch(input, init) {
|
|
833
|
+
requests++;
|
|
834
|
+
const signal = init?.signal ?? (input instanceof Request ? input.signal : void 0);
|
|
835
|
+
assert(signal != null);
|
|
836
|
+
return new Promise((_, reject) => {
|
|
837
|
+
signal.addEventListener("abort", () => reject(signal.reason), { once: true });
|
|
838
|
+
});
|
|
839
|
+
},
|
|
840
|
+
close() {
|
|
841
|
+
closes++;
|
|
842
|
+
return Promise.resolve();
|
|
843
|
+
}
|
|
844
|
+
})
|
|
845
|
+
}), FetchError);
|
|
846
|
+
assert(error.message.includes("Timed out after 100 ms"));
|
|
847
|
+
assertInstanceOf(error.cause, DOMException);
|
|
848
|
+
assertEquals(error.cause.name, "TimeoutError");
|
|
849
|
+
assertEquals(requests, 1);
|
|
850
|
+
assertEquals(closes, 1);
|
|
851
|
+
const sent = recorder.getMeasurements("activitypub.delivery.sent");
|
|
852
|
+
assertEquals(sent.length, 1);
|
|
853
|
+
assertEquals(sent[0].attributes["activitypub.delivery.success"], false);
|
|
854
|
+
});
|
|
855
|
+
});
|
|
856
|
+
test("sendActivity() closes a session opened after the deadline", async () => {
|
|
857
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
858
|
+
let resolveOpen;
|
|
859
|
+
let closes = 0;
|
|
860
|
+
const error = await assertRejects(() => sendActivity({
|
|
861
|
+
activity: lifecycleActivity,
|
|
862
|
+
meterProvider,
|
|
863
|
+
keys: unsignedKeys,
|
|
864
|
+
inbox: new URL("https://example.com/late-open")
|
|
865
|
+
}, {
|
|
866
|
+
timeoutMs: 20,
|
|
867
|
+
openHop: () => new Promise((resolve) => resolveOpen = resolve)
|
|
868
|
+
}), FetchError);
|
|
869
|
+
assertInstanceOf(error.cause, DOMException);
|
|
870
|
+
assertEquals(error.cause.name, "TimeoutError");
|
|
871
|
+
const sent = recorder.getMeasurements("activitypub.delivery.sent");
|
|
872
|
+
assertEquals(sent.length, 1);
|
|
873
|
+
assertEquals(sent[0].attributes["activitypub.delivery.success"], false);
|
|
874
|
+
assert(resolveOpen != null);
|
|
875
|
+
resolveOpen({
|
|
876
|
+
url: new URL("https://example.com/late-open"),
|
|
877
|
+
fetch: () => Promise.reject(/* @__PURE__ */ new Error("A late session must not fetch")),
|
|
878
|
+
close: () => {
|
|
879
|
+
closes++;
|
|
880
|
+
return Promise.resolve();
|
|
881
|
+
}
|
|
882
|
+
});
|
|
883
|
+
await Promise.resolve();
|
|
884
|
+
assertEquals(closes, 1);
|
|
885
|
+
});
|
|
886
|
+
test("sendActivity() keeps its deadline across redirects", async (t) => {
|
|
887
|
+
for (const signed of [false, true]) await t.step(`signed: ${signed}`, async () => {
|
|
888
|
+
const first = "https://example.com/first-inbox";
|
|
889
|
+
const second = "https://example.com/second-inbox";
|
|
890
|
+
const requests = [];
|
|
891
|
+
let closes = 0;
|
|
892
|
+
await assertRejects(() => sendActivity({
|
|
893
|
+
activity: lifecycleActivity,
|
|
894
|
+
keys: signed ? signedKeys : unsignedKeys,
|
|
895
|
+
inbox: new URL(first)
|
|
896
|
+
}, {
|
|
897
|
+
timeoutMs: 100,
|
|
898
|
+
openHop: (url) => Promise.resolve({
|
|
899
|
+
url: new URL(url),
|
|
900
|
+
async fetch(input, init) {
|
|
901
|
+
const request = new Request(input, init);
|
|
902
|
+
requests.push(request);
|
|
903
|
+
if (url === first) {
|
|
904
|
+
await new Promise((resolve) => setTimeout(resolve, 30));
|
|
905
|
+
return new Response(null, {
|
|
906
|
+
status: 307,
|
|
907
|
+
headers: { Location: second }
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
return await new Promise((_, reject) => {
|
|
911
|
+
request.signal.addEventListener("abort", () => reject(request.signal.reason), { once: true });
|
|
912
|
+
});
|
|
913
|
+
},
|
|
914
|
+
close() {
|
|
915
|
+
closes++;
|
|
916
|
+
return Promise.resolve();
|
|
917
|
+
}
|
|
918
|
+
})
|
|
919
|
+
}), FetchError);
|
|
920
|
+
assertEquals(requests.map((request) => request.url), [first, second]);
|
|
921
|
+
assert(requests.every((request) => request.signal.aborted));
|
|
922
|
+
assertEquals(closes, 2);
|
|
923
|
+
});
|
|
924
|
+
});
|
|
925
|
+
test("sendActivity() keeps its deadline across signature attempts", async () => {
|
|
926
|
+
let requests = 0;
|
|
927
|
+
let closes = 0;
|
|
928
|
+
await assertRejects(() => sendActivity({
|
|
929
|
+
activity: lifecycleActivity,
|
|
930
|
+
keys: signedKeys,
|
|
931
|
+
inbox: new URL("https://example.com/double-knock-timeout")
|
|
932
|
+
}, {
|
|
933
|
+
timeoutMs: 100,
|
|
934
|
+
openHop: (url) => Promise.resolve({
|
|
935
|
+
url: new URL(url),
|
|
936
|
+
fetch(input, init) {
|
|
937
|
+
requests++;
|
|
938
|
+
if (requests === 1) return Promise.resolve(new Response(null, { status: 401 }));
|
|
939
|
+
const signal = init?.signal ?? (input instanceof Request ? input.signal : void 0);
|
|
940
|
+
assert(signal != null);
|
|
941
|
+
return new Promise((_, reject) => {
|
|
942
|
+
signal.addEventListener("abort", () => reject(signal.reason), { once: true });
|
|
943
|
+
});
|
|
944
|
+
},
|
|
945
|
+
close() {
|
|
946
|
+
closes++;
|
|
947
|
+
return Promise.resolve();
|
|
948
|
+
}
|
|
949
|
+
})
|
|
950
|
+
}), FetchError);
|
|
951
|
+
assertEquals(requests, 2);
|
|
952
|
+
assertEquals(closes, 1);
|
|
953
|
+
});
|
|
954
|
+
test("sendActivity() preserves an error status when its body stalls", async (t) => {
|
|
955
|
+
for (const signed of [false, true]) for (const status of [410, 500]) await t.step(`signed: ${signed}, status: ${status}`, async () => {
|
|
956
|
+
let requests = 0;
|
|
957
|
+
let closes = 0;
|
|
958
|
+
const error = await assertRejects(() => sendActivity({
|
|
959
|
+
activity: lifecycleActivity,
|
|
960
|
+
keys: signed ? signedKeys : unsignedKeys,
|
|
961
|
+
inbox: new URL("https://example.com/slow-body")
|
|
962
|
+
}, {
|
|
963
|
+
timeoutMs: 100,
|
|
964
|
+
openHop: (url) => Promise.resolve({
|
|
965
|
+
url: new URL(url),
|
|
966
|
+
fetch() {
|
|
967
|
+
requests++;
|
|
968
|
+
return Promise.resolve(new Response(new ReadableStream({ pull: () => new Promise(() => {}) }), { status }));
|
|
969
|
+
},
|
|
970
|
+
close() {
|
|
971
|
+
closes++;
|
|
972
|
+
return Promise.resolve();
|
|
973
|
+
}
|
|
974
|
+
})
|
|
975
|
+
}), SendActivityError);
|
|
976
|
+
assertEquals(error.statusCode, status);
|
|
977
|
+
assertEquals(error.responseBody, "(timed out reading response body)");
|
|
978
|
+
assertEquals(requests, signed ? 2 : 1);
|
|
979
|
+
assertEquals(closes, 1);
|
|
980
|
+
});
|
|
981
|
+
});
|
|
982
|
+
test("sendActivity() does not read a body after its deadline", async () => {
|
|
983
|
+
let reads = 0;
|
|
984
|
+
let closes = 0;
|
|
985
|
+
const error = await assertRejects(() => sendActivity({
|
|
986
|
+
activity: lifecycleActivity,
|
|
987
|
+
keys: unsignedKeys,
|
|
988
|
+
inbox: new URL("https://example.com/late-error")
|
|
989
|
+
}, {
|
|
990
|
+
timeoutMs: 10,
|
|
991
|
+
openHop: (url) => Promise.resolve({
|
|
992
|
+
url: new URL(url),
|
|
993
|
+
async fetch() {
|
|
994
|
+
await new Promise((resolve) => setTimeout(resolve, 30));
|
|
995
|
+
return new Response(new ReadableStream({ pull() {
|
|
996
|
+
reads++;
|
|
997
|
+
throw new Error("The expired response must not be read");
|
|
998
|
+
} }, { highWaterMark: 0 }), { status: 500 });
|
|
999
|
+
},
|
|
1000
|
+
close() {
|
|
1001
|
+
closes++;
|
|
1002
|
+
return Promise.resolve();
|
|
1003
|
+
}
|
|
1004
|
+
})
|
|
1005
|
+
}), SendActivityError);
|
|
1006
|
+
assertEquals(error.statusCode, 500);
|
|
1007
|
+
assertEquals(error.responseBody, "(timed out reading response body)");
|
|
1008
|
+
assertEquals(reads, 0);
|
|
1009
|
+
assertEquals(closes, 1);
|
|
1010
|
+
});
|
|
1011
|
+
test("sendActivity() bounds signature spec lookup", async () => {
|
|
1012
|
+
let resolveLookup;
|
|
1013
|
+
const lookup = new Promise((resolve) => resolveLookup = resolve);
|
|
1014
|
+
let lookupReleased = false;
|
|
1015
|
+
let lookups = 0;
|
|
1016
|
+
let closes = 0;
|
|
1017
|
+
const release = setTimeout(() => {
|
|
1018
|
+
lookupReleased = true;
|
|
1019
|
+
resolveLookup("rfc9421");
|
|
1020
|
+
}, 100);
|
|
1021
|
+
try {
|
|
1022
|
+
const error = await assertRejects(() => sendActivity({
|
|
1023
|
+
activity: lifecycleActivity,
|
|
1024
|
+
keys: signedKeys,
|
|
1025
|
+
inbox: new URL("https://example.com/stalled-spec-lookup"),
|
|
1026
|
+
specDeterminer: {
|
|
1027
|
+
determineSpec() {
|
|
1028
|
+
lookups++;
|
|
1029
|
+
return lookup;
|
|
1030
|
+
},
|
|
1031
|
+
rememberSpec: () => {}
|
|
1032
|
+
}
|
|
1033
|
+
}, {
|
|
1034
|
+
timeoutMs: 20,
|
|
1035
|
+
openHop: (url) => Promise.resolve({
|
|
1036
|
+
url: new URL(url),
|
|
1037
|
+
fetch: () => Promise.resolve(new Response(null, { status: 202 })),
|
|
1038
|
+
close() {
|
|
1039
|
+
closes++;
|
|
1040
|
+
return Promise.resolve();
|
|
1041
|
+
}
|
|
1042
|
+
})
|
|
1043
|
+
}), FetchError);
|
|
1044
|
+
assertInstanceOf(error.cause, DOMException);
|
|
1045
|
+
assertEquals(error.cause.name, "TimeoutError");
|
|
1046
|
+
assertEquals(lookups, 1);
|
|
1047
|
+
assertFalse(lookupReleased);
|
|
1048
|
+
assertEquals(closes, 1);
|
|
1049
|
+
} finally {
|
|
1050
|
+
clearTimeout(release);
|
|
1051
|
+
resolveLookup("rfc9421");
|
|
1052
|
+
}
|
|
1053
|
+
});
|
|
1054
|
+
test("sendActivity() does not wait for signature spec storage", async () => {
|
|
1055
|
+
let resolveStorage;
|
|
1056
|
+
const storage = new Promise((resolve) => resolveStorage = resolve);
|
|
1057
|
+
let storageReleased = false;
|
|
1058
|
+
let writes = 0;
|
|
1059
|
+
let closes = 0;
|
|
1060
|
+
const release = setTimeout(() => {
|
|
1061
|
+
storageReleased = true;
|
|
1062
|
+
resolveStorage();
|
|
1063
|
+
}, 100);
|
|
1064
|
+
try {
|
|
1065
|
+
await sendActivity({
|
|
1066
|
+
activity: lifecycleActivity,
|
|
1067
|
+
keys: signedKeys,
|
|
1068
|
+
inbox: new URL("https://example.com/stalled-spec-storage"),
|
|
1069
|
+
specDeterminer: {
|
|
1070
|
+
determineSpec: () => "rfc9421",
|
|
1071
|
+
rememberSpec() {
|
|
1072
|
+
writes++;
|
|
1073
|
+
return storage;
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
}, {
|
|
1077
|
+
timeoutMs: 20,
|
|
1078
|
+
openHop: (url) => Promise.resolve({
|
|
1079
|
+
url: new URL(url),
|
|
1080
|
+
fetch: () => Promise.resolve(new Response(null, { status: 202 })),
|
|
1081
|
+
close() {
|
|
1082
|
+
closes++;
|
|
1083
|
+
return Promise.resolve();
|
|
1084
|
+
}
|
|
1085
|
+
})
|
|
1086
|
+
});
|
|
1087
|
+
assertEquals(writes, 1);
|
|
1088
|
+
assertFalse(storageReleased);
|
|
1089
|
+
assertEquals(closes, 1);
|
|
1090
|
+
} finally {
|
|
1091
|
+
clearTimeout(release);
|
|
1092
|
+
resolveStorage();
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
test("sendActivity() keeps an empty error body distinct from a timeout", async () => {
|
|
1096
|
+
const error = await assertRejects(() => sendActivity({
|
|
1097
|
+
activity: lifecycleActivity,
|
|
1098
|
+
keys: unsignedKeys,
|
|
1099
|
+
inbox: new URL("https://example.com/empty-error")
|
|
1100
|
+
}, { openHop: (url) => Promise.resolve({
|
|
1101
|
+
url: new URL(url),
|
|
1102
|
+
fetch: () => Promise.resolve(new Response(null, { status: 500 })),
|
|
1103
|
+
close: () => Promise.resolve()
|
|
1104
|
+
}) }), SendActivityError);
|
|
1105
|
+
assertEquals(error.statusCode, 500);
|
|
1106
|
+
assertEquals(error.responseBody, "");
|
|
1107
|
+
});
|
|
818
1108
|
test("sendActivity() cancels a successful response body", async (t) => {
|
|
819
1109
|
for (const signed of [true, false]) await t.step(`signed: ${signed}`, async () => {
|
|
820
1110
|
const inbox = "https://example.com/lifecycle/inbox";
|
|
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import "../std__assert-BjJn2daJ.mjs";
|
|
5
5
|
import { r as assertFalse } from "../assert_throws-BbSMEFKo.mjs";
|
|
6
6
|
import { t as assert } from "../assert-CEO06XCw.mjs";
|
|
7
|
-
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-
|
|
7
|
+
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-CMvoB-vD.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/federation/temporal.test.ts
|
|
10
10
|
test("hasMalformedKnownTemporalLiteral() detects expanded proof timestamps", async () => {
|
|
@@ -67,5 +67,29 @@ test("hasMalformedKnownTemporalLiteral() ignores custom-typed as:closed values",
|
|
|
67
67
|
"@type": "https://example.com/ns#customDateTime"
|
|
68
68
|
}] }, void 0));
|
|
69
69
|
});
|
|
70
|
+
test("hasMalformedKnownTemporalLiteral() accepts date-times without seconds", async () => {
|
|
71
|
+
for (const published of [
|
|
72
|
+
"2024-01-01T10:00Z",
|
|
73
|
+
"2024-01-01T10:00+09:00",
|
|
74
|
+
"2024-01-01T10:00-05:00",
|
|
75
|
+
"2024-01-01T10:00",
|
|
76
|
+
"2024-01-01T10:00.5Z",
|
|
77
|
+
"2024-01-01T10:00.5+09:00",
|
|
78
|
+
"2024-01-01T10:00.5-05:00",
|
|
79
|
+
"2024-01-01T10:00.5"
|
|
80
|
+
]) assertFalse(await hasMalformedKnownTemporalLiteral({ "https://www.w3.org/ns/activitystreams#published": [{
|
|
81
|
+
"@value": published,
|
|
82
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
|
|
83
|
+
}] }, void 0), published);
|
|
84
|
+
});
|
|
85
|
+
test("hasMalformedKnownTemporalLiteral() mirrors the as:closed decoder for date-times without seconds", async () => {
|
|
86
|
+
const closed = (value) => ({ "https://www.w3.org/ns/activitystreams#closed": [{
|
|
87
|
+
"@value": value,
|
|
88
|
+
"@type": "http://www.w3.org/2001/XMLSchema#dateTime"
|
|
89
|
+
}] });
|
|
90
|
+
assertFalse(await hasMalformedKnownTemporalLiteral(closed("2024-01-01T10:00.5Z"), void 0));
|
|
91
|
+
assert(await hasMalformedKnownTemporalLiteral(closed("2024-02-31T10:00.5Z"), void 0));
|
|
92
|
+
assert(await hasMalformedKnownTemporalLiteral(closed("Sat, 01 Jan 2024 10:00:00 GMT"), void 0));
|
|
93
|
+
});
|
|
70
94
|
//#endregion
|
|
71
95
|
export {};
|
|
@@ -6,7 +6,7 @@ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
|
6
6
|
import "../std__assert-BjJn2daJ.mjs";
|
|
7
7
|
import { t as assertNotEquals } from "../assert_not_equals-DkVK8oqV.mjs";
|
|
8
8
|
import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
|
|
9
|
-
import { o as createFederation, s as handleWebFinger } from "../middleware-
|
|
9
|
+
import { o as createFederation, s as handleWebFinger } from "../middleware-D31fNcY4.mjs";
|
|
10
10
|
import { Image, Link, Person, Tombstone } from "@fedify/vocab";
|
|
11
11
|
import { createTestMeterProvider, test } from "@fedify/fixture";
|
|
12
12
|
//#region src/federation/webfinger.test.ts
|
|
@@ -7,11 +7,12 @@ let _opentelemetry_api = require("@opentelemetry/api");
|
|
|
7
7
|
let byte_encodings_hex = require("byte-encodings/hex");
|
|
8
8
|
let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
|
|
9
9
|
let structured_field_values = require("structured-field-values");
|
|
10
|
+
let _fedify_vocab_runtime_internal = require("@fedify/vocab-runtime/internal");
|
|
10
11
|
let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conventions");
|
|
11
12
|
let byte_encodings_base64 = require("byte-encodings/base64");
|
|
12
13
|
//#region deno.json
|
|
13
14
|
var name = "@fedify/fedify";
|
|
14
|
-
var version = "2.3.16
|
|
15
|
+
var version = "2.3.16";
|
|
15
16
|
//#endregion
|
|
16
17
|
//#region src/sig/accept.ts
|
|
17
18
|
/**
|
|
@@ -1071,7 +1072,7 @@ function generateCryptoKeyPair(algorithm) {
|
|
|
1071
1072
|
*/
|
|
1072
1073
|
async function exportJwk(key) {
|
|
1073
1074
|
validateCryptoKey(key);
|
|
1074
|
-
const jwk = await crypto.subtle.exportKey("jwk", key);
|
|
1075
|
+
const jwk = await crypto.subtle.exportKey("jwk", (0, _fedify_vocab_runtime_internal.asCryptoKey)(key));
|
|
1075
1076
|
if (jwk.crv === "Ed25519") jwk.alg = "Ed25519";
|
|
1076
1077
|
return jwk;
|
|
1077
1078
|
}
|
|
@@ -1611,12 +1612,13 @@ const DOUBLE_KNOCK_TRANSPORT_RETRY_DELAY_MS = 100;
|
|
|
1611
1612
|
*/
|
|
1612
1613
|
async function signRequest(request, privateKey, keyId, options = {}) {
|
|
1613
1614
|
validateCryptoKey(privateKey, "private");
|
|
1615
|
+
const signingKey = (0, _fedify_vocab_runtime_internal.asCryptoKey)(privateKey);
|
|
1614
1616
|
return await (options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.sign", async (span) => {
|
|
1615
1617
|
try {
|
|
1616
1618
|
const spec = options.spec ?? "draft-cavage-http-signatures-12";
|
|
1617
1619
|
let signed;
|
|
1618
|
-
if (spec === "rfc9421") signed = await signRequestRfc9421(request,
|
|
1619
|
-
else signed = await signRequestDraft(request,
|
|
1620
|
+
if (spec === "rfc9421") signed = await signRequestRfc9421(request, signingKey, keyId, span, options.currentTime, options.body, options.rfc9421);
|
|
1621
|
+
else signed = await signRequestDraft(request, signingKey, keyId, span, options.currentTime, options.body);
|
|
1620
1622
|
if (span.isRecording()) {
|
|
1621
1623
|
span.setAttribute(_opentelemetry_semantic_conventions.ATTR_HTTP_REQUEST_METHOD, signed.method);
|
|
1622
1624
|
span.setAttribute(_opentelemetry_semantic_conventions.ATTR_URL_FULL, signed.url);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { Actor, CryptographicKey, Multikey } from "@fedify/vocab";
|
|
3
3
|
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
4
|
-
import { DocumentLoader } from "@fedify/vocab-runtime";
|
|
4
|
+
import { CryptoKeyLike, DocumentLoader } from "@fedify/vocab-runtime";
|
|
5
5
|
//#region src/sig/key.d.ts
|
|
6
6
|
/**
|
|
7
7
|
* Generates a key pair which is appropriate for Fedify.
|
|
@@ -18,7 +18,7 @@ declare function generateCryptoKeyPair(algorithm?: "RSASSA-PKCS1-v1_5" | "Ed2551
|
|
|
18
18
|
* serialization and storage.
|
|
19
19
|
* @throws {TypeError} If the key is invalid or unsupported.
|
|
20
20
|
*/
|
|
21
|
-
declare function exportJwk(key:
|
|
21
|
+
declare function exportJwk(key: CryptoKeyLike): Promise<JsonWebKey>;
|
|
22
22
|
/**
|
|
23
23
|
* Imports a key from JWK format.
|
|
24
24
|
* @param jwk The key in JWK format.
|
|
@@ -427,7 +427,7 @@ interface Rfc9421SignRequestOptions {
|
|
|
427
427
|
* @returns The signed request.
|
|
428
428
|
* @throws {TypeError} If the private key is invalid or unsupported.
|
|
429
429
|
*/
|
|
430
|
-
declare function signRequest(request: Request, privateKey:
|
|
430
|
+
declare function signRequest(request: Request, privateKey: CryptoKeyLike, keyId: URL, options?: SignRequestOptions): Promise<Request>;
|
|
431
431
|
/**
|
|
432
432
|
* Options for {@link verifyRequest}.
|
|
433
433
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { Actor, CryptographicKey, Multikey } from "@fedify/vocab";
|
|
3
|
-
import { DocumentLoader } from "@fedify/vocab-runtime";
|
|
3
|
+
import { CryptoKeyLike, DocumentLoader } from "@fedify/vocab-runtime";
|
|
4
4
|
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
5
5
|
//#region src/sig/key.d.ts
|
|
6
6
|
/**
|
|
@@ -18,7 +18,7 @@ declare function generateCryptoKeyPair(algorithm?: "RSASSA-PKCS1-v1_5" | "Ed2551
|
|
|
18
18
|
* serialization and storage.
|
|
19
19
|
* @throws {TypeError} If the key is invalid or unsupported.
|
|
20
20
|
*/
|
|
21
|
-
declare function exportJwk(key:
|
|
21
|
+
declare function exportJwk(key: CryptoKeyLike): Promise<JsonWebKey>;
|
|
22
22
|
/**
|
|
23
23
|
* Imports a key from JWK format.
|
|
24
24
|
* @param jwk The key in JWK format.
|
|
@@ -427,7 +427,7 @@ interface Rfc9421SignRequestOptions {
|
|
|
427
427
|
* @returns The signed request.
|
|
428
428
|
* @throws {TypeError} If the private key is invalid or unsupported.
|
|
429
429
|
*/
|
|
430
|
-
declare function signRequest(request: Request, privateKey:
|
|
430
|
+
declare function signRequest(request: Request, privateKey: CryptoKeyLike, keyId: URL, options?: SignRequestOptions): Promise<Request>;
|
|
431
431
|
/**
|
|
432
432
|
* Options for {@link verifyRequest}.
|
|
433
433
|
*/
|
|
@@ -1,14 +1,15 @@
|
|
|
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-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
4
|
+
import { n as version, t as name } from "./deno-FtdqgHJA.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-CaoYRhNH.mjs";
|
|
6
6
|
import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-Dd__NiUL.mjs";
|
|
7
|
-
import { i as fetchKeyDetailed, s as validateCryptoKey } from "./key-
|
|
7
|
+
import { i as fetchKeyDetailed, s as validateCryptoKey } from "./key-o1SmN5s0.mjs";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { CryptographicKey } from "@fedify/vocab";
|
|
10
10
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
11
11
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
12
|
+
import { asCryptoKey } from "@fedify/vocab-runtime/internal";
|
|
12
13
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
13
14
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
14
15
|
import { encodeHex } from "byte-encodings/hex";
|
|
@@ -27,12 +28,13 @@ const DOUBLE_KNOCK_TRANSPORT_RETRY_DELAY_MS = 100;
|
|
|
27
28
|
*/
|
|
28
29
|
async function signRequest(request, privateKey, keyId, options = {}) {
|
|
29
30
|
validateCryptoKey(privateKey, "private");
|
|
31
|
+
const signingKey = asCryptoKey(privateKey);
|
|
30
32
|
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.sign", async (span) => {
|
|
31
33
|
try {
|
|
32
34
|
const spec = options.spec ?? "draft-cavage-http-signatures-12";
|
|
33
35
|
let signed;
|
|
34
|
-
if (spec === "rfc9421") signed = await signRequestRfc9421(request,
|
|
35
|
-
else signed = await signRequestDraft(request,
|
|
36
|
+
if (spec === "rfc9421") signed = await signRequestRfc9421(request, signingKey, keyId, span, options.currentTime, options.body, options.rfc9421);
|
|
37
|
+
else signed = await signRequestDraft(request, signingKey, keyId, span, options.currentTime, options.body);
|
|
36
38
|
if (span.isRecording()) {
|
|
37
39
|
span.setAttribute(ATTR_HTTP_REQUEST_METHOD, signed.method);
|
|
38
40
|
span.setAttribute(ATTR_URL_FULL, signed.url);
|
|
@@ -6,11 +6,12 @@ import { SpanKind, SpanStatusCode, metrics, trace } from "@opentelemetry/api";
|
|
|
6
6
|
import { encodeHex } from "byte-encodings/hex";
|
|
7
7
|
import { FetchError, UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
8
8
|
import { Item, decodeDict, encodeDict, encodeItem } from "structured-field-values";
|
|
9
|
+
import { asCryptoKey } from "@fedify/vocab-runtime/internal";
|
|
9
10
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
10
11
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
11
12
|
//#region deno.json
|
|
12
13
|
var name = "@fedify/fedify";
|
|
13
|
-
var version = "2.3.16
|
|
14
|
+
var version = "2.3.16";
|
|
14
15
|
//#endregion
|
|
15
16
|
//#region src/sig/accept.ts
|
|
16
17
|
/**
|
|
@@ -1070,7 +1071,7 @@ function generateCryptoKeyPair(algorithm) {
|
|
|
1070
1071
|
*/
|
|
1071
1072
|
async function exportJwk(key) {
|
|
1072
1073
|
validateCryptoKey(key);
|
|
1073
|
-
const jwk = await crypto.subtle.exportKey("jwk", key);
|
|
1074
|
+
const jwk = await crypto.subtle.exportKey("jwk", asCryptoKey(key));
|
|
1074
1075
|
if (jwk.crv === "Ed25519") jwk.alg = "Ed25519";
|
|
1075
1076
|
return jwk;
|
|
1076
1077
|
}
|
|
@@ -1610,12 +1611,13 @@ const DOUBLE_KNOCK_TRANSPORT_RETRY_DELAY_MS = 100;
|
|
|
1610
1611
|
*/
|
|
1611
1612
|
async function signRequest(request, privateKey, keyId, options = {}) {
|
|
1612
1613
|
validateCryptoKey(privateKey, "private");
|
|
1614
|
+
const signingKey = asCryptoKey(privateKey);
|
|
1613
1615
|
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.sign", async (span) => {
|
|
1614
1616
|
try {
|
|
1615
1617
|
const spec = options.spec ?? "draft-cavage-http-signatures-12";
|
|
1616
1618
|
let signed;
|
|
1617
|
-
if (spec === "rfc9421") signed = await signRequestRfc9421(request,
|
|
1618
|
-
else signed = await signRequestDraft(request,
|
|
1619
|
+
if (spec === "rfc9421") signed = await signRequestRfc9421(request, signingKey, keyId, span, options.currentTime, options.body, options.rfc9421);
|
|
1620
|
+
else signed = await signRequestDraft(request, signingKey, keyId, span, options.currentTime, options.body);
|
|
1619
1621
|
if (span.isRecording()) {
|
|
1620
1622
|
span.setAttribute(ATTR_HTTP_REQUEST_METHOD, signed.method);
|
|
1621
1623
|
span.setAttribute(ATTR_URL_FULL, signed.url);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { g as recordInboxActivity, n as getDurationMs, r as getFederationMetrics } from "./metrics-
|
|
4
|
+
import { n as version, t as name } from "./deno-FtdqgHJA.mjs";
|
|
5
|
+
import { g as recordInboxActivity, n as getDurationMs, r as getFederationMetrics } from "./metrics-CaoYRhNH.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { getTypeId } from "@fedify/vocab";
|
|
8
8
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
@@ -1,12 +1,13 @@
|
|
|
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-
|
|
5
|
-
import { _ as recordKeyLookup, n as getDurationMs, t as classifyFetchError } from "./metrics-
|
|
4
|
+
import { n as version, t as name } from "./deno-FtdqgHJA.mjs";
|
|
5
|
+
import { _ as recordKeyLookup, n as getDurationMs, t as classifyFetchError } from "./metrics-CaoYRhNH.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";
|
|
9
9
|
import { FetchError, UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
10
|
+
import { asCryptoKey } from "@fedify/vocab-runtime/internal";
|
|
10
11
|
//#region src/sig/key.ts
|
|
11
12
|
/** Classifies decoding failures without hiding unexpected loader errors. */
|
|
12
13
|
function classifyKeyJsonLdError(error, seen = /* @__PURE__ */ new Set()) {
|
|
@@ -118,7 +119,7 @@ function generateCryptoKeyPair(algorithm) {
|
|
|
118
119
|
*/
|
|
119
120
|
async function exportJwk(key) {
|
|
120
121
|
validateCryptoKey(key);
|
|
121
|
-
const jwk = await crypto.subtle.exportKey("jwk", key);
|
|
122
|
+
const jwk = await crypto.subtle.exportKey("jwk", asCryptoKey(key));
|
|
122
123
|
if (jwk.crv === "Ed25519") jwk.alg = "Ed25519";
|
|
123
124
|
return jwk;
|
|
124
125
|
}
|