@fedify/fedify 2.4.0-dev.2157 → 2.4.0-dev.2164
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-CLaS4-yA.mjs → builder-BqRmnx7p.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-D7K94KPz.mjs → compound-proof-CxDBdtNz.mjs} +2 -2
- package/dist/{context-exYu7gDU.d.ts → context-BykNUf04.d.ts} +120 -3
- package/dist/{context-BMggDR-l.d.cts → context-L0Fnib9j.d.cts} +120 -3
- package/dist/{deno-D1gcWWqB.mjs → deno-CizGaYeG.mjs} +1 -1
- package/dist/{docloader-BMqr3hji.mjs → docloader-BBFAItNB.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 +3 -3
- package/dist/federation/mod.d.ts +3 -3
- 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.d.mts +2 -0
- package/dist/federation/portable-parse-uri.test.mjs +348 -0
- 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-2e8XrN7q.cjs → federation-DFCnp94y.cjs} +103 -29
- package/dist/{http-Dgtt45-K.js → http-Baovr6xq.js} +161 -7
- package/dist/{http-CjezPjFX.d.cts → http-Cok5-vIC.d.ts} +6 -1
- package/dist/{http-C-x_OLSp.d.ts → http-DC1cqAQ2.d.cts} +6 -1
- package/dist/{http-CGcLv8rh.mjs → http-DRH0n8TD.mjs} +7 -5
- package/dist/{http-BObQoB0j.cjs → http-R4g1McwE.cjs} +185 -11
- package/dist/{key-CPM4r6tP.mjs → key-D5awqp7u.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-bdPqTR1k.mjs → kv-cache-C7RWL7hz.mjs} +1 -1
- package/dist/{kv-cache-BweyIZTb.js → kv-cache-CZiBDLPi.js} +1 -1
- package/dist/{kv-cache-D2fnB8qu.cjs → kv-cache-Ct-KWRta.cjs} +1 -1
- package/dist/{ld-lU_ZqzsQ.mjs → ld-CyliEU48.mjs} +3 -3
- package/dist/{metrics-B41pRPfd.mjs → metrics-CFBEehTc.mjs} +1 -1
- package/dist/{middleware-xdukzV3x.mjs → middleware-B99JjvFn.mjs} +70 -20
- package/dist/{middleware-TrCVULgs.mjs → middleware-BmqEWsWP.mjs} +1 -1
- package/dist/{middleware-BYWyYjmX.js → middleware-CdpTFsa2.js} +103 -29
- 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-Decmur1U.d.cts → mod-BLOXGs6m.d.cts} +1 -1
- package/dist/{mod-S--JxYjo.d.cts → mod-CPPqkyV_.d.cts} +1 -1
- package/dist/{mod-CnGtADvO.d.ts → mod-DK0y9fd-.d.ts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +7 -7
- package/dist/mod.d.ts +7 -7
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-D63yPo_i.mjs → owner-DKdtsrEq.mjs} +18 -3
- package/dist/{portable-collection-_lZg-osX.mjs → portable-collection-Cb5cdPIU.mjs} +2 -2
- package/dist/{portable-collection-B8ojoQ50.cjs → portable-collection-UajqDrSL.cjs} +15 -1
- package/dist/{portable-collection-C3xEzYri.js → portable-collection-uv4CuQXm.js} +15 -1
- package/dist/{portable-key-D8uWZF7b.mjs → portable-key-Bv1RdQ0n.mjs} +2 -1
- package/dist/{proof-C2YwD8a_.mjs → proof-CRTPWbVh.mjs} +4 -4
- package/dist/{send-D9SGhxTB.mjs → send-2dULlZc8.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 +6 -6
- package/dist/sig/proof.test.mjs +3 -3
- package/dist/{temporal-q6FSekcN.mjs → temporal-Dhsk6aUT.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/testing/mod.d.mts +118 -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 +6 -6
|
@@ -6,7 +6,7 @@ import { t as ManualClockKvStore } from "../kv-DBRWVx3Q.mjs";
|
|
|
6
6
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
7
7
|
import { t as assertInstanceOf } from "../assert_instance_of-mrXWWNY-.mjs";
|
|
8
8
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
9
|
-
import { t as KvKeyCache } from "../keycache-
|
|
9
|
+
import { t as KvKeyCache } from "../keycache-PiOM9pM0.mjs";
|
|
10
10
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
11
11
|
import { test } from "@fedify/fixture";
|
|
12
12
|
//#region src/federation/keycache.test.ts
|
|
@@ -224,6 +224,72 @@ test("KvKeyCache.compatibleKeyScope() ignores malformed entries", async () => {
|
|
|
224
224
|
await kv.set(entryKey, { key: "garbage" });
|
|
225
225
|
assertEquals(await cache.compatibleKeyScope("multikey").get(keyId), void 0);
|
|
226
226
|
assertEquals(await kv.get(entryKey), void 0);
|
|
227
|
+
const httpEntryKey = [
|
|
228
|
+
"pk",
|
|
229
|
+
"__compatible",
|
|
230
|
+
"httpSignature",
|
|
231
|
+
keyId.href
|
|
232
|
+
];
|
|
233
|
+
await kv.set(httpEntryKey, {
|
|
234
|
+
key: await new CryptographicKey({ id: keyId }).toJsonLd(),
|
|
235
|
+
expires: 1e300
|
|
236
|
+
});
|
|
237
|
+
assertEquals(await cache.compatibleKeyScope("httpSignature").get(keyId), void 0);
|
|
238
|
+
assertEquals(await kv.get(httpEntryKey), void 0);
|
|
239
|
+
});
|
|
240
|
+
test("KvKeyCache.compatibleKeyScope() keeps the owners of keys", async () => {
|
|
241
|
+
const kv = new MemoryKvStore();
|
|
242
|
+
const now = Temporal.Instant.fromEpochMilliseconds(0);
|
|
243
|
+
const scope = new KvKeyCache(kv, ["pk"], {
|
|
244
|
+
now: () => now,
|
|
245
|
+
keyTtl: Temporal.Duration.from({ minutes: 5 })
|
|
246
|
+
}).compatibleKeyScope("httpSignature");
|
|
247
|
+
const keyId = new URL("https://gw.example/.well-known/apgateway/did:key:z/a");
|
|
248
|
+
const owner = {
|
|
249
|
+
"@id": "ap://did:key:z/a",
|
|
250
|
+
"@type": ["urn:example:Actor"]
|
|
251
|
+
};
|
|
252
|
+
assertEquals(await scope.set(keyId, new CryptographicKey({ id: keyId }), {
|
|
253
|
+
expires: now.add({ hours: 1 }),
|
|
254
|
+
owner
|
|
255
|
+
}), now.add({ minutes: 5 }));
|
|
256
|
+
const entry = await scope.getEntry(keyId);
|
|
257
|
+
assertInstanceOf(entry?.key, CryptographicKey);
|
|
258
|
+
assertEquals(entry?.owner, owner);
|
|
259
|
+
assertEquals(entry?.expires, now.add({ minutes: 5 }));
|
|
260
|
+
const entryKey = [
|
|
261
|
+
"pk",
|
|
262
|
+
"__compatible",
|
|
263
|
+
"httpSignature",
|
|
264
|
+
keyId.href
|
|
265
|
+
];
|
|
266
|
+
await kv.set(entryKey, JSON.parse(JSON.stringify(await kv.get(entryKey))));
|
|
267
|
+
assertEquals((await scope.getEntry(keyId))?.owner, owner);
|
|
268
|
+
await kv.set(entryKey, {
|
|
269
|
+
...await kv.get(entryKey) ?? {},
|
|
270
|
+
owner: "bogus"
|
|
271
|
+
});
|
|
272
|
+
const malformed = await scope.getEntry(keyId);
|
|
273
|
+
assertInstanceOf(malformed?.key, CryptographicKey);
|
|
274
|
+
assertEquals(malformed?.owner, void 0);
|
|
275
|
+
await scope.set(keyId, new CryptographicKey({ id: keyId }), { owner: {
|
|
276
|
+
...owner,
|
|
277
|
+
"urn:example:padding": "x".repeat(64 * 1024)
|
|
278
|
+
} });
|
|
279
|
+
const oversized = await scope.getEntry(keyId);
|
|
280
|
+
assertInstanceOf(oversized?.key, CryptographicKey);
|
|
281
|
+
assertEquals(oversized?.owner, void 0);
|
|
282
|
+
assertEquals(await scope.set(keyId, null, { owner }), void 0);
|
|
283
|
+
assertEquals(await kv.get(entryKey), {
|
|
284
|
+
key: null,
|
|
285
|
+
expires: 6e5
|
|
286
|
+
});
|
|
287
|
+
assertEquals(await scope.getEntry(keyId), null);
|
|
288
|
+
assertEquals(await scope.set(keyId, new CryptographicKey({ id: keyId }), {
|
|
289
|
+
expires: now,
|
|
290
|
+
owner
|
|
291
|
+
}), void 0);
|
|
292
|
+
assertEquals(await scope.getEntry(keyId), void 0);
|
|
227
293
|
});
|
|
228
294
|
//#endregion
|
|
229
295
|
export {};
|
|
@@ -4,7 +4,7 @@ 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 assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
7
|
-
import { _ as recordKeyLookup, a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, m as recordDocumentFetch, p as recordDocumentCache, r as getFederationMetrics, t as classifyFetchError, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "../metrics-
|
|
7
|
+
import { _ as recordKeyLookup, a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, m as recordDocumentFetch, p as recordDocumentCache, r as getFederationMetrics, t as classifyFetchError, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "../metrics-CFBEehTc.mjs";
|
|
8
8
|
import { createTestMeterProvider, test } from "@fedify/fixture";
|
|
9
9
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
10
10
|
import { DataPointType, MeterProvider, MetricReader } from "@opentelemetry/sdk-metrics";
|
|
@@ -16,14 +16,14 @@ import "../std__assert-DvMDRPes.mjs";
|
|
|
16
16
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
17
17
|
import { t as assertStrictEquals } from "../assert_strict_equals-CYvBmkpC.mjs";
|
|
18
18
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
19
|
-
import { g as recordInboxActivity } from "../metrics-
|
|
20
|
-
import { a as compactJsonLd, h as verifyJsonLd, p as signJsonLd, s as detachSignature } from "../ld-
|
|
21
|
-
import { a as signObject, s as verifyObject } from "../proof-
|
|
22
|
-
import { d as verifyRequest, l as signRequest } from "../http-
|
|
19
|
+
import { g as recordInboxActivity } from "../metrics-CFBEehTc.mjs";
|
|
20
|
+
import { a as compactJsonLd, h as verifyJsonLd, p as signJsonLd, s as detachSignature } from "../ld-CyliEU48.mjs";
|
|
21
|
+
import { a as signObject, s as verifyObject } from "../proof-CRTPWbVh.mjs";
|
|
22
|
+
import { d as verifyRequest, l as signRequest } from "../http-DRH0n8TD.mjs";
|
|
23
23
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
24
|
-
import { t as getAuthenticatedDocumentLoader } from "../docloader-
|
|
25
|
-
import { S as handleBenchmarkTrigger, i as KvSpecDeterminer, n as FederationImpl, o as createFederation, r as InboxContextImpl, t as ContextImpl } from "../middleware-
|
|
26
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
24
|
+
import { t as getAuthenticatedDocumentLoader } from "../docloader-BBFAItNB.mjs";
|
|
25
|
+
import { S as handleBenchmarkTrigger, i as KvSpecDeterminer, n as FederationImpl, o as createFederation, r as InboxContextImpl, t as ContextImpl } from "../middleware-B99JjvFn.mjs";
|
|
26
|
+
import { t as doesActorOwnKey } from "../owner-DKdtsrEq.mjs";
|
|
27
27
|
import { t as CircuitBreaker } from "../circuit-breaker-C5NqoLBJ.mjs";
|
|
28
28
|
import { t as TaskCodec } from "../codec-C6rTrpIp.mjs";
|
|
29
29
|
import { t as markCircuitBreakerLegacySweepDone } from "../circuit-breaker-test-utils-DW6YC_Pe.mjs";
|
package/dist/federation/mod.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_federation = require("../federation-
|
|
3
|
+
const require_federation = require("../federation-DFCnp94y.cjs");
|
|
4
4
|
exports.CircuitBreaker = require_federation.CircuitBreaker;
|
|
5
5
|
exports.InProcessMessageQueue = require_federation.InProcessMessageQueue;
|
|
6
6
|
exports.MemoryKvStore = require_federation.MemoryKvStore;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as respondWithObjectIfAcceptable, 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";
|
|
3
3
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-BhNbN8Ed.cjs";
|
|
4
|
-
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-
|
|
5
|
-
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, GetObjectOptions, GetSignedKeyOptions, HashlinkMediaDispatcher, HashlinkMediaRequest, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MediaUploaderCallback, MediaUploaderSetters, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, PortableActorIdMapper, PortableCollectionOwnerMapper, PortableInboxForwardingOptions, PortableRequest, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, TaskDefinition, TaskDefinitionOptions, TaskEnqueueOptions, TaskHandler, TaskRegistry, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, normalizeCircuitBreakerOptions, parseCircuitBreakerKvState, respondWithObject, respondWithObjectIfAcceptable };
|
|
4
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-BLOXGs6m.cjs";
|
|
5
|
+
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, GetObjectOptions, GetSignedKeyOptions, HashlinkMediaDispatcher, HashlinkMediaRequest, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MediaUploaderCallback, MediaUploaderSetters, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriOptions, ParseUriResult, PortableActorIdMapper, PortableCollectionOwnerMapper, PortableInboxForwardingOptions, PortableRequest, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, TaskDefinition, TaskDefinitionOptions, TaskEnqueueOptions, TaskHandler, TaskRegistry, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, normalizeCircuitBreakerOptions, parseCircuitBreakerKvState, respondWithObject, respondWithObjectIfAcceptable };
|
package/dist/federation/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as respondWithObjectIfAcceptable, 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";
|
|
3
3
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "../kv-BhNbN8Ed.js";
|
|
4
|
-
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-
|
|
5
|
-
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, GetObjectOptions, GetSignedKeyOptions, HashlinkMediaDispatcher, HashlinkMediaRequest, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MediaUploaderCallback, MediaUploaderSetters, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriResult, PortableActorIdMapper, PortableCollectionOwnerMapper, PortableInboxForwardingOptions, PortableRequest, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, TaskDefinition, TaskDefinitionOptions, TaskEnqueueOptions, TaskHandler, TaskRegistry, UnverifiedActivityHandler, UnverifiedActivityReason, WebFingerHandlerParameters, WebFingerLinksDispatcher, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, handleWebFinger, normalizeCircuitBreakerOptions, parseCircuitBreakerKvState, respondWithObject, respondWithObjectIfAcceptable };
|
|
4
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-DK0y9fd-.js";
|
|
5
|
+
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, GetObjectOptions, GetSignedKeyOptions, HashlinkMediaDispatcher, HashlinkMediaRequest, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboxChallengePolicy, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MediaUploaderCallback, MediaUploaderSetters, MemoryKvStore, Message, MessageQueue, MessageQueueDepth, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfoDispatcher, NormalizedCircuitBreakerOptions, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboxContext, OutboxErrorHandler, OutboxListener, OutboxListenerErrorHandler, OutboxListenerSetters, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseUriOptions, ParseUriResult, PortableActorIdMapper, PortableCollectionOwnerMapper, PortableInboxForwardingOptions, PortableRequest, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, SharedInboxKeyDispatcher, TaskDefinition, TaskDefinitionOptions, TaskEnqueueOptions, TaskHandler, TaskRegistry, 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 "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
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-
|
|
3
|
+
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-CdpTFsa2.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";
|
|
@@ -7,12 +7,12 @@ import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
|
7
7
|
import "../std__assert-DvMDRPes.mjs";
|
|
8
8
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
9
9
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
10
|
-
import { n as exportJwk } from "../key-
|
|
11
|
-
import { s as detachSignature } from "../ld-
|
|
12
|
-
import { a as signObject } from "../proof-
|
|
10
|
+
import { n as exportJwk } from "../key-D5awqp7u.mjs";
|
|
11
|
+
import { s as detachSignature } from "../ld-CyliEU48.mjs";
|
|
12
|
+
import { a as signObject } from "../proof-CRTPWbVh.mjs";
|
|
13
13
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
14
|
-
import { c as assertPortableActorActivity, n as FederationImpl, o as createFederation } from "../middleware-
|
|
15
|
-
import { a as verifyCompoundPortableObjectProofs } from "../compound-proof-
|
|
14
|
+
import { c as assertPortableActorActivity, n as FederationImpl, o as createFederation } from "../middleware-B99JjvFn.mjs";
|
|
15
|
+
import { a as verifyCompoundPortableObjectProofs } from "../compound-proof-CxDBdtNz.mjs";
|
|
16
16
|
import { configure, reset } from "@logtape/logtape";
|
|
17
17
|
import { Create, Note, Person } from "@fedify/vocab";
|
|
18
18
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -8,10 +8,10 @@ import { t as assertInstanceOf } from "../assert_instance_of-mrXWWNY-.mjs";
|
|
|
8
8
|
import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
9
9
|
import "../std__assert-DvMDRPes.mjs";
|
|
10
10
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
11
|
-
import { a as signObject, c as verifyPortableObjectProof } from "../proof-
|
|
12
|
-
import { d as verifyRequest, l as signRequest } from "../http-
|
|
11
|
+
import { a as signObject, c as verifyPortableObjectProof } from "../proof-CRTPWbVh.mjs";
|
|
12
|
+
import { d as verifyRequest, l as signRequest } from "../http-DRH0n8TD.mjs";
|
|
13
13
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
14
|
-
import { b as PORTABLE_OBJECT_CONTENT_TYPE, o as createFederation } from "../middleware-
|
|
14
|
+
import { b as PORTABLE_OBJECT_CONTENT_TYPE, o as createFederation } from "../middleware-B99JjvFn.mjs";
|
|
15
15
|
import { n as RouterError } from "../router-u5O5KCQr.mjs";
|
|
16
16
|
import { configure, reset } from "@logtape/logtape";
|
|
17
17
|
import { Note, Person, Tombstone, lookupObject } from "@fedify/vocab";
|
|
@@ -7,10 +7,10 @@ import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
|
7
7
|
import { t as assertInstanceOf } from "../assert_instance_of-mrXWWNY-.mjs";
|
|
8
8
|
import "../std__assert-DvMDRPes.mjs";
|
|
9
9
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
10
|
-
import { n as exportJwk } from "../key-
|
|
11
|
-
import { c as verifyPortableObjectProof, s as verifyObject } from "../proof-
|
|
10
|
+
import { n as exportJwk } from "../key-D5awqp7u.mjs";
|
|
11
|
+
import { c as verifyPortableObjectProof, s as verifyObject } from "../proof-CRTPWbVh.mjs";
|
|
12
12
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
13
|
-
import { n as FederationImpl } from "../middleware-
|
|
13
|
+
import { n as FederationImpl } from "../middleware-B99JjvFn.mjs";
|
|
14
14
|
import { Create, DataIntegrityProof, Note, OrderedCollection, Person, traverseCollection } from "@fedify/vocab";
|
|
15
15
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
16
16
|
import { FetchError, encodeMultibase, exportDidKey } from "@fedify/vocab-runtime";
|
|
@@ -7,11 +7,11 @@ import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
|
|
|
7
7
|
import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
8
8
|
import "../std__assert-DvMDRPes.mjs";
|
|
9
9
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
10
|
-
import { a as signObject } from "../proof-
|
|
10
|
+
import { a as signObject } from "../proof-CRTPWbVh.mjs";
|
|
11
11
|
import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
|
|
12
|
-
import { b as PORTABLE_OBJECT_CONTENT_TYPE, o as createFederation } from "../middleware-
|
|
13
|
-
import { t as verifyPortableObject } from "../portable-collection-
|
|
14
|
-
import { s as verifyServedPortableObjects } from "../compound-proof-
|
|
12
|
+
import { b as PORTABLE_OBJECT_CONTENT_TYPE, o as createFederation } from "../middleware-B99JjvFn.mjs";
|
|
13
|
+
import { t as verifyPortableObject } from "../portable-collection-Cb5cdPIU.mjs";
|
|
14
|
+
import { s as verifyServedPortableObjects } from "../compound-proof-CxDBdtNz.mjs";
|
|
15
15
|
import { n as RouterError } from "../router-u5O5KCQr.mjs";
|
|
16
16
|
import { configure, reset } from "@logtape/logtape";
|
|
17
17
|
import { Create, Note, Object as Object$1, OrderedCollection, Person, Tombstone, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "temporal-polyfill";
|
|
1
|
+
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as esm_default } from "../esm-BHXXx4Wx.mjs";
|
|
@@ -7,12 +7,14 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
|
7
7
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
8
8
|
import "../std__assert-DvMDRPes.mjs";
|
|
9
9
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
10
|
+
import { r as getVerifiedKeyOwnerEvidence } from "../key-owner-evidence-Bo3yaeL5.mjs";
|
|
11
|
+
import { p as signJsonLd } from "../ld-CyliEU48.mjs";
|
|
12
|
+
import { d as verifyRequest, f as verifyRequestDetailed, l as signRequest } from "../http-DRH0n8TD.mjs";
|
|
13
|
+
import { a as rsaPrivateKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
14
|
+
import { f as handleInbox, n as FederationImpl, o as createFederation } from "../middleware-B99JjvFn.mjs";
|
|
15
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-DKdtsrEq.mjs";
|
|
14
16
|
import { t as ActivityListenerSet } from "../activity-listener-C-BSbKI7.mjs";
|
|
15
|
-
import { t as KvKeyCache } from "../keycache-
|
|
17
|
+
import { t as KvKeyCache } from "../keycache-PiOM9pM0.mjs";
|
|
16
18
|
import { Create, CryptographicKey, Person } from "@fedify/vocab";
|
|
17
19
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
18
20
|
import { FetchError, encodeMultibase, exportDidKey, parseIri } from "@fedify/vocab-runtime";
|
|
@@ -508,5 +510,177 @@ test("handleInbox() checks the DIDs of compatible activity IDs", async () => {
|
|
|
508
510
|
dispatched: 0
|
|
509
511
|
});
|
|
510
512
|
});
|
|
513
|
+
function countingLoader(responses) {
|
|
514
|
+
const inner = createLoader(responses);
|
|
515
|
+
let count = 0;
|
|
516
|
+
return {
|
|
517
|
+
documentLoader(url, options) {
|
|
518
|
+
if (url.replace(/#.*$/, "") === compatibleActorId(gateway)) count++;
|
|
519
|
+
return inner(url, options);
|
|
520
|
+
},
|
|
521
|
+
fetched: () => count
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
async function signedRequest(keyId = gatewayKeyId, privateKey = rsaPrivateKey2, spec) {
|
|
525
|
+
return await signRequest(new Request("https://local.example/notes/1", { headers: { Accept: "application/activity+json" } }), privateKey, keyId, spec == null ? {} : { spec });
|
|
526
|
+
}
|
|
527
|
+
test("handleInbox() fetches the actor of a gateway key once", async () => {
|
|
528
|
+
for (const [keyId, actor] of [[gatewayKeyId, await actorDocument([gateway])], [apKeyId, await apActorDocument()]]) {
|
|
529
|
+
const { documentLoader, fetched } = countingLoader({ [compatibleActorId(gateway)]: actor });
|
|
530
|
+
const kv = new MemoryKvStore();
|
|
531
|
+
for (let i = 0; i < 2; i++) {
|
|
532
|
+
assertEquals(await deliver(await createJson(`once-${i}`), [gateway], {
|
|
533
|
+
kv,
|
|
534
|
+
documentLoader,
|
|
535
|
+
keyId
|
|
536
|
+
}), {
|
|
537
|
+
status: 401,
|
|
538
|
+
dispatched: 0
|
|
539
|
+
});
|
|
540
|
+
assertEquals(fetched(), 1);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
});
|
|
544
|
+
test("RequestContext.getSignedKeyOwner() does not fetch the actor of a gateway key again", async () => {
|
|
545
|
+
for (const [keyId, actor, gateways] of [[
|
|
546
|
+
gatewayKeyId,
|
|
547
|
+
await actorDocument([gateway, otherGateway]),
|
|
548
|
+
[`${gateway}/`, `${otherGateway}/`]
|
|
549
|
+
], [
|
|
550
|
+
apKeyId,
|
|
551
|
+
await apActorDocument(),
|
|
552
|
+
[`${gateway}/`]
|
|
553
|
+
]]) {
|
|
554
|
+
const { documentLoader, fetched } = countingLoader({ [compatibleActorId(gateway)]: actor });
|
|
555
|
+
const ctx = new FederationImpl({
|
|
556
|
+
kv: new MemoryKvStore(),
|
|
557
|
+
contextLoaderFactory: () => mockDocumentLoader,
|
|
558
|
+
documentLoaderFactory: () => documentLoader
|
|
559
|
+
}).createContext(await signedRequest(keyId), void 0);
|
|
560
|
+
assertEquals((await ctx.getSignedKey())?.id?.href, keyId.href);
|
|
561
|
+
assertEquals(fetched(), 1);
|
|
562
|
+
const owner = await ctx.getSignedKeyOwner();
|
|
563
|
+
assertEquals(owner?.id?.href, actorId.href);
|
|
564
|
+
assertEquals(owner?.gateways.map((g) => g.href), [...gateways]);
|
|
565
|
+
assertEquals(fetched(), 1);
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
test("getKeyOwner() reuses the actor of a cached gateway key", async () => {
|
|
569
|
+
for (const spec of [void 0, "rfc9421"]) {
|
|
570
|
+
const { documentLoader, fetched } = countingLoader({ [compatibleActorId(gateway)]: await actorDocument([gateway]) });
|
|
571
|
+
const options = {
|
|
572
|
+
documentLoader,
|
|
573
|
+
contextLoader: mockDocumentLoader,
|
|
574
|
+
keyCache: new KvKeyCache(new MemoryKvStore(), ["pk"])
|
|
575
|
+
};
|
|
576
|
+
const fresh = await verifyRequest(await signedRequest(gatewayKeyId, rsaPrivateKey2, spec), options);
|
|
577
|
+
const cached = await verifyRequest(await signedRequest(gatewayKeyId, rsaPrivateKey2, spec), options);
|
|
578
|
+
assertEquals(fetched(), 1);
|
|
579
|
+
for (const key of [fresh, cached]) assertEquals((await getKeyOwner(key, options))?.id?.href, actorId.href);
|
|
580
|
+
assertEquals(fetched(), 1);
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
test("doesActorOwnKey() checks the actor of a verified gateway key without fetching", async () => {
|
|
584
|
+
const { documentLoader, fetched } = countingLoader({ [compatibleActorId(gateway)]: await actorDocument([gateway]) });
|
|
585
|
+
const options = {
|
|
586
|
+
documentLoader,
|
|
587
|
+
contextLoader: mockDocumentLoader
|
|
588
|
+
};
|
|
589
|
+
const key = await verifyRequest(await signedRequest(), options);
|
|
590
|
+
assertEquals(fetched(), 1);
|
|
591
|
+
assertEquals(await doesActorOwnKey(portableCreate(), key, options), true);
|
|
592
|
+
assertEquals(await doesActorOwnKey(new Create({
|
|
593
|
+
id: parseIri(`ap+ef61://${otherDid}/activities/1`),
|
|
594
|
+
actor: parseIri(`ap+ef61://${otherDid}/actors/alice`)
|
|
595
|
+
}), key, options), false);
|
|
596
|
+
assertEquals(fetched(), 1);
|
|
597
|
+
});
|
|
598
|
+
test("doesActorOwnKey() and getKeyOwner() fully check other gateway keys", async () => {
|
|
599
|
+
const { documentLoader, fetched } = countingLoader({ [compatibleActorId(gateway)]: await actorDocument([gateway]) });
|
|
600
|
+
const options = {
|
|
601
|
+
documentLoader,
|
|
602
|
+
contextLoader: mockDocumentLoader
|
|
603
|
+
};
|
|
604
|
+
const verified = await verifyRequest(await signedRequest(), options);
|
|
605
|
+
assertEquals(fetched(), 1);
|
|
606
|
+
const others = [new CryptographicKey({
|
|
607
|
+
id: gatewayKeyId,
|
|
608
|
+
owner: actorId,
|
|
609
|
+
publicKey: rsaPublicKey2.publicKey
|
|
610
|
+
}), verified.clone({})];
|
|
611
|
+
let expected = 1;
|
|
612
|
+
for (const key of others) {
|
|
613
|
+
assertEquals(await doesActorOwnKey(portableCreate(), key, options), true);
|
|
614
|
+
assertEquals(fetched(), ++expected);
|
|
615
|
+
assertEquals((await getKeyOwner(key, options))?.id?.href, actorId.href);
|
|
616
|
+
assertEquals(fetched(), ++expected);
|
|
617
|
+
}
|
|
618
|
+
const mutated = await verifyRequest(await signedRequest(), options);
|
|
619
|
+
mutated.ownerId.href = parseIri(`ap+ef61://${otherDid}/actors/alice`).href;
|
|
620
|
+
assertEquals(getVerifiedKeyOwnerEvidence(mutated), void 0);
|
|
621
|
+
});
|
|
622
|
+
test("verifyRequest() does not vouch for the owners of keys that fail to verify signatures", async () => {
|
|
623
|
+
const documentLoader = createLoader({ [compatibleActorId(gateway)]: await actorDocument([gateway]) });
|
|
624
|
+
const cachedKeys = [];
|
|
625
|
+
const keyCache = new class extends KvKeyCache {
|
|
626
|
+
compatibleKeyScope(scope) {
|
|
627
|
+
const scoped = super.compatibleKeyScope(scope);
|
|
628
|
+
return {
|
|
629
|
+
...scoped,
|
|
630
|
+
set(keyId, key, options) {
|
|
631
|
+
if (key instanceof CryptographicKey) cachedKeys.push(key);
|
|
632
|
+
return scoped.set(keyId, key, options);
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
}
|
|
636
|
+
}(new MemoryKvStore(), ["pk"]);
|
|
637
|
+
assertEquals((await verifyRequestDetailed(await signedRequest(gatewayKeyId, rsaPrivateKey3), {
|
|
638
|
+
documentLoader,
|
|
639
|
+
contextLoader: mockDocumentLoader,
|
|
640
|
+
keyCache
|
|
641
|
+
})).verified, false);
|
|
642
|
+
assertEquals(cachedKeys.length, 1);
|
|
643
|
+
assertEquals(getVerifiedKeyOwnerEvidence(cachedKeys[0]), void 0);
|
|
644
|
+
});
|
|
645
|
+
test("doesActorOwnKey() fully checks cached gateway keys cached without their actors", async () => {
|
|
646
|
+
const { documentLoader, fetched } = countingLoader({ [compatibleActorId(gateway)]: await actorDocument([gateway]) });
|
|
647
|
+
const kv = new MemoryKvStore();
|
|
648
|
+
const options = {
|
|
649
|
+
documentLoader,
|
|
650
|
+
contextLoader: mockDocumentLoader,
|
|
651
|
+
keyCache: new KvKeyCache(kv, ["pk"])
|
|
652
|
+
};
|
|
653
|
+
await verifyRequest(await signedRequest(), options);
|
|
654
|
+
assertEquals(fetched(), 1);
|
|
655
|
+
const entryKey = [
|
|
656
|
+
"pk",
|
|
657
|
+
"__compatible",
|
|
658
|
+
"httpSignature",
|
|
659
|
+
gatewayKeyId.href
|
|
660
|
+
];
|
|
661
|
+
const { owner: _, ...entry } = await kv.get(entryKey) ?? {};
|
|
662
|
+
await kv.set(entryKey, entry);
|
|
663
|
+
const key = await verifyRequest(await signedRequest(), options);
|
|
664
|
+
assertEquals(fetched(), 1);
|
|
665
|
+
assertEquals(getVerifiedKeyOwnerEvidence(key), void 0);
|
|
666
|
+
assertEquals(await doesActorOwnKey(portableCreate(), key, options), true);
|
|
667
|
+
assertEquals(fetched(), 2);
|
|
668
|
+
});
|
|
669
|
+
test("Owners of verified gateway keys expire with their cache entries", async () => {
|
|
670
|
+
const documentLoader = createLoader({ [compatibleActorId(gateway)]: await actorDocument([gateway]) });
|
|
671
|
+
const now = Temporal.Now.instant();
|
|
672
|
+
const keyCache = new KvKeyCache(new MemoryKvStore(), ["pk"], {
|
|
673
|
+
keyTtl: Temporal.Duration.from({ minutes: 5 }),
|
|
674
|
+
now: () => now
|
|
675
|
+
});
|
|
676
|
+
const key = await verifyRequest(await signedRequest(), {
|
|
677
|
+
documentLoader,
|
|
678
|
+
contextLoader: mockDocumentLoader,
|
|
679
|
+
keyCache
|
|
680
|
+
});
|
|
681
|
+
const deadline = now.add({ minutes: 5 });
|
|
682
|
+
assertEquals(getVerifiedKeyOwnerEvidence(key, deadline.subtract({ seconds: 1 }))?.expires, deadline);
|
|
683
|
+
assertEquals(getVerifiedKeyOwnerEvidence(key, deadline), void 0);
|
|
684
|
+
});
|
|
511
685
|
//#endregion
|
|
512
686
|
export {};
|
|
@@ -8,11 +8,11 @@ import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
|
|
|
8
8
|
import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
9
9
|
import "../std__assert-DvMDRPes.mjs";
|
|
10
10
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
11
|
-
import { p as signJsonLd } from "../ld-
|
|
12
|
-
import { a as signObject } from "../proof-
|
|
13
|
-
import { f as verifyRequestDetailed, l as signRequest } from "../http-
|
|
11
|
+
import { p as signJsonLd } from "../ld-CyliEU48.mjs";
|
|
12
|
+
import { a as signObject } from "../proof-CRTPWbVh.mjs";
|
|
13
|
+
import { f as verifyRequestDetailed, l as signRequest } from "../http-DRH0n8TD.mjs";
|
|
14
14
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
15
|
-
import { _ as coversDelivery, o as createFederation, v as forwardPortableInboxActivity, y as resolvePortableInboxForwardingOptions } from "../middleware-
|
|
15
|
+
import { _ as coversDelivery, o as createFederation, v as forwardPortableInboxActivity, y as resolvePortableInboxForwardingOptions } from "../middleware-B99JjvFn.mjs";
|
|
16
16
|
import { Create, CryptographicKey, Follow, Note, Person, Tombstone } from "@fedify/vocab";
|
|
17
17
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
18
18
|
import { exportDidKey, formatIri, parseIri } from "@fedify/vocab-runtime";
|