@fedify/fedify 2.4.0-dev.2159 → 2.4.0-dev.2169
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/{builder-D89oOfHC.mjs → builder-B2d_Pt0j.mjs} +2 -2
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-B02Os8h2.mjs → compound-proof-D28gMFqP.mjs} +2 -2
- package/dist/{context-JDNkUtnu.d.ts → context-BykNUf04.d.ts} +1 -1
- package/dist/{context-DpsaHkk1.d.cts → context-L0Fnib9j.d.cts} +1 -1
- package/dist/{deno-CE_s0yQb.mjs → deno-DU8dvnWk.mjs} +1 -1
- package/dist/{docloader-C5p26tpa.mjs → docloader-CghLH7Zi.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +3 -3
- package/dist/federation/handler-compound-proof.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +5 -5
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/keycache.test.mjs +67 -1
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +7 -7
- 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/outgoing-proof.test.mjs +5 -5
- package/dist/federation/portable-actor.test.mjs +3 -3
- package/dist/federation/portable-chain.test.mjs +3 -3
- package/dist/federation/portable-collection.test.mjs +4 -4
- package/dist/federation/portable-gateway-keys.test.mjs +180 -6
- package/dist/federation/portable-inbox.test.mjs +4 -4
- package/dist/federation/portable-parse-uri.test.mjs +1 -1
- package/dist/federation/portable.test.mjs +3 -3
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/tasks/enqueue.test.mjs +1 -1
- package/dist/federation/tasks/tasks.test.mjs +2 -2
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-dBOqmJcA.cjs → federation-DrNgkLfJ.cjs} +48 -24
- package/dist/{http-wdsia0-O.cjs → http-5CJBdU8n.cjs} +392 -65
- package/dist/{http-nTZuTacw.js → http-BGpexPO7.js} +368 -61
- package/dist/{http-DV_yW4dv.mjs → http-Bd6rZlJX.mjs} +7 -5
- package/dist/{http-C-x_OLSp.d.ts → http-Cok5-vIC.d.ts} +5 -0
- package/dist/{http-CjezPjFX.d.cts → http-DC1cqAQ2.d.cts} +5 -0
- package/dist/{key-C6jnekFI.mjs → key-gIhVZO3p.mjs} +58 -7
- package/dist/key-owner-evidence-Bo3yaeL5.mjs +108 -0
- package/dist/{keycache-BInaECGj.mjs → keycache-PiOM9pM0.mjs} +46 -21
- package/dist/{kv-cache-Bxm0a0Ww.mjs → kv-cache-D0qjSeWY.mjs} +1 -1
- package/dist/{kv-cache-BHNtQi9e.cjs → kv-cache-YRi_g8GB.cjs} +1 -1
- package/dist/{kv-cache-DhIl9YlV.js → kv-cache-iR55fqlk.js} +1 -1
- package/dist/{ld-ya2C1Xip.mjs → ld-BsTkRrwF.mjs} +3 -3
- package/dist/{metrics-ByOQOHHS.mjs → metrics-jUDFfVgi.mjs} +1 -1
- package/dist/{middleware-Bdwd_Gg8.mjs → middleware-Coqgp-K0.mjs} +15 -15
- package/dist/{middleware-WiaN4RS3.js → middleware-DlxMxVp5.js} +48 -24
- package/dist/{middleware-DoVWq8mE.mjs → middleware-Dq-OCmb6.mjs} +1 -1
- package/dist/{mod-Bz9tFXI2.d.ts → mod--jv6vyrP.d.ts} +1 -1
- package/dist/{mod-DaiBrWDW.d.ts → mod-B5z_q9TH.d.ts} +1 -1
- package/dist/{mod-Mt4aO3DX.d.cts → mod-BA_F2x53.d.cts} +1 -1
- package/dist/{mod-DSKkTwH2.d.cts → mod-BLOXGs6m.d.cts} +1 -1
- package/dist/{mod-S--JxYjo.d.cts → mod-CPPqkyV_.d.cts} +1 -1
- package/dist/{mod-_4K05HZF.d.ts → mod-DK0y9fd-.d.ts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +5 -5
- package/dist/mod.d.ts +5 -5
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-C6Nv5yyw.mjs → owner-D3GoetXS.mjs} +18 -3
- package/dist/{portable-collection-B-mU1F1-.js → portable-collection-Bkdh_WpL.js} +15 -1
- package/dist/{portable-collection-uWj3hfzv.mjs → portable-collection-C60_acmx.mjs} +2 -2
- package/dist/{portable-collection-C65SwL2l.cjs → portable-collection-CnlCamup.cjs} +15 -1
- package/dist/{portable-key-BXsVLSMa.mjs → portable-key-DyF5AnZo.mjs} +209 -55
- package/dist/{proof-BdO3BbLh.mjs → proof-CQAYqWdj.mjs} +4 -4
- package/dist/{send-BwANxryy.mjs → send-DjkQrxt5.mjs} +3 -3
- package/dist/sig/compound-proof-discovery.test.mjs +1 -1
- package/dist/sig/compound-proof-producer.test.mjs +1 -1
- package/dist/sig/compound-proof-verification.test.mjs +2 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key-owner-evidence.test.d.mts +2 -0
- package/dist/sig/key-owner-evidence.test.mjs +100 -0
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/portable-collection.test.mjs +1 -1
- package/dist/sig/portable-key.test.mjs +253 -7
- package/dist/sig/proof.test.mjs +3 -3
- package/dist/{temporal-CbPfRGZq.mjs → temporal-oRKP803M.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- 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 +7 -7
package/dist/mod.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
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
|
-
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-
|
|
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-DC1cqAQ2.cjs";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-BF0L9cMt.cjs";
|
|
5
|
-
import { $ as respondWithObjectIfAcceptable, $t as ActivityTransformer, A as InboxListenerSetters, At as HashlinkMediaDispatcher, B as Message, Bt as OutboxListenerErrorHandler, C as FederationBuilder, Ct as AuthorizePredicate, D as IdempotencyKeyCallback, Dt as CustomCollectionCounter, E as FederationStartQueueOptions, Et as CollectionDispatcher, F as Rfc6570Expression, Ft as NodeInfoDispatcher, G as TaskHandler, Gt as UnverifiedActivityHandler, H as TaskDefinition, Ht as PortableActorIdMapper, I as FederationKvPrefixes, It as ObjectAuthorizePredicate, J as RetryContext, Jt as SendActivityError, K as TaskRegistry, Kt as UnverifiedActivityReason, L as FederationOrigin, Lt as ObjectDispatcher, M as ObjectCallbackSetters, Mt as InboxErrorHandler, N as OutboxListenerSetters, Nt as InboxListener, O as IdempotencyStrategy, Ot as CustomCollectionCursor, P as PortableInboxForwardingOptions, Pt as MediaUploaderCallback, Q as respondWithObject, Qt as digest, R as FederationQueueOptions, Rt as OutboxErrorHandler, S as FederationBenchmarkOptions, St as ActorKeyPairsDispatcher, T as FederationOptions, Tt as CollectionCursor, U as TaskDefinitionOptions, Ut as PortableCollectionOwnerMapper, V as createFederationBuilder, Vt as OutboxPermanentFailureHandler, W as TaskEnqueueOptions, Wt as SharedInboxKeyDispatcher, X as createExponentialBackoffPolicy, Xt as PageItems, Y as RetryPolicy, Yt as SenderKeyPair, Z as RespondWithObjectOptions, Zt as buildCollectionSynchronizationHeader, _ as CollectionCallbackSetters, _t as normalizeCircuitBreakerOptions, a as GetObjectOptions, at as MessageQueueListenOptions, b as Federatable, bt as ActorDispatcher, c as OutboxContext, ct as CircuitBreakerActivityDrop, d as PortableRequest, dt as CircuitBreakerFailurePolicy, et as InProcessMessageQueue, f as RequestContext, ft as CircuitBreakerKvState, g as ActorCallbackSetters, gt as NormalizedCircuitBreakerOptions, h as SendActivityOptionsForCollection, ht as CircuitBreakerStateChange, i as GetActorOptions, it as MessageQueueEnqueueOptions, j as MediaUploaderSetters, jt as HashlinkMediaRequest, k as InboxChallengePolicy, kt as CustomCollectionDispatcher, l as ParseUriOptions, lt as CircuitBreakerBeforeSendDecision, m as SendActivityOptions, mt as CircuitBreakerState, n as Context, nt as MessageQueue, o as GetSignedKeyOptions, ot as ParallelMessageQueue, p as RouteActivityOptions, pt as CircuitBreakerOptions, q as CreateExponentialBackoffPolicyOptions, qt as WebFingerLinksDispatcher, r as ForwardActivityOptions, rt as MessageQueueDepth, s as InboxContext, st as CircuitBreaker, t as ActorKeyPair, tt as InProcessMessageQueueOptions, u as ParseUriResult, ut as CircuitBreakerCreateOptions, v as ConstructorWithTypeId, vt as parseCircuitBreakerKvState, w as FederationFetchOptions, wt as CollectionCounter, x as Federation, xt as ActorHandleMapper, y as CustomCollectionCallbackSetters, yt as ActorAliasMapper, z as createFederation, zt as OutboxListener } from "./context-
|
|
5
|
+
import { $ as respondWithObjectIfAcceptable, $t as ActivityTransformer, A as InboxListenerSetters, At as HashlinkMediaDispatcher, B as Message, Bt as OutboxListenerErrorHandler, C as FederationBuilder, Ct as AuthorizePredicate, D as IdempotencyKeyCallback, Dt as CustomCollectionCounter, E as FederationStartQueueOptions, Et as CollectionDispatcher, F as Rfc6570Expression, Ft as NodeInfoDispatcher, G as TaskHandler, Gt as UnverifiedActivityHandler, H as TaskDefinition, Ht as PortableActorIdMapper, I as FederationKvPrefixes, It as ObjectAuthorizePredicate, J as RetryContext, Jt as SendActivityError, K as TaskRegistry, Kt as UnverifiedActivityReason, L as FederationOrigin, Lt as ObjectDispatcher, M as ObjectCallbackSetters, Mt as InboxErrorHandler, N as OutboxListenerSetters, Nt as InboxListener, O as IdempotencyStrategy, Ot as CustomCollectionCursor, P as PortableInboxForwardingOptions, Pt as MediaUploaderCallback, Q as respondWithObject, Qt as digest, R as FederationQueueOptions, Rt as OutboxErrorHandler, S as FederationBenchmarkOptions, St as ActorKeyPairsDispatcher, T as FederationOptions, Tt as CollectionCursor, U as TaskDefinitionOptions, Ut as PortableCollectionOwnerMapper, V as createFederationBuilder, Vt as OutboxPermanentFailureHandler, W as TaskEnqueueOptions, Wt as SharedInboxKeyDispatcher, X as createExponentialBackoffPolicy, Xt as PageItems, Y as RetryPolicy, Yt as SenderKeyPair, Z as RespondWithObjectOptions, Zt as buildCollectionSynchronizationHeader, _ as CollectionCallbackSetters, _t as normalizeCircuitBreakerOptions, a as GetObjectOptions, at as MessageQueueListenOptions, b as Federatable, bt as ActorDispatcher, c as OutboxContext, ct as CircuitBreakerActivityDrop, d as PortableRequest, dt as CircuitBreakerFailurePolicy, et as InProcessMessageQueue, f as RequestContext, ft as CircuitBreakerKvState, g as ActorCallbackSetters, gt as NormalizedCircuitBreakerOptions, h as SendActivityOptionsForCollection, ht as CircuitBreakerStateChange, i as GetActorOptions, it as MessageQueueEnqueueOptions, j as MediaUploaderSetters, jt as HashlinkMediaRequest, k as InboxChallengePolicy, kt as CustomCollectionDispatcher, l as ParseUriOptions, lt as CircuitBreakerBeforeSendDecision, m as SendActivityOptions, mt as CircuitBreakerState, n as Context, nt as MessageQueue, o as GetSignedKeyOptions, ot as ParallelMessageQueue, p as RouteActivityOptions, pt as CircuitBreakerOptions, q as CreateExponentialBackoffPolicyOptions, qt as WebFingerLinksDispatcher, r as ForwardActivityOptions, rt as MessageQueueDepth, s as InboxContext, st as CircuitBreaker, t as ActorKeyPair, tt as InProcessMessageQueueOptions, u as ParseUriResult, ut as CircuitBreakerCreateOptions, v as ConstructorWithTypeId, vt as parseCircuitBreakerKvState, w as FederationFetchOptions, wt as CollectionCounter, x as Federation, xt as ActorHandleMapper, y as CustomCollectionCallbackSetters, yt as ActorAliasMapper, z as createFederation, zt as OutboxListener } from "./context-L0Fnib9j.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-
|
|
9
|
-
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "./mod-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-
|
|
8
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-BLOXGs6m.cjs";
|
|
9
|
+
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "./mod-CPPqkyV_.cjs";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-BA_F2x53.cjs";
|
|
11
11
|
export * from "@fedify/vocab-runtime";
|
|
12
12
|
|
|
13
13
|
//#region src/mod.d.ts
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
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
|
-
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-
|
|
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-Cok5-vIC.js";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-BSzr5-I8.js";
|
|
5
|
-
import { $ as respondWithObjectIfAcceptable, $t as ActivityTransformer, A as InboxListenerSetters, At as HashlinkMediaDispatcher, B as Message, Bt as OutboxListenerErrorHandler, C as FederationBuilder, Ct as AuthorizePredicate, D as IdempotencyKeyCallback, Dt as CustomCollectionCounter, E as FederationStartQueueOptions, Et as CollectionDispatcher, F as Rfc6570Expression, Ft as NodeInfoDispatcher, G as TaskHandler, Gt as UnverifiedActivityHandler, H as TaskDefinition, Ht as PortableActorIdMapper, I as FederationKvPrefixes, It as ObjectAuthorizePredicate, J as RetryContext, Jt as SendActivityError, K as TaskRegistry, Kt as UnverifiedActivityReason, L as FederationOrigin, Lt as ObjectDispatcher, M as ObjectCallbackSetters, Mt as InboxErrorHandler, N as OutboxListenerSetters, Nt as InboxListener, O as IdempotencyStrategy, Ot as CustomCollectionCursor, P as PortableInboxForwardingOptions, Pt as MediaUploaderCallback, Q as respondWithObject, Qt as digest, R as FederationQueueOptions, Rt as OutboxErrorHandler, S as FederationBenchmarkOptions, St as ActorKeyPairsDispatcher, T as FederationOptions, Tt as CollectionCursor, U as TaskDefinitionOptions, Ut as PortableCollectionOwnerMapper, V as createFederationBuilder, Vt as OutboxPermanentFailureHandler, W as TaskEnqueueOptions, Wt as SharedInboxKeyDispatcher, X as createExponentialBackoffPolicy, Xt as PageItems, Y as RetryPolicy, Yt as SenderKeyPair, Z as RespondWithObjectOptions, Zt as buildCollectionSynchronizationHeader, _ as CollectionCallbackSetters, _t as normalizeCircuitBreakerOptions, a as GetObjectOptions, at as MessageQueueListenOptions, b as Federatable, bt as ActorDispatcher, c as OutboxContext, ct as CircuitBreakerActivityDrop, d as PortableRequest, dt as CircuitBreakerFailurePolicy, et as InProcessMessageQueue, f as RequestContext, ft as CircuitBreakerKvState, g as ActorCallbackSetters, gt as NormalizedCircuitBreakerOptions, h as SendActivityOptionsForCollection, ht as CircuitBreakerStateChange, i as GetActorOptions, it as MessageQueueEnqueueOptions, j as MediaUploaderSetters, jt as HashlinkMediaRequest, k as InboxChallengePolicy, kt as CustomCollectionDispatcher, l as ParseUriOptions, lt as CircuitBreakerBeforeSendDecision, m as SendActivityOptions, mt as CircuitBreakerState, n as Context, nt as MessageQueue, o as GetSignedKeyOptions, ot as ParallelMessageQueue, p as RouteActivityOptions, pt as CircuitBreakerOptions, q as CreateExponentialBackoffPolicyOptions, qt as WebFingerLinksDispatcher, r as ForwardActivityOptions, rt as MessageQueueDepth, s as InboxContext, st as CircuitBreaker, t as ActorKeyPair, tt as InProcessMessageQueueOptions, u as ParseUriResult, ut as CircuitBreakerCreateOptions, v as ConstructorWithTypeId, vt as parseCircuitBreakerKvState, w as FederationFetchOptions, wt as CollectionCounter, x as Federation, xt as ActorHandleMapper, y as CustomCollectionCallbackSetters, yt as ActorAliasMapper, z as createFederation, zt as OutboxListener } from "./context-
|
|
5
|
+
import { $ as respondWithObjectIfAcceptable, $t as ActivityTransformer, A as InboxListenerSetters, At as HashlinkMediaDispatcher, B as Message, Bt as OutboxListenerErrorHandler, C as FederationBuilder, Ct as AuthorizePredicate, D as IdempotencyKeyCallback, Dt as CustomCollectionCounter, E as FederationStartQueueOptions, Et as CollectionDispatcher, F as Rfc6570Expression, Ft as NodeInfoDispatcher, G as TaskHandler, Gt as UnverifiedActivityHandler, H as TaskDefinition, Ht as PortableActorIdMapper, I as FederationKvPrefixes, It as ObjectAuthorizePredicate, J as RetryContext, Jt as SendActivityError, K as TaskRegistry, Kt as UnverifiedActivityReason, L as FederationOrigin, Lt as ObjectDispatcher, M as ObjectCallbackSetters, Mt as InboxErrorHandler, N as OutboxListenerSetters, Nt as InboxListener, O as IdempotencyStrategy, Ot as CustomCollectionCursor, P as PortableInboxForwardingOptions, Pt as MediaUploaderCallback, Q as respondWithObject, Qt as digest, R as FederationQueueOptions, Rt as OutboxErrorHandler, S as FederationBenchmarkOptions, St as ActorKeyPairsDispatcher, T as FederationOptions, Tt as CollectionCursor, U as TaskDefinitionOptions, Ut as PortableCollectionOwnerMapper, V as createFederationBuilder, Vt as OutboxPermanentFailureHandler, W as TaskEnqueueOptions, Wt as SharedInboxKeyDispatcher, X as createExponentialBackoffPolicy, Xt as PageItems, Y as RetryPolicy, Yt as SenderKeyPair, Z as RespondWithObjectOptions, Zt as buildCollectionSynchronizationHeader, _ as CollectionCallbackSetters, _t as normalizeCircuitBreakerOptions, a as GetObjectOptions, at as MessageQueueListenOptions, b as Federatable, bt as ActorDispatcher, c as OutboxContext, ct as CircuitBreakerActivityDrop, d as PortableRequest, dt as CircuitBreakerFailurePolicy, et as InProcessMessageQueue, f as RequestContext, ft as CircuitBreakerKvState, g as ActorCallbackSetters, gt as NormalizedCircuitBreakerOptions, h as SendActivityOptionsForCollection, ht as CircuitBreakerStateChange, i as GetActorOptions, it as MessageQueueEnqueueOptions, j as MediaUploaderSetters, jt as HashlinkMediaRequest, k as InboxChallengePolicy, kt as CustomCollectionDispatcher, l as ParseUriOptions, lt as CircuitBreakerBeforeSendDecision, m as SendActivityOptions, mt as CircuitBreakerState, n as Context, nt as MessageQueue, o as GetSignedKeyOptions, ot as ParallelMessageQueue, p as RouteActivityOptions, pt as CircuitBreakerOptions, q as CreateExponentialBackoffPolicyOptions, qt as WebFingerLinksDispatcher, r as ForwardActivityOptions, rt as MessageQueueDepth, s as InboxContext, st as CircuitBreaker, t as ActorKeyPair, tt as InProcessMessageQueueOptions, u as ParseUriResult, ut as CircuitBreakerCreateOptions, v as ConstructorWithTypeId, vt as parseCircuitBreakerKvState, w as FederationFetchOptions, wt as CollectionCounter, x as Federation, xt as ActorHandleMapper, y as CustomCollectionCallbackSetters, yt as ActorAliasMapper, z as createFederation, zt as OutboxListener } from "./context-BykNUf04.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-
|
|
9
|
-
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "./mod
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-
|
|
8
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-DK0y9fd-.js";
|
|
9
|
+
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "./mod--jv6vyrP.js";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-B5z_q9TH.js";
|
|
11
11
|
export * from "@fedify/vocab-runtime";
|
|
12
12
|
|
|
13
13
|
//#region src/mod.d.ts
|
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 hasSignatureLike, B as fetchKey, D as detachSignature, E as createSignature, F as verifyJsonLd, H as generateCryptoKeyPair, I as verifySignature, N as signJsonLd, R as exportJwk, U as importJwk, V as fetchKeyDetailed, _ as verifyPortableObjectProof, a as signRequest, b as verifyProof,
|
|
7
|
-
import { a as respondWithObjectIfAcceptable, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as respondWithObject, l as CircuitBreaker, n as handleWebFinger, o as SendActivityError, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "./middleware-
|
|
6
|
+
import { A as hasSignatureLike, B as fetchKey, D as detachSignature, E as createSignature, F as verifyJsonLd, H as generateCryptoKeyPair, I as verifySignature, N as signJsonLd, R as exportJwk, U as importJwk, V as fetchKeyDetailed, _ as verifyPortableObjectProof, a as signRequest, b as verifyProof, f as createProof, g as verifyObject, gt as validateAcceptSignature, ht as parseAcceptSignature, m as signObject, mt as fulfillAcceptSignature, o as verifyRequest, p as hasProofLike, pt as formatAcceptSignature, s as verifyRequestDetailed, w as attachSignature } from "./http-BGpexPO7.js";
|
|
7
|
+
import { a as respondWithObjectIfAcceptable, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as respondWithObject, l as CircuitBreaker, n as handleWebFinger, o as SendActivityError, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "./middleware-DlxMxVp5.js";
|
|
8
8
|
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-_S2_MeLF.js";
|
|
9
|
-
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
9
|
+
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-Bkdh_WpL.js";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-iR55fqlk.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-B2rlkkyJ.mjs";
|
|
|
5
5
|
import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
6
6
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
7
7
|
import "../std__assert-DvMDRPes.mjs";
|
|
8
|
-
import { C as handleNodeInfo, o as createFederation, w as handleNodeInfoJrd } from "../middleware-
|
|
8
|
+
import { C as handleNodeInfo, o as createFederation, w as handleNodeInfoJrd } from "../middleware-Coqgp-K0.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
//#region src/nodeinfo/handler.test.ts
|
|
11
11
|
test("handleNodeInfo()", async () => {
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
4
|
+
import { n as version, t as name } from "./deno-DU8dvnWk.mjs";
|
|
5
5
|
import { c as isPortableId, d as isSamePublicKey$1, o as isCompatibleKeyId, t as getCanonicalPortableId, u as isPortableUri } from "./portable-key-id-Bg259c4Z.mjs";
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
6
|
+
import { i as parseKeyOwnerEvidence, r as getVerifiedKeyOwnerEvidence } from "./key-owner-evidence-Bo3yaeL5.mjs";
|
|
7
|
+
import { l as verifyKeyOwnership, n as exportJwk, r as fetchActorDocument } from "./key-gIhVZO3p.mjs";
|
|
8
|
+
import { n as resolvePortableActorKey, t as fetchPortableGatewayKey } from "./portable-key-DyF5AnZo.mjs";
|
|
8
9
|
import { getLogger } from "@logtape/logtape";
|
|
9
10
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
10
11
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -44,6 +45,13 @@ async function doesActorOwnKey(activity, key, options) {
|
|
|
44
45
|
span.setAttribute("activitypub.key_ownership.method", "none");
|
|
45
46
|
return false;
|
|
46
47
|
}
|
|
48
|
+
const evidence = getVerifiedKeyOwnerEvidence(key);
|
|
49
|
+
if (evidence != null) {
|
|
50
|
+
const verified = getCanonicalPortableId(actorId) === evidence.ownerId;
|
|
51
|
+
span.setAttribute("activitypub.key_ownership.verified", verified);
|
|
52
|
+
span.setAttribute("activitypub.key_ownership.method", key.id != null && isPortableUri(key.id) ? "portable_actor_key" : "portable_gateway_key");
|
|
53
|
+
return verified;
|
|
54
|
+
}
|
|
47
55
|
if (key.id != null && isPortableUri(key.id)) {
|
|
48
56
|
const owner = await getPortableActorKeyOwner(key, options);
|
|
49
57
|
const ownerId = owner?.id == null ? null : getCanonicalPortableId(owner.id);
|
|
@@ -150,6 +158,13 @@ async function getKeyOwner(keyId, options) {
|
|
|
150
158
|
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
151
159
|
tracerProvider
|
|
152
160
|
};
|
|
161
|
+
if (keyId instanceof CryptographicKey) {
|
|
162
|
+
const evidence = getVerifiedKeyOwnerEvidence(keyId);
|
|
163
|
+
if (evidence != null) {
|
|
164
|
+
const owner = await parseKeyOwnerEvidence(evidence, fetchOptions);
|
|
165
|
+
if (owner != null) return owner;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
153
168
|
const id = keyId instanceof CryptographicKey ? keyId.id : keyId;
|
|
154
169
|
if (id != null && isPortableUri(id)) return await getPortableActorKeyOwner(keyId, fetchOptions);
|
|
155
170
|
if (id != null && isCompatibleKeyId(id)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { Ct as isSamePublicKey$1, G as verifyKeyOwnership, R as exportJwk, St as
|
|
3
|
+
import { Ct as isPortableId, Dt as name, Et as isSamePublicKey$1, G as verifyKeyOwnership, J as parseKeyOwnerEvidence, Ot as version, R as exportJwk, St as isCompatibleKeyId, Tt as isPortableUri, _ as verifyPortableObjectProof, _t as getCanonicalPortableId, c as fetchPortableGatewayKey, l as resolvePortableActorKey, q as getVerifiedKeyOwnerEvidence, y as verifyPortableObjectProofWithRoot, z as fetchActorDocument } from "./http-BGpexPO7.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { CollectionPage, CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
6
6
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -41,6 +41,13 @@ async function doesActorOwnKey(activity, key, options) {
|
|
|
41
41
|
span.setAttribute("activitypub.key_ownership.method", "none");
|
|
42
42
|
return false;
|
|
43
43
|
}
|
|
44
|
+
const evidence = getVerifiedKeyOwnerEvidence(key);
|
|
45
|
+
if (evidence != null) {
|
|
46
|
+
const verified = getCanonicalPortableId(actorId) === evidence.ownerId;
|
|
47
|
+
span.setAttribute("activitypub.key_ownership.verified", verified);
|
|
48
|
+
span.setAttribute("activitypub.key_ownership.method", key.id != null && isPortableUri(key.id) ? "portable_actor_key" : "portable_gateway_key");
|
|
49
|
+
return verified;
|
|
50
|
+
}
|
|
44
51
|
if (key.id != null && isPortableUri(key.id)) {
|
|
45
52
|
const owner = await getPortableActorKeyOwner(key, options);
|
|
46
53
|
const ownerId = owner?.id == null ? null : getCanonicalPortableId(owner.id);
|
|
@@ -147,6 +154,13 @@ async function getKeyOwner(keyId, options) {
|
|
|
147
154
|
contextLoader: options.contextLoader ?? getDocumentLoader(),
|
|
148
155
|
tracerProvider
|
|
149
156
|
};
|
|
157
|
+
if (keyId instanceof CryptographicKey) {
|
|
158
|
+
const evidence = getVerifiedKeyOwnerEvidence(keyId);
|
|
159
|
+
if (evidence != null) {
|
|
160
|
+
const owner = await parseKeyOwnerEvidence(evidence, fetchOptions);
|
|
161
|
+
if (owner != null) return owner;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
150
164
|
const id = keyId instanceof CryptographicKey ? keyId.id : keyId;
|
|
151
165
|
if (id != null && isPortableUri(id)) return await getPortableActorKeyOwner(keyId, fetchOptions);
|
|
152
166
|
if (id != null && isCompatibleKeyId(id)) {
|
|
@@ -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-
|
|
5
|
-
import { c as verifyPortableObjectProof, u as verifyPortableObjectProofWithRoot } from "./proof-
|
|
4
|
+
import { n as version, t as name } from "./deno-DU8dvnWk.mjs";
|
|
5
|
+
import { c as verifyPortableObjectProof, u as verifyPortableObjectProofWithRoot } from "./proof-CQAYqWdj.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { CollectionPage, Object as Object$1, isActor } from "@fedify/vocab";
|
|
8
8
|
import { trace } from "@opentelemetry/api";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
|
-
const require_http = require("./http-
|
|
2
|
+
const require_http = require("./http-5CJBdU8n.cjs");
|
|
3
3
|
let _logtape_logtape = require("@logtape/logtape");
|
|
4
4
|
let _fedify_vocab = require("@fedify/vocab");
|
|
5
5
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
@@ -40,6 +40,13 @@ async function doesActorOwnKey(activity, key, options) {
|
|
|
40
40
|
span.setAttribute("activitypub.key_ownership.method", "none");
|
|
41
41
|
return false;
|
|
42
42
|
}
|
|
43
|
+
const evidence = require_http.getVerifiedKeyOwnerEvidence(key);
|
|
44
|
+
if (evidence != null) {
|
|
45
|
+
const verified = require_http.getCanonicalPortableId(actorId) === evidence.ownerId;
|
|
46
|
+
span.setAttribute("activitypub.key_ownership.verified", verified);
|
|
47
|
+
span.setAttribute("activitypub.key_ownership.method", key.id != null && require_http.isPortableUri(key.id) ? "portable_actor_key" : "portable_gateway_key");
|
|
48
|
+
return verified;
|
|
49
|
+
}
|
|
43
50
|
if (key.id != null && require_http.isPortableUri(key.id)) {
|
|
44
51
|
const owner = await getPortableActorKeyOwner(key, options);
|
|
45
52
|
const ownerId = owner?.id == null ? null : require_http.getCanonicalPortableId(owner.id);
|
|
@@ -146,6 +153,13 @@ async function getKeyOwner(keyId, options) {
|
|
|
146
153
|
contextLoader: options.contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)(),
|
|
147
154
|
tracerProvider
|
|
148
155
|
};
|
|
156
|
+
if (keyId instanceof _fedify_vocab.CryptographicKey) {
|
|
157
|
+
const evidence = require_http.getVerifiedKeyOwnerEvidence(keyId);
|
|
158
|
+
if (evidence != null) {
|
|
159
|
+
const owner = await require_http.parseKeyOwnerEvidence(evidence, fetchOptions);
|
|
160
|
+
if (owner != null) return owner;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
149
163
|
const id = keyId instanceof _fedify_vocab.CryptographicKey ? keyId.id : keyId;
|
|
150
164
|
if (id != null && require_http.isPortableUri(id)) return await getPortableActorKeyOwner(keyId, fetchOptions);
|
|
151
165
|
if (id != null && require_http.isCompatibleKeyId(id)) {
|
|
@@ -2,7 +2,7 @@ import "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { d as isSamePublicKey, i as getRawCanonicalPortableId, s as isPortableActorDocument, t as getCanonicalPortableId, u as isPortableUri } from "./portable-key-id-Bg259c4Z.mjs";
|
|
5
|
-
import { u as verifyPortableObjectProofWithRoot } from "./proof-
|
|
5
|
+
import { u as verifyPortableObjectProofWithRoot } from "./proof-CQAYqWdj.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { CryptographicKey, Multikey, Object as Object$1 } from "@fedify/vocab";
|
|
8
8
|
import { FetchError, formatIri, getDocumentLoader, isGatewayUrl, parseIri, toCompatibleEf61Id } from "@fedify/vocab-runtime";
|
|
@@ -175,6 +175,7 @@ async function verifyPortableKeyDocument(document, actor, keyId, isGatewayKey, o
|
|
|
175
175
|
type: "verified",
|
|
176
176
|
actor,
|
|
177
177
|
key,
|
|
178
|
+
document: root,
|
|
178
179
|
...expires == null ? {} : { expires }
|
|
179
180
|
};
|
|
180
181
|
}
|
|
@@ -221,6 +222,21 @@ async function fetchPortableGatewayKey(keyId, options = {}) {
|
|
|
221
222
|
});
|
|
222
223
|
}
|
|
223
224
|
/**
|
|
225
|
+
* The maximum number of `@gateway` location hints followed for one `ap:` or
|
|
226
|
+
* `ap+ef61:` key ID. Whoever made a signature chooses the hints of its key
|
|
227
|
+
* ID, so fewer of them are followed than when dereferencing objects, which
|
|
228
|
+
* bounds the gateways one signature can make Fedify ask. Further hints are
|
|
229
|
+
* ignored.
|
|
230
|
+
*/
|
|
231
|
+
const MAX_KEY_ID_GATEWAY_HINTS = 3;
|
|
232
|
+
/**
|
|
233
|
+
* The default of {@link PortableActorKeyOptions.lookupTimeout}, in
|
|
234
|
+
* milliseconds.
|
|
235
|
+
*/
|
|
236
|
+
const DEFAULT_KEY_ID_LOOKUP_TIMEOUT = 1e4;
|
|
237
|
+
/** The longest delay that `setTimeout()` supports, in milliseconds. */
|
|
238
|
+
const MAX_TIMEOUT = 2 ** 31 - 1;
|
|
239
|
+
/**
|
|
224
240
|
* Resolves a key of a portable actor at an `ap:` or `ap+ef61:` key ID, e.g.,
|
|
225
241
|
* `ap://did:key:z6Mk…/actor#main-key`. Such a key ID names no gateway, so
|
|
226
242
|
* the actor's document, i.e., the key ID without its fragment, is fetched
|
|
@@ -248,12 +264,25 @@ async function fetchPortableGatewayKey(keyId, options = {}) {
|
|
|
248
264
|
* unreachable gateway would have served, so the result is an `unavailable`
|
|
249
265
|
* that is not cacheable.
|
|
250
266
|
*
|
|
267
|
+
* Only the first {@link MAX_KEY_ID_GATEWAY_HINTS} location hints are
|
|
268
|
+
* followed, and all the gateways share one timeout, see
|
|
269
|
+
* {@link PortableActorKeyOptions.lookupTimeout}. A gateway that does not
|
|
270
|
+
* serve the document in time failed to serve it, like an unreachable one,
|
|
271
|
+
* with an error that has no HTTP status. A gateway whose document could not
|
|
272
|
+
* be processed in time, and the gateways left untried, make the result an
|
|
273
|
+
* `unavailable` that is not cacheable. A result that arrives after
|
|
274
|
+
* the timeout is ignored, even if it vouches for the key.
|
|
275
|
+
*
|
|
251
276
|
* @param keyId The key ID, which must be an `ap:` or `ap+ef61:` URI.
|
|
252
|
-
* @param options Loaders and
|
|
277
|
+
* @param options Loaders, telemetry providers, and the timeout.
|
|
253
278
|
* @returns The resolution, which is never `legacy`.
|
|
279
|
+
* @throws {RangeError} If the timeout is not a non-negative number of
|
|
280
|
+
* milliseconds that `setTimeout()` supports.
|
|
254
281
|
* @internal
|
|
255
282
|
*/
|
|
256
283
|
async function resolvePortableActorKey(keyId, options = {}) {
|
|
284
|
+
const lookupTimeout = options.lookupTimeout ?? DEFAULT_KEY_ID_LOOKUP_TIMEOUT;
|
|
285
|
+
if (!Number.isFinite(lookupTimeout) || lookupTimeout < 0 || lookupTimeout > MAX_TIMEOUT) throw new RangeError(`The lookup timeout must be between 0 and ${MAX_TIMEOUT} ms: ${lookupTimeout}`);
|
|
257
286
|
const documentLoader = options.documentLoader ?? getDocumentLoader();
|
|
258
287
|
const contextLoader = options.contextLoader ?? getDocumentLoader();
|
|
259
288
|
let formattedKeyId = keyId.href;
|
|
@@ -272,75 +301,67 @@ async function resolvePortableActorKey(keyId, options = {}) {
|
|
|
272
301
|
if (keyId.hash === "" || keyId.hash === "#") return reject("The key ID has no fragment; only keys embedded in actor documents are supported.");
|
|
273
302
|
const actorUrl = new URL(keyId.href);
|
|
274
303
|
actorUrl.hash = "";
|
|
304
|
+
const gateways = getPortableGatewayCandidates(actorUrl);
|
|
305
|
+
if (gateways.length > MAX_KEY_ID_GATEWAY_HINTS) logger.debug("Following only the first {max} location hints of key {keyId}.", {
|
|
306
|
+
keyId: formattedKeyId,
|
|
307
|
+
max: MAX_KEY_ID_GATEWAY_HINTS
|
|
308
|
+
});
|
|
275
309
|
const requestUrls = [];
|
|
276
|
-
for (const gateway of
|
|
310
|
+
for (const gateway of gateways.slice(0, MAX_KEY_ID_GATEWAY_HINTS)) try {
|
|
277
311
|
requestUrls.push(toCompatibleEf61Id(actorUrl, gateway).href);
|
|
278
312
|
} catch (error) {
|
|
279
313
|
if (!(error instanceof TypeError)) throw error;
|
|
280
314
|
return reject(`The key ID cannot be fetched from gateways: ${error}`);
|
|
281
315
|
}
|
|
282
316
|
if (requestUrls.length < 1) requestUrls.push(formatIri(actorUrl));
|
|
317
|
+
const controller = new AbortController();
|
|
318
|
+
const timeoutError = new DOMException(`Timed out looking up the actor of key ${formattedKeyId} after ${lookupTimeout} ms.`, "TimeoutError");
|
|
319
|
+
let timer;
|
|
320
|
+
if (lookupTimeout > 0) timer = setTimeout(() => controller.abort(timeoutError), lookupTimeout);
|
|
321
|
+
else controller.abort(timeoutError);
|
|
322
|
+
const { signal } = controller;
|
|
323
|
+
const attemptOptions = {
|
|
324
|
+
...options,
|
|
325
|
+
documentLoader: withDeadline(documentLoader, signal),
|
|
326
|
+
contextLoader: withDeadline(contextLoader, signal),
|
|
327
|
+
signal,
|
|
328
|
+
formattedKeyId
|
|
329
|
+
};
|
|
283
330
|
const attempts = [];
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
} catch (error) {
|
|
289
|
-
logger.debug("Failed to fetch the actor of key {keyId} from {url}: {error}", {
|
|
290
|
-
keyId: formattedKeyId,
|
|
291
|
-
url,
|
|
292
|
-
error
|
|
293
|
-
});
|
|
294
|
-
attempts.push({
|
|
295
|
-
type: "retrievalFailed",
|
|
296
|
-
error
|
|
297
|
-
});
|
|
298
|
-
continue;
|
|
299
|
-
}
|
|
300
|
-
let resolution;
|
|
301
|
-
try {
|
|
302
|
-
const object = await Object$1.fromJsonLd(remoteDocument.document, {
|
|
303
|
-
documentLoader,
|
|
304
|
-
contextLoader,
|
|
305
|
-
tracerProvider: options.tracerProvider
|
|
306
|
-
});
|
|
307
|
-
resolution = isPortableActorDocument(object) ? await verifyPortableKeyDocument(remoteDocument.document, object, keyId, false, {
|
|
308
|
-
...options,
|
|
309
|
-
documentLoader,
|
|
310
|
-
contextLoader
|
|
311
|
-
}) : {
|
|
312
|
-
type: "rejected",
|
|
313
|
-
reason: "The document is not a portable actor."
|
|
314
|
-
};
|
|
315
|
-
} catch (error) {
|
|
316
|
-
if (error instanceof TypeError) resolution = {
|
|
317
|
-
type: "rejected",
|
|
318
|
-
reason: `The document is malformed: ${error.message}`
|
|
319
|
-
};
|
|
320
|
-
else {
|
|
321
|
-
logger.debug("Failed to process the actor of key {keyId} served from {url}: {error}", {
|
|
331
|
+
try {
|
|
332
|
+
for (const url of requestUrls) {
|
|
333
|
+
if (signal.aborted) {
|
|
334
|
+
logger.debug("Ran out of time looking up the actor of key {keyId}; gateways from {url} on were not tried.", {
|
|
322
335
|
keyId: formattedKeyId,
|
|
323
|
-
url
|
|
324
|
-
error
|
|
336
|
+
url
|
|
325
337
|
});
|
|
326
338
|
attempts.push({
|
|
327
339
|
type: "indeterminate",
|
|
328
|
-
error
|
|
340
|
+
error: signal.reason
|
|
341
|
+
});
|
|
342
|
+
break;
|
|
343
|
+
}
|
|
344
|
+
const state = { processing: false };
|
|
345
|
+
let attempt;
|
|
346
|
+
try {
|
|
347
|
+
attempt = await raceAbort(attemptGateway(url, keyId, attemptOptions, state), signal);
|
|
348
|
+
} catch (error) {
|
|
349
|
+
if (!signal.aborted) throw error;
|
|
350
|
+
logger.debug("Ran out of time looking up the actor of key {keyId} at {url}.", {
|
|
351
|
+
keyId: formattedKeyId,
|
|
352
|
+
url
|
|
353
|
+
});
|
|
354
|
+
attempts.push({
|
|
355
|
+
type: state.processing ? "indeterminate" : "retrievalFailed",
|
|
356
|
+
error: signal.reason
|
|
329
357
|
});
|
|
330
358
|
continue;
|
|
331
359
|
}
|
|
360
|
+
if (attempt.type === "verified") return attempt;
|
|
361
|
+
attempts.push(attempt);
|
|
332
362
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
logger.debug("The actor document served from {url} does not vouch for key {keyId}: {reason}", {
|
|
336
|
-
keyId: formattedKeyId,
|
|
337
|
-
url,
|
|
338
|
-
reason
|
|
339
|
-
});
|
|
340
|
-
attempts.push({
|
|
341
|
-
type: "rejected",
|
|
342
|
-
reason
|
|
343
|
-
});
|
|
363
|
+
} finally {
|
|
364
|
+
clearTimeout(timer);
|
|
344
365
|
}
|
|
345
366
|
const rejections = attempts.flatMap((a) => a.type === "rejected" ? [a.reason] : []);
|
|
346
367
|
if (rejections.length === attempts.length) return reject(rejections.join(" "));
|
|
@@ -361,6 +382,139 @@ async function resolvePortableActorKey(keyId, options = {}) {
|
|
|
361
382
|
};
|
|
362
383
|
}
|
|
363
384
|
/**
|
|
385
|
+
* Fetches the actor's document of a key at an `ap:` or `ap+ef61:` key ID from
|
|
386
|
+
* one gateway, and tells whether it vouches for the key. It never rejects;
|
|
387
|
+
* the caller races it against the lookup's timeout, and ignores what it
|
|
388
|
+
* resolves to after the timeout.
|
|
389
|
+
*/
|
|
390
|
+
async function attemptGateway(url, keyId, options, state) {
|
|
391
|
+
const { documentLoader, contextLoader, signal, formattedKeyId } = options;
|
|
392
|
+
let remoteDocument;
|
|
393
|
+
try {
|
|
394
|
+
remoteDocument = await documentLoader(url);
|
|
395
|
+
} catch (error) {
|
|
396
|
+
logger.debug("Failed to fetch the actor of key {keyId} from {url}: {error}", {
|
|
397
|
+
keyId: formattedKeyId,
|
|
398
|
+
url,
|
|
399
|
+
error
|
|
400
|
+
});
|
|
401
|
+
return {
|
|
402
|
+
type: "retrievalFailed",
|
|
403
|
+
error
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
if (signal.aborted) return {
|
|
407
|
+
type: "indeterminate",
|
|
408
|
+
error: signal.reason
|
|
409
|
+
};
|
|
410
|
+
state.processing = true;
|
|
411
|
+
let resolution;
|
|
412
|
+
try {
|
|
413
|
+
const object = await Object$1.fromJsonLd(remoteDocument.document, {
|
|
414
|
+
documentLoader,
|
|
415
|
+
contextLoader,
|
|
416
|
+
tracerProvider: options.tracerProvider
|
|
417
|
+
});
|
|
418
|
+
signal.throwIfAborted();
|
|
419
|
+
resolution = isPortableActorDocument(object) ? await verifyPortableKeyDocument(remoteDocument.document, object, keyId, false, options) : {
|
|
420
|
+
type: "rejected",
|
|
421
|
+
reason: "The document is not a portable actor."
|
|
422
|
+
};
|
|
423
|
+
} catch (error) {
|
|
424
|
+
if (error instanceof TypeError && !signal.aborted) resolution = {
|
|
425
|
+
type: "rejected",
|
|
426
|
+
reason: `The document is malformed: ${error.message}`
|
|
427
|
+
};
|
|
428
|
+
else {
|
|
429
|
+
logger.debug("Failed to process the actor of key {keyId} served from {url}: {error}", {
|
|
430
|
+
keyId: formattedKeyId,
|
|
431
|
+
url,
|
|
432
|
+
error
|
|
433
|
+
});
|
|
434
|
+
return {
|
|
435
|
+
type: "indeterminate",
|
|
436
|
+
error
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
if (resolution.type === "verified") return resolution;
|
|
441
|
+
const reason = resolution.type === "rejected" ? resolution.reason : "The document is not a portable actor.";
|
|
442
|
+
logger.debug("The actor document served from {url} does not vouch for key {keyId}: {reason}", {
|
|
443
|
+
keyId: formattedKeyId,
|
|
444
|
+
url,
|
|
445
|
+
reason
|
|
446
|
+
});
|
|
447
|
+
return {
|
|
448
|
+
type: "rejected",
|
|
449
|
+
reason
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Wraps a document loader so that it gives up when the given signal aborts,
|
|
454
|
+
* as well as when the signal in its own options does. The wrapped loader is
|
|
455
|
+
* passed a signal that aborts in either case, but in case it ignores that
|
|
456
|
+
* signal, what it resolves to after the abort is ignored, and the wrapper
|
|
457
|
+
* rejects with the reason of the abort at once. After the abort, the wrapped
|
|
458
|
+
* loader is not called at all.
|
|
459
|
+
*/
|
|
460
|
+
function withDeadline(loader, signal) {
|
|
461
|
+
return (url, options) => {
|
|
462
|
+
const combined = combineSignals(signal, options?.signal);
|
|
463
|
+
return raceAbort(combined.signal.aborted ? Promise.reject(combined.signal.reason) : new Promise((resolve) => resolve(loader(url, {
|
|
464
|
+
...options,
|
|
465
|
+
signal: combined.signal
|
|
466
|
+
}))), combined.signal).finally(combined.dispose);
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* Makes a signal that aborts when either of the given signals does, with
|
|
471
|
+
* the reason of the one that aborted first. `AbortSignal.any()` is not
|
|
472
|
+
* available on every supported runtime, e.g., Bun before 1.1.4.
|
|
473
|
+
* @returns The signal, and a function that stops listening to the given
|
|
474
|
+
* signals.
|
|
475
|
+
*/
|
|
476
|
+
function combineSignals(signal, other) {
|
|
477
|
+
if (other == null || other === signal) return {
|
|
478
|
+
signal,
|
|
479
|
+
dispose() {}
|
|
480
|
+
};
|
|
481
|
+
const controller = new AbortController();
|
|
482
|
+
const sources = [signal, other];
|
|
483
|
+
const dispose = () => {
|
|
484
|
+
for (const source of sources) source.removeEventListener("abort", onAbort);
|
|
485
|
+
};
|
|
486
|
+
function onAbort() {
|
|
487
|
+
dispose();
|
|
488
|
+
controller.abort(this.reason);
|
|
489
|
+
}
|
|
490
|
+
const aborted = sources.find((source) => source.aborted);
|
|
491
|
+
if (aborted == null) for (const source of sources) source.addEventListener("abort", onAbort);
|
|
492
|
+
else controller.abort(aborted.reason);
|
|
493
|
+
return {
|
|
494
|
+
signal: controller.signal,
|
|
495
|
+
dispose
|
|
496
|
+
};
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Waits for the given promise unless the given signal aborts first, in which
|
|
500
|
+
* case it rejects with the reason of the abort. If the signal has aborted by
|
|
501
|
+
* the time the promise settles, the abort wins as well, so that nothing that
|
|
502
|
+
* settles after it counts.
|
|
503
|
+
*/
|
|
504
|
+
function raceAbort(promise, signal) {
|
|
505
|
+
return new Promise((resolve, reject) => {
|
|
506
|
+
const onAbort = () => reject(signal.reason);
|
|
507
|
+
const settle = (settled) => {
|
|
508
|
+
signal.removeEventListener("abort", onAbort);
|
|
509
|
+
if (signal.aborted) onAbort();
|
|
510
|
+
else settled();
|
|
511
|
+
};
|
|
512
|
+
promise.then((value) => settle(() => resolve(value)), (error) => settle(() => reject(error)));
|
|
513
|
+
if (signal.aborted) onAbort();
|
|
514
|
+
else signal.addEventListener("abort", onAbort, { once: true });
|
|
515
|
+
});
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
364
518
|
* Finds the nodes that stand for the key with the given canonical portable
|
|
365
519
|
* ID. A node whose ID is an `ap:` or `ap+ef61:` URI stands for the key
|
|
366
520
|
* itself, e.g., Mitra lists the keys of portable actors that way while
|
|
@@ -1,13 +1,13 @@
|
|
|
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-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
4
|
+
import { n as version, t as name } from "./deno-DU8dvnWk.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-jUDFfVgi.mjs";
|
|
6
6
|
import { c as isPortableId, r as getPortableDid } from "./portable-key-id-Bg259c4Z.mjs";
|
|
7
|
-
import { c as validateCryptoKey, i as fetchKey, t as bypassKeyCacheReads } from "./key-
|
|
7
|
+
import { c as validateCryptoKey, i as fetchKey, t as bypassKeyCacheReads } from "./key-gIhVZO3p.mjs";
|
|
8
8
|
import { n as preloadedOnlyDocumentLoader } from "./public-audience--klBIOk1.mjs";
|
|
9
9
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-4IJqPYos.mjs";
|
|
10
|
-
import { c as getNormalizationContextLoader } from "./ld-
|
|
10
|
+
import { c as getNormalizationContextLoader } from "./ld-BsTkRrwF.mjs";
|
|
11
11
|
import { getLogger } from "@logtape/logtape";
|
|
12
12
|
import { Activity, DataIntegrityProof, Multikey, getTypeId } from "@fedify/vocab";
|
|
13
13
|
import { 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-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics } from "./metrics-
|
|
6
|
-
import { n as doubleKnock } from "./http-
|
|
4
|
+
import { n as version, t as name } from "./deno-DU8dvnWk.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics } from "./metrics-jUDFfVgi.mjs";
|
|
6
|
+
import { n as doubleKnock } from "./http-Bd6rZlJX.mjs";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
import { FetchError, UrlError, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
|
-
import { i as inspectCompoundPortableObjectApplicability, n as discoverCompoundProofDocuments } from "../compound-proof-
|
|
6
|
+
import { i as inspectCompoundPortableObjectApplicability, n as discoverCompoundProofDocuments } from "../compound-proof-D28gMFqP.mjs";
|
|
7
7
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/sig/compound-proof-discovery.test.ts
|
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
|
-
import { i as inspectCompoundPortableObjectApplicability, r as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "../compound-proof-
|
|
6
|
+
import { i as inspectCompoundPortableObjectApplicability, r as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "../compound-proof-D28gMFqP.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
//#region src/sig/compound-proof-producer.test.ts
|
|
9
9
|
const portableId = "ap+ef61://did:key:z6MkAlice/objects/1";
|
|
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
|
-
import { l as verifyPortableObjectProofPolicy, o as verifyMapLocalProof } from "../proof-
|
|
7
|
+
import { l as verifyPortableObjectProofPolicy, o as verifyMapLocalProof } from "../proof-CQAYqWdj.mjs";
|
|
8
8
|
import { n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
9
|
-
import { a as verifyCompoundPortableObjectProofs, i as inspectCompoundPortableObjectApplicability, o as verifyCompoundProofDocuments, t as containsCompoundPortableObject } from "../compound-proof-
|
|
9
|
+
import { a as verifyCompoundPortableObjectProofs, i as inspectCompoundPortableObjectApplicability, o as verifyCompoundProofDocuments, t as containsCompoundPortableObject } from "../compound-proof-D28gMFqP.mjs";
|
|
10
10
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
11
11
|
import { t as map_local_context_conflict_default } from "../map-local-context-conflict-DOYEEJ3u.mjs";
|
|
12
12
|
import { CryptographicKey, Multikey, Person } from "@fedify/vocab";
|
|
@@ -6,9 +6,9 @@ import "../std__assert-DvMDRPes.mjs";
|
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
7
|
import { n as preloadedOnlyDocumentLoader } from "../public-audience--klBIOk1.mjs";
|
|
8
8
|
import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-4IJqPYos.mjs";
|
|
9
|
-
import { a as signObject, d as verifyProof } from "../proof-
|
|
9
|
+
import { a as signObject, d as verifyProof } from "../proof-CQAYqWdj.mjs";
|
|
10
10
|
import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
|
|
11
|
-
import { o as verifyCompoundProofDocuments } from "../compound-proof-
|
|
11
|
+
import { o as verifyCompoundProofDocuments } from "../compound-proof-D28gMFqP.mjs";
|
|
12
12
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
13
13
|
import { t as map_local_context_conflict_default } from "../map-local-context-conflict-DOYEEJ3u.mjs";
|
|
14
14
|
import { Create, DataIntegrityProof, Note, Question } from "@fedify/vocab";
|