@fedify/fedify 2.4.0-dev.1959 → 2.4.0-pr.1006.44
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/README.md +2 -0
- package/dist/{builder-sMkz-MdT.mjs → builder-BdcA_1Rt.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-COLwHogJ.d.cts → context-BOnn653X.d.cts} +0 -27
- package/dist/{context-DiiCt4S7.d.ts → context-CmjP-cgJ.d.ts} +0 -27
- package/dist/{deno-Xg7DR4LS.mjs → deno-tSRHKXbU.mjs} +1 -1
- package/dist/{docloader-4YqMWBpt.mjs → docloader-BAO-cgto.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 +4 -30
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +8 -195
- 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 +2 -3
- package/dist/federation/tasks/tasks.test.mjs +3 -4
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-BNJgxgH6.cjs → federation-BzLBT04I.cjs} +13 -32
- package/dist/{http-Bh37_81O.js → http-CcFURGbR.js} +1 -1
- package/dist/{http-DyXZdUng.mjs → http-Cp_Byhf8.mjs} +3 -3
- package/dist/{http-BuOvqNbW.cjs → http-DBbZNv2i.cjs} +1 -1
- package/dist/{key-CXsAkAt6.mjs → key-CEDlSMK7.mjs} +2 -2
- package/dist/{keycache-ZLqIfrkL.mjs → keycache-0Jk78XmB.mjs} +1 -3
- package/dist/{kv-cache-Btl0s7i7.cjs → kv-cache-B-JFZafn.cjs} +1 -1
- package/dist/{kv-cache-BubmP7z9.mjs → kv-cache-C7qYJ4To.mjs} +1 -1
- package/dist/{kv-cache-DjFxdXjk.js → kv-cache-CocB_ME8.js} +1 -1
- package/dist/{ld-C5Qv0_xn.mjs → ld-B8k-089e.mjs} +3 -3
- package/dist/{metrics-B7-JxJSv.mjs → metrics-CIK7ZY_B.mjs} +1 -1
- package/dist/{middleware-DB_evWhA.mjs → middleware--nGmJXXx.mjs} +22 -39
- package/dist/{middleware-CF539vn2.js → middleware-CBO16r56.js} +13 -32
- package/dist/{middleware-BfRUvR8e.mjs → middleware-Dx9byvw-.mjs} +1 -1
- package/dist/{mod-CSH1Ee-I.d.ts → mod-BYuZ0WXt.d.ts} +1 -1
- package/dist/{mod-BZldCEU0.d.cts → mod-kUSY5n3f.d.cts} +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-DFzwGoyv.mjs → owner-Cf55GD32.mjs} +2 -2
- package/dist/{proof-DJGBYtRT.mjs → proof-BAVwiUPt.mjs} +4 -4
- package/dist/{proof-3rlJfM0Z.js → proof-CqV_aPhu.js} +1 -1
- package/dist/{proof-BVpjHUMS.cjs → proof-DSohcbCt.cjs} +1 -1
- package/dist/{send-BOXP7DyW.mjs → send-DL5nBv54.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/{temporal-D6yzxQ23.mjs → temporal-C_3AI99D.mjs} +1 -1
- package/dist/testing/mod.d.mts +1 -70
- package/dist/testing/mod.mjs +2 -4
- package/dist/{tasks-dbCShlCb.mjs → testing-D13ymFKy.mjs} +1 -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
- package/dist/kv-DBRWVx3Q.mjs +0 -104
- package/dist/testing/kv.test.d.mts +0 -2
- package/dist/testing/kv.test.mjs +0 -101
- package/dist/testing-hbky2gMN.mjs +0 -8
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-Dmm3t92W.cjs");
|
|
3
3
|
const require_transformers = require("./transformers-BalCrSsr.cjs");
|
|
4
|
-
const require_http = require("./http-
|
|
5
|
-
const require_proof = require("./proof-
|
|
4
|
+
const require_http = require("./http-DBbZNv2i.cjs");
|
|
5
|
+
const require_proof = require("./proof-DSohcbCt.cjs");
|
|
6
6
|
const require_types = require("./types-RXm5YxpC.cjs");
|
|
7
|
-
const require_kv_cache = require("./kv-cache-
|
|
7
|
+
const require_kv_cache = require("./kv-cache-B-JFZafn.cjs");
|
|
8
8
|
let _logtape_logtape = require("@logtape/logtape");
|
|
9
9
|
let _fedify_uri_template = require("@fedify/uri-template");
|
|
10
10
|
let _fedify_vocab = require("@fedify/vocab");
|
|
@@ -1463,14 +1463,12 @@ var KvKeyCache = class {
|
|
|
1463
1463
|
prefix;
|
|
1464
1464
|
options;
|
|
1465
1465
|
unavailableKeyTtl;
|
|
1466
|
-
keyTtl;
|
|
1467
1466
|
nullKeys;
|
|
1468
1467
|
constructor(kv, prefix, options = {}) {
|
|
1469
1468
|
this.kv = kv;
|
|
1470
1469
|
this.prefix = prefix;
|
|
1471
1470
|
this.options = options;
|
|
1472
1471
|
this.unavailableKeyTtl = options.unavailableKeyTtl ?? Temporal$8.Duration.from({ minutes: 10 });
|
|
1473
|
-
this.keyTtl = options.keyTtl ?? Temporal$8.Duration.from({ days: 30 });
|
|
1474
1472
|
this.nullKeys = /* @__PURE__ */ new Map();
|
|
1475
1473
|
}
|
|
1476
1474
|
#getFetchErrorKey(keyId) {
|
|
@@ -1511,7 +1509,7 @@ var KvKeyCache = class {
|
|
|
1511
1509
|
}
|
|
1512
1510
|
this.nullKeys.delete(keyId.href);
|
|
1513
1511
|
const serialized = await key.toJsonLd(this.options);
|
|
1514
|
-
await this.kv.set([...this.prefix, keyId.href], serialized
|
|
1512
|
+
await this.kv.set([...this.prefix, keyId.href], serialized);
|
|
1515
1513
|
}
|
|
1516
1514
|
async getFetchError(keyId) {
|
|
1517
1515
|
const cached = await this.kv.get(this.#getFetchErrorKey(keyId));
|
|
@@ -2469,7 +2467,7 @@ async function handleInbox(request, options) {
|
|
|
2469
2467
|
* @returns A promise that resolves to an HTTP response.
|
|
2470
2468
|
*/
|
|
2471
2469
|
async function handleInboxInternal(request, parameters, span) {
|
|
2472
|
-
const { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes,
|
|
2470
|
+
const { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, unverifiedActivityHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, inboxChallengePolicy, meterProvider, tracerProvider } = parameters;
|
|
2473
2471
|
const logger = (0, _logtape_logtape.getLogger)([
|
|
2474
2472
|
"fedify",
|
|
2475
2473
|
"federation",
|
|
@@ -2540,12 +2538,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
2540
2538
|
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
2541
2539
|
});
|
|
2542
2540
|
}
|
|
2543
|
-
const keyCache = new KvKeyCache(kv, kvPrefixes.publicKey,
|
|
2544
|
-
documentLoader: ctx.documentLoader,
|
|
2545
|
-
contextLoader: ctx.contextLoader,
|
|
2546
|
-
tracerProvider,
|
|
2547
|
-
keyTtl: publicKeyTtl
|
|
2548
|
-
});
|
|
2541
|
+
const keyCache = new KvKeyCache(kv, kvPrefixes.publicKey, ctx);
|
|
2549
2542
|
const jsonWithoutSig = require_proof.detachSignature(json);
|
|
2550
2543
|
const hasLdSignature = require_proof.hasSignature(json);
|
|
2551
2544
|
const canAttemptAlternateAuthAfterLdSignatureFailure = skipSignatureVerification || hasHttpSignatureHeaders(request) || hasObjectIntegrityProof(jsonWithoutSig);
|
|
@@ -4770,8 +4763,6 @@ function createFederation(options) {
|
|
|
4770
4763
|
var FederationImpl = class extends FederationBuilderImpl {
|
|
4771
4764
|
kv;
|
|
4772
4765
|
kvPrefixes;
|
|
4773
|
-
publicKeyTtl;
|
|
4774
|
-
httpMessageSignaturesSpecTtl;
|
|
4775
4766
|
inboxQueue;
|
|
4776
4767
|
outboxQueue;
|
|
4777
4768
|
fanoutQueue;
|
|
@@ -4837,8 +4828,6 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
4837
4828
|
taskDeduplication: ["_fedify", "taskDeduplication"],
|
|
4838
4829
|
...options.kvPrefixes ?? {}
|
|
4839
4830
|
};
|
|
4840
|
-
this.publicKeyTtl = Temporal$2.Duration.from(options.publicKeyTtl ?? { days: 30 });
|
|
4841
|
-
this.httpMessageSignaturesSpecTtl = Temporal$2.Duration.from(options.httpMessageSignaturesSpecTtl ?? { days: 90 });
|
|
4842
4831
|
if (options.queue == null) {
|
|
4843
4832
|
this.inboxQueue = void 0;
|
|
4844
4833
|
this.outboxQueue = void 0;
|
|
@@ -4941,7 +4930,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
4941
4930
|
this.authenticatedDocumentLoaderFactory = (identity, factoryOpts) => require_http.instrumentDocumentLoader(userAuthFactory != null ? userAuthFactory(identity, factoryOpts) : require_kv_cache.getAuthenticatedDocumentLoader(identity, {
|
|
4942
4931
|
allowPrivateAddress: factoryOpts?.allowPrivateAddress ?? allowPrivateAddress,
|
|
4943
4932
|
userAgent: factoryOpts?.userAgent ?? userAgent,
|
|
4944
|
-
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, options.firstKnock
|
|
4933
|
+
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, options.firstKnock),
|
|
4945
4934
|
tracerProvider: this.tracerProvider
|
|
4946
4935
|
}), {
|
|
4947
4936
|
meterProvider: this._meterProvider,
|
|
@@ -5316,7 +5305,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
5316
5305
|
inbox,
|
|
5317
5306
|
sharedInbox: message.sharedInbox,
|
|
5318
5307
|
headers: new Headers(message.headers),
|
|
5319
|
-
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock
|
|
5308
|
+
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock),
|
|
5320
5309
|
meterProvider: this.meterProvider,
|
|
5321
5310
|
tracerProvider: this.tracerProvider
|
|
5322
5311
|
});
|
|
@@ -5937,7 +5926,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
5937
5926
|
inbox: new URL(inbox),
|
|
5938
5927
|
sharedInbox: inboxes[inbox].sharedInbox,
|
|
5939
5928
|
headers: collectionSync == null ? void 0 : new Headers({ "Collection-Synchronization": await buildCollectionSynchronizationHeader(collectionSync, inboxes[inbox].actorIds) }),
|
|
5940
|
-
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock
|
|
5929
|
+
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock),
|
|
5941
5930
|
meterProvider: this.meterProvider,
|
|
5942
5931
|
tracerProvider: this.tracerProvider
|
|
5943
5932
|
}));
|
|
@@ -6250,7 +6239,6 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
6250
6239
|
inboxContextFactory,
|
|
6251
6240
|
kv: this.kv,
|
|
6252
6241
|
kvPrefixes: this.kvPrefixes,
|
|
6253
|
-
publicKeyTtl: this.publicKeyTtl,
|
|
6254
6242
|
queue: this.inboxQueue,
|
|
6255
6243
|
actorDispatcher: this.actorCallbacks?.dispatcher,
|
|
6256
6244
|
inboxListeners: this.inboxListeners,
|
|
@@ -6992,12 +6980,7 @@ var ContextImpl = class ContextImpl {
|
|
|
6992
6980
|
]);
|
|
6993
6981
|
const contextLoader = options.contextLoader ?? this.contextLoader;
|
|
6994
6982
|
const json = await activity.toJsonLd({ contextLoader });
|
|
6995
|
-
const keyCache = new KvKeyCache(this.federation.kv, this.federation.kvPrefixes.publicKey,
|
|
6996
|
-
documentLoader: this.documentLoader,
|
|
6997
|
-
contextLoader: this.contextLoader,
|
|
6998
|
-
tracerProvider: this.tracerProvider,
|
|
6999
|
-
keyTtl: this.federation.publicKeyTtl
|
|
7000
|
-
});
|
|
6983
|
+
const keyCache = new KvKeyCache(this.federation.kv, this.federation.kvPrefixes.publicKey, this);
|
|
7001
6984
|
if (await require_proof.verifyObject(_fedify_vocab.Activity, json, {
|
|
7002
6985
|
contextLoader,
|
|
7003
6986
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
@@ -7272,7 +7255,7 @@ async function forwardActivityInternal(ctx, loggerCategory, forwarder, recipient
|
|
|
7272
7255
|
sharedInbox: inboxes[inbox].sharedInbox,
|
|
7273
7256
|
meterProvider: ctx.meterProvider,
|
|
7274
7257
|
tracerProvider: ctx.tracerProvider,
|
|
7275
|
-
specDeterminer: new KvSpecDeterminer(ctx.federation.kv, ctx.federation.kvPrefixes.httpMessageSignaturesSpec, ctx.federation.firstKnock
|
|
7258
|
+
specDeterminer: new KvSpecDeterminer(ctx.federation.kv, ctx.federation.kvPrefixes.httpMessageSignaturesSpec, ctx.federation.firstKnock)
|
|
7276
7259
|
}));
|
|
7277
7260
|
await Promise.all(promises);
|
|
7278
7261
|
return true;
|
|
@@ -7443,18 +7426,16 @@ var KvSpecDeterminer = class {
|
|
|
7443
7426
|
kv;
|
|
7444
7427
|
prefix;
|
|
7445
7428
|
defaultSpec;
|
|
7446
|
-
|
|
7447
|
-
constructor(kv, prefix, defaultSpec = "rfc9421", options = {}) {
|
|
7429
|
+
constructor(kv, prefix, defaultSpec = "rfc9421") {
|
|
7448
7430
|
this.kv = kv;
|
|
7449
7431
|
this.prefix = prefix;
|
|
7450
7432
|
this.defaultSpec = defaultSpec;
|
|
7451
|
-
this.specTtl = options.specTtl ?? Temporal$2.Duration.from({ days: 90 });
|
|
7452
7433
|
}
|
|
7453
7434
|
async determineSpec(origin) {
|
|
7454
7435
|
return await this.kv.get([...this.prefix, origin]) ?? this.defaultSpec;
|
|
7455
7436
|
}
|
|
7456
7437
|
async rememberSpec(origin, spec) {
|
|
7457
|
-
await this.kv.set([...this.prefix, origin], spec
|
|
7438
|
+
await this.kv.set([...this.prefix, origin], spec);
|
|
7458
7439
|
}
|
|
7459
7440
|
};
|
|
7460
7441
|
function notFound(_request) {
|
|
@@ -10,7 +10,7 @@ import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } fro
|
|
|
10
10
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
11
11
|
//#region deno.json
|
|
12
12
|
var name = "@fedify/fedify";
|
|
13
|
-
var version = "2.4.0-
|
|
13
|
+
var version = "2.4.0-pr.1006.44+7feb05c5";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/sig/accept.ts
|
|
16
16
|
/**
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
4
|
+
import { n as version, t as name } from "./deno-tSRHKXbU.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-CIK7ZY_B.mjs";
|
|
6
6
|
import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-CPVqki78.mjs";
|
|
7
|
-
import { o as validateCryptoKey, r as fetchKeyDetailed } from "./key-
|
|
7
|
+
import { o as validateCryptoKey, r as fetchKeyDetailed } from "./key-CEDlSMK7.mjs";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { CryptographicKey } from "@fedify/vocab";
|
|
10
10
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -9,7 +9,7 @@ let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conve
|
|
|
9
9
|
let byte_encodings_base64 = require("byte-encodings/base64");
|
|
10
10
|
//#region deno.json
|
|
11
11
|
var name = "@fedify/fedify";
|
|
12
|
-
var version = "2.4.0-
|
|
12
|
+
var version = "2.4.0-pr.1006.44+7feb05c5";
|
|
13
13
|
//#endregion
|
|
14
14
|
//#region ../../node_modules/.pnpm/temporal-polyfill@1.0.1/node_modules/temporal-polyfill/chunks/root.js
|
|
15
15
|
const NativeTemporal = globalThis.Temporal;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { _ as recordKeyLookup, n as getDurationMs, t as classifyFetchError } from "./metrics-
|
|
4
|
+
import { n as version, t as name } from "./deno-tSRHKXbU.mjs";
|
|
5
|
+
import { _ as recordKeyLookup, n as getDurationMs, t as classifyFetchError } from "./metrics-CIK7ZY_B.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { CryptographicKey, Multikey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -8,14 +8,12 @@ var KvKeyCache = class {
|
|
|
8
8
|
prefix;
|
|
9
9
|
options;
|
|
10
10
|
unavailableKeyTtl;
|
|
11
|
-
keyTtl;
|
|
12
11
|
nullKeys;
|
|
13
12
|
constructor(kv, prefix, options = {}) {
|
|
14
13
|
this.kv = kv;
|
|
15
14
|
this.prefix = prefix;
|
|
16
15
|
this.options = options;
|
|
17
16
|
this.unavailableKeyTtl = options.unavailableKeyTtl ?? Temporal.Duration.from({ minutes: 10 });
|
|
18
|
-
this.keyTtl = options.keyTtl ?? Temporal.Duration.from({ days: 30 });
|
|
19
17
|
this.nullKeys = /* @__PURE__ */ new Map();
|
|
20
18
|
}
|
|
21
19
|
#getFetchErrorKey(keyId) {
|
|
@@ -56,7 +54,7 @@ var KvKeyCache = class {
|
|
|
56
54
|
}
|
|
57
55
|
this.nullKeys.delete(keyId.href);
|
|
58
56
|
const serialized = await key.toJsonLd(this.options);
|
|
59
|
-
await this.kv.set([...this.prefix, keyId.href], serialized
|
|
57
|
+
await this.kv.set([...this.prefix, keyId.href], serialized);
|
|
60
58
|
}
|
|
61
59
|
async getFetchError(keyId) {
|
|
62
60
|
const cached = await this.kv.get(this.#getFetchErrorKey(keyId));
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
|
-
const require_http = require("./http-
|
|
2
|
+
const require_http = require("./http-DBbZNv2i.cjs");
|
|
3
3
|
let _logtape_logtape = require("@logtape/logtape");
|
|
4
4
|
let es_toolkit = require("es-toolkit");
|
|
5
5
|
let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { p as recordDocumentCache } from "./metrics-
|
|
4
|
+
import { p as recordDocumentCache } from "./metrics-CIK7ZY_B.mjs";
|
|
5
5
|
import { getLogger } from "@logtape/logtape";
|
|
6
6
|
import { preloadedContexts } from "@fedify/vocab-runtime";
|
|
7
7
|
//#region src/utils/kv-cache.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { C as recordDocumentCache, d as validateCryptoKey, t as doubleKnock } from "./http-
|
|
3
|
+
import { C as recordDocumentCache, d as validateCryptoKey, t as doubleKnock } from "./http-CcFURGbR.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { curry } from "es-toolkit";
|
|
6
6
|
import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
6
|
-
import { n as fetchKey, o as validateCryptoKey } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-tSRHKXbU.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-CIK7ZY_B.mjs";
|
|
6
|
+
import { n as fetchKey, o as validateCryptoKey } from "./key-CEDlSMK7.mjs";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
|
|
9
9
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -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-tSRHKXbU.mjs";
|
|
5
5
|
import { metrics } from "@opentelemetry/api";
|
|
6
6
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
7
7
|
//#region src/federation/metrics.ts
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, n as getDurationMs, o as isAbortError, r as getFederationMetrics, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "./metrics-
|
|
4
|
+
import { n as version, t as name } from "./deno-tSRHKXbU.mjs";
|
|
5
|
+
import { a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, n as getDurationMs, o as isAbortError, r as getFederationMetrics, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "./metrics-CIK7ZY_B.mjs";
|
|
6
6
|
import { t as formatAcceptSignature } from "./accept-CPVqki78.mjs";
|
|
7
|
-
import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-
|
|
8
|
-
import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-
|
|
9
|
-
import { t as getAuthenticatedDocumentLoader } from "./docloader-
|
|
10
|
-
import { n as kvCache } from "./kv-cache-
|
|
7
|
+
import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-CEDlSMK7.mjs";
|
|
8
|
+
import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-Cp_Byhf8.mjs";
|
|
9
|
+
import { t as getAuthenticatedDocumentLoader } from "./docloader-BAO-cgto.mjs";
|
|
10
|
+
import { n as kvCache } from "./kv-cache-C7qYJ4To.mjs";
|
|
11
|
+
import { _ as wrapContextLoaderForJsonLd, a as compactJsonLd, c as getNormalizationContextLoader, d as isClearlyMalformedContextReference, f as isInvalidUrlTypeError, l as hasSignature, m as verifyCompactJsonLd, p as signJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as hasSignatureLike } from "./ld-B8k-089e.mjs";
|
|
12
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-Cf55GD32.mjs";
|
|
11
13
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-B5Ne7JoL.mjs";
|
|
14
|
+
import { i as verifyObject, n as hasProofLike, r as signObject } from "./proof-BAVwiUPt.mjs";
|
|
12
15
|
import { t as getNodeInfo } from "./client-CtxvmazV.mjs";
|
|
13
16
|
import { t as nodeInfoToJson } from "./types-DE_LV1JB.mjs";
|
|
14
|
-
import {
|
|
15
|
-
import { n as
|
|
16
|
-
import { i as verifyObject, n as hasProofLike, r as signObject } from "./proof-DJGBYtRT.mjs";
|
|
17
|
-
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-BOXP7DyW.mjs";
|
|
18
|
-
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-sMkz-MdT.mjs";
|
|
17
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-DL5nBv54.mjs";
|
|
18
|
+
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-BdcA_1Rt.mjs";
|
|
19
19
|
import { t as CircuitBreaker } from "./circuit-breaker-C5NqoLBJ.mjs";
|
|
20
20
|
import { t as buildCollectionSynchronizationHeader } from "./collection-CnnP1UAv.mjs";
|
|
21
|
-
import { t as KvKeyCache } from "./keycache-
|
|
21
|
+
import { t as KvKeyCache } from "./keycache-0Jk78XmB.mjs";
|
|
22
22
|
import { t as acceptsJsonLd } from "./negotiation-CCocWT_N.mjs";
|
|
23
|
-
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-
|
|
23
|
+
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-C_3AI99D.mjs";
|
|
24
24
|
import { t as createExponentialBackoffPolicy } from "./retry-zX5xw5e0.mjs";
|
|
25
25
|
import { t as TaskCodec } from "./codec-C6rTrpIp.mjs";
|
|
26
26
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
@@ -1246,7 +1246,7 @@ async function handleInbox(request, options) {
|
|
|
1246
1246
|
* @returns A promise that resolves to an HTTP response.
|
|
1247
1247
|
*/
|
|
1248
1248
|
async function handleInboxInternal(request, parameters, span) {
|
|
1249
|
-
const { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes,
|
|
1249
|
+
const { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, unverifiedActivityHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, inboxChallengePolicy, meterProvider, tracerProvider } = parameters;
|
|
1250
1250
|
const logger = getLogger([
|
|
1251
1251
|
"fedify",
|
|
1252
1252
|
"federation",
|
|
@@ -1317,12 +1317,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1317
1317
|
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
1318
1318
|
});
|
|
1319
1319
|
}
|
|
1320
|
-
const keyCache = new KvKeyCache(kv, kvPrefixes.publicKey,
|
|
1321
|
-
documentLoader: ctx.documentLoader,
|
|
1322
|
-
contextLoader: ctx.contextLoader,
|
|
1323
|
-
tracerProvider,
|
|
1324
|
-
keyTtl: publicKeyTtl
|
|
1325
|
-
});
|
|
1320
|
+
const keyCache = new KvKeyCache(kv, kvPrefixes.publicKey, ctx);
|
|
1326
1321
|
const jsonWithoutSig = detachSignature(json);
|
|
1327
1322
|
const hasLdSignature = hasSignature(json);
|
|
1328
1323
|
const canAttemptAlternateAuthAfterLdSignatureFailure = skipSignatureVerification || hasHttpSignatureHeaders(request) || hasObjectIntegrityProof(jsonWithoutSig);
|
|
@@ -2818,8 +2813,6 @@ function createFederation(options) {
|
|
|
2818
2813
|
var FederationImpl = class extends FederationBuilderImpl {
|
|
2819
2814
|
kv;
|
|
2820
2815
|
kvPrefixes;
|
|
2821
|
-
publicKeyTtl;
|
|
2822
|
-
httpMessageSignaturesSpecTtl;
|
|
2823
2816
|
inboxQueue;
|
|
2824
2817
|
outboxQueue;
|
|
2825
2818
|
fanoutQueue;
|
|
@@ -2885,8 +2878,6 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2885
2878
|
taskDeduplication: ["_fedify", "taskDeduplication"],
|
|
2886
2879
|
...options.kvPrefixes ?? {}
|
|
2887
2880
|
};
|
|
2888
|
-
this.publicKeyTtl = Temporal.Duration.from(options.publicKeyTtl ?? { days: 30 });
|
|
2889
|
-
this.httpMessageSignaturesSpecTtl = Temporal.Duration.from(options.httpMessageSignaturesSpecTtl ?? { days: 90 });
|
|
2890
2881
|
if (options.queue == null) {
|
|
2891
2882
|
this.inboxQueue = void 0;
|
|
2892
2883
|
this.outboxQueue = void 0;
|
|
@@ -2989,7 +2980,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2989
2980
|
this.authenticatedDocumentLoaderFactory = (identity, factoryOpts) => instrumentDocumentLoader(userAuthFactory != null ? userAuthFactory(identity, factoryOpts) : getAuthenticatedDocumentLoader(identity, {
|
|
2990
2981
|
allowPrivateAddress: factoryOpts?.allowPrivateAddress ?? allowPrivateAddress,
|
|
2991
2982
|
userAgent: factoryOpts?.userAgent ?? userAgent,
|
|
2992
|
-
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, options.firstKnock
|
|
2983
|
+
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, options.firstKnock),
|
|
2993
2984
|
tracerProvider: this.tracerProvider
|
|
2994
2985
|
}), {
|
|
2995
2986
|
meterProvider: this._meterProvider,
|
|
@@ -3364,7 +3355,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3364
3355
|
inbox,
|
|
3365
3356
|
sharedInbox: message.sharedInbox,
|
|
3366
3357
|
headers: new Headers(message.headers),
|
|
3367
|
-
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock
|
|
3358
|
+
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock),
|
|
3368
3359
|
meterProvider: this.meterProvider,
|
|
3369
3360
|
tracerProvider: this.tracerProvider
|
|
3370
3361
|
});
|
|
@@ -3985,7 +3976,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
3985
3976
|
inbox: new URL(inbox),
|
|
3986
3977
|
sharedInbox: inboxes[inbox].sharedInbox,
|
|
3987
3978
|
headers: collectionSync == null ? void 0 : new Headers({ "Collection-Synchronization": await buildCollectionSynchronizationHeader(collectionSync, inboxes[inbox].actorIds) }),
|
|
3988
|
-
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock
|
|
3979
|
+
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock),
|
|
3989
3980
|
meterProvider: this.meterProvider,
|
|
3990
3981
|
tracerProvider: this.tracerProvider
|
|
3991
3982
|
}));
|
|
@@ -4298,7 +4289,6 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
4298
4289
|
inboxContextFactory,
|
|
4299
4290
|
kv: this.kv,
|
|
4300
4291
|
kvPrefixes: this.kvPrefixes,
|
|
4301
|
-
publicKeyTtl: this.publicKeyTtl,
|
|
4302
4292
|
queue: this.inboxQueue,
|
|
4303
4293
|
actorDispatcher: this.actorCallbacks?.dispatcher,
|
|
4304
4294
|
inboxListeners: this.inboxListeners,
|
|
@@ -5040,12 +5030,7 @@ var ContextImpl = class ContextImpl {
|
|
|
5040
5030
|
]);
|
|
5041
5031
|
const contextLoader = options.contextLoader ?? this.contextLoader;
|
|
5042
5032
|
const json = await activity.toJsonLd({ contextLoader });
|
|
5043
|
-
const keyCache = new KvKeyCache(this.federation.kv, this.federation.kvPrefixes.publicKey,
|
|
5044
|
-
documentLoader: this.documentLoader,
|
|
5045
|
-
contextLoader: this.contextLoader,
|
|
5046
|
-
tracerProvider: this.tracerProvider,
|
|
5047
|
-
keyTtl: this.federation.publicKeyTtl
|
|
5048
|
-
});
|
|
5033
|
+
const keyCache = new KvKeyCache(this.federation.kv, this.federation.kvPrefixes.publicKey, this);
|
|
5049
5034
|
if (await verifyObject(Activity, json, {
|
|
5050
5035
|
contextLoader,
|
|
5051
5036
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
@@ -5320,7 +5305,7 @@ async function forwardActivityInternal(ctx, loggerCategory, forwarder, recipient
|
|
|
5320
5305
|
sharedInbox: inboxes[inbox].sharedInbox,
|
|
5321
5306
|
meterProvider: ctx.meterProvider,
|
|
5322
5307
|
tracerProvider: ctx.tracerProvider,
|
|
5323
|
-
specDeterminer: new KvSpecDeterminer(ctx.federation.kv, ctx.federation.kvPrefixes.httpMessageSignaturesSpec, ctx.federation.firstKnock
|
|
5308
|
+
specDeterminer: new KvSpecDeterminer(ctx.federation.kv, ctx.federation.kvPrefixes.httpMessageSignaturesSpec, ctx.federation.firstKnock)
|
|
5324
5309
|
}));
|
|
5325
5310
|
await Promise.all(promises);
|
|
5326
5311
|
return true;
|
|
@@ -5491,18 +5476,16 @@ var KvSpecDeterminer = class {
|
|
|
5491
5476
|
kv;
|
|
5492
5477
|
prefix;
|
|
5493
5478
|
defaultSpec;
|
|
5494
|
-
|
|
5495
|
-
constructor(kv, prefix, defaultSpec = "rfc9421", options = {}) {
|
|
5479
|
+
constructor(kv, prefix, defaultSpec = "rfc9421") {
|
|
5496
5480
|
this.kv = kv;
|
|
5497
5481
|
this.prefix = prefix;
|
|
5498
5482
|
this.defaultSpec = defaultSpec;
|
|
5499
|
-
this.specTtl = options.specTtl ?? Temporal.Duration.from({ days: 90 });
|
|
5500
5483
|
}
|
|
5501
5484
|
async determineSpec(origin) {
|
|
5502
5485
|
return await this.kv.get([...this.prefix, origin]) ?? this.defaultSpec;
|
|
5503
5486
|
}
|
|
5504
5487
|
async rememberSpec(origin, spec) {
|
|
5505
|
-
await this.kv.set([...this.prefix, origin], spec
|
|
5488
|
+
await this.kv.set([...this.prefix, origin], spec);
|
|
5506
5489
|
}
|
|
5507
5490
|
};
|
|
5508
5491
|
function notFound(_request) {
|
|
@@ -2,10 +2,10 @@ import { Temporal } from "temporal-polyfill";
|
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
import { t as __exportAll } from "./rolldown-runtime-BC-Eo5Mj.js";
|
|
4
4
|
import { r as getDefaultActivityTransformers } from "./transformers-DAtXl_Kc.js";
|
|
5
|
-
import { A as formatAcceptSignature, D as recordOutboxEnqueue, E as recordOutboxActivity, F as version, O as recordWebFingerHandle, P as name, S as recordCollectionTotalItems, T as recordInboxActivity, a as verifyRequestDetailed, b as recordCollectionPageItems, d as validateCryptoKey, f as getDurationMs, g as isAbortError, h as instrumentDocumentLoader, i as verifyRequest, k as registerQueueDepthGauge, m as getRemoteHost, n as parseRfc9421SignatureInput, o as exportJwk, p as getFederationMetrics, t as doubleKnock, u as importJwk, v as recordCircuitBreakerStateChange, w as recordFanoutRecipients, x as recordCollectionRequest, y as recordCollectionDispatchDuration } from "./http-
|
|
6
|
-
import { S as verifyCompactJsonLd, T as wrapContextLoaderForJsonLd, _ as hasSignature, b as isInvalidUrlTypeError, c as doesActorOwnKey, d as assertSafeJsonLd, g as getNormalizationContextLoader, h as detachSignature, i as verifyObject, l as getKeyOwner, n as hasProofLike, p as compactJsonLd, r as signObject, s as normalizeOutgoingActivityJsonLd, u as InvalidContextReferenceError, v as hasSignatureLike, x as signJsonLd, y as isClearlyMalformedContextReference } from "./proof-
|
|
5
|
+
import { A as formatAcceptSignature, D as recordOutboxEnqueue, E as recordOutboxActivity, F as version, O as recordWebFingerHandle, P as name, S as recordCollectionTotalItems, T as recordInboxActivity, a as verifyRequestDetailed, b as recordCollectionPageItems, d as validateCryptoKey, f as getDurationMs, g as isAbortError, h as instrumentDocumentLoader, i as verifyRequest, k as registerQueueDepthGauge, m as getRemoteHost, n as parseRfc9421SignatureInput, o as exportJwk, p as getFederationMetrics, t as doubleKnock, u as importJwk, v as recordCircuitBreakerStateChange, w as recordFanoutRecipients, x as recordCollectionRequest, y as recordCollectionDispatchDuration } from "./http-CcFURGbR.js";
|
|
6
|
+
import { S as verifyCompactJsonLd, T as wrapContextLoaderForJsonLd, _ as hasSignature, b as isInvalidUrlTypeError, c as doesActorOwnKey, d as assertSafeJsonLd, g as getNormalizationContextLoader, h as detachSignature, i as verifyObject, l as getKeyOwner, n as hasProofLike, p as compactJsonLd, r as signObject, s as normalizeOutgoingActivityJsonLd, u as InvalidContextReferenceError, v as hasSignatureLike, x as signJsonLd, y as isClearlyMalformedContextReference } from "./proof-CqV_aPhu.js";
|
|
7
7
|
import { n as getNodeInfo, t as nodeInfoToJson } from "./types-Dtyf8lVj.js";
|
|
8
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
8
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-CocB_ME8.js";
|
|
9
9
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
10
10
|
import { Router, RouterError, assertPath } from "@fedify/uri-template";
|
|
11
11
|
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, Tombstone, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
@@ -1460,14 +1460,12 @@ var KvKeyCache = class {
|
|
|
1460
1460
|
prefix;
|
|
1461
1461
|
options;
|
|
1462
1462
|
unavailableKeyTtl;
|
|
1463
|
-
keyTtl;
|
|
1464
1463
|
nullKeys;
|
|
1465
1464
|
constructor(kv, prefix, options = {}) {
|
|
1466
1465
|
this.kv = kv;
|
|
1467
1466
|
this.prefix = prefix;
|
|
1468
1467
|
this.options = options;
|
|
1469
1468
|
this.unavailableKeyTtl = options.unavailableKeyTtl ?? Temporal.Duration.from({ minutes: 10 });
|
|
1470
|
-
this.keyTtl = options.keyTtl ?? Temporal.Duration.from({ days: 30 });
|
|
1471
1469
|
this.nullKeys = /* @__PURE__ */ new Map();
|
|
1472
1470
|
}
|
|
1473
1471
|
#getFetchErrorKey(keyId) {
|
|
@@ -1508,7 +1506,7 @@ var KvKeyCache = class {
|
|
|
1508
1506
|
}
|
|
1509
1507
|
this.nullKeys.delete(keyId.href);
|
|
1510
1508
|
const serialized = await key.toJsonLd(this.options);
|
|
1511
|
-
await this.kv.set([...this.prefix, keyId.href], serialized
|
|
1509
|
+
await this.kv.set([...this.prefix, keyId.href], serialized);
|
|
1512
1510
|
}
|
|
1513
1511
|
async getFetchError(keyId) {
|
|
1514
1512
|
const cached = await this.kv.get(this.#getFetchErrorKey(keyId));
|
|
@@ -2464,7 +2462,7 @@ async function handleInbox(request, options) {
|
|
|
2464
2462
|
* @returns A promise that resolves to an HTTP response.
|
|
2465
2463
|
*/
|
|
2466
2464
|
async function handleInboxInternal(request, parameters, span) {
|
|
2467
|
-
const { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes,
|
|
2465
|
+
const { recipient, context: ctx, inboxContextFactory, kv, kvPrefixes, queue, actorDispatcher, inboxListeners, inboxErrorHandler, unverifiedActivityHandler, onNotFound, signatureTimeWindow, skipSignatureVerification, inboxChallengePolicy, meterProvider, tracerProvider } = parameters;
|
|
2468
2466
|
const logger = getLogger([
|
|
2469
2467
|
"fedify",
|
|
2470
2468
|
"federation",
|
|
@@ -2535,12 +2533,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
2535
2533
|
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
2536
2534
|
});
|
|
2537
2535
|
}
|
|
2538
|
-
const keyCache = new KvKeyCache(kv, kvPrefixes.publicKey,
|
|
2539
|
-
documentLoader: ctx.documentLoader,
|
|
2540
|
-
contextLoader: ctx.contextLoader,
|
|
2541
|
-
tracerProvider,
|
|
2542
|
-
keyTtl: publicKeyTtl
|
|
2543
|
-
});
|
|
2536
|
+
const keyCache = new KvKeyCache(kv, kvPrefixes.publicKey, ctx);
|
|
2544
2537
|
const jsonWithoutSig = detachSignature(json);
|
|
2545
2538
|
const hasLdSignature = hasSignature(json);
|
|
2546
2539
|
const canAttemptAlternateAuthAfterLdSignatureFailure = skipSignatureVerification || hasHttpSignatureHeaders(request) || hasObjectIntegrityProof(jsonWithoutSig);
|
|
@@ -4674,8 +4667,6 @@ function createFederation(options) {
|
|
|
4674
4667
|
var FederationImpl = class extends FederationBuilderImpl {
|
|
4675
4668
|
kv;
|
|
4676
4669
|
kvPrefixes;
|
|
4677
|
-
publicKeyTtl;
|
|
4678
|
-
httpMessageSignaturesSpecTtl;
|
|
4679
4670
|
inboxQueue;
|
|
4680
4671
|
outboxQueue;
|
|
4681
4672
|
fanoutQueue;
|
|
@@ -4741,8 +4732,6 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
4741
4732
|
taskDeduplication: ["_fedify", "taskDeduplication"],
|
|
4742
4733
|
...options.kvPrefixes ?? {}
|
|
4743
4734
|
};
|
|
4744
|
-
this.publicKeyTtl = Temporal.Duration.from(options.publicKeyTtl ?? { days: 30 });
|
|
4745
|
-
this.httpMessageSignaturesSpecTtl = Temporal.Duration.from(options.httpMessageSignaturesSpecTtl ?? { days: 90 });
|
|
4746
4735
|
if (options.queue == null) {
|
|
4747
4736
|
this.inboxQueue = void 0;
|
|
4748
4737
|
this.outboxQueue = void 0;
|
|
@@ -4845,7 +4834,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
4845
4834
|
this.authenticatedDocumentLoaderFactory = (identity, factoryOpts) => instrumentDocumentLoader(userAuthFactory != null ? userAuthFactory(identity, factoryOpts) : getAuthenticatedDocumentLoader(identity, {
|
|
4846
4835
|
allowPrivateAddress: factoryOpts?.allowPrivateAddress ?? allowPrivateAddress,
|
|
4847
4836
|
userAgent: factoryOpts?.userAgent ?? userAgent,
|
|
4848
|
-
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, options.firstKnock
|
|
4837
|
+
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, options.firstKnock),
|
|
4849
4838
|
tracerProvider: this.tracerProvider
|
|
4850
4839
|
}), {
|
|
4851
4840
|
meterProvider: this._meterProvider,
|
|
@@ -5220,7 +5209,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
5220
5209
|
inbox,
|
|
5221
5210
|
sharedInbox: message.sharedInbox,
|
|
5222
5211
|
headers: new Headers(message.headers),
|
|
5223
|
-
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock
|
|
5212
|
+
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock),
|
|
5224
5213
|
meterProvider: this.meterProvider,
|
|
5225
5214
|
tracerProvider: this.tracerProvider
|
|
5226
5215
|
});
|
|
@@ -5841,7 +5830,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
5841
5830
|
inbox: new URL(inbox),
|
|
5842
5831
|
sharedInbox: inboxes[inbox].sharedInbox,
|
|
5843
5832
|
headers: collectionSync == null ? void 0 : new Headers({ "Collection-Synchronization": await buildCollectionSynchronizationHeader(collectionSync, inboxes[inbox].actorIds) }),
|
|
5844
|
-
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock
|
|
5833
|
+
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, this.firstKnock),
|
|
5845
5834
|
meterProvider: this.meterProvider,
|
|
5846
5835
|
tracerProvider: this.tracerProvider
|
|
5847
5836
|
}));
|
|
@@ -6154,7 +6143,6 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
6154
6143
|
inboxContextFactory,
|
|
6155
6144
|
kv: this.kv,
|
|
6156
6145
|
kvPrefixes: this.kvPrefixes,
|
|
6157
|
-
publicKeyTtl: this.publicKeyTtl,
|
|
6158
6146
|
queue: this.inboxQueue,
|
|
6159
6147
|
actorDispatcher: this.actorCallbacks?.dispatcher,
|
|
6160
6148
|
inboxListeners: this.inboxListeners,
|
|
@@ -6896,12 +6884,7 @@ var ContextImpl = class ContextImpl {
|
|
|
6896
6884
|
]);
|
|
6897
6885
|
const contextLoader = options.contextLoader ?? this.contextLoader;
|
|
6898
6886
|
const json = await activity.toJsonLd({ contextLoader });
|
|
6899
|
-
const keyCache = new KvKeyCache(this.federation.kv, this.federation.kvPrefixes.publicKey,
|
|
6900
|
-
documentLoader: this.documentLoader,
|
|
6901
|
-
contextLoader: this.contextLoader,
|
|
6902
|
-
tracerProvider: this.tracerProvider,
|
|
6903
|
-
keyTtl: this.federation.publicKeyTtl
|
|
6904
|
-
});
|
|
6887
|
+
const keyCache = new KvKeyCache(this.federation.kv, this.federation.kvPrefixes.publicKey, this);
|
|
6905
6888
|
if (await verifyObject(Activity, json, {
|
|
6906
6889
|
contextLoader,
|
|
6907
6890
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
@@ -7176,7 +7159,7 @@ async function forwardActivityInternal(ctx, loggerCategory, forwarder, recipient
|
|
|
7176
7159
|
sharedInbox: inboxes[inbox].sharedInbox,
|
|
7177
7160
|
meterProvider: ctx.meterProvider,
|
|
7178
7161
|
tracerProvider: ctx.tracerProvider,
|
|
7179
|
-
specDeterminer: new KvSpecDeterminer(ctx.federation.kv, ctx.federation.kvPrefixes.httpMessageSignaturesSpec, ctx.federation.firstKnock
|
|
7162
|
+
specDeterminer: new KvSpecDeterminer(ctx.federation.kv, ctx.federation.kvPrefixes.httpMessageSignaturesSpec, ctx.federation.firstKnock)
|
|
7180
7163
|
}));
|
|
7181
7164
|
await Promise.all(promises);
|
|
7182
7165
|
return true;
|
|
@@ -7347,18 +7330,16 @@ var KvSpecDeterminer = class {
|
|
|
7347
7330
|
kv;
|
|
7348
7331
|
prefix;
|
|
7349
7332
|
defaultSpec;
|
|
7350
|
-
|
|
7351
|
-
constructor(kv, prefix, defaultSpec = "rfc9421", options = {}) {
|
|
7333
|
+
constructor(kv, prefix, defaultSpec = "rfc9421") {
|
|
7352
7334
|
this.kv = kv;
|
|
7353
7335
|
this.prefix = prefix;
|
|
7354
7336
|
this.defaultSpec = defaultSpec;
|
|
7355
|
-
this.specTtl = options.specTtl ?? Temporal.Duration.from({ days: 90 });
|
|
7356
7337
|
}
|
|
7357
7338
|
async determineSpec(origin) {
|
|
7358
7339
|
return await this.kv.get([...this.prefix, origin]) ?? this.defaultSpec;
|
|
7359
7340
|
}
|
|
7360
7341
|
async rememberSpec(origin, spec) {
|
|
7361
|
-
await this.kv.set([...this.prefix, origin], spec
|
|
7342
|
+
await this.kv.set([...this.prefix, origin], spec);
|
|
7362
7343
|
}
|
|
7363
7344
|
};
|
|
7364
7345
|
function notFound(_request) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { _t as ActorHandleMapper, gt as ActorDispatcher, ht as ActorAliasMapper, l as RequestContext, zt as WebFingerLinksDispatcher } from "./context-
|
|
2
|
+
import { _t as ActorHandleMapper, gt as ActorDispatcher, ht as ActorAliasMapper, l as RequestContext, zt as WebFingerLinksDispatcher } from "./context-CmjP-cgJ.js";
|
|
3
3
|
import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
|
|
4
4
|
import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { _t as ActorHandleMapper, gt as ActorDispatcher, ht as ActorAliasMapper, l as RequestContext, zt as WebFingerLinksDispatcher } from "./context-
|
|
2
|
+
import { _t as ActorHandleMapper, gt as ActorDispatcher, ht as ActorAliasMapper, l as RequestContext, zt as WebFingerLinksDispatcher } from "./context-BOnn653X.cjs";
|
|
3
3
|
import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
|
|
4
4
|
import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
|
|
5
5
|
|
package/dist/mod.cjs
CHANGED
|
@@ -3,11 +3,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
require("./rolldown-runtime-Dmm3t92W.cjs");
|
|
4
4
|
const require_transformers = require("./transformers-BalCrSsr.cjs");
|
|
5
5
|
require("./compat/mod.cjs");
|
|
6
|
-
const require_http = require("./http-
|
|
7
|
-
const require_federation = require("./federation-
|
|
8
|
-
const require_proof = require("./proof-
|
|
6
|
+
const require_http = require("./http-DBbZNv2i.cjs");
|
|
7
|
+
const require_federation = require("./federation-BzLBT04I.cjs");
|
|
8
|
+
const require_proof = require("./proof-DSohcbCt.cjs");
|
|
9
9
|
const require_types = require("./types-RXm5YxpC.cjs");
|
|
10
|
-
const require_kv_cache = require("./kv-cache-
|
|
10
|
+
const require_kv_cache = require("./kv-cache-B-JFZafn.cjs");
|
|
11
11
|
require("./nodeinfo/mod.cjs");
|
|
12
12
|
require("./runtime/mod.cjs");
|
|
13
13
|
require("./sig/mod.cjs");
|