@fedify/fedify 2.4.0-dev.2065 → 2.4.0-dev.2071
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-CMkrnYbY.mjs → builder-DVQ0yhKJ.mjs} +6 -2
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-Dj3DCsoj.mjs → compound-proof-KmXDfWFp.mjs} +1 -1
- package/dist/{context-b36TpPoG.d.cts → context-DijrgHDe.d.cts} +45 -2
- package/dist/{context-D_gg4M0n.d.ts → context-DsB9kF6q.d.ts} +45 -2
- package/dist/{deno-BuRFI7wk.mjs → deno-B-NtYZVW.mjs} +1 -1
- package/dist/{docloader-_aSNLA90.mjs → docloader-C6yOVoaF.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +4 -4
- package/dist/federation/handler-compound-proof.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +5 -5
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +8 -8
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +1 -1
- package/dist/federation/outgoing-proof.test.mjs +6 -6
- package/dist/federation/portable-gateway-keys.test.d.mts +2 -0
- package/dist/federation/portable-gateway-keys.test.mjs +363 -0
- package/dist/federation/portable.test.mjs +3 -3
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/tasks/enqueue.test.mjs +1 -1
- package/dist/federation/tasks/tasks.test.mjs +2 -2
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-Coi_bg12.cjs → federation-CUiHc7dP.cjs} +182 -76
- package/dist/http-BoWBwC0g.js +5087 -0
- package/dist/{http-BGShIsd6.cjs → http-CuLWIJdf.cjs} +2684 -48
- package/dist/{http-f1qaBtOh.mjs → http-DKWi8RjI.mjs} +20 -5
- package/dist/{http-65PYi9jY.d.ts → http-n2v6DPxu.d.ts} +52 -2
- package/dist/{http-CP-7OdSq.d.cts → http-xlG-jRdB.d.cts} +52 -2
- package/dist/{key-BxHsA1s9.mjs → key-lfcx_NaE.mjs} +147 -7
- package/dist/{kv-cache-Cgj-kpQS.js → kv-cache-BdnmnAVc.js} +1 -1
- package/dist/{kv-cache-CY6pDNoS.cjs → kv-cache-DE8kSNQU.cjs} +1 -1
- package/dist/{kv-cache-C9IY-FMN.mjs → kv-cache-d8EjO29d.mjs} +1 -1
- package/dist/{ld-CqJq5erX.mjs → ld-jyjdrWjG.mjs} +3 -3
- package/dist/{metrics-DOqknlZd.mjs → metrics-B5Rei-HC.mjs} +1 -1
- package/dist/{middleware-1h_LgwXC.js → middleware-CAObohey.js} +149 -43
- package/dist/{middleware-s-AZzx4r.mjs → middleware-CPx4ZWwt.mjs} +155 -53
- package/dist/{middleware-VOCZN3SO.mjs → middleware-CdVnCDXD.mjs} +1 -1
- package/dist/{mod-Dhm7SqyE.d.ts → mod-C9WSpZWm.d.ts} +1 -1
- package/dist/{mod-C0BYc0OU.d.ts → mod-CVZrXSdm.d.ts} +1 -1
- package/dist/{mod-BhMvsgdF.d.ts → mod-DMkflQdF.d.ts} +1 -1
- package/dist/{mod-Bfenkg_c.d.cts → mod-DTAaBwiY.d.cts} +1 -1
- package/dist/{mod-pLbeNwcC.d.cts → mod-HDSvS-ww.d.cts} +1 -1
- package/dist/{mod-CyiSjRkk.d.cts → mod-xGFCHqq_.d.cts} +1 -1
- package/dist/mod.cjs +18 -18
- package/dist/mod.d.cts +7 -7
- package/dist/mod.d.ts +7 -7
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/owner-1TFakcTF.js +215 -0
- package/dist/owner-BXufwAzm.cjs +225 -0
- package/dist/{owner-D_F22lfM.mjs → owner-ByqNQVaa.mjs} +45 -2
- package/dist/portable-key-Cw_ow5vn.mjs +194 -0
- package/dist/{proof-B03JXhrk.mjs → proof-B6gwdhN5.mjs} +5 -5
- package/dist/{send-NNkfKtVN.mjs → send-DsK7xevO.mjs} +3 -3
- package/dist/sig/compound-proof-discovery.test.mjs +1 -1
- package/dist/sig/compound-proof-producer.test.mjs +1 -1
- package/dist/sig/compound-proof-verification.test.mjs +2 -2
- package/dist/sig/compound-proof.test.mjs +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 +16 -16
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +3 -3
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/portable-collection.test.mjs +3 -3
- package/dist/sig/portable-key.test.d.mts +2 -0
- package/dist/sig/portable-key.test.mjs +275 -0
- package/dist/sig/proof.test.mjs +4 -4
- package/dist/{sig-Bb20Pyrd.js → sig-BR_Z6mpY.js} +2 -2
- package/dist/{sig-B1E2uyhQ.cjs → sig-TTn9wYrE.cjs} +4 -4
- package/dist/{temporal-VVVSuruq.mjs → temporal-Bw5jtrBY.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/testing/mod.d.mts +43 -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.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +6 -6
- package/dist/http-z5n7chWw.js +0 -2647
- package/dist/owner-BLBWXCNt.js +0 -2276
- package/dist/owner-D8ZpRusc.cjs +0 -2446
|
@@ -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-
|
|
4
|
+
const require_http = require("./http-CuLWIJdf.cjs");
|
|
5
5
|
const require_types = require("./types-Be2zbyeG.cjs");
|
|
6
|
-
const require_owner = require("./owner-
|
|
7
|
-
const require_kv_cache = require("./kv-cache-
|
|
6
|
+
const require_owner = require("./owner-BXufwAzm.cjs");
|
|
7
|
+
const require_kv_cache = require("./kv-cache-DE8kSNQU.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");
|
|
@@ -281,6 +281,10 @@ var FederationBuilderImpl = class {
|
|
|
281
281
|
callbacks.aliasMapper = mapper;
|
|
282
282
|
return setters;
|
|
283
283
|
},
|
|
284
|
+
mapPortableActorId(mapper) {
|
|
285
|
+
callbacks.portableActorIdMapper = mapper;
|
|
286
|
+
return setters;
|
|
287
|
+
},
|
|
284
288
|
mapActorAlias: (path, identifier) => {
|
|
285
289
|
if (identifier === "") throw new _fedify_uri_template.RouterError("Identifier cannot be empty.");
|
|
286
290
|
if (this.router.has(`actorAlias:${identifier}`)) throw new _fedify_uri_template.RouterError(`Actor alias for "${identifier}" already set.`);
|
|
@@ -1777,7 +1781,7 @@ async function verifyDiscoveredProofDocuments(discovered, options) {
|
|
|
1777
1781
|
verified: false,
|
|
1778
1782
|
reason: { type: "missingContext" }
|
|
1779
1783
|
});
|
|
1780
|
-
const key = await
|
|
1784
|
+
const key = await require_http.verifyMapLocalProof(document.securedDocument, options);
|
|
1781
1785
|
return key == null ? Object.freeze({
|
|
1782
1786
|
...metadata,
|
|
1783
1787
|
verified: false,
|
|
@@ -1815,7 +1819,7 @@ async function verifyCompoundPortableObjectProofs(json, limits, options = {}) {
|
|
|
1815
1819
|
const proof = proofByPath.get(object.path);
|
|
1816
1820
|
const key = proof?.verified === true ? proof.key : null;
|
|
1817
1821
|
try {
|
|
1818
|
-
const policy = await
|
|
1822
|
+
const policy = await require_http.verifyPortableObjectProofPolicy(object.document, key, options);
|
|
1819
1823
|
return policy.verified ? Object.freeze({
|
|
1820
1824
|
...metadata,
|
|
1821
1825
|
id: policy.objectId,
|
|
@@ -2397,7 +2401,7 @@ function hasMalformedKnownTemporalLiteralInternal(value, visited) {
|
|
|
2397
2401
|
async function hasMalformedKnownTemporalLiteral(value, contextLoader) {
|
|
2398
2402
|
try {
|
|
2399
2403
|
return hasMalformedKnownTemporalLiteralInternal(await _fedify_vocab_runtime_jsonld.default.expand(value, {
|
|
2400
|
-
documentLoader:
|
|
2404
|
+
documentLoader: require_http.getNormalizationContextLoader(contextLoader),
|
|
2401
2405
|
keepFreeFloatingNodes: true
|
|
2402
2406
|
}), /* @__PURE__ */ new Set());
|
|
2403
2407
|
} catch {
|
|
@@ -2421,15 +2425,15 @@ function isPermanentRemoteContextError$1(error) {
|
|
|
2421
2425
|
if (!(error instanceof Error) || error.name !== "jsonld.InvalidUrl") return false;
|
|
2422
2426
|
const details = error.details;
|
|
2423
2427
|
if (details?.code === "invalid remote context") return true;
|
|
2424
|
-
return isRemoteContextLoadingFailure$1(error) && typeof details?.url === "string" && !URL.canParse(details.url) &&
|
|
2428
|
+
return isRemoteContextLoadingFailure$1(error) && typeof details?.url === "string" && !URL.canParse(details.url) && require_http.isClearlyMalformedContextReference(details.url);
|
|
2425
2429
|
}
|
|
2426
2430
|
function isInvalidJsonLdError(error) {
|
|
2427
2431
|
if (!(error instanceof Error)) return false;
|
|
2428
2432
|
const name = error.name;
|
|
2429
|
-
return name === "UnsafeJsonLdError" || error instanceof
|
|
2433
|
+
return name === "UnsafeJsonLdError" || error instanceof require_http.InvalidContextReferenceError || isPermanentRemoteContextError$1(error) || name === "jsonld.SyntaxError" && !isRemoteContextLoadingFailure$1(error);
|
|
2430
2434
|
}
|
|
2431
2435
|
function isValidationTypeError(error) {
|
|
2432
|
-
return error instanceof TypeError && (/^(Invalid JSON-LD:|Invalid type:|Unexpected type:|Invalid @id:)/.test(error.message) ||
|
|
2436
|
+
return error instanceof TypeError && (/^(Invalid JSON-LD:|Invalid type:|Unexpected type:|Invalid @id:)/.test(error.message) || require_http.isInvalidUrlTypeError(error));
|
|
2433
2437
|
}
|
|
2434
2438
|
function isPermanentActivityParseError(error) {
|
|
2435
2439
|
return isInvalidJsonLdError(error) || isValidationTypeError(error);
|
|
@@ -2535,7 +2539,7 @@ async function handlePortableObject(request, { values, context, objectDispatcher
|
|
|
2535
2539
|
try {
|
|
2536
2540
|
jsonLd = await object.toJsonLd(context);
|
|
2537
2541
|
servedId = await getJsonLdRootId(jsonLd, context.contextLoader);
|
|
2538
|
-
result = await
|
|
2542
|
+
result = await require_http.verifyPortableObjectProof(jsonLd, {
|
|
2539
2543
|
contextLoader: context.contextLoader,
|
|
2540
2544
|
documentLoader: context.documentLoader,
|
|
2541
2545
|
tracerProvider: context.tracerProvider,
|
|
@@ -2576,7 +2580,7 @@ function isRequestedPortableObject(object, canonicalId) {
|
|
|
2576
2580
|
}
|
|
2577
2581
|
async function getJsonLdRootId(jsonLd, contextLoader) {
|
|
2578
2582
|
const expanded = await _fedify_vocab_runtime_jsonld.default.expand(jsonLd, {
|
|
2579
|
-
documentLoader:
|
|
2583
|
+
documentLoader: require_http.getNormalizationContextLoader(contextLoader),
|
|
2580
2584
|
keepFreeFloatingNodes: true
|
|
2581
2585
|
});
|
|
2582
2586
|
if (expanded.length !== 1) return null;
|
|
@@ -2634,13 +2638,13 @@ function recordCollectionMetrics(meterProvider, base, result, options = {}) {
|
|
|
2634
2638
|
* @param parameters The parameters for handling the collection.
|
|
2635
2639
|
* @returns A promise that resolves to an HTTP response.
|
|
2636
2640
|
*/
|
|
2637
|
-
async function handleCollection(request, { name: name$
|
|
2638
|
-
const spanName = name$
|
|
2641
|
+
async function handleCollection(request, { name: name$1, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, tracerProvider, meterProvider, onUnauthorized, onNotFound }) {
|
|
2642
|
+
const spanName = name$1.trim().replace(/\s+/g, "_");
|
|
2639
2643
|
tracerProvider = tracerProvider ?? _opentelemetry_api.trace.getTracerProvider();
|
|
2640
2644
|
const tracer = tracerProvider.getTracer(require_http.name, require_http.version);
|
|
2641
2645
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
2642
2646
|
const metricBase = {
|
|
2643
|
-
kind: getCollectionMetricKind(name$
|
|
2647
|
+
kind: getCollectionMetricKind(name$1),
|
|
2644
2648
|
page: cursor != null,
|
|
2645
2649
|
dispatcher: "built_in"
|
|
2646
2650
|
};
|
|
@@ -2681,7 +2685,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
|
|
|
2681
2685
|
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
2682
2686
|
return await onNotFound(request);
|
|
2683
2687
|
}
|
|
2684
|
-
const items = filterCollectionItems(page.items, name$
|
|
2688
|
+
const items = filterCollectionItems(page.items, name$1, filterPredicate);
|
|
2685
2689
|
itemCount = items.length;
|
|
2686
2690
|
span.setAttribute("fedify.collection.items", itemCount);
|
|
2687
2691
|
return items;
|
|
@@ -2721,7 +2725,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
|
|
|
2721
2725
|
} else {
|
|
2722
2726
|
const uri = new URL(baseUri);
|
|
2723
2727
|
uri.searchParams.set("cursor", cursor);
|
|
2724
|
-
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$
|
|
2728
|
+
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$1}`, {
|
|
2725
2729
|
kind: _opentelemetry_api.SpanKind.SERVER,
|
|
2726
2730
|
attributes: {
|
|
2727
2731
|
"activitypub.collection.id": uri.href,
|
|
@@ -2737,7 +2741,7 @@ async function handleCollection(request, { name: name$2, identifier, uriGetter,
|
|
|
2737
2741
|
span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
2738
2742
|
return await onNotFound(request);
|
|
2739
2743
|
}
|
|
2740
|
-
const items = filterCollectionItems(page.items, name$
|
|
2744
|
+
const items = filterCollectionItems(page.items, name$1, filterPredicate);
|
|
2741
2745
|
itemCount = items.length;
|
|
2742
2746
|
span.setAttribute("fedify.collection.items", itemCount);
|
|
2743
2747
|
return {
|
|
@@ -3328,8 +3332,8 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
3328
3332
|
tracerProvider,
|
|
3329
3333
|
keyTtl: publicKeyTtl
|
|
3330
3334
|
});
|
|
3331
|
-
const jsonWithoutSig =
|
|
3332
|
-
const hasLdSignature =
|
|
3335
|
+
const jsonWithoutSig = require_http.detachSignature(json);
|
|
3336
|
+
const hasLdSignature = require_http.hasSignature(json);
|
|
3333
3337
|
const canAttemptAlternateAuthAfterLdSignatureFailure = skipSignatureVerification || hasHttpSignatureHeaders(request) || hasObjectIntegrityProof(jsonWithoutSig);
|
|
3334
3338
|
let deferredLdSignatureError = void 0;
|
|
3335
3339
|
const respondInvalidActivity = async (error) => {
|
|
@@ -3361,7 +3365,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
3361
3365
|
let ldSigVerified = false;
|
|
3362
3366
|
if (hasLdSignature) {
|
|
3363
3367
|
try {
|
|
3364
|
-
compactedJson = await
|
|
3368
|
+
compactedJson = await require_http.compactJsonLd(json, ctx.contextLoader);
|
|
3365
3369
|
} catch (error) {
|
|
3366
3370
|
if (isInvalidJsonLdError(error)) {
|
|
3367
3371
|
logger.error("Failed to parse JSON-LD:\n{error}", {
|
|
@@ -3381,9 +3385,9 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
3381
3385
|
});
|
|
3382
3386
|
}
|
|
3383
3387
|
if (compactedJson !== json) {
|
|
3384
|
-
compactedJsonWithoutSig =
|
|
3388
|
+
compactedJsonWithoutSig = require_http.detachSignature(compactedJson);
|
|
3385
3389
|
try {
|
|
3386
|
-
ldSigVerified = await
|
|
3390
|
+
ldSigVerified = await require_http.verifyCompactJsonLd(compactedJson, {
|
|
3387
3391
|
contextLoader: ctx.contextLoader,
|
|
3388
3392
|
documentLoader: ctx.documentLoader,
|
|
3389
3393
|
keyCache,
|
|
@@ -3405,7 +3409,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
3405
3409
|
if (!canAttemptAlternateAuthAfterLdSignatureFailure) throw error;
|
|
3406
3410
|
if (!skipSignatureVerification) try {
|
|
3407
3411
|
await _fedify_vocab.Object.fromJsonLd(compactedJson, {
|
|
3408
|
-
contextLoader:
|
|
3412
|
+
contextLoader: require_http.getNormalizationContextLoader(ctx.contextLoader),
|
|
3409
3413
|
documentLoader: ctx.documentLoader,
|
|
3410
3414
|
tracerProvider
|
|
3411
3415
|
});
|
|
@@ -3429,6 +3433,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
3429
3433
|
}
|
|
3430
3434
|
let activity = null;
|
|
3431
3435
|
let activityVerified = false;
|
|
3436
|
+
let proofVerified = false;
|
|
3432
3437
|
if (ldSigVerified) {
|
|
3433
3438
|
logger.debug("Linked Data Signatures are verified.", {
|
|
3434
3439
|
recipient,
|
|
@@ -3437,7 +3442,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
3437
3442
|
try {
|
|
3438
3443
|
activity = await _fedify_vocab.Activity.fromJsonLd(compactedJsonWithoutSig, {
|
|
3439
3444
|
...ctx,
|
|
3440
|
-
contextLoader:
|
|
3445
|
+
contextLoader: require_http.getNormalizationContextLoader(ctx.contextLoader)
|
|
3441
3446
|
});
|
|
3442
3447
|
} catch (error) {
|
|
3443
3448
|
if (error instanceof RangeError && await hasMalformedKnownTemporalLiteral(compactedJsonWithoutSig, ctx.contextLoader)) return await respondInvalidActivity(error);
|
|
@@ -3445,14 +3450,29 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
3445
3450
|
return await respondInvalidActivity(error);
|
|
3446
3451
|
}
|
|
3447
3452
|
activityVerified = true;
|
|
3453
|
+
if (!skipSignatureVerification && require_http.hasPortableActor(activity)) try {
|
|
3454
|
+
proofVerified = await require_http.verifyObject(_fedify_vocab.Activity, jsonWithoutSig, {
|
|
3455
|
+
contextLoader: require_http.wrapContextLoaderForJsonLd(ctx.contextLoader),
|
|
3456
|
+
documentLoader: ctx.documentLoader,
|
|
3457
|
+
keyCache,
|
|
3458
|
+
meterProvider,
|
|
3459
|
+
tracerProvider
|
|
3460
|
+
}) != null;
|
|
3461
|
+
} catch (error) {
|
|
3462
|
+
if (!isPermanentActivityParseError(error)) throw error;
|
|
3463
|
+
logger.debug("Failed to verify the Object Integrity Proofs of the portable actor's activity:\n{error}", {
|
|
3464
|
+
recipient,
|
|
3465
|
+
error
|
|
3466
|
+
});
|
|
3467
|
+
}
|
|
3448
3468
|
} else {
|
|
3449
3469
|
logger.debug("Linked Data Signatures are not verified.", {
|
|
3450
3470
|
recipient,
|
|
3451
3471
|
json
|
|
3452
3472
|
});
|
|
3453
3473
|
try {
|
|
3454
|
-
activity = await
|
|
3455
|
-
contextLoader:
|
|
3474
|
+
activity = await require_http.verifyObject(_fedify_vocab.Activity, jsonWithoutSig, {
|
|
3475
|
+
contextLoader: require_http.wrapContextLoaderForJsonLd(ctx.contextLoader),
|
|
3456
3476
|
documentLoader: ctx.documentLoader,
|
|
3457
3477
|
keyCache,
|
|
3458
3478
|
meterProvider,
|
|
@@ -3501,6 +3521,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
3501
3521
|
activity: json
|
|
3502
3522
|
});
|
|
3503
3523
|
activityVerified = true;
|
|
3524
|
+
proofVerified = true;
|
|
3504
3525
|
}
|
|
3505
3526
|
}
|
|
3506
3527
|
let httpSigKey = null;
|
|
@@ -3597,7 +3618,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
3597
3618
|
try {
|
|
3598
3619
|
activity = await _fedify_vocab.Activity.fromJsonLd(jsonWithoutSig, {
|
|
3599
3620
|
...ctx,
|
|
3600
|
-
contextLoader:
|
|
3621
|
+
contextLoader: require_http.wrapContextLoaderForJsonLd(ctx.contextLoader)
|
|
3601
3622
|
});
|
|
3602
3623
|
} catch (error) {
|
|
3603
3624
|
if (!isPermanentActivityParseError(error)) throw error;
|
|
@@ -3613,6 +3634,24 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
3613
3634
|
"http_signatures.verified": httpSigKey != null,
|
|
3614
3635
|
"http_signatures.key_id": httpSigKey?.id?.href ?? ""
|
|
3615
3636
|
});
|
|
3637
|
+
if (!skipSignatureVerification && !proofVerified && (require_http.hasPortableActor(activity) || isPortableGatewayKey(httpSigKey))) {
|
|
3638
|
+
if (deferredLdSignatureError != null) throw deferredLdSignatureError;
|
|
3639
|
+
logger.error("The activity {activityId} of the portable actor {actorId} is not authenticated by a valid Object Integrity Proof.", {
|
|
3640
|
+
activity: json,
|
|
3641
|
+
recipient,
|
|
3642
|
+
activityId: activity.id?.href,
|
|
3643
|
+
actorId: activity.actorId?.href,
|
|
3644
|
+
keyId: httpSigKey?.id?.href
|
|
3645
|
+
});
|
|
3646
|
+
span.setStatus({
|
|
3647
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
3648
|
+
message: `The activity of the portable actor (${activity.actorId?.href}) is not authenticated by a valid Object Integrity Proof.`
|
|
3649
|
+
});
|
|
3650
|
+
return new Response("Activities of portable actors must have valid Object Integrity Proofs.", {
|
|
3651
|
+
status: 401,
|
|
3652
|
+
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
3653
|
+
});
|
|
3654
|
+
}
|
|
3616
3655
|
if (httpSigKey != null && !await require_owner.doesActorOwnKey(activity, httpSigKey, ctx)) {
|
|
3617
3656
|
if (deferredLdSignatureError != null) throw deferredLdSignatureError;
|
|
3618
3657
|
require_http.getFederationMetrics(parameters.meterProvider).recordSignatureVerificationFailure("actorKeyMismatch", httpSigKey.id == null ? void 0 : require_http.getRemoteHost(httpSigKey.id));
|
|
@@ -3830,8 +3869,8 @@ var CustomCollectionHandler = class {
|
|
|
3830
3869
|
* @param CollectionPage The CollectionPage constructor.
|
|
3831
3870
|
* @param filterPredicate Optional filter predicate for items.
|
|
3832
3871
|
*/
|
|
3833
|
-
constructor(name$
|
|
3834
|
-
this.name = name$
|
|
3872
|
+
constructor(name$2, values, context, callbacks, tracerProvider = _opentelemetry_api.trace.getTracerProvider(), meterProvider, Collection, CollectionPage, filterPredicate) {
|
|
3873
|
+
this.name = name$2;
|
|
3835
3874
|
this.values = values;
|
|
3836
3875
|
this.context = context;
|
|
3837
3876
|
this.callbacks = callbacks;
|
|
@@ -4315,6 +4354,15 @@ const MIN_COMPONENTS = [
|
|
|
4315
4354
|
"@target-uri",
|
|
4316
4355
|
"@authority"
|
|
4317
4356
|
];
|
|
4357
|
+
/**
|
|
4358
|
+
* Checks whether an HTTP Signature key is a gateway key of an FEP-ef61
|
|
4359
|
+
* portable actor, i.e., its ID is a compatible identifier and it is owned by
|
|
4360
|
+
* a portable actor, which only the portable actor's signed document can
|
|
4361
|
+
* establish.
|
|
4362
|
+
*/
|
|
4363
|
+
function isPortableGatewayKey(key) {
|
|
4364
|
+
return key?.id != null && require_http.isCompatibleKeyId(key.id) && key.ownerId != null && require_http.isPortableUri(key.ownerId);
|
|
4365
|
+
}
|
|
4318
4366
|
//#endregion
|
|
4319
4367
|
//#region src/federation/kv.ts
|
|
4320
4368
|
const Temporal$5 = require_http.Temporal;
|
|
@@ -4928,39 +4976,50 @@ function formatKeyIds(candidates) {
|
|
|
4928
4976
|
return candidates.map((c) => c.verificationMethod.href).join(", ");
|
|
4929
4977
|
}
|
|
4930
4978
|
/**
|
|
4979
|
+
* Rejects an activity of a portable actor whose ID cannot be authenticated by
|
|
4980
|
+
* the actor's DID: FEP-ef61 requires the activity to be a portable object
|
|
4981
|
+
* signed by that DID, so its ID has to be a portable ID with the same DID.
|
|
4982
|
+
* @throws {TypeError} If the activity is performed by a portable actor, but
|
|
4983
|
+
* its ID is not a portable ID of the actor's DID, or its
|
|
4984
|
+
* portable actors do not share a DID.
|
|
4985
|
+
* @internal
|
|
4986
|
+
*/
|
|
4987
|
+
function assertPortableActorActivity(activity) {
|
|
4988
|
+
const portableActors = activity.actorIds.filter(isPortableUrl);
|
|
4989
|
+
if (portableActors.length < 1) return;
|
|
4990
|
+
const did = (0, _fedify_vocab_runtime.getFe34Origin)(portableActors[0]);
|
|
4991
|
+
if (portableActors.some((actorId) => (0, _fedify_vocab_runtime.getFe34Origin)(actorId) !== did)) throw new TypeError(`The activity ${activity.id?.href} has portable actors with different DIDs (${portableActors.map((a) => a.href).join(", ")}); a portable activity is signed by a single DID.`);
|
|
4992
|
+
if (activity.id == null || !isPortableUrl(activity.id) || (0, _fedify_vocab_runtime.getFe34Origin)(activity.id) !== did) throw new TypeError(`The activity ${activity.id?.href} is performed by the portable actor ${portableActors[0].href}, so its ID has to be an ap: or ap+ef61: URI with the same DID (${did}), as FEP-ef61 requires it to carry an Object Integrity Proof made by that DID.`);
|
|
4993
|
+
}
|
|
4994
|
+
/**
|
|
4931
4995
|
* Creates the Object Integrity Proofs Fedify attaches to an outgoing activity.
|
|
4932
4996
|
*
|
|
4997
|
+
* Keys whose IDs are FEP-ef61 compatible identifiers are gateway keys, which
|
|
4998
|
+
* never sign proofs. A portable activity, i.e., one with an `ap:` or
|
|
4999
|
+
* `ap+ef61:` ID, that carries no proof is signed only by the one Ed25519 key
|
|
5000
|
+
* whose verification method is a DID URL for its DID, even if it is the only
|
|
5001
|
+
* key; if no key or more than one key qualifies, this function throws.
|
|
5002
|
+
*
|
|
4933
5003
|
* Outside the map-local compound-proof profile, i.e., when the activity
|
|
4934
5004
|
* embeds no portable object, every Ed25519 key signs the activity, as it
|
|
4935
5005
|
* always has. Inside the profile, which accepts exactly one direct proof per
|
|
4936
5006
|
* map, Fedify creates at most one proof:
|
|
4937
5007
|
*
|
|
4938
5008
|
* - An activity that already carries a proof is kept as is.
|
|
4939
|
-
* - A single Ed25519 key signs
|
|
4940
|
-
* - With several Ed25519 keys, a portable activity is
|
|
4941
|
-
*
|
|
4942
|
-
* proof the FEP-ef61 policy can accept. If no key or more than one key
|
|
4943
|
-
* qualifies, or the activity is not portable itself, the choice is
|
|
4944
|
-
* ambiguous and this function throws.
|
|
5009
|
+
* - A single Ed25519 key signs a non-portable activity.
|
|
5010
|
+
* - With several Ed25519 keys, a non-portable activity is ambiguous, and
|
|
5011
|
+
* this function throws.
|
|
4945
5012
|
*
|
|
4946
|
-
* @throws {TypeError} If a single proof key cannot be chosen
|
|
5013
|
+
* @throws {TypeError} If a single proof key cannot be chosen, or the activity
|
|
5014
|
+
* is performed by a portable actor but is not a portable
|
|
5015
|
+
* activity of the same DID.
|
|
4947
5016
|
* @internal
|
|
4948
5017
|
*/
|
|
4949
5018
|
async function signOutgoingActivity(activity, candidates, options) {
|
|
4950
5019
|
const { contextLoader, tracerProvider } = options;
|
|
4951
|
-
|
|
4952
|
-
for await (const _ of activity.getProofs({ contextLoader })) {
|
|
4953
|
-
hasProof = true;
|
|
4954
|
-
break;
|
|
4955
|
-
}
|
|
4956
|
-
const keys = candidates.filter((c) => c.privateKey.algorithm.name === "Ed25519");
|
|
4957
|
-
if (keys.length < 1 || hasProof && !options.appendToExistingProofs) return {
|
|
4958
|
-
activity,
|
|
4959
|
-
hasProof,
|
|
4960
|
-
proofCreated: false
|
|
4961
|
-
};
|
|
5020
|
+
assertPortableActorActivity(activity);
|
|
4962
5021
|
const sign = async (selected) => {
|
|
4963
|
-
for (const { verificationMethod, privateKey } of selected) activity = await
|
|
5022
|
+
for (const { verificationMethod, privateKey } of selected) activity = await require_http.signObject(activity, privateKey, verificationMethod, {
|
|
4964
5023
|
contextLoader,
|
|
4965
5024
|
tracerProvider
|
|
4966
5025
|
});
|
|
@@ -4970,6 +5029,18 @@ async function signOutgoingActivity(activity, candidates, options) {
|
|
|
4970
5029
|
proofCreated: true
|
|
4971
5030
|
};
|
|
4972
5031
|
};
|
|
5032
|
+
let hasProof = false;
|
|
5033
|
+
for await (const _ of activity.getProofs({ contextLoader })) {
|
|
5034
|
+
hasProof = true;
|
|
5035
|
+
break;
|
|
5036
|
+
}
|
|
5037
|
+
const keys = candidates.filter((c) => c.privateKey.algorithm.name === "Ed25519" && !require_http.isCompatibleKeyId(c.verificationMethod));
|
|
5038
|
+
if (!hasProof && activity.id != null && isPortableUrl(activity.id)) return await sign(selectPortableActivityKey(activity, activity.id, keys));
|
|
5039
|
+
if (keys.length < 1 || hasProof && !options.appendToExistingProofs) return {
|
|
5040
|
+
activity,
|
|
5041
|
+
hasProof,
|
|
5042
|
+
proofCreated: false
|
|
5043
|
+
};
|
|
4973
5044
|
if (keys.length < 2 && !hasProof) return await sign(keys);
|
|
4974
5045
|
if (!containsCompoundPortableObject(await activity.toJsonLd({
|
|
4975
5046
|
format: "compact",
|
|
@@ -4989,15 +5060,26 @@ async function signOutgoingActivity(activity, candidates, options) {
|
|
|
4989
5060
|
proofCreated: false
|
|
4990
5061
|
};
|
|
4991
5062
|
}
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
5063
|
+
throw new TypeError(`Cannot choose an Object Integrity Proof key for the activity ${activityId}: it embeds portable objects, so it falls under the map-local compound-proof profile, which accepts exactly one direct proof per map, but ${keys.length} Ed25519 keys were supplied (${formatKeyIds(keys)}). Send it with explicit sender keys that contain exactly one Ed25519 key (RSA keys for HTTP Signatures may stay), or sign it with signObject() before sending it.`);
|
|
5064
|
+
}
|
|
5065
|
+
/**
|
|
5066
|
+
* Chooses the one Ed25519 key that can sign a portable activity: the key
|
|
5067
|
+
* whose verification method is a DID URL for the activity's DID.
|
|
5068
|
+
* @throws {TypeError} If no key or more than one key qualifies.
|
|
5069
|
+
*/
|
|
5070
|
+
function selectPortableActivityKey(activity, activityId, keys) {
|
|
5071
|
+
const activityDid = (0, _fedify_vocab_runtime.getFe34Origin)(activityId);
|
|
5072
|
+
const eligible = keys.filter((c) => c.verificationMethod.protocol === "did:" && (0, _fedify_vocab_runtime.haveSameFe34Origin)(activityId, c.verificationMethod));
|
|
5073
|
+
if (eligible.length !== 1) throw new TypeError(`Cannot choose an Object Integrity Proof key for the portable activity ${activityId.href}: ` + (eligible.length < 1 ? `none of its ${keys.length} Ed25519 keys (${formatKeyIds(keys)}) ` : `${eligible.length} of its Ed25519 keys (${formatKeyIds(eligible)}) `) + `${eligible.length < 1 ? "is" : "are"} a DID URL verification method for ${activityDid}. FEP-ef61 requires a portable activity's proof to be made by its DID, and the map-local compound-proof profile accepts exactly one direct proof per map. Gateway keys, whose IDs are compatible identifiers, never sign proofs. Supply exactly one Ed25519 key whose key ID is a DID URL for ${activityDid}, or sign the activity with signObject() before sending it.`);
|
|
5074
|
+
(0, _logtape_logtape.getLogger)([
|
|
5075
|
+
"fedify",
|
|
5076
|
+
"federation",
|
|
5077
|
+
"outbox"
|
|
5078
|
+
]).debug("The portable activity {activityId} is signed only by {keyId}, the one Ed25519 key whose verification method matches its DID.", {
|
|
5079
|
+
activityId: activity.id?.href,
|
|
4998
5080
|
keyId: eligible[0].verificationMethod.href
|
|
4999
5081
|
});
|
|
5000
|
-
return
|
|
5082
|
+
return eligible;
|
|
5001
5083
|
}
|
|
5002
5084
|
/**
|
|
5003
5085
|
* Rejects an outgoing activity whose proofs Fedify's own inbox would reject
|
|
@@ -5758,10 +5840,10 @@ function isPermanentRemoteContextError(error) {
|
|
|
5758
5840
|
if (!(error instanceof Error) || error.name !== "jsonld.InvalidUrl") return false;
|
|
5759
5841
|
const details = error.details;
|
|
5760
5842
|
if (details?.code === "invalid remote context") return true;
|
|
5761
|
-
return isRemoteContextLoadingFailure(error) && typeof details?.url === "string" && !URL.canParse(details.url) &&
|
|
5843
|
+
return isRemoteContextLoadingFailure(error) && typeof details?.url === "string" && !URL.canParse(details.url) && require_http.isClearlyMalformedContextReference(details.url);
|
|
5762
5844
|
}
|
|
5763
5845
|
function isPermanentInboxParseError(error) {
|
|
5764
|
-
return error instanceof Error && (error.name === "UnsafeJsonLdError" || error instanceof
|
|
5846
|
+
return error instanceof Error && (error.name === "UnsafeJsonLdError" || error instanceof require_http.InvalidContextReferenceError || isPermanentRemoteContextError(error) || error.name === "jsonld.SyntaxError" && !isRemoteContextLoadingFailure(error)) || error instanceof TypeError && (/^(Invalid JSON-LD:|Invalid type:|Unexpected type:|Invalid @id:)/.test(error.message) || require_http.isInvalidUrlTypeError(error));
|
|
5765
5847
|
}
|
|
5766
5848
|
function hasLinkedDataSignatureJsonLdProcessingError(error) {
|
|
5767
5849
|
if (error.message.startsWith("Maximum deep iterations exceeded")) return true;
|
|
@@ -6614,22 +6696,22 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
6614
6696
|
let parseInput = void 0;
|
|
6615
6697
|
let parseContextLoader = context.contextLoader;
|
|
6616
6698
|
try {
|
|
6617
|
-
const hasSignatureField =
|
|
6699
|
+
const hasSignatureField = require_http.hasSignature(message.activity);
|
|
6618
6700
|
const shouldParseFromNormalizedSignedPayload = message.ldSignatureVerified === true || message.normalizedActivity != null || message.ldSignatureVerified == null && hasSignatureField;
|
|
6619
6701
|
const parseContext = hasSignatureField ? {
|
|
6620
6702
|
...context,
|
|
6621
|
-
contextLoader:
|
|
6703
|
+
contextLoader: require_http.getNormalizationContextLoader(context.contextLoader)
|
|
6622
6704
|
} : {
|
|
6623
6705
|
...context,
|
|
6624
|
-
contextLoader:
|
|
6706
|
+
contextLoader: require_http.wrapContextLoaderForJsonLd(context.contextLoader)
|
|
6625
6707
|
};
|
|
6626
6708
|
parseContextLoader = parseContext.contextLoader;
|
|
6627
6709
|
let normalizedActivity;
|
|
6628
6710
|
if (shouldParseFromNormalizedSignedPayload) {
|
|
6629
|
-
normalizedActivity = message.normalizedActivity ?? await
|
|
6630
|
-
|
|
6711
|
+
normalizedActivity = message.normalizedActivity ?? await require_http.compactJsonLd(message.activity, context.contextLoader);
|
|
6712
|
+
require_http.assertSafeJsonLd(normalizedActivity);
|
|
6631
6713
|
}
|
|
6632
|
-
parseInput = shouldParseFromNormalizedSignedPayload ?
|
|
6714
|
+
parseInput = shouldParseFromNormalizedSignedPayload ? require_http.detachSignature(normalizedActivity) : hasSignatureField ? require_http.detachSignature(message.activity) : message.activity;
|
|
6633
6715
|
activity = await _fedify_vocab.Activity.fromJsonLd(parseInput, parseContext);
|
|
6634
6716
|
activityType = (0, _fedify_vocab.getTypeId)(activity).href;
|
|
6635
6717
|
span.setAttribute("activitypub.activity.type", activityType);
|
|
@@ -6884,9 +6966,10 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
6884
6966
|
const contextLoader = this.contextLoaderFactory(this.#getLoaderOptions(ctx.origin));
|
|
6885
6967
|
const activityId = activity.id.href;
|
|
6886
6968
|
let rsaKey = null;
|
|
6969
|
+
const ldSignable = !require_http.hasPortableActor(activity);
|
|
6887
6970
|
for (const { keyId, privateKey } of keys) {
|
|
6888
6971
|
require_http.validateCryptoKey(privateKey, "private");
|
|
6889
|
-
if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") rsaKey = {
|
|
6972
|
+
if (ldSignable && rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5" && !require_http.isCompatibleKeyId(keyId)) rsaKey = {
|
|
6890
6973
|
keyId,
|
|
6891
6974
|
privateKey
|
|
6892
6975
|
};
|
|
@@ -6905,9 +6988,10 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
6905
6988
|
format: "compact",
|
|
6906
6989
|
contextLoader
|
|
6907
6990
|
});
|
|
6908
|
-
if (proofCreated || !hasProof || options.normalizeExistingProofs) jsonLd = await
|
|
6991
|
+
if (proofCreated || !hasProof || options.normalizeExistingProofs) jsonLd = await require_http.normalizeOutgoingActivityJsonLd(jsonLd, contextLoader, { preserveNestedSecuredDocuments: true });
|
|
6909
6992
|
assertSupportedCompoundProofShape(jsonLd, activityId);
|
|
6910
|
-
if (rsaKey == null) logger.
|
|
6993
|
+
if (rsaKey == null && !ldSignable) logger.debug("The activity {activityId} is performed by a portable actor, so it is sent without a Linked Data signature.", { activityId });
|
|
6994
|
+
else if (rsaKey == null) logger.warn("No supported key found to create a Linked Data signature for the activity {activityId}. The activity will be sent without a Linked Data signature. In order to create a Linked Data signature, at least one RSASSA-PKCS1-v1_5 key must be provided.", {
|
|
6911
6995
|
activityId,
|
|
6912
6996
|
keys: keys.map((pair) => ({
|
|
6913
6997
|
keyId: pair.keyId.href,
|
|
@@ -6915,7 +6999,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
6915
6999
|
}))
|
|
6916
7000
|
});
|
|
6917
7001
|
else try {
|
|
6918
|
-
jsonLd = await
|
|
7002
|
+
jsonLd = await require_http.signJsonLd(jsonLd, rsaKey.privateKey, rsaKey.keyId, {
|
|
6919
7003
|
contextLoader,
|
|
6920
7004
|
tracerProvider: this.tracerProvider
|
|
6921
7005
|
});
|
|
@@ -7783,14 +7867,15 @@ var ContextImpl = class ContextImpl {
|
|
|
7783
7867
|
getActorKeyPairsIdentifier: identifier,
|
|
7784
7868
|
actorKeyPairsDispatcherIdentifier: this.invokedFromActorKeyPairsDispatcher.identifier
|
|
7785
7869
|
});
|
|
7870
|
+
const portableActor = await this.getPortableActorKeyOwner(identifier);
|
|
7786
7871
|
let keyPairs;
|
|
7787
7872
|
try {
|
|
7788
|
-
keyPairs = await this.getKeyPairsFromIdentifier(identifier);
|
|
7873
|
+
keyPairs = await this.getKeyPairsFromIdentifier(identifier, portableActor);
|
|
7789
7874
|
} catch (_) {
|
|
7790
7875
|
logger.warn("No actor key pairs dispatcher registered.");
|
|
7791
7876
|
return [];
|
|
7792
7877
|
}
|
|
7793
|
-
const owner = this.getActorUri(identifier);
|
|
7878
|
+
const owner = portableActor?.id ?? this.getActorUri(identifier);
|
|
7794
7879
|
const result = [];
|
|
7795
7880
|
let i = 1;
|
|
7796
7881
|
for (const keyPair of keyPairs) {
|
|
@@ -7802,7 +7887,7 @@ var ContextImpl = class ContextImpl {
|
|
|
7802
7887
|
publicKey: keyPair.publicKey
|
|
7803
7888
|
}),
|
|
7804
7889
|
multikey: new _fedify_vocab.Multikey({
|
|
7805
|
-
id: new URL(`#multikey-${i}`, owner),
|
|
7890
|
+
id: portableActor == null ? new URL(`#multikey-${i}`, owner) : keyPair.keyId,
|
|
7806
7891
|
controller: owner,
|
|
7807
7892
|
publicKey: keyPair.publicKey
|
|
7808
7893
|
})
|
|
@@ -7812,7 +7897,26 @@ var ContextImpl = class ContextImpl {
|
|
|
7812
7897
|
}
|
|
7813
7898
|
return result;
|
|
7814
7899
|
}
|
|
7815
|
-
|
|
7900
|
+
/**
|
|
7901
|
+
* Resolves the portable actor that the actor with the given identifier is,
|
|
7902
|
+
* through the portable actor ID mapper, along with the base of its gateway
|
|
7903
|
+
* key IDs on this server.
|
|
7904
|
+
* @param identifier The actor's identifier.
|
|
7905
|
+
* @returns The portable actor's ID and key ID base, or `null` if the actor
|
|
7906
|
+
* is not portable.
|
|
7907
|
+
* @throws {TypeError} If the mapper returns an invalid portable actor ID.
|
|
7908
|
+
*/
|
|
7909
|
+
async getPortableActorKeyOwner(identifier) {
|
|
7910
|
+
const mapper = this.federation.actorCallbacks?.portableActorIdMapper;
|
|
7911
|
+
if (mapper == null) return null;
|
|
7912
|
+
const id = await mapper(this, identifier);
|
|
7913
|
+
if (id == null) return null;
|
|
7914
|
+
return {
|
|
7915
|
+
id,
|
|
7916
|
+
keyBase: require_http.getGatewayKeyBase(id, this.canonicalOrigin)
|
|
7917
|
+
};
|
|
7918
|
+
}
|
|
7919
|
+
async getKeyPairsFromIdentifier(identifier, portableActor) {
|
|
7816
7920
|
const logger = (0, _logtape_logtape.getLogger)([
|
|
7817
7921
|
"fedify",
|
|
7818
7922
|
"federation",
|
|
@@ -7829,6 +7933,8 @@ var ContextImpl = class ContextImpl {
|
|
|
7829
7933
|
}
|
|
7830
7934
|
throw error;
|
|
7831
7935
|
}
|
|
7936
|
+
if (portableActor === void 0) portableActor = await this.getPortableActorKeyOwner(identifier);
|
|
7937
|
+
const keyBase = portableActor?.keyBase ?? actorUri;
|
|
7832
7938
|
const keyPairs = await this.federation.actorCallbacks?.keyPairsDispatcher(new ContextImpl({
|
|
7833
7939
|
...this,
|
|
7834
7940
|
invokedFromActorKeyPairsDispatcher: { identifier }
|
|
@@ -7839,7 +7945,7 @@ var ContextImpl = class ContextImpl {
|
|
|
7839
7945
|
for (const keyPair of keyPairs) {
|
|
7840
7946
|
result.push({
|
|
7841
7947
|
...keyPair,
|
|
7842
|
-
keyId: new URL(i == 0 ? `#main-key` : `#key-${i + 1}`,
|
|
7948
|
+
keyId: new URL(i == 0 ? `#main-key` : `#key-${i + 1}`, keyBase)
|
|
7843
7949
|
});
|
|
7844
7950
|
i++;
|
|
7845
7951
|
}
|
|
@@ -7885,7 +7991,7 @@ var ContextImpl = class ContextImpl {
|
|
|
7885
7991
|
userAgent: options.userAgent ?? this.federation.userAgent,
|
|
7886
7992
|
tracerProvider: options.tracerProvider ?? this.tracerProvider,
|
|
7887
7993
|
meterProvider: options.meterProvider ?? this.meterProvider,
|
|
7888
|
-
verifyPortableObject: options.verifyPortableObject ??
|
|
7994
|
+
verifyPortableObject: options.verifyPortableObject ?? require_http.verifyPortableObjectProof,
|
|
7889
7995
|
allowPrivateAddress: this.federation.allowPrivateAddress
|
|
7890
7996
|
});
|
|
7891
7997
|
}
|
|
@@ -8148,7 +8254,7 @@ var ContextImpl = class ContextImpl {
|
|
|
8148
8254
|
tracerProvider: this.tracerProvider,
|
|
8149
8255
|
keyTtl: this.federation.publicKeyTtl
|
|
8150
8256
|
});
|
|
8151
|
-
if (await
|
|
8257
|
+
if (await require_http.verifyObject(_fedify_vocab.Activity, json, {
|
|
8152
8258
|
contextLoader,
|
|
8153
8259
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
8154
8260
|
meterProvider: this.meterProvider,
|
|
@@ -8381,8 +8487,8 @@ async function forwardActivityInternal(ctx, loggerCategory, forwarder, recipient
|
|
|
8381
8487
|
if (forwarder.length < 1) throw new Error("The forwarder's key pairs are empty.");
|
|
8382
8488
|
keys = forwarder;
|
|
8383
8489
|
} else keys = [forwarder];
|
|
8384
|
-
if (!
|
|
8385
|
-
if (!
|
|
8490
|
+
if (!require_http.hasSignatureLike(ctx.activity)) {
|
|
8491
|
+
if (!require_http.hasProofLike(ctx.activity)) {
|
|
8386
8492
|
if (options?.skipIfUnsigned) return false;
|
|
8387
8493
|
logger.warn("The activity {activityId} is not signed; even if it is forwarded to other servers as is, it may not be accepted by them due to the lack of a signature/proof.", {
|
|
8388
8494
|
activityId: ctx.activityId,
|