@fedify/fedify 2.4.0-dev.1951 → 2.4.0-dev.1959
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-P44yYQ5Z.mjs → builder-sMkz-MdT.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/{context-BOnn653X.d.cts → context-COLwHogJ.d.cts} +27 -0
- package/dist/{context-CmjP-cgJ.d.ts → context-DiiCt4S7.d.ts} +27 -0
- package/dist/{deno-U6Pe1U6h.mjs → deno-Xg7DR4LS.mjs} +1 -1
- package/dist/{docloader-DantBD_9.mjs → docloader-4YqMWBpt.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +3 -3
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/keycache.test.mjs +30 -4
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +195 -8
- 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/send.test.mjs +3 -3
- package/dist/federation/tasks/enqueue.test.mjs +3 -2
- package/dist/federation/tasks/tasks.test.mjs +4 -3
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-BAtfz-C3.cjs → federation-BNJgxgH6.cjs} +32 -13
- package/dist/{http-CnBZmc4J.js → http-Bh37_81O.js} +1 -1
- package/dist/{http-BTD1L4Sv.cjs → http-BuOvqNbW.cjs} +1 -1
- package/dist/{http-Cssq59HU.mjs → http-DyXZdUng.mjs} +3 -3
- package/dist/{key-GeKuVU-k.mjs → key-CXsAkAt6.mjs} +2 -2
- package/dist/{keycache-0Jk78XmB.mjs → keycache-ZLqIfrkL.mjs} +3 -1
- package/dist/kv-DBRWVx3Q.mjs +104 -0
- package/dist/{kv-cache-D3gKJwUK.cjs → kv-cache-Btl0s7i7.cjs} +1 -1
- package/dist/{kv-cache-CoMnysg5.mjs → kv-cache-BubmP7z9.mjs} +1 -1
- package/dist/{kv-cache-CMUnx7rx.js → kv-cache-DjFxdXjk.js} +1 -1
- package/dist/{ld-BLl_mzo2.mjs → ld-C5Qv0_xn.mjs} +3 -3
- package/dist/{metrics-KDlQIBxX.mjs → metrics-B7-JxJSv.mjs} +1 -1
- package/dist/{middleware-CIlcGav-.mjs → middleware-BfRUvR8e.mjs} +1 -1
- package/dist/{middleware-aheUmEPU.js → middleware-CF539vn2.js} +32 -13
- package/dist/{middleware-D-vIOT8Y.mjs → middleware-DB_evWhA.mjs} +39 -22
- package/dist/{mod-kUSY5n3f.d.cts → mod-BZldCEU0.d.cts} +1 -1
- package/dist/{mod-BYuZ0WXt.d.ts → mod-CSH1Ee-I.d.ts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +2 -2
- package/dist/mod.d.ts +2 -2
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-C111mU7b.mjs → owner-DFzwGoyv.mjs} +2 -2
- package/dist/{proof-CLZurGKe.js → proof-3rlJfM0Z.js} +1 -1
- package/dist/{proof-B_yPn2BI.cjs → proof-BVpjHUMS.cjs} +1 -1
- package/dist/{proof-B_5-ezjh.mjs → proof-DJGBYtRT.mjs} +4 -4
- package/dist/{send-r_mRJ1qS.mjs → send-BOXP7DyW.mjs} +3 -3
- package/dist/sig/http.test.mjs +2 -2
- 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.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +1 -1
- package/dist/{testing-D13ymFKy.mjs → tasks-dbCShlCb.mjs} +0 -1
- package/dist/{temporal-CIBMJUty.mjs → temporal-D6yzxQ23.mjs} +1 -1
- package/dist/testing/kv.test.d.mts +2 -0
- package/dist/testing/kv.test.mjs +101 -0
- package/dist/testing/mod.d.mts +70 -1
- package/dist/testing/mod.mjs +4 -2
- package/dist/testing-hbky2gMN.mjs +8 -0
- 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.js +1 -1
- package/package.json +7 -7
|
@@ -1,7 +1,7 @@
|
|
|
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-Xg7DR4LS.mjs";
|
|
5
5
|
import { t as ActivityListenerSet } from "./activity-listener-C-BSbKI7.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { Router, RouterError, assertPath } from "@fedify/uri-template";
|
|
@@ -85,7 +85,7 @@ var FederationBuilderImpl = class {
|
|
|
85
85
|
* specified.
|
|
86
86
|
*/
|
|
87
87
|
async build(options) {
|
|
88
|
-
const { FederationImpl } = await import("./middleware-
|
|
88
|
+
const { FederationImpl } = await import("./middleware-BfRUvR8e.mjs");
|
|
89
89
|
const f = new FederationImpl(options);
|
|
90
90
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
91
91
|
f.router = this.router.clone();
|
package/dist/compat/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { Gt as ActivityTransformer, n as Context } from "../context-
|
|
2
|
+
import { Gt as ActivityTransformer, n as Context } from "../context-COLwHogJ.cjs";
|
|
3
3
|
import { Activity } from "@fedify/vocab";
|
|
4
4
|
|
|
5
5
|
//#region src/compat/transformers.d.ts
|
package/dist/compat/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { Gt as ActivityTransformer, n as Context } from "../context-
|
|
2
|
+
import { Gt as ActivityTransformer, n as Context } from "../context-DiiCt4S7.js";
|
|
3
3
|
import { Activity } from "@fedify/vocab";
|
|
4
4
|
|
|
5
5
|
//#region src/compat/transformers.d.ts
|
|
@@ -5,7 +5,7 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
|
|
6
6
|
import { t as assertInstanceOf } from "../assert_instance_of-g3WcyYNR.mjs";
|
|
7
7
|
import { t as assert } from "../assert-CebeUf0C.mjs";
|
|
8
|
-
import { b as autoIdAssigner, n as FederationImpl, y as actorDehydrator } from "../middleware-
|
|
8
|
+
import { b as autoIdAssigner, n as FederationImpl, y as actorDehydrator } from "../middleware-DB_evWhA.mjs";
|
|
9
9
|
import { Follow, Person } from "@fedify/vocab";
|
|
10
10
|
import { test } from "@fedify/fixture";
|
|
11
11
|
//#region src/compat/transformers.test.ts
|
|
@@ -1975,6 +1975,33 @@ interface FederationOptions<TContextData> {
|
|
|
1975
1975
|
*/
|
|
1976
1976
|
kvPrefixes?: Partial<FederationKvPrefixes>;
|
|
1977
1977
|
/**
|
|
1978
|
+
* The time-to-live for a remote actor's public key cached under
|
|
1979
|
+
* {@link FederationKvPrefixes.publicKey}. Once it expires, the next
|
|
1980
|
+
* signature verification that needs the key refetches it from the remote
|
|
1981
|
+
* server and caches it again.
|
|
1982
|
+
*
|
|
1983
|
+
* Shortening it bounds how long a revoked or rotated key stays in the cache,
|
|
1984
|
+
* at the cost of more requests to remote servers; refetching an expired key
|
|
1985
|
+
* fails while the peer is unavailable, so a very short value makes
|
|
1986
|
+
* verification depend on the peer being reachable.
|
|
1987
|
+
* @default `{ days: 30 }`
|
|
1988
|
+
* @since 2.4.0
|
|
1989
|
+
*/
|
|
1990
|
+
publicKeyTtl?: Temporal.DurationLike;
|
|
1991
|
+
/**
|
|
1992
|
+
* The time-to-live for a remote origin's remembered HTTP Message Signatures
|
|
1993
|
+
* spec cached under {@link FederationKvPrefixes.httpMessageSignaturesSpec}.
|
|
1994
|
+
* Once it expires, the next delivery to that origin relearns the spec by
|
|
1995
|
+
* double-knocking and remembers it again.
|
|
1996
|
+
*
|
|
1997
|
+
* Shortening it makes Fedify notice a peer's spec upgrade sooner, at the
|
|
1998
|
+
* cost of an extra signed request per delivery whenever the first spec tried
|
|
1999
|
+
* is rejected.
|
|
2000
|
+
* @default `{ days: 90 }`
|
|
2001
|
+
* @since 2.4.0
|
|
2002
|
+
*/
|
|
2003
|
+
httpMessageSignaturesSpecTtl?: Temporal.DurationLike;
|
|
2004
|
+
/**
|
|
1978
2005
|
* The message queue for sending and receiving activities. If not provided,
|
|
1979
2006
|
* activities will not be queued and will be processed immediately.
|
|
1980
2007
|
*
|
|
@@ -1977,6 +1977,33 @@ interface FederationOptions<TContextData> {
|
|
|
1977
1977
|
*/
|
|
1978
1978
|
kvPrefixes?: Partial<FederationKvPrefixes>;
|
|
1979
1979
|
/**
|
|
1980
|
+
* The time-to-live for a remote actor's public key cached under
|
|
1981
|
+
* {@link FederationKvPrefixes.publicKey}. Once it expires, the next
|
|
1982
|
+
* signature verification that needs the key refetches it from the remote
|
|
1983
|
+
* server and caches it again.
|
|
1984
|
+
*
|
|
1985
|
+
* Shortening it bounds how long a revoked or rotated key stays in the cache,
|
|
1986
|
+
* at the cost of more requests to remote servers; refetching an expired key
|
|
1987
|
+
* fails while the peer is unavailable, so a very short value makes
|
|
1988
|
+
* verification depend on the peer being reachable.
|
|
1989
|
+
* @default `{ days: 30 }`
|
|
1990
|
+
* @since 2.4.0
|
|
1991
|
+
*/
|
|
1992
|
+
publicKeyTtl?: Temporal.DurationLike;
|
|
1993
|
+
/**
|
|
1994
|
+
* The time-to-live for a remote origin's remembered HTTP Message Signatures
|
|
1995
|
+
* spec cached under {@link FederationKvPrefixes.httpMessageSignaturesSpec}.
|
|
1996
|
+
* Once it expires, the next delivery to that origin relearns the spec by
|
|
1997
|
+
* double-knocking and remembers it again.
|
|
1998
|
+
*
|
|
1999
|
+
* Shortening it makes Fedify notice a peer's spec upgrade sooner, at the
|
|
2000
|
+
* cost of an extra signed request per delivery whenever the first spec tried
|
|
2001
|
+
* is rejected.
|
|
2002
|
+
* @default `{ days: 90 }`
|
|
2003
|
+
* @since 2.4.0
|
|
2004
|
+
*/
|
|
2005
|
+
httpMessageSignaturesSpecTtl?: Temporal.DurationLike;
|
|
2006
|
+
/**
|
|
1980
2007
|
* The message queue for sending and receiving activities. If not provided,
|
|
1981
2008
|
* activities will not be queued and will be processed immediately.
|
|
1982
2009
|
*
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { o as validateCryptoKey } from "./key-
|
|
5
|
-
import { n as doubleKnock } from "./http-
|
|
4
|
+
import { o as validateCryptoKey } from "./key-CXsAkAt6.mjs";
|
|
5
|
+
import { n as doubleKnock } from "./http-DyXZdUng.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { curry } from "es-toolkit";
|
|
8
8
|
import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
@@ -6,7 +6,7 @@ import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
|
|
|
6
6
|
import { t as assertExists } from "../assert_exists-DtzkXC47.mjs";
|
|
7
7
|
import { t as assertThrows } from "../assert_throws-BJ5wuvR2.mjs";
|
|
8
8
|
import "../std__assert-CxFT0MNt.mjs";
|
|
9
|
-
import { r as createFederationBuilder } from "../builder-
|
|
9
|
+
import { r as createFederationBuilder } from "../builder-sMkz-MdT.mjs";
|
|
10
10
|
import { DisallowedOperatorError, DisallowedVarSpecModifierError, DuplicateRouteVariableError, RouteTemplateOptionsNotMatchedError, RouterError } from "@fedify/uri-template";
|
|
11
11
|
import { Activity, Note, Person } from "@fedify/vocab";
|
|
12
12
|
import { test } from "@fedify/fixture";
|
|
@@ -10,10 +10,10 @@ import "../std__assert-CxFT0MNt.mjs";
|
|
|
10
10
|
import { t as assertRejects } from "../assert_rejects-wFbSPn1O.mjs";
|
|
11
11
|
import { t as assert } from "../assert-CebeUf0C.mjs";
|
|
12
12
|
import { r as parseAcceptSignature } from "../accept-CPVqki78.mjs";
|
|
13
|
-
import { s as signRequest } from "../http-
|
|
13
|
+
import { s as signRequest } from "../http-DyXZdUng.mjs";
|
|
14
14
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { c as handleActor, d as handleInbox, f as handleObject, h as respondWithObjectIfAcceptable, l as handleCollection, m as respondWithObject, o as createFederation, p as handleOutbox, u as handleCustomCollection } from "../middleware-DB_evWhA.mjs";
|
|
16
|
+
import { a as compactJsonLd, p as signJsonLd } from "../ld-C5Qv0_xn.mjs";
|
|
17
17
|
import { t as ActivityListenerSet } from "../activity-listener-C-BSbKI7.mjs";
|
|
18
18
|
import { Activity, Create, Note, Person, Tombstone } from "@fedify/vocab";
|
|
19
19
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -5,8 +5,8 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
|
|
6
6
|
import "../std__assert-CxFT0MNt.mjs";
|
|
7
7
|
import { n as ed25519PrivateKey, r as ed25519PublicKey, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { o as createFederation } from "../middleware-DB_evWhA.mjs";
|
|
9
|
+
import { r as signObject } from "../proof-DJGBYtRT.mjs";
|
|
10
10
|
import { Create, Follow, Person } from "@fedify/vocab";
|
|
11
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
//#region src/federation/idempotency.test.ts
|
|
@@ -2,10 +2,11 @@ import { Temporal } from "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
5
|
+
import { t as ManualClockKvStore } from "../kv-DBRWVx3Q.mjs";
|
|
5
6
|
import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
|
|
6
7
|
import { t as assertInstanceOf } from "../assert_instance_of-g3WcyYNR.mjs";
|
|
7
8
|
import { t as assert } from "../assert-CebeUf0C.mjs";
|
|
8
|
-
import { t as KvKeyCache } from "../keycache-
|
|
9
|
+
import { t as KvKeyCache } from "../keycache-ZLqIfrkL.mjs";
|
|
9
10
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
10
11
|
import { test } from "@fedify/fixture";
|
|
11
12
|
//#region src/federation/keycache.test.ts
|
|
@@ -79,16 +80,41 @@ test("KvKeyCache fetch error metadata", async () => {
|
|
|
79
80
|
assertEquals(await cache.getFetchError(keyId), void 0);
|
|
80
81
|
});
|
|
81
82
|
test("KvKeyCache unavailable entries expire", async () => {
|
|
82
|
-
const
|
|
83
|
+
const kv = new ManualClockKvStore();
|
|
84
|
+
const unavailableKeyTtl = Temporal.Duration.from({ minutes: 10 });
|
|
85
|
+
const cache = new KvKeyCache(kv, ["pk"], { unavailableKeyTtl });
|
|
83
86
|
const keyId = new URL("https://example.com/expired");
|
|
84
87
|
await cache.set(keyId, null);
|
|
85
88
|
await cache.setFetchError(keyId, {
|
|
86
89
|
status: 410,
|
|
87
90
|
response: new Response(null, { status: 410 })
|
|
88
91
|
});
|
|
89
|
-
|
|
92
|
+
kv.advance({ minutes: 20 });
|
|
93
|
+
const later = new KvKeyCache(kv, ["pk"], { unavailableKeyTtl });
|
|
94
|
+
assertEquals(await later.get(keyId), void 0);
|
|
95
|
+
assertEquals(await later.getFetchError(keyId), void 0);
|
|
96
|
+
});
|
|
97
|
+
test("KvKeyCache.keyTtl defaults to 30 days", () => {
|
|
98
|
+
assertEquals(new KvKeyCache(new MemoryKvStore(), ["pk"]).keyTtl.total("day"), 30);
|
|
99
|
+
});
|
|
100
|
+
test("KvKeyCache.keyTtl is configurable", () => {
|
|
101
|
+
assertEquals(new KvKeyCache(new MemoryKvStore(), ["pk"], { keyTtl: Temporal.Duration.from({ days: 7 }) }).keyTtl.total("day"), 7);
|
|
102
|
+
});
|
|
103
|
+
test("KvKeyCache cached keys expire after keyTtl", async () => {
|
|
104
|
+
const kv = new ManualClockKvStore();
|
|
105
|
+
const cache = new KvKeyCache(kv, ["pk"], { keyTtl: Temporal.Duration.from({ days: 30 }) });
|
|
106
|
+
const keyId = new URL("https://example.com/key");
|
|
107
|
+
await cache.set(keyId, new CryptographicKey({ id: keyId }));
|
|
108
|
+
assert(await kv.get(["pk", keyId.href]) != null);
|
|
109
|
+
assertInstanceOf(await cache.get(keyId), CryptographicKey);
|
|
110
|
+
kv.advance({ days: 31 });
|
|
111
|
+
assertEquals(await kv.get(["pk", keyId.href]), void 0);
|
|
90
112
|
assertEquals(await cache.get(keyId), void 0);
|
|
91
|
-
assertEquals(
|
|
113
|
+
assertEquals(cache.nullKeys.has(keyId.href), false);
|
|
114
|
+
await cache.set(keyId, new CryptographicKey({ id: keyId }));
|
|
115
|
+
const refetched = await cache.get(keyId);
|
|
116
|
+
assertInstanceOf(refetched, CryptographicKey);
|
|
117
|
+
assertEquals(refetched.id?.href, keyId.href);
|
|
92
118
|
});
|
|
93
119
|
//#endregion
|
|
94
120
|
export {};
|
|
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
|
|
5
5
|
import "../std__assert-CxFT0MNt.mjs";
|
|
6
6
|
import { t as assertRejects } from "../assert_rejects-wFbSPn1O.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-B7-JxJSv.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";
|
|
@@ -3,7 +3,9 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as esm_default } from "../esm-BHXXx4Wx.mjs";
|
|
5
5
|
import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { t as ManualClockKvStore } from "../kv-DBRWVx3Q.mjs";
|
|
7
|
+
import { a as numberSchema, r as envelopeSchema, t as MockQueue } from "../tasks-dbCShlCb.mjs";
|
|
8
|
+
import "../testing-hbky2gMN.mjs";
|
|
7
9
|
import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
|
|
8
10
|
import { t as assertExists } from "../assert_exists-DtzkXC47.mjs";
|
|
9
11
|
import { t as assertFalse } from "../assert_false-3pLLLsO4.mjs";
|
|
@@ -14,14 +16,14 @@ import "../std__assert-CxFT0MNt.mjs";
|
|
|
14
16
|
import { t as assertRejects } from "../assert_rejects-wFbSPn1O.mjs";
|
|
15
17
|
import { t as assertStrictEquals } from "../assert_strict_equals-Bpjl4Psw.mjs";
|
|
16
18
|
import { t as assert } from "../assert-CebeUf0C.mjs";
|
|
17
|
-
import { g as recordInboxActivity } from "../metrics-
|
|
18
|
-
import { l as verifyRequest, s as signRequest } from "../http-
|
|
19
|
+
import { g as recordInboxActivity } from "../metrics-B7-JxJSv.mjs";
|
|
20
|
+
import { l as verifyRequest, s as signRequest } from "../http-DyXZdUng.mjs";
|
|
19
21
|
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";
|
|
20
|
-
import { t as getAuthenticatedDocumentLoader } from "../docloader-
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
22
|
+
import { t as getAuthenticatedDocumentLoader } from "../docloader-4YqMWBpt.mjs";
|
|
23
|
+
import { g as handleBenchmarkTrigger, i as KvSpecDeterminer, n as FederationImpl, o as createFederation, r as InboxContextImpl, t as ContextImpl } from "../middleware-DB_evWhA.mjs";
|
|
24
|
+
import { a as compactJsonLd, h as verifyJsonLd, p as signJsonLd, s as detachSignature } from "../ld-C5Qv0_xn.mjs";
|
|
25
|
+
import { t as doesActorOwnKey } from "../owner-DFzwGoyv.mjs";
|
|
26
|
+
import { i as verifyObject, r as signObject } from "../proof-DJGBYtRT.mjs";
|
|
25
27
|
import { t as CircuitBreaker } from "../circuit-breaker-C5NqoLBJ.mjs";
|
|
26
28
|
import { t as TaskCodec } from "../codec-C6rTrpIp.mjs";
|
|
27
29
|
import { t as markCircuitBreakerLegacySweepDone } from "../circuit-breaker-test-utils-DW6YC_Pe.mjs";
|
|
@@ -7358,6 +7360,191 @@ test("KvSpecDeterminer", async (t) => {
|
|
|
7358
7360
|
spec = await determiner.determineSpec("example.com");
|
|
7359
7361
|
assertEquals(spec, "rfc9421");
|
|
7360
7362
|
});
|
|
7363
|
+
await t.step("should default specTtl to 90 days", () => {
|
|
7364
|
+
assertEquals(new KvSpecDeterminer(new MemoryKvStore(), ["test", "spec"]).specTtl.total("day"), 90);
|
|
7365
|
+
});
|
|
7366
|
+
await t.step("should accept a configurable specTtl as a 4th positional argument", () => {
|
|
7367
|
+
assertEquals(new KvSpecDeterminer(new MemoryKvStore(), ["test", "spec"], "rfc9421", { specTtl: Temporal.Duration.from({ days: 7 }) }).specTtl.total("day"), 7);
|
|
7368
|
+
});
|
|
7369
|
+
await t.step("should expire, relearn, and remember the spec again", async () => {
|
|
7370
|
+
const kv = new ManualClockKvStore();
|
|
7371
|
+
const determiner = new KvSpecDeterminer(kv, ["test", "spec"], "rfc9421", { specTtl: Temporal.Duration.from({ days: 90 }) });
|
|
7372
|
+
await determiner.rememberSpec("example.com", "draft-cavage-http-signatures-12");
|
|
7373
|
+
assertEquals(await determiner.determineSpec("example.com"), "draft-cavage-http-signatures-12");
|
|
7374
|
+
kv.advance({ days: 91 });
|
|
7375
|
+
assertEquals(await determiner.determineSpec("example.com"), "rfc9421");
|
|
7376
|
+
await determiner.rememberSpec("example.com", "draft-cavage-http-signatures-12");
|
|
7377
|
+
assertEquals(await determiner.determineSpec("example.com"), "draft-cavage-http-signatures-12");
|
|
7378
|
+
});
|
|
7379
|
+
});
|
|
7380
|
+
/**
|
|
7381
|
+
* A `KvStore` that records the TTL every write was made with, so tests can
|
|
7382
|
+
* assert on TTLs even after the entries themselves have expired.
|
|
7383
|
+
*/
|
|
7384
|
+
var TtlRecordingKvStore = class {
|
|
7385
|
+
inner = new ManualClockKvStore();
|
|
7386
|
+
writes = [];
|
|
7387
|
+
/** Moves the wrapped store's virtual clock forward. */
|
|
7388
|
+
advance(duration) {
|
|
7389
|
+
this.inner.advance(duration);
|
|
7390
|
+
}
|
|
7391
|
+
get(key) {
|
|
7392
|
+
return this.inner.get(key);
|
|
7393
|
+
}
|
|
7394
|
+
set(key, value, options) {
|
|
7395
|
+
this.writes.push({
|
|
7396
|
+
key,
|
|
7397
|
+
ttl: options?.ttl
|
|
7398
|
+
});
|
|
7399
|
+
return this.inner.set(key, value, options);
|
|
7400
|
+
}
|
|
7401
|
+
delete(key) {
|
|
7402
|
+
return this.inner.delete(key);
|
|
7403
|
+
}
|
|
7404
|
+
list(prefix) {
|
|
7405
|
+
return this.inner.list(prefix);
|
|
7406
|
+
}
|
|
7407
|
+
/** The TTL of the most recent write to `key`, or `undefined` if never set. */
|
|
7408
|
+
lastTtl(key) {
|
|
7409
|
+
const matches = this.writes.filter((w) => w.key.length === key.length && w.key.every((p, i) => p === key[i]));
|
|
7410
|
+
return matches.length < 1 ? void 0 : matches[matches.length - 1].ttl;
|
|
7411
|
+
}
|
|
7412
|
+
};
|
|
7413
|
+
test("createFederation() defaults the cache TTLs and lets them be overridden", () => {
|
|
7414
|
+
const defaults = new FederationImpl({ kv: new MemoryKvStore() });
|
|
7415
|
+
assertEquals(defaults.publicKeyTtl.total("day"), 30);
|
|
7416
|
+
assertEquals(defaults.httpMessageSignaturesSpecTtl.total("day"), 90);
|
|
7417
|
+
const overridden = new FederationImpl({
|
|
7418
|
+
kv: new MemoryKvStore(),
|
|
7419
|
+
publicKeyTtl: { days: 1 },
|
|
7420
|
+
httpMessageSignaturesSpecTtl: { hours: 12 }
|
|
7421
|
+
});
|
|
7422
|
+
assertEquals(overridden.publicKeyTtl.total("day"), 1);
|
|
7423
|
+
assertEquals(overridden.httpMessageSignaturesSpecTtl.total("hour"), 12);
|
|
7424
|
+
});
|
|
7425
|
+
test("createFederation() applies httpMessageSignaturesSpecTtl to remembered specs", async () => {
|
|
7426
|
+
esm_default.spyGlobal();
|
|
7427
|
+
try {
|
|
7428
|
+
const attempts = [];
|
|
7429
|
+
esm_default.post("https://example.com/inbox", async (cl) => {
|
|
7430
|
+
const request = cl.request.clone();
|
|
7431
|
+
const spec = request.headers.has("Signature-Input") ? "rfc9421" : "draft-cavage-http-signatures-12";
|
|
7432
|
+
attempts.push(spec);
|
|
7433
|
+
if (spec === "rfc9421") return new Response(null, { status: 401 });
|
|
7434
|
+
const key = await verifyRequest(request, {
|
|
7435
|
+
documentLoader: mockDocumentLoader,
|
|
7436
|
+
contextLoader: mockDocumentLoader
|
|
7437
|
+
});
|
|
7438
|
+
return new Response(null, { status: key == null ? 401 : 202 });
|
|
7439
|
+
});
|
|
7440
|
+
const kv = new TtlRecordingKvStore();
|
|
7441
|
+
const ctx = createFederation({
|
|
7442
|
+
kv,
|
|
7443
|
+
documentLoaderFactory: () => mockDocumentLoader,
|
|
7444
|
+
contextLoaderFactory: () => mockDocumentLoader,
|
|
7445
|
+
httpMessageSignaturesSpecTtl: { days: 14 }
|
|
7446
|
+
}).createContext(new URL("https://example.com/"), void 0);
|
|
7447
|
+
const specKey = [
|
|
7448
|
+
"_fedify",
|
|
7449
|
+
"httpMessageSignaturesSpec",
|
|
7450
|
+
"https://example.com"
|
|
7451
|
+
];
|
|
7452
|
+
const send = () => ctx.sendActivity([{
|
|
7453
|
+
privateKey: rsaPrivateKey2,
|
|
7454
|
+
keyId: rsaPublicKey2.id
|
|
7455
|
+
}], {
|
|
7456
|
+
id: new URL("https://example.com/recipient"),
|
|
7457
|
+
inboxId: new URL("https://example.com/inbox")
|
|
7458
|
+
}, new vocab.Create({
|
|
7459
|
+
id: new URL(`https://example.com/activities/${crypto.randomUUID()}`),
|
|
7460
|
+
actor: new URL("https://example.com/person")
|
|
7461
|
+
}));
|
|
7462
|
+
await send();
|
|
7463
|
+
assertEquals(attempts, ["rfc9421", "draft-cavage-http-signatures-12"]);
|
|
7464
|
+
assertEquals(await kv.get(specKey), "draft-cavage-http-signatures-12");
|
|
7465
|
+
assertEquals(kv.lastTtl(specKey)?.total("day"), 14);
|
|
7466
|
+
attempts.length = 0;
|
|
7467
|
+
await send();
|
|
7468
|
+
assertEquals(attempts, ["draft-cavage-http-signatures-12"]);
|
|
7469
|
+
kv.advance({ days: 15 });
|
|
7470
|
+
assertEquals(await kv.get(specKey), void 0);
|
|
7471
|
+
attempts.length = 0;
|
|
7472
|
+
await send();
|
|
7473
|
+
assertEquals(attempts, ["rfc9421", "draft-cavage-http-signatures-12"]);
|
|
7474
|
+
assertEquals(await kv.get(specKey), "draft-cavage-http-signatures-12");
|
|
7475
|
+
assertEquals(kv.lastTtl(specKey)?.total("day"), 14);
|
|
7476
|
+
} finally {
|
|
7477
|
+
esm_default.hardReset();
|
|
7478
|
+
}
|
|
7479
|
+
});
|
|
7480
|
+
test("createFederation() applies publicKeyTtl to cached public keys", async () => {
|
|
7481
|
+
esm_default.spyGlobal();
|
|
7482
|
+
try {
|
|
7483
|
+
let keyFetches = 0;
|
|
7484
|
+
esm_default.get("begin:https://example.com/person2", () => {
|
|
7485
|
+
keyFetches++;
|
|
7486
|
+
return {
|
|
7487
|
+
headers: { "Content-Type": "application/activity+json" },
|
|
7488
|
+
body: person2_default
|
|
7489
|
+
};
|
|
7490
|
+
});
|
|
7491
|
+
const keyId = "https://example.com/person2#key3";
|
|
7492
|
+
const kv = new TtlRecordingKvStore();
|
|
7493
|
+
const federation = createFederation({
|
|
7494
|
+
kv,
|
|
7495
|
+
documentLoaderFactory: () => mockDocumentLoader,
|
|
7496
|
+
contextLoaderFactory: () => mockDocumentLoader,
|
|
7497
|
+
publicKeyTtl: { days: 7 }
|
|
7498
|
+
});
|
|
7499
|
+
const inbox = [];
|
|
7500
|
+
federation.setActorDispatcher("/users/{identifier}", (_, identifier) => identifier === "john" ? new vocab.Person({}) : null).setKeyPairsDispatcher(() => [{
|
|
7501
|
+
privateKey: rsaPrivateKey2,
|
|
7502
|
+
publicKey: rsaPublicKey2.publicKey
|
|
7503
|
+
}]);
|
|
7504
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(vocab.Create, (_ctx, create) => {
|
|
7505
|
+
inbox.push(create);
|
|
7506
|
+
});
|
|
7507
|
+
const deliver = async () => {
|
|
7508
|
+
const activity = new vocab.Create({
|
|
7509
|
+
id: new URL(`https://example.com/activities/${crypto.randomUUID()}`),
|
|
7510
|
+
actor: new URL("https://example.com/person2")
|
|
7511
|
+
});
|
|
7512
|
+
let request = new Request("https://example.com/users/john/inbox", {
|
|
7513
|
+
method: "POST",
|
|
7514
|
+
headers: {
|
|
7515
|
+
"Content-Type": "application/activity+json",
|
|
7516
|
+
accept: "application/ld+json"
|
|
7517
|
+
},
|
|
7518
|
+
body: JSON.stringify(await activity.toJsonLd({ contextLoader: mockDocumentLoader }))
|
|
7519
|
+
});
|
|
7520
|
+
request = await signRequest(request, rsaPrivateKey3, new URL(keyId));
|
|
7521
|
+
return await federation.fetch(request, { contextData: void 0 });
|
|
7522
|
+
};
|
|
7523
|
+
const publicKeyKey = [
|
|
7524
|
+
"_fedify",
|
|
7525
|
+
"publicKey",
|
|
7526
|
+
keyId
|
|
7527
|
+
];
|
|
7528
|
+
assertEquals((await deliver()).status, 202);
|
|
7529
|
+
assertEquals(inbox.length, 1);
|
|
7530
|
+
assert(keyFetches > 0);
|
|
7531
|
+
assert(await kv.get(publicKeyKey) != null);
|
|
7532
|
+
assertEquals(kv.lastTtl(publicKeyKey)?.total("day"), 7);
|
|
7533
|
+
keyFetches = 0;
|
|
7534
|
+
assertEquals((await deliver()).status, 202);
|
|
7535
|
+
assertEquals(inbox.length, 2);
|
|
7536
|
+
assertEquals(keyFetches, 0);
|
|
7537
|
+
kv.advance({ days: 8 });
|
|
7538
|
+
assertEquals(await kv.get(publicKeyKey), void 0);
|
|
7539
|
+
keyFetches = 0;
|
|
7540
|
+
assertEquals((await deliver()).status, 202);
|
|
7541
|
+
assertEquals(inbox.length, 3);
|
|
7542
|
+
assert(keyFetches > 0);
|
|
7543
|
+
assert(await kv.get(publicKeyKey) != null);
|
|
7544
|
+
assertEquals(kv.lastTtl(publicKeyKey)?.total("day"), 7);
|
|
7545
|
+
} finally {
|
|
7546
|
+
esm_default.hardReset();
|
|
7547
|
+
}
|
|
7361
7548
|
});
|
|
7362
7549
|
test("createFederation() instruments documentLoader with activitypub.document.fetch", async () => {
|
|
7363
7550
|
const [meterProvider, recorder] = createTestMeterProvider();
|
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-BNJgxgH6.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 MessageQueueDepth, A as OutboxListenerSetters, At as ObjectAuthorizePredicate, B as TaskEnqueueOptions, Bt as SendActivityError, C as FederationStartQueueOptions, Ct as CustomCollectionCounter, D as InboxListenerSetters, Dt as InboxListener, E as InboxChallengePolicy, Et as InboxErrorHandler, F as createFederation, Ft as OutboxPermanentFailureHandler, G as RetryPolicy, H as TaskRegistry, Ht as PageItems, I as Message, It as SharedInboxKeyDispatcher, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as UnverifiedActivityHandler, M as FederationKvPrefixes, Mt as OutboxErrorHandler, N as FederationOrigin, Nt as OutboxListener, O as MediaUploaderSetters, Ot as MediaUploaderCallback, P as FederationQueueOptions, Pt as OutboxListenerErrorHandler, Q as MessageQueue, R as TaskDefinition, Rt as UnverifiedActivityReason, S as FederationOptions, St as CollectionDispatcher, T as IdempotencyStrategy, Tt as CustomCollectionDispatcher, U as CreateExponentialBackoffPolicyOptions, Ut as buildCollectionSynchronizationHeader, V as TaskHandler, Vt as SenderKeyPair, W as RetryContext, Wt as digest, X as InProcessMessageQueue, Y as respondWithObjectIfAcceptable, Z as InProcessMessageQueueOptions, _ as Federatable, _t as ActorHandleMapper, a as GetSignedKeyOptions, at as CircuitBreakerBeforeSendDecision, b as FederationBuilder, bt as CollectionCounter, c as ParseUriResult, ct as CircuitBreakerKvState, d as SendActivityOptions, dt as CircuitBreakerStateChange, et as MessageQueueEnqueueOptions, f as SendActivityOptionsForCollection, ft as NormalizedCircuitBreakerOptions, g as CustomCollectionCallbackSetters, gt as ActorDispatcher, h as ConstructorWithTypeId, ht as ActorAliasMapper, i as GetActorOptions, it as CircuitBreakerActivityDrop, j as Rfc6570Expression, jt as ObjectDispatcher, k as ObjectCallbackSetters, kt as NodeInfoDispatcher, l as RequestContext, lt as CircuitBreakerOptions, m as CollectionCallbackSetters, mt as parseCircuitBreakerKvState, n as Context, nt as ParallelMessageQueue, o as InboxContext, ot as CircuitBreakerCreateOptions, p as ActorCallbackSetters, pt as normalizeCircuitBreakerOptions, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreaker, s as OutboxContext, st as CircuitBreakerFailurePolicy, t as ActorKeyPair, tt as MessageQueueListenOptions, u as RouteActivityOptions, ut as CircuitBreakerState, v as Federation, vt as ActorKeyPairsDispatcher, w as IdempotencyKeyCallback, wt as CustomCollectionCursor, x as FederationFetchOptions, xt as CollectionCursor, y as FederationBenchmarkOptions, yt as AuthorizePredicate, z as TaskDefinitionOptions, zt as WebFingerLinksDispatcher } from "../context-
|
|
2
|
+
import { $ as MessageQueueDepth, A as OutboxListenerSetters, At as ObjectAuthorizePredicate, B as TaskEnqueueOptions, Bt as SendActivityError, C as FederationStartQueueOptions, Ct as CustomCollectionCounter, D as InboxListenerSetters, Dt as InboxListener, E as InboxChallengePolicy, Et as InboxErrorHandler, F as createFederation, Ft as OutboxPermanentFailureHandler, G as RetryPolicy, H as TaskRegistry, Ht as PageItems, I as Message, It as SharedInboxKeyDispatcher, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as UnverifiedActivityHandler, M as FederationKvPrefixes, Mt as OutboxErrorHandler, N as FederationOrigin, Nt as OutboxListener, O as MediaUploaderSetters, Ot as MediaUploaderCallback, P as FederationQueueOptions, Pt as OutboxListenerErrorHandler, Q as MessageQueue, R as TaskDefinition, Rt as UnverifiedActivityReason, S as FederationOptions, St as CollectionDispatcher, T as IdempotencyStrategy, Tt as CustomCollectionDispatcher, U as CreateExponentialBackoffPolicyOptions, Ut as buildCollectionSynchronizationHeader, V as TaskHandler, Vt as SenderKeyPair, W as RetryContext, Wt as digest, X as InProcessMessageQueue, Y as respondWithObjectIfAcceptable, Z as InProcessMessageQueueOptions, _ as Federatable, _t as ActorHandleMapper, a as GetSignedKeyOptions, at as CircuitBreakerBeforeSendDecision, b as FederationBuilder, bt as CollectionCounter, c as ParseUriResult, ct as CircuitBreakerKvState, d as SendActivityOptions, dt as CircuitBreakerStateChange, et as MessageQueueEnqueueOptions, f as SendActivityOptionsForCollection, ft as NormalizedCircuitBreakerOptions, g as CustomCollectionCallbackSetters, gt as ActorDispatcher, h as ConstructorWithTypeId, ht as ActorAliasMapper, i as GetActorOptions, it as CircuitBreakerActivityDrop, j as Rfc6570Expression, jt as ObjectDispatcher, k as ObjectCallbackSetters, kt as NodeInfoDispatcher, l as RequestContext, lt as CircuitBreakerOptions, m as CollectionCallbackSetters, mt as parseCircuitBreakerKvState, n as Context, nt as ParallelMessageQueue, o as InboxContext, ot as CircuitBreakerCreateOptions, p as ActorCallbackSetters, pt as normalizeCircuitBreakerOptions, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreaker, s as OutboxContext, st as CircuitBreakerFailurePolicy, t as ActorKeyPair, tt as MessageQueueListenOptions, u as RouteActivityOptions, ut as CircuitBreakerState, v as Federation, vt as ActorKeyPairsDispatcher, w as IdempotencyKeyCallback, wt as CustomCollectionCursor, x as FederationFetchOptions, xt as CollectionCursor, y as FederationBenchmarkOptions, yt as AuthorizePredicate, z as TaskDefinitionOptions, zt as WebFingerLinksDispatcher } from "../context-COLwHogJ.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-
|
|
4
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-BZldCEU0.cjs";
|
|
5
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, GetSignedKeyOptions, 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, 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 MessageQueueDepth, A as OutboxListenerSetters, At as ObjectAuthorizePredicate, B as TaskEnqueueOptions, Bt as SendActivityError, C as FederationStartQueueOptions, Ct as CustomCollectionCounter, D as InboxListenerSetters, Dt as InboxListener, E as InboxChallengePolicy, Et as InboxErrorHandler, F as createFederation, Ft as OutboxPermanentFailureHandler, G as RetryPolicy, H as TaskRegistry, Ht as PageItems, I as Message, It as SharedInboxKeyDispatcher, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as UnverifiedActivityHandler, M as FederationKvPrefixes, Mt as OutboxErrorHandler, N as FederationOrigin, Nt as OutboxListener, O as MediaUploaderSetters, Ot as MediaUploaderCallback, P as FederationQueueOptions, Pt as OutboxListenerErrorHandler, Q as MessageQueue, R as TaskDefinition, Rt as UnverifiedActivityReason, S as FederationOptions, St as CollectionDispatcher, T as IdempotencyStrategy, Tt as CustomCollectionDispatcher, U as CreateExponentialBackoffPolicyOptions, Ut as buildCollectionSynchronizationHeader, V as TaskHandler, Vt as SenderKeyPair, W as RetryContext, Wt as digest, X as InProcessMessageQueue, Y as respondWithObjectIfAcceptable, Z as InProcessMessageQueueOptions, _ as Federatable, _t as ActorHandleMapper, a as GetSignedKeyOptions, at as CircuitBreakerBeforeSendDecision, b as FederationBuilder, bt as CollectionCounter, c as ParseUriResult, ct as CircuitBreakerKvState, d as SendActivityOptions, dt as CircuitBreakerStateChange, et as MessageQueueEnqueueOptions, f as SendActivityOptionsForCollection, ft as NormalizedCircuitBreakerOptions, g as CustomCollectionCallbackSetters, gt as ActorDispatcher, h as ConstructorWithTypeId, ht as ActorAliasMapper, i as GetActorOptions, it as CircuitBreakerActivityDrop, j as Rfc6570Expression, jt as ObjectDispatcher, k as ObjectCallbackSetters, kt as NodeInfoDispatcher, l as RequestContext, lt as CircuitBreakerOptions, m as CollectionCallbackSetters, mt as parseCircuitBreakerKvState, n as Context, nt as ParallelMessageQueue, o as InboxContext, ot as CircuitBreakerCreateOptions, p as ActorCallbackSetters, pt as normalizeCircuitBreakerOptions, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreaker, s as OutboxContext, st as CircuitBreakerFailurePolicy, t as ActorKeyPair, tt as MessageQueueListenOptions, u as RouteActivityOptions, ut as CircuitBreakerState, v as Federation, vt as ActorKeyPairsDispatcher, w as IdempotencyKeyCallback, wt as CustomCollectionCursor, x as FederationFetchOptions, xt as CollectionCursor, y as FederationBenchmarkOptions, yt as AuthorizePredicate, z as TaskDefinitionOptions, zt as WebFingerLinksDispatcher } from "../context-
|
|
2
|
+
import { $ as MessageQueueDepth, A as OutboxListenerSetters, At as ObjectAuthorizePredicate, B as TaskEnqueueOptions, Bt as SendActivityError, C as FederationStartQueueOptions, Ct as CustomCollectionCounter, D as InboxListenerSetters, Dt as InboxListener, E as InboxChallengePolicy, Et as InboxErrorHandler, F as createFederation, Ft as OutboxPermanentFailureHandler, G as RetryPolicy, H as TaskRegistry, Ht as PageItems, I as Message, It as SharedInboxKeyDispatcher, J as respondWithObject, K as createExponentialBackoffPolicy, L as createFederationBuilder, Lt as UnverifiedActivityHandler, M as FederationKvPrefixes, Mt as OutboxErrorHandler, N as FederationOrigin, Nt as OutboxListener, O as MediaUploaderSetters, Ot as MediaUploaderCallback, P as FederationQueueOptions, Pt as OutboxListenerErrorHandler, Q as MessageQueue, R as TaskDefinition, Rt as UnverifiedActivityReason, S as FederationOptions, St as CollectionDispatcher, T as IdempotencyStrategy, Tt as CustomCollectionDispatcher, U as CreateExponentialBackoffPolicyOptions, Ut as buildCollectionSynchronizationHeader, V as TaskHandler, Vt as SenderKeyPair, W as RetryContext, Wt as digest, X as InProcessMessageQueue, Y as respondWithObjectIfAcceptable, Z as InProcessMessageQueueOptions, _ as Federatable, _t as ActorHandleMapper, a as GetSignedKeyOptions, at as CircuitBreakerBeforeSendDecision, b as FederationBuilder, bt as CollectionCounter, c as ParseUriResult, ct as CircuitBreakerKvState, d as SendActivityOptions, dt as CircuitBreakerStateChange, et as MessageQueueEnqueueOptions, f as SendActivityOptionsForCollection, ft as NormalizedCircuitBreakerOptions, g as CustomCollectionCallbackSetters, gt as ActorDispatcher, h as ConstructorWithTypeId, ht as ActorAliasMapper, i as GetActorOptions, it as CircuitBreakerActivityDrop, j as Rfc6570Expression, jt as ObjectDispatcher, k as ObjectCallbackSetters, kt as NodeInfoDispatcher, l as RequestContext, lt as CircuitBreakerOptions, m as CollectionCallbackSetters, mt as parseCircuitBreakerKvState, n as Context, nt as ParallelMessageQueue, o as InboxContext, ot as CircuitBreakerCreateOptions, p as ActorCallbackSetters, pt as normalizeCircuitBreakerOptions, q as RespondWithObjectOptions, r as ForwardActivityOptions, rt as CircuitBreaker, s as OutboxContext, st as CircuitBreakerFailurePolicy, t as ActorKeyPair, tt as MessageQueueListenOptions, u as RouteActivityOptions, ut as CircuitBreakerState, v as Federation, vt as ActorKeyPairsDispatcher, w as IdempotencyKeyCallback, wt as CustomCollectionCursor, x as FederationFetchOptions, xt as CollectionCursor, y as FederationBenchmarkOptions, yt as AuthorizePredicate, z as TaskDefinitionOptions, zt as WebFingerLinksDispatcher } from "../context-DiiCt4S7.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-
|
|
4
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "../mod-CSH1Ee-I.js";
|
|
5
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, GetSignedKeyOptions, 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, 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 respondWithObject, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as SendActivityError, l as CircuitBreaker, n as handleWebFinger, o as respondWithObjectIfAcceptable, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "../middleware-
|
|
3
|
+
import { a as respondWithObject, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as SendActivityError, l as CircuitBreaker, n as handleWebFinger, o as respondWithObjectIfAcceptable, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "../middleware-CF539vn2.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";
|
|
@@ -10,10 +10,10 @@ import { t as assertNotEquals } from "../assert_not_equals-BN7yDMWe.mjs";
|
|
|
10
10
|
import "../std__assert-CxFT0MNt.mjs";
|
|
11
11
|
import { t as assertRejects } from "../assert_rejects-wFbSPn1O.mjs";
|
|
12
12
|
import { t as assert } from "../assert-CebeUf0C.mjs";
|
|
13
|
-
import { l as verifyRequest } from "../http-
|
|
13
|
+
import { l as verifyRequest } from "../http-DyXZdUng.mjs";
|
|
14
14
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
15
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
16
|
-
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-
|
|
15
|
+
import { t as doesActorOwnKey } from "../owner-DFzwGoyv.mjs";
|
|
16
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-BOXP7DyW.mjs";
|
|
17
17
|
import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
|
|
18
18
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
19
19
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
@@ -2,8 +2,9 @@ import { Temporal } from "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as MemoryKvStore } from "../../kv-DCHkaJ9-.mjs";
|
|
5
|
-
import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, t as MockQueue } from "../../
|
|
6
|
-
import
|
|
5
|
+
import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, t as MockQueue } from "../../tasks-dbCShlCb.mjs";
|
|
6
|
+
import "../../testing-hbky2gMN.mjs";
|
|
7
|
+
import { o as createFederation } from "../../middleware-DB_evWhA.mjs";
|
|
7
8
|
import { n as ParallelMessageQueue } from "../../mq-Dm1Wmtm-.mjs";
|
|
8
9
|
import { configure, reset } from "@logtape/logtape";
|
|
9
10
|
import { delay } from "es-toolkit";
|
|
@@ -2,9 +2,10 @@ import { Temporal } from "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as MemoryKvStore } from "../../kv-DCHkaJ9-.mjs";
|
|
5
|
-
import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, t as MockQueue } from "../../
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
5
|
+
import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, t as MockQueue } from "../../tasks-dbCShlCb.mjs";
|
|
6
|
+
import "../../testing-hbky2gMN.mjs";
|
|
7
|
+
import { o as createFederation } from "../../middleware-DB_evWhA.mjs";
|
|
8
|
+
import { r as createFederationBuilder } from "../../builder-sMkz-MdT.mjs";
|
|
8
9
|
import { t as TaskCodec } from "../../codec-C6rTrpIp.mjs";
|
|
9
10
|
import { t as InProcessMessageQueue } from "../../mq-Dm1Wmtm-.mjs";
|
|
10
11
|
import { W3CTraceContextPropagator } from "@opentelemetry/core";
|
|
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertFalse } from "../assert_false-3pLLLsO4.mjs";
|
|
5
5
|
import "../std__assert-CxFT0MNt.mjs";
|
|
6
6
|
import { t as assert } from "../assert-CebeUf0C.mjs";
|
|
7
|
-
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-
|
|
7
|
+
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-D6yzxQ23.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/federation/temporal.test.ts
|
|
10
10
|
test("hasMalformedKnownTemporalLiteral() detects expanded proof timestamps", async () => {
|
|
@@ -6,7 +6,7 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
|
6
6
|
import { t as assertEquals } from "../assert_equals-CBlRfA-_.mjs";
|
|
7
7
|
import { t as assertNotEquals } from "../assert_not_equals-BN7yDMWe.mjs";
|
|
8
8
|
import "../std__assert-CxFT0MNt.mjs";
|
|
9
|
-
import { o as createFederation, s as handleWebFinger } from "../middleware-
|
|
9
|
+
import { o as createFederation, s as handleWebFinger } from "../middleware-DB_evWhA.mjs";
|
|
10
10
|
import { Image, Link, Person, Tombstone } from "@fedify/vocab";
|
|
11
11
|
import { createTestMeterProvider, test } from "@fedify/fixture";
|
|
12
12
|
//#region src/federation/webfinger.test.ts
|