@fedify/fedify 2.4.0-dev.2122 → 2.4.0-dev.2129
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-BCXywsZF.mjs → builder-C0bxZDL0.mjs} +3 -3
- 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-Fxd45Oy5.mjs → compound-proof-D9Kljk_7.mjs} +3 -3
- package/dist/{context-tOiJfBoD.d.ts → context-Cz1w5Krc.d.ts} +31 -5
- package/dist/{context-CoNRxGYp.mjs → context-DfSVPcJ8.mjs} +6 -3
- package/dist/{context-SMNOiiY6.d.cts → context-Dvec_D_h.d.cts} +31 -5
- package/dist/{deno-BZrnW0Qz.mjs → deno-_o3lkDlG.mjs} +1 -1
- package/dist/{docloader-3BHaS20Z.mjs → docloader-BbS0rO-Y.mjs} +7 -7
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +3 -3
- package/dist/federation/handler-compound-proof.test.mjs +4 -4
- package/dist/federation/handler.test.mjs +6 -6
- 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 +2 -2
- package/dist/federation/mod.d.ts +2 -2
- package/dist/federation/mod.js +1 -1
- package/dist/federation/outgoing-proof.test.mjs +6 -6
- package/dist/federation/portable-actor.test.mjs +3 -3
- package/dist/federation/portable-chain.test.d.mts +2 -0
- package/dist/federation/portable-chain.test.mjs +358 -0
- package/dist/federation/portable-gateway-keys.test.mjs +77 -6
- package/dist/federation/portable-inbox.test.mjs +9 -4
- package/dist/federation/portable.test.mjs +3 -3
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/tasks/enqueue.test.mjs +2 -2
- package/dist/federation/tasks/tasks.test.mjs +3 -3
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +2 -2
- package/dist/{federation-Ml6NrgRV.cjs → federation-DRY8KrkB.cjs} +46 -22
- package/dist/{http-4bmgw-mA.cjs → http-B1J6E-bT.cjs} +384 -33
- package/dist/{http-B9BQDNIy.mjs → http-BpOiZE09.mjs} +18 -12
- package/dist/{http-D76Py0M4.d.cts → http-C-x_OLSp.d.ts} +57 -14
- package/dist/{http-BETASGl0.js → http-C2M6wcs8.js} +374 -35
- package/dist/{http-BrQgkJay.d.ts → http-CjezPjFX.d.cts} +57 -14
- package/dist/{key-PyYvun0F.mjs → key-DolJjJab.mjs} +103 -16
- package/dist/{kv-cache-CPqUxRL3.mjs → kv-cache-Bq2cah0c.mjs} +1 -1
- package/dist/{kv-cache-C4mv2ZFQ.js → kv-cache-D7TiyMxv.js} +6 -6
- package/dist/{kv-cache-D2Bz6t_c.cjs → kv-cache-D9nRbG2Q.cjs} +6 -6
- package/dist/{ld-u4JOD4iO.mjs → ld-Dwc176V4.mjs} +3 -3
- package/dist/{metrics-DCLoLvLz.mjs → metrics-CDaHfBXY.mjs} +1 -1
- package/dist/{middleware-B7bmtONC.mjs → middleware-CmB1FD8A.mjs} +1 -1
- package/dist/{middleware-DWlAGlyP.js → middleware-CylX-pvI.js} +52 -28
- package/dist/{middleware-CgOqRkK-.mjs → middleware-DN3MdTDg.mjs} +64 -39
- package/dist/{mod-CTh7ijx5.d.ts → mod-Bz9tFXI2.d.ts} +14 -3
- package/dist/{mod-Cwdt_CWU.d.ts → mod-CZetqT5h.d.ts} +1 -1
- package/dist/{mod-Cr79cQlc.d.cts → mod-D4g9ffEn.d.cts} +1 -1
- package/dist/{mod-DnElMslb.d.cts → mod-DGOIxEfb.d.cts} +1 -1
- package/dist/{mod-DMdGFMEl.d.cts → mod-S--JxYjo.d.cts} +14 -3
- package/dist/{mod-COWgSo2v.d.ts → mod-owwElvpw.d.ts} +1 -1
- package/dist/mod.cjs +8 -8
- package/dist/mod.d.cts +5 -5
- package/dist/mod.d.ts +5 -5
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/handler.test.mjs +2 -2
- package/dist/{owner-CPFM-sqo.mjs → owner-BNHhwjNu.mjs} +37 -4
- package/dist/{sig-C1xOA4ml.js → portable-collection-CRpTUHCY.mjs} +5 -4
- package/dist/portable-collection-CgglAI9B.js +656 -0
- package/dist/{sig-Cb9VSeiF.cjs → portable-collection-PTGD0q70.cjs} +253 -2
- package/dist/portable-key-DqX2emHQ.mjs +395 -0
- package/dist/{portable-key-id-T7lecIbt.mjs → portable-key-id-Bg259c4Z.mjs} +69 -2
- package/dist/{proof-BCOg7Njv.mjs → proof-B4_0E-KU.mjs} +5 -5
- package/dist/{send-C8eOPat3.mjs → send-Dpu5qbP5.mjs} +3 -3
- package/dist/sig/compound-proof-discovery.test.mjs +1 -1
- package/dist/sig/compound-proof-producer.test.mjs +1 -1
- package/dist/sig/compound-proof-verification.test.mjs +2 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +5 -6
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +2 -3
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/portable-collection.test.mjs +20 -431
- package/dist/sig/portable-key.test.mjs +479 -5
- package/dist/sig/proof.test.mjs +3 -3
- package/dist/{temporal-vjHOhBpy.mjs → temporal-78JVR3GK.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/testing/mod.d.mts +30 -4
- package/dist/testing/mod.mjs +2 -2
- package/dist/{testing-BWq1dCzx.mjs → testing-otQhu4aD.mjs} +1 -1
- package/dist/utils/docloader.test.mjs +81 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +7 -7
- package/dist/owner-DkA0Lz7v.cjs +0 -225
- package/dist/owner-wNinn7RK.js +0 -215
- package/dist/portable-key-DyylakVV.mjs +0 -214
|
@@ -1,28 +1,29 @@
|
|
|
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-_o3lkDlG.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-CDaHfBXY.mjs";
|
|
6
6
|
import { t as formatAcceptSignature } from "./accept-CPVqki78.mjs";
|
|
7
|
-
import { a as
|
|
8
|
-
import { c as validateCryptoKey, n as exportJwk, s as importJwk } from "./key-
|
|
7
|
+
import { a as hasPortableActor, c as isPortableId, l as isPortableKeyId, n as getGatewayKeyBase, o as isCompatibleKeyId, r as getPortableDid, t as getCanonicalPortableId, u as isPortableUri } from "./portable-key-id-Bg259c4Z.mjs";
|
|
8
|
+
import { c as validateCryptoKey, n as exportJwk, s as importJwk } from "./key-DolJjJab.mjs";
|
|
9
9
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-4IJqPYos.mjs";
|
|
10
|
-
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-
|
|
11
|
-
import { i as signObject, l as verifyPortableObjectProofWithRoot, o as verifyObject, r as hasProofLike, s as verifyPortableObjectProof, t as InvalidPortableObjectIdError } from "./proof-
|
|
12
|
-
import { a as listRequestSignatures, c as selectRequestSignature, d as verifyRequest, f as verifyRequestDetailed, s as parseRfc9421SignatureInput } from "./http-
|
|
13
|
-
import { t as getAuthenticatedDocumentLoader } from "./docloader-
|
|
14
|
-
import { n as kvCache } from "./kv-cache-
|
|
10
|
+
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-Dwc176V4.mjs";
|
|
11
|
+
import { i as signObject, l as verifyPortableObjectProofWithRoot, o as verifyObject, r as hasProofLike, s as verifyPortableObjectProof, t as InvalidPortableObjectIdError } from "./proof-B4_0E-KU.mjs";
|
|
12
|
+
import { a as listRequestSignatures, c as selectRequestSignature, d as verifyRequest, f as verifyRequestDetailed, s as parseRfc9421SignatureInput } from "./http-BpOiZE09.mjs";
|
|
13
|
+
import { t as getAuthenticatedDocumentLoader } from "./docloader-BbS0rO-Y.mjs";
|
|
14
|
+
import { n as kvCache } from "./kv-cache-Bq2cah0c.mjs";
|
|
15
15
|
import { d as readBoundedText, l as BodyTooLargeError, t as getNodeInfo, u as MAX_BODY_SIZE } from "./client-DpnpgjyX.mjs";
|
|
16
16
|
import { t as nodeInfoToJson } from "./types-DE_LV1JB.mjs";
|
|
17
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-
|
|
18
|
-
import {
|
|
19
|
-
import { n as
|
|
17
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-BNHhwjNu.mjs";
|
|
18
|
+
import { t as verifyPortableObject } from "./portable-collection-CRpTUHCY.mjs";
|
|
19
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-Dpu5qbP5.mjs";
|
|
20
|
+
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-C0bxZDL0.mjs";
|
|
20
21
|
import { t as CircuitBreaker } from "./circuit-breaker-C5NqoLBJ.mjs";
|
|
21
22
|
import { t as buildCollectionSynchronizationHeader } from "./collection-CnnP1UAv.mjs";
|
|
22
|
-
import { a as verifyCompoundPortableObjectProofs, i as inspectCompoundPortableObjectApplicability, r as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "./compound-proof-
|
|
23
|
+
import { a as verifyCompoundPortableObjectProofs, i as inspectCompoundPortableObjectApplicability, r as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "./compound-proof-D9Kljk_7.mjs";
|
|
23
24
|
import { t as KvKeyCache } from "./keycache-BInaECGj.mjs";
|
|
24
25
|
import { t as acceptsJsonLd } from "./negotiation-CCocWT_N.mjs";
|
|
25
|
-
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-
|
|
26
|
+
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-78JVR3GK.mjs";
|
|
26
27
|
import { t as createExponentialBackoffPolicy } from "./retry-zX5xw5e0.mjs";
|
|
27
28
|
import { t as TaskCodec } from "./codec-C6rTrpIp.mjs";
|
|
28
29
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
@@ -1311,13 +1312,13 @@ function recordCollectionMetrics(meterProvider, base, result, options = {}) {
|
|
|
1311
1312
|
* @param parameters The parameters for handling the collection.
|
|
1312
1313
|
* @returns A promise that resolves to an HTTP response.
|
|
1313
1314
|
*/
|
|
1314
|
-
async function handleCollection(request, { name: name$
|
|
1315
|
-
const spanName = name$
|
|
1315
|
+
async function handleCollection(request, { name: name$2, identifier, uriGetter, filter, filterPredicate, context, collectionCallbacks, tracerProvider, meterProvider, onUnauthorized, onNotFound }) {
|
|
1316
|
+
const spanName = name$2.trim().replace(/\s+/g, "_");
|
|
1316
1317
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
1317
1318
|
const tracer = tracerProvider.getTracer(name, version);
|
|
1318
1319
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
1319
1320
|
const metricBase = {
|
|
1320
|
-
kind: getCollectionMetricKind(name$
|
|
1321
|
+
kind: getCollectionMetricKind(name$2),
|
|
1321
1322
|
page: cursor != null,
|
|
1322
1323
|
dispatcher: "built_in"
|
|
1323
1324
|
};
|
|
@@ -1358,7 +1359,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
|
|
|
1358
1359
|
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
1359
1360
|
return await onNotFound(request);
|
|
1360
1361
|
}
|
|
1361
|
-
const items = filterCollectionItems(page.items, name$
|
|
1362
|
+
const items = filterCollectionItems(page.items, name$2, filterPredicate);
|
|
1362
1363
|
itemCount = items.length;
|
|
1363
1364
|
span.setAttribute("fedify.collection.items", itemCount);
|
|
1364
1365
|
return items;
|
|
@@ -1398,7 +1399,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
|
|
|
1398
1399
|
} else {
|
|
1399
1400
|
const uri = new URL(baseUri);
|
|
1400
1401
|
uri.searchParams.set("cursor", cursor);
|
|
1401
|
-
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$
|
|
1402
|
+
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$2}`, {
|
|
1402
1403
|
kind: SpanKind.SERVER,
|
|
1403
1404
|
attributes: {
|
|
1404
1405
|
"activitypub.collection.id": uri.href,
|
|
@@ -1414,7 +1415,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
|
|
|
1414
1415
|
span.setStatus({ code: SpanStatusCode.ERROR });
|
|
1415
1416
|
return await onNotFound(request);
|
|
1416
1417
|
}
|
|
1417
|
-
const items = filterCollectionItems(page.items, name$
|
|
1418
|
+
const items = filterCollectionItems(page.items, name$2, filterPredicate);
|
|
1418
1419
|
itemCount = items.length;
|
|
1419
1420
|
span.setAttribute("fedify.collection.items", itemCount);
|
|
1420
1421
|
return {
|
|
@@ -2149,7 +2150,8 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
2149
2150
|
documentLoader: ctx.documentLoader,
|
|
2150
2151
|
keyCache,
|
|
2151
2152
|
meterProvider,
|
|
2152
|
-
tracerProvider
|
|
2153
|
+
tracerProvider,
|
|
2154
|
+
verifyPortableObject: ctx.verifyPortableObject
|
|
2153
2155
|
});
|
|
2154
2156
|
} catch (error) {
|
|
2155
2157
|
if (error instanceof RangeError && await hasMalformedKnownTemporalLiteral(jsonWithoutSig, ctx.contextLoader)) return await respondInvalidActivity(error);
|
|
@@ -2307,7 +2309,7 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
2307
2309
|
"http_signatures.verified": httpSigKey != null,
|
|
2308
2310
|
"http_signatures.key_id": httpSigKey?.id?.href ?? ""
|
|
2309
2311
|
});
|
|
2310
|
-
if (!skipSignatureVerification && !proofVerified && (isPortableActivity(activity) ||
|
|
2312
|
+
if (!skipSignatureVerification && !proofVerified && (isPortableActivity(activity) || isPortableActorKey(httpSigKey))) {
|
|
2311
2313
|
if (deferredLdSignatureError != null) throw deferredLdSignatureError;
|
|
2312
2314
|
logger.error("The activity {activityId} of the portable actor {actorId} is not authenticated by a valid Object Integrity Proof.", {
|
|
2313
2315
|
activity: json,
|
|
@@ -2602,8 +2604,8 @@ var CustomCollectionHandler = class {
|
|
|
2602
2604
|
* @param CollectionPage The CollectionPage constructor.
|
|
2603
2605
|
* @param filterPredicate Optional filter predicate for items.
|
|
2604
2606
|
*/
|
|
2605
|
-
constructor(name$
|
|
2606
|
-
this.name = name$
|
|
2607
|
+
constructor(name$1, values, context, callbacks, tracerProvider = trace.getTracerProvider(), meterProvider, Collection, CollectionPage, filterPredicate) {
|
|
2608
|
+
this.name = name$1;
|
|
2607
2609
|
this.values = values;
|
|
2608
2610
|
this.context = context;
|
|
2609
2611
|
this.callbacks = callbacks;
|
|
@@ -3088,13 +3090,13 @@ const MIN_COMPONENTS = [
|
|
|
3088
3090
|
"@authority"
|
|
3089
3091
|
];
|
|
3090
3092
|
/**
|
|
3091
|
-
* Checks whether an HTTP Signature key is a
|
|
3092
|
-
*
|
|
3093
|
-
* a portable actor, which only the portable actor's
|
|
3094
|
-
* establish.
|
|
3093
|
+
* Checks whether an HTTP Signature key is a key of an FEP-ef61 portable
|
|
3094
|
+
* actor, i.e., its ID is a compatible identifier or an `ap:` or `ap+ef61:`
|
|
3095
|
+
* URI, and it is owned by a portable actor, which only the portable actor's
|
|
3096
|
+
* signed document can establish.
|
|
3095
3097
|
*/
|
|
3096
|
-
function
|
|
3097
|
-
return key?.id != null &&
|
|
3098
|
+
function isPortableActorKey(key) {
|
|
3099
|
+
return key?.id != null && isPortableKeyId(key.id) && key.ownerId != null && isPortableId(key.ownerId);
|
|
3098
3100
|
}
|
|
3099
3101
|
/**
|
|
3100
3102
|
* Checks whether an activity needs an Object Integrity Proof by its DID:
|
|
@@ -3213,7 +3215,7 @@ async function signOutgoingActivity(activity, candidates, options) {
|
|
|
3213
3215
|
hasProof = true;
|
|
3214
3216
|
break;
|
|
3215
3217
|
}
|
|
3216
|
-
const keys = candidates.filter((c) => c.privateKey.algorithm.name === "Ed25519" && !
|
|
3218
|
+
const keys = candidates.filter((c) => c.privateKey.algorithm.name === "Ed25519" && !isPortableKeyId(c.verificationMethod));
|
|
3217
3219
|
if (!hasProof && activity.id != null && isPortableId(activity.id)) return await sign(selectPortableActivityKey(activity, activity.id, keys));
|
|
3218
3220
|
if (keys.length < 1 || hasProof && !options.appendToExistingProofs) return {
|
|
3219
3221
|
activity,
|
|
@@ -4348,11 +4350,16 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
4348
4350
|
});
|
|
4349
4351
|
return parsedActorIds;
|
|
4350
4352
|
};
|
|
4351
|
-
const parseActivity = () =>
|
|
4352
|
-
contextLoader
|
|
4353
|
-
documentLoader
|
|
4354
|
-
|
|
4355
|
-
|
|
4353
|
+
const parseActivity = () => {
|
|
4354
|
+
const contextLoader = this.contextLoaderFactory(loaderOptions);
|
|
4355
|
+
const documentLoader = rsaKeyPair == null ? this.documentLoaderFactory(loaderOptions) : this.authenticatedDocumentLoaderFactory(rsaKeyPair, loaderOptions);
|
|
4356
|
+
return Activity.fromJsonLd(message.activity, {
|
|
4357
|
+
contextLoader,
|
|
4358
|
+
documentLoader,
|
|
4359
|
+
tracerProvider: this.tracerProvider,
|
|
4360
|
+
verifyPortableObject: createPortableObjectVerifier(documentLoader, contextLoader, this)
|
|
4361
|
+
});
|
|
4362
|
+
};
|
|
4356
4363
|
const enqueueHeldOutboxMessage = async (delay, heldSince) => {
|
|
4357
4364
|
const { outboxQueue } = this;
|
|
4358
4365
|
if (outboxQueue == null) return;
|
|
@@ -4994,7 +5001,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
4994
5001
|
const ldSignable = !hasPortableActor(activity);
|
|
4995
5002
|
for (const { keyId, privateKey } of keys) {
|
|
4996
5003
|
validateCryptoKey(privateKey, "private");
|
|
4997
|
-
if (ldSignable && rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5" && !
|
|
5004
|
+
if (ldSignable && rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5" && !isPortableKeyId(keyId)) rsaKey = {
|
|
4998
5005
|
keyId,
|
|
4999
5006
|
privateKey
|
|
5000
5007
|
};
|
|
@@ -5828,12 +5835,28 @@ function getCollectionMetricRoute(routeName) {
|
|
|
5828
5835
|
}
|
|
5829
5836
|
}
|
|
5830
5837
|
const FANOUT_THRESHOLD = 5;
|
|
5838
|
+
/**
|
|
5839
|
+
* Creates the FEP-ef61 portable object verifier that a context applies to
|
|
5840
|
+
* portable objects it dereferences: `verifyPortableObject()` with the given
|
|
5841
|
+
* loaders and the federation's tracer provider as defaults. Other options,
|
|
5842
|
+
* such as the document URL, gateways, and referrer, are passed through as
|
|
5843
|
+
* they are.
|
|
5844
|
+
*/
|
|
5845
|
+
function createPortableObjectVerifier(documentLoader, contextLoader, federation) {
|
|
5846
|
+
return (document, options = {}) => verifyPortableObject(document, {
|
|
5847
|
+
...options,
|
|
5848
|
+
documentLoader: options.documentLoader ?? documentLoader,
|
|
5849
|
+
contextLoader: options.contextLoader ?? contextLoader,
|
|
5850
|
+
tracerProvider: options.tracerProvider ?? federation.tracerProvider
|
|
5851
|
+
});
|
|
5852
|
+
}
|
|
5831
5853
|
var ContextImpl = class ContextImpl {
|
|
5832
5854
|
url;
|
|
5833
5855
|
federation;
|
|
5834
5856
|
data;
|
|
5835
5857
|
documentLoader;
|
|
5836
5858
|
contextLoader;
|
|
5859
|
+
verifyPortableObject;
|
|
5837
5860
|
invokedFromActorKeyPairsDispatcher;
|
|
5838
5861
|
#codec;
|
|
5839
5862
|
constructor({ url, federation, data, documentLoader, contextLoader, invokedFromActorKeyPairsDispatcher }) {
|
|
@@ -5842,6 +5865,7 @@ var ContextImpl = class ContextImpl {
|
|
|
5842
5865
|
this.data = data;
|
|
5843
5866
|
this.documentLoader = documentLoader;
|
|
5844
5867
|
this.contextLoader = contextLoader;
|
|
5868
|
+
this.verifyPortableObject = createPortableObjectVerifier(documentLoader, contextLoader, federation);
|
|
5845
5869
|
this.invokedFromActorKeyPairsDispatcher = invokedFromActorKeyPairsDispatcher;
|
|
5846
5870
|
}
|
|
5847
5871
|
/**
|
|
@@ -6193,7 +6217,7 @@ var ContextImpl = class ContextImpl {
|
|
|
6193
6217
|
userAgent: options.userAgent ?? this.federation.userAgent,
|
|
6194
6218
|
tracerProvider: options.tracerProvider ?? this.tracerProvider,
|
|
6195
6219
|
meterProvider: options.meterProvider ?? this.meterProvider,
|
|
6196
|
-
verifyPortableObject: options.verifyPortableObject ??
|
|
6220
|
+
verifyPortableObject: options.verifyPortableObject ?? this.verifyPortableObject,
|
|
6197
6221
|
allowPrivateAddress: this.federation.allowPrivateAddress
|
|
6198
6222
|
});
|
|
6199
6223
|
}
|
|
@@ -6201,7 +6225,8 @@ var ContextImpl = class ContextImpl {
|
|
|
6201
6225
|
return traverseCollection(collection, {
|
|
6202
6226
|
...options,
|
|
6203
6227
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
6204
|
-
contextLoader: options.contextLoader ?? this.contextLoader
|
|
6228
|
+
contextLoader: options.contextLoader ?? this.contextLoader,
|
|
6229
|
+
verifyPortableObject: options.verifyPortableObject ?? this.verifyPortableObject
|
|
6205
6230
|
});
|
|
6206
6231
|
}
|
|
6207
6232
|
lookupNodeInfo(url, options = {}) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { S as KeyCache } from "./http-
|
|
2
|
+
import { S as KeyCache } from "./http-C-x_OLSp.js";
|
|
3
3
|
import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "@fedify/vocab";
|
|
4
4
|
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
5
|
-
import { DocumentLoader, PortableObjectVerifierOptions } from "@fedify/vocab-runtime";
|
|
5
|
+
import { DocumentLoader, PortableObjectVerifier, PortableObjectVerifierOptions } from "@fedify/vocab-runtime";
|
|
6
6
|
|
|
7
7
|
//#region src/sig/ld.d.ts
|
|
8
8
|
/**
|
|
@@ -376,7 +376,18 @@ declare function verifyPortableObjectProof(jsonLd: unknown, options?: VerifyPort
|
|
|
376
376
|
* Options for {@link verifyObject}.
|
|
377
377
|
* @since 0.10.0
|
|
378
378
|
*/
|
|
379
|
-
interface VerifyObjectOptions extends VerifyProofOptions {
|
|
379
|
+
interface VerifyObjectOptions extends VerifyProofOptions {
|
|
380
|
+
/**
|
|
381
|
+
* The default [FEP-ef61] portable object verifier for the property
|
|
382
|
+
* accessors of the returned object and the objects obtained from it, e.g.,
|
|
383
|
+
* `Context.verifyPortableObject`. It is not used to verify the given
|
|
384
|
+
* object itself.
|
|
385
|
+
*
|
|
386
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
387
|
+
* @since 2.4.0
|
|
388
|
+
*/
|
|
389
|
+
verifyPortableObject?: PortableObjectVerifier;
|
|
390
|
+
}
|
|
380
391
|
/**
|
|
381
392
|
* Verifies the given object. It will verify all the proofs in the object,
|
|
382
393
|
* and succeed only if all the proofs are valid and all attributions and
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { n as HttpMessageSignaturesSpecDeterminer } from "./http-
|
|
2
|
+
import { n as HttpMessageSignaturesSpecDeterminer } from "./http-C-x_OLSp.js";
|
|
3
3
|
import { n as KvStore, t as KvKey } from "./kv-BhNbN8Ed.js";
|
|
4
4
|
import { t as DocumentFetchKind } from "./metrics-DoRtI0qU.js";
|
|
5
5
|
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { n as HttpMessageSignaturesSpecDeterminer } from "./http-
|
|
2
|
+
import { n as HttpMessageSignaturesSpecDeterminer } from "./http-CjezPjFX.cjs";
|
|
3
3
|
import { n as KvStore, t as KvKey } from "./kv-BhNbN8Ed.cjs";
|
|
4
4
|
import { t as DocumentFetchKind } from "./metrics-DVKYY6K1.cjs";
|
|
5
5
|
import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { Gt as WebFingerLinksDispatcher, bt as ActorHandleMapper, d as RequestContext, vt as ActorAliasMapper, yt as ActorDispatcher } from "./context-
|
|
2
|
+
import { Gt as WebFingerLinksDispatcher, bt as ActorHandleMapper, d as RequestContext, vt as ActorAliasMapper, yt as ActorDispatcher } from "./context-Dvec_D_h.cjs";
|
|
3
3
|
import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
|
|
4
4
|
import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
|
|
5
5
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { S as KeyCache } from "./http-
|
|
2
|
+
import { S as KeyCache } from "./http-CjezPjFX.cjs";
|
|
3
3
|
import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "@fedify/vocab";
|
|
4
|
-
import { DocumentLoader, PortableObjectVerifierOptions } from "@fedify/vocab-runtime";
|
|
4
|
+
import { DocumentLoader, PortableObjectVerifier, PortableObjectVerifierOptions } from "@fedify/vocab-runtime";
|
|
5
5
|
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
6
6
|
|
|
7
7
|
//#region src/sig/ld.d.ts
|
|
@@ -376,7 +376,18 @@ declare function verifyPortableObjectProof(jsonLd: unknown, options?: VerifyPort
|
|
|
376
376
|
* Options for {@link verifyObject}.
|
|
377
377
|
* @since 0.10.0
|
|
378
378
|
*/
|
|
379
|
-
interface VerifyObjectOptions extends VerifyProofOptions {
|
|
379
|
+
interface VerifyObjectOptions extends VerifyProofOptions {
|
|
380
|
+
/**
|
|
381
|
+
* The default [FEP-ef61] portable object verifier for the property
|
|
382
|
+
* accessors of the returned object and the objects obtained from it, e.g.,
|
|
383
|
+
* `Context.verifyPortableObject`. It is not used to verify the given
|
|
384
|
+
* object itself.
|
|
385
|
+
*
|
|
386
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
387
|
+
* @since 2.4.0
|
|
388
|
+
*/
|
|
389
|
+
verifyPortableObject?: PortableObjectVerifier;
|
|
390
|
+
}
|
|
380
391
|
/**
|
|
381
392
|
* Verifies the given object. It will verify all the proofs in the object,
|
|
382
393
|
* and succeed only if all the proofs are valid and all attributions and
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { Gt as WebFingerLinksDispatcher, bt as ActorHandleMapper, d as RequestContext, vt as ActorAliasMapper, yt as ActorDispatcher } from "./context-
|
|
2
|
+
import { Gt as WebFingerLinksDispatcher, bt as ActorHandleMapper, d as RequestContext, vt as ActorAliasMapper, yt as ActorDispatcher } from "./context-Cz1w5Krc.js";
|
|
3
3
|
import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
|
|
4
4
|
import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
|
|
5
5
|
|
package/dist/mod.cjs
CHANGED
|
@@ -3,14 +3,14 @@ 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-
|
|
6
|
+
const require_http = require("./http-B1J6E-bT.cjs");
|
|
7
|
+
const require_federation = require("./federation-DRY8KrkB.cjs");
|
|
8
8
|
const require_types = require("./types-Be2zbyeG.cjs");
|
|
9
|
-
const
|
|
10
|
-
const require_kv_cache = require("./kv-cache-
|
|
9
|
+
const require_portable_collection = require("./portable-collection-PTGD0q70.cjs");
|
|
10
|
+
const require_kv_cache = require("./kv-cache-D9nRbG2Q.cjs");
|
|
11
11
|
require("./nodeinfo/mod.cjs");
|
|
12
12
|
require("./runtime/mod.cjs");
|
|
13
|
-
|
|
13
|
+
require("./sig/mod.cjs");
|
|
14
14
|
require("./utils/mod.cjs");
|
|
15
15
|
//#endregion
|
|
16
16
|
exports.CircuitBreaker = require_federation.CircuitBreaker;
|
|
@@ -31,7 +31,7 @@ exports.createProof = require_http.createProof;
|
|
|
31
31
|
exports.createSignature = require_http.createSignature;
|
|
32
32
|
exports.detachSignature = require_http.detachSignature;
|
|
33
33
|
exports.digest = require_federation.digest;
|
|
34
|
-
exports.doesActorOwnKey =
|
|
34
|
+
exports.doesActorOwnKey = require_portable_collection.doesActorOwnKey;
|
|
35
35
|
exports.exportJwk = require_http.exportJwk;
|
|
36
36
|
exports.fetchKey = require_http.fetchKey;
|
|
37
37
|
exports.fetchKeyDetailed = require_http.fetchKeyDetailed;
|
|
@@ -40,7 +40,7 @@ exports.fulfillAcceptSignature = require_http.fulfillAcceptSignature;
|
|
|
40
40
|
exports.generateCryptoKeyPair = require_http.generateCryptoKeyPair;
|
|
41
41
|
exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
|
|
42
42
|
exports.getDefaultActivityTransformers = require_transformers.getDefaultActivityTransformers;
|
|
43
|
-
exports.getKeyOwner =
|
|
43
|
+
exports.getKeyOwner = require_portable_collection.getKeyOwner;
|
|
44
44
|
exports.getNodeInfo = require_types.getNodeInfo;
|
|
45
45
|
exports.handleWebFinger = require_federation.handleWebFinger;
|
|
46
46
|
exports.hasProofLike = require_http.hasProofLike;
|
|
@@ -60,7 +60,7 @@ exports.signRequest = require_http.signRequest;
|
|
|
60
60
|
exports.validateAcceptSignature = require_http.validateAcceptSignature;
|
|
61
61
|
exports.verifyJsonLd = require_http.verifyJsonLd;
|
|
62
62
|
exports.verifyObject = require_http.verifyObject;
|
|
63
|
-
exports.verifyPortableObject =
|
|
63
|
+
exports.verifyPortableObject = require_portable_collection.verifyPortableObject;
|
|
64
64
|
exports.verifyPortableObjectProof = require_http.verifyPortableObjectProof;
|
|
65
65
|
exports.verifyProof = require_http.verifyProof;
|
|
66
66
|
exports.verifyRequest = require_http.verifyRequest;
|
package/dist/mod.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-D-XP_Ccb.cjs";
|
|
3
|
-
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-
|
|
3
|
+
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-CjezPjFX.cjs";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-BF0L9cMt.cjs";
|
|
5
|
-
import { $ as InProcessMessageQueue, A as MediaUploaderSetters, At as HashlinkMediaRequest, B as createFederationBuilder, Bt as OutboxPermanentFailureHandler, C as FederationFetchOptions, Ct as CollectionCounter, D as IdempotencyStrategy, Dt as CustomCollectionCursor, E as IdempotencyKeyCallback, Et as CustomCollectionCounter, F as FederationKvPrefixes, Ft as ObjectAuthorizePredicate, G as TaskRegistry, Gt as WebFingerLinksDispatcher, H as TaskDefinitionOptions, Ht as SharedInboxKeyDispatcher, I as FederationOrigin, It as ObjectDispatcher, J as RetryPolicy, Jt as PageItems, K as CreateExponentialBackoffPolicyOptions, Kt as SendActivityError, L as FederationQueueOptions, Lt as OutboxErrorHandler, M as OutboxListenerSetters, Mt as InboxListener, N as PortableInboxForwardingOptions, Nt as MediaUploaderCallback, O as InboxChallengePolicy, Ot as CustomCollectionDispatcher, P as Rfc6570Expression, Pt as NodeInfoDispatcher, Q as respondWithObjectIfAcceptable, R as createFederation, Rt as OutboxListener, S as FederationBuilder, St as AuthorizePredicate, T as FederationStartQueueOptions, Tt as CollectionDispatcher, U as TaskEnqueueOptions, Ut as UnverifiedActivityHandler, V as TaskDefinition, Vt as PortableActorIdMapper, W as TaskHandler, Wt as UnverifiedActivityReason, X as RespondWithObjectOptions, Xt as digest, Y as createExponentialBackoffPolicy, Yt as buildCollectionSynchronizationHeader, Z as respondWithObject, Zt as ActivityTransformer, _ as ConstructorWithTypeId, _t as parseCircuitBreakerKvState, a as GetObjectOptions, at as ParallelMessageQueue, b as Federation, bt as ActorHandleMapper, c as OutboxContext, ct as CircuitBreakerBeforeSendDecision, d as RequestContext, dt as CircuitBreakerKvState, et as InProcessMessageQueueOptions, f as RouteActivityOptions, ft as CircuitBreakerOptions, g as CollectionCallbackSetters, gt as normalizeCircuitBreakerOptions, h as ActorCallbackSetters, ht as NormalizedCircuitBreakerOptions, i as GetActorOptions, it as MessageQueueListenOptions, j as ObjectCallbackSetters, jt as InboxErrorHandler, k as InboxListenerSetters, kt as HashlinkMediaDispatcher, l as ParseUriResult, lt as CircuitBreakerCreateOptions, m as SendActivityOptionsForCollection, mt as CircuitBreakerStateChange, n as Context, nt as MessageQueueDepth, o as GetSignedKeyOptions, ot as CircuitBreaker, p as SendActivityOptions, pt as CircuitBreakerState, q as RetryContext, qt as SenderKeyPair, r as ForwardActivityOptions, rt as MessageQueueEnqueueOptions, s as InboxContext, st as CircuitBreakerActivityDrop, t as ActorKeyPair, tt as MessageQueue, u as PortableRequest, ut as CircuitBreakerFailurePolicy, v as CustomCollectionCallbackSetters, vt as ActorAliasMapper, w as FederationOptions, wt as CollectionCursor, x as FederationBenchmarkOptions, xt as ActorKeyPairsDispatcher, y as Federatable, yt as ActorDispatcher, z as Message, zt as OutboxListenerErrorHandler } from "./context-
|
|
5
|
+
import { $ as InProcessMessageQueue, A as MediaUploaderSetters, At as HashlinkMediaRequest, B as createFederationBuilder, Bt as OutboxPermanentFailureHandler, C as FederationFetchOptions, Ct as CollectionCounter, D as IdempotencyStrategy, Dt as CustomCollectionCursor, E as IdempotencyKeyCallback, Et as CustomCollectionCounter, F as FederationKvPrefixes, Ft as ObjectAuthorizePredicate, G as TaskRegistry, Gt as WebFingerLinksDispatcher, H as TaskDefinitionOptions, Ht as SharedInboxKeyDispatcher, I as FederationOrigin, It as ObjectDispatcher, J as RetryPolicy, Jt as PageItems, K as CreateExponentialBackoffPolicyOptions, Kt as SendActivityError, L as FederationQueueOptions, Lt as OutboxErrorHandler, M as OutboxListenerSetters, Mt as InboxListener, N as PortableInboxForwardingOptions, Nt as MediaUploaderCallback, O as InboxChallengePolicy, Ot as CustomCollectionDispatcher, P as Rfc6570Expression, Pt as NodeInfoDispatcher, Q as respondWithObjectIfAcceptable, R as createFederation, Rt as OutboxListener, S as FederationBuilder, St as AuthorizePredicate, T as FederationStartQueueOptions, Tt as CollectionDispatcher, U as TaskEnqueueOptions, Ut as UnverifiedActivityHandler, V as TaskDefinition, Vt as PortableActorIdMapper, W as TaskHandler, Wt as UnverifiedActivityReason, X as RespondWithObjectOptions, Xt as digest, Y as createExponentialBackoffPolicy, Yt as buildCollectionSynchronizationHeader, Z as respondWithObject, Zt as ActivityTransformer, _ as ConstructorWithTypeId, _t as parseCircuitBreakerKvState, a as GetObjectOptions, at as ParallelMessageQueue, b as Federation, bt as ActorHandleMapper, c as OutboxContext, ct as CircuitBreakerBeforeSendDecision, d as RequestContext, dt as CircuitBreakerKvState, et as InProcessMessageQueueOptions, f as RouteActivityOptions, ft as CircuitBreakerOptions, g as CollectionCallbackSetters, gt as normalizeCircuitBreakerOptions, h as ActorCallbackSetters, ht as NormalizedCircuitBreakerOptions, i as GetActorOptions, it as MessageQueueListenOptions, j as ObjectCallbackSetters, jt as InboxErrorHandler, k as InboxListenerSetters, kt as HashlinkMediaDispatcher, l as ParseUriResult, lt as CircuitBreakerCreateOptions, m as SendActivityOptionsForCollection, mt as CircuitBreakerStateChange, n as Context, nt as MessageQueueDepth, o as GetSignedKeyOptions, ot as CircuitBreaker, p as SendActivityOptions, pt as CircuitBreakerState, q as RetryContext, qt as SenderKeyPair, r as ForwardActivityOptions, rt as MessageQueueEnqueueOptions, s as InboxContext, st as CircuitBreakerActivityDrop, t as ActorKeyPair, tt as MessageQueue, u as PortableRequest, ut as CircuitBreakerFailurePolicy, v as CustomCollectionCallbackSetters, vt as ActorAliasMapper, w as FederationOptions, wt as CollectionCursor, x as FederationBenchmarkOptions, xt as ActorKeyPairsDispatcher, y as Federatable, yt as ActorDispatcher, z as Message, zt as OutboxListenerErrorHandler } from "./context-Dvec_D_h.cjs";
|
|
6
6
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-BhNbN8Ed.cjs";
|
|
7
7
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
|
|
8
|
-
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-
|
|
9
|
-
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "./mod-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-
|
|
8
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-DGOIxEfb.cjs";
|
|
9
|
+
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "./mod-S--JxYjo.cjs";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-D4g9ffEn.cjs";
|
|
11
11
|
export * from "@fedify/vocab-runtime";
|
|
12
12
|
|
|
13
13
|
//#region src/mod.d.ts
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-D-XP_Ccb.js";
|
|
3
|
-
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-
|
|
3
|
+
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-C-x_OLSp.js";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-BSzr5-I8.js";
|
|
5
|
-
import { $ as InProcessMessageQueue, A as MediaUploaderSetters, At as HashlinkMediaRequest, B as createFederationBuilder, Bt as OutboxPermanentFailureHandler, C as FederationFetchOptions, Ct as CollectionCounter, D as IdempotencyStrategy, Dt as CustomCollectionCursor, E as IdempotencyKeyCallback, Et as CustomCollectionCounter, F as FederationKvPrefixes, Ft as ObjectAuthorizePredicate, G as TaskRegistry, Gt as WebFingerLinksDispatcher, H as TaskDefinitionOptions, Ht as SharedInboxKeyDispatcher, I as FederationOrigin, It as ObjectDispatcher, J as RetryPolicy, Jt as PageItems, K as CreateExponentialBackoffPolicyOptions, Kt as SendActivityError, L as FederationQueueOptions, Lt as OutboxErrorHandler, M as OutboxListenerSetters, Mt as InboxListener, N as PortableInboxForwardingOptions, Nt as MediaUploaderCallback, O as InboxChallengePolicy, Ot as CustomCollectionDispatcher, P as Rfc6570Expression, Pt as NodeInfoDispatcher, Q as respondWithObjectIfAcceptable, R as createFederation, Rt as OutboxListener, S as FederationBuilder, St as AuthorizePredicate, T as FederationStartQueueOptions, Tt as CollectionDispatcher, U as TaskEnqueueOptions, Ut as UnverifiedActivityHandler, V as TaskDefinition, Vt as PortableActorIdMapper, W as TaskHandler, Wt as UnverifiedActivityReason, X as RespondWithObjectOptions, Xt as digest, Y as createExponentialBackoffPolicy, Yt as buildCollectionSynchronizationHeader, Z as respondWithObject, Zt as ActivityTransformer, _ as ConstructorWithTypeId, _t as parseCircuitBreakerKvState, a as GetObjectOptions, at as ParallelMessageQueue, b as Federation, bt as ActorHandleMapper, c as OutboxContext, ct as CircuitBreakerBeforeSendDecision, d as RequestContext, dt as CircuitBreakerKvState, et as InProcessMessageQueueOptions, f as RouteActivityOptions, ft as CircuitBreakerOptions, g as CollectionCallbackSetters, gt as normalizeCircuitBreakerOptions, h as ActorCallbackSetters, ht as NormalizedCircuitBreakerOptions, i as GetActorOptions, it as MessageQueueListenOptions, j as ObjectCallbackSetters, jt as InboxErrorHandler, k as InboxListenerSetters, kt as HashlinkMediaDispatcher, l as ParseUriResult, lt as CircuitBreakerCreateOptions, m as SendActivityOptionsForCollection, mt as CircuitBreakerStateChange, n as Context, nt as MessageQueueDepth, o as GetSignedKeyOptions, ot as CircuitBreaker, p as SendActivityOptions, pt as CircuitBreakerState, q as RetryContext, qt as SenderKeyPair, r as ForwardActivityOptions, rt as MessageQueueEnqueueOptions, s as InboxContext, st as CircuitBreakerActivityDrop, t as ActorKeyPair, tt as MessageQueue, u as PortableRequest, ut as CircuitBreakerFailurePolicy, v as CustomCollectionCallbackSetters, vt as ActorAliasMapper, w as FederationOptions, wt as CollectionCursor, x as FederationBenchmarkOptions, xt as ActorKeyPairsDispatcher, y as Federatable, yt as ActorDispatcher, z as Message, zt as OutboxListenerErrorHandler } from "./context-
|
|
5
|
+
import { $ as InProcessMessageQueue, A as MediaUploaderSetters, At as HashlinkMediaRequest, B as createFederationBuilder, Bt as OutboxPermanentFailureHandler, C as FederationFetchOptions, Ct as CollectionCounter, D as IdempotencyStrategy, Dt as CustomCollectionCursor, E as IdempotencyKeyCallback, Et as CustomCollectionCounter, F as FederationKvPrefixes, Ft as ObjectAuthorizePredicate, G as TaskRegistry, Gt as WebFingerLinksDispatcher, H as TaskDefinitionOptions, Ht as SharedInboxKeyDispatcher, I as FederationOrigin, It as ObjectDispatcher, J as RetryPolicy, Jt as PageItems, K as CreateExponentialBackoffPolicyOptions, Kt as SendActivityError, L as FederationQueueOptions, Lt as OutboxErrorHandler, M as OutboxListenerSetters, Mt as InboxListener, N as PortableInboxForwardingOptions, Nt as MediaUploaderCallback, O as InboxChallengePolicy, Ot as CustomCollectionDispatcher, P as Rfc6570Expression, Pt as NodeInfoDispatcher, Q as respondWithObjectIfAcceptable, R as createFederation, Rt as OutboxListener, S as FederationBuilder, St as AuthorizePredicate, T as FederationStartQueueOptions, Tt as CollectionDispatcher, U as TaskEnqueueOptions, Ut as UnverifiedActivityHandler, V as TaskDefinition, Vt as PortableActorIdMapper, W as TaskHandler, Wt as UnverifiedActivityReason, X as RespondWithObjectOptions, Xt as digest, Y as createExponentialBackoffPolicy, Yt as buildCollectionSynchronizationHeader, Z as respondWithObject, Zt as ActivityTransformer, _ as ConstructorWithTypeId, _t as parseCircuitBreakerKvState, a as GetObjectOptions, at as ParallelMessageQueue, b as Federation, bt as ActorHandleMapper, c as OutboxContext, ct as CircuitBreakerBeforeSendDecision, d as RequestContext, dt as CircuitBreakerKvState, et as InProcessMessageQueueOptions, f as RouteActivityOptions, ft as CircuitBreakerOptions, g as CollectionCallbackSetters, gt as normalizeCircuitBreakerOptions, h as ActorCallbackSetters, ht as NormalizedCircuitBreakerOptions, i as GetActorOptions, it as MessageQueueListenOptions, j as ObjectCallbackSetters, jt as InboxErrorHandler, k as InboxListenerSetters, kt as HashlinkMediaDispatcher, l as ParseUriResult, lt as CircuitBreakerCreateOptions, m as SendActivityOptionsForCollection, mt as CircuitBreakerStateChange, n as Context, nt as MessageQueueDepth, o as GetSignedKeyOptions, ot as CircuitBreaker, p as SendActivityOptions, pt as CircuitBreakerState, q as RetryContext, qt as SenderKeyPair, r as ForwardActivityOptions, rt as MessageQueueEnqueueOptions, s as InboxContext, st as CircuitBreakerActivityDrop, t as ActorKeyPair, tt as MessageQueue, u as PortableRequest, ut as CircuitBreakerFailurePolicy, v as CustomCollectionCallbackSetters, vt as ActorAliasMapper, w as FederationOptions, wt as CollectionCursor, x as FederationBenchmarkOptions, xt as ActorKeyPairsDispatcher, y as Federatable, yt as ActorDispatcher, z as Message, zt as OutboxListenerErrorHandler } from "./context-Cz1w5Krc.js";
|
|
6
6
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-BhNbN8Ed.js";
|
|
7
7
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
|
|
8
|
-
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-
|
|
9
|
-
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "./mod-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-
|
|
8
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-owwElvpw.js";
|
|
9
|
+
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "./mod-Bz9tFXI2.js";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-CZetqT5h.js";
|
|
11
11
|
export * from "@fedify/vocab-runtime";
|
|
12
12
|
|
|
13
13
|
//#region src/mod.d.ts
|
package/dist/mod.js
CHANGED
|
@@ -3,15 +3,15 @@ import { URLPattern } from "urlpattern-polyfill";
|
|
|
3
3
|
import "./rolldown-runtime-BC-Eo5Mj.js";
|
|
4
4
|
import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-DAtXl_Kc.js";
|
|
5
5
|
import "./compat/mod.js";
|
|
6
|
-
import { B as
|
|
7
|
-
import { a as respondWithObjectIfAcceptable, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as respondWithObject, l as CircuitBreaker, n as handleWebFinger, o as SendActivityError, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "./middleware-
|
|
6
|
+
import { B as fetchKeyDetailed, C as attachSignature, E as detachSignature, F as verifySignature, H as importJwk, L as exportJwk, M as signJsonLd, P as verifyJsonLd, T as createSignature, V as generateCryptoKeyPair, a as signRequest, d as createProof, dt as parseAcceptSignature, f as hasProofLike, ft as validateAcceptSignature, g as verifyPortableObjectProof, h as verifyObject, k as hasSignatureLike, lt as formatAcceptSignature, o as verifyRequest, p as signObject, s as verifyRequestDetailed, ut as fulfillAcceptSignature, y as verifyProof, z as fetchKey } from "./http-C2M6wcs8.js";
|
|
7
|
+
import { a as respondWithObjectIfAcceptable, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as respondWithObject, l as CircuitBreaker, n as handleWebFinger, o as SendActivityError, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "./middleware-CylX-pvI.js";
|
|
8
8
|
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-C_cNlNVK.js";
|
|
9
|
-
import { n as getKeyOwner, t as
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
9
|
+
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-CgglAI9B.js";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-D7TiyMxv.js";
|
|
11
11
|
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError } from "./federation/mod.js";
|
|
12
12
|
import "./nodeinfo/mod.js";
|
|
13
13
|
import "./runtime/mod.js";
|
|
14
|
-
import
|
|
14
|
+
import "./sig/mod.js";
|
|
15
15
|
import "./utils/mod.js";
|
|
16
16
|
export * from "@fedify/vocab-runtime";
|
|
17
17
|
//#endregion
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { r as createRequestContext } from "../context-
|
|
4
|
+
import { r as createRequestContext } from "../context-DfSVPcJ8.mjs";
|
|
5
5
|
import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
6
6
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
7
7
|
import "../std__assert-DvMDRPes.mjs";
|
|
8
|
-
import { C as handleNodeInfo, o as createFederation, w as handleNodeInfoJrd } from "../middleware-
|
|
8
|
+
import { C as handleNodeInfo, o as createFederation, w as handleNodeInfoJrd } from "../middleware-DN3MdTDg.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
//#region src/nodeinfo/handler.test.ts
|
|
11
11
|
test("handleNodeInfo()", async () => {
|
|
@@ -1,10 +1,10 @@
|
|
|
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 {
|
|
6
|
-
import { l as verifyKeyOwnership, n as exportJwk, r as fetchActorDocument } from "./key-
|
|
7
|
-
import { t as fetchPortableGatewayKey } from "./portable-key-
|
|
4
|
+
import { n as version, t as name } from "./deno-_o3lkDlG.mjs";
|
|
5
|
+
import { c as isPortableId, d as isSamePublicKey$1, o as isCompatibleKeyId, t as getCanonicalPortableId, u as isPortableUri } from "./portable-key-id-Bg259c4Z.mjs";
|
|
6
|
+
import { l as verifyKeyOwnership, n as exportJwk, r as fetchActorDocument } from "./key-DolJjJab.mjs";
|
|
7
|
+
import { n as resolvePortableActorKey, t as fetchPortableGatewayKey } from "./portable-key-DqX2emHQ.mjs";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
10
10
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -44,6 +44,14 @@ async function doesActorOwnKey(activity, key, options) {
|
|
|
44
44
|
span.setAttribute("activitypub.key_ownership.method", "none");
|
|
45
45
|
return false;
|
|
46
46
|
}
|
|
47
|
+
if (key.id != null && isPortableUri(key.id)) {
|
|
48
|
+
const owner = await getPortableActorKeyOwner(key, options);
|
|
49
|
+
const ownerId = owner?.id == null ? null : getCanonicalPortableId(owner.id);
|
|
50
|
+
const verified = ownerId != null && ownerId === getCanonicalPortableId(actorId);
|
|
51
|
+
span.setAttribute("activitypub.key_ownership.verified", verified);
|
|
52
|
+
span.setAttribute("activitypub.key_ownership.method", "portable_actor_key");
|
|
53
|
+
return verified;
|
|
54
|
+
}
|
|
47
55
|
if (key.id != null && isCompatibleKeyId(key.id)) {
|
|
48
56
|
const owner = await getPortableGatewayKeyOwner(key, options);
|
|
49
57
|
if (owner !== void 0) {
|
|
@@ -143,6 +151,7 @@ async function getKeyOwner(keyId, options) {
|
|
|
143
151
|
tracerProvider
|
|
144
152
|
};
|
|
145
153
|
const id = keyId instanceof CryptographicKey ? keyId.id : keyId;
|
|
154
|
+
if (id != null && isPortableUri(id)) return await getPortableActorKeyOwner(keyId, fetchOptions);
|
|
146
155
|
if (id != null && isCompatibleKeyId(id)) {
|
|
147
156
|
const owner = await getPortableGatewayKeyOwner(keyId, fetchOptions);
|
|
148
157
|
if (owner !== void 0) return owner;
|
|
@@ -215,5 +224,29 @@ async function getPortableGatewayKeyOwner(key, options) {
|
|
|
215
224
|
}
|
|
216
225
|
return resolution.actor;
|
|
217
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* Resolves the owner of a key of an [FEP-ef61] portable actor at an `ap:` or
|
|
229
|
+
* `ap+ef61:` key ID.
|
|
230
|
+
*
|
|
231
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
232
|
+
* @param key The key, or its ID, which must be an `ap:` or `ap+ef61:` URI.
|
|
233
|
+
* @param options Options for fetching the key.
|
|
234
|
+
* @returns The portable actor if its signed document vouches for the key,
|
|
235
|
+
* and the given key, if any, has the same key material, or `null`
|
|
236
|
+
* if not.
|
|
237
|
+
*/
|
|
238
|
+
async function getPortableActorKeyOwner(key, options) {
|
|
239
|
+
const keyId = key instanceof CryptographicKey ? key.id : key;
|
|
240
|
+
if (keyId == null) return null;
|
|
241
|
+
const resolution = await resolvePortableActorKey(keyId, options);
|
|
242
|
+
if (resolution.type !== "verified") return null;
|
|
243
|
+
if (key instanceof CryptographicKey) {
|
|
244
|
+
if (key.publicKey == null || !await isSamePublicKey$1(key.publicKey, resolution.key.publicKey)) {
|
|
245
|
+
logger.debug("The key {keyId} does not have the same key material as the key its portable actor vouches for.", { keyId: keyId.href });
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return resolution.actor;
|
|
250
|
+
}
|
|
218
251
|
//#endregion
|
|
219
252
|
export { getKeyOwner as n, doesActorOwnKey as t };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
import "./
|
|
1
|
+
import "temporal-polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { n as version, t as name } from "./deno-_o3lkDlG.mjs";
|
|
5
|
+
import { l as verifyPortableObjectProofWithRoot, s as verifyPortableObjectProof } from "./proof-B4_0E-KU.mjs";
|
|
5
6
|
import { getLogger } from "@logtape/logtape";
|
|
6
7
|
import { CollectionPage, Object as Object$1, isActor } from "@fedify/vocab";
|
|
7
8
|
import { trace } from "@opentelemetry/api";
|