@fedify/fedify 2.4.6-dev.2628 → 2.4.6-dev.2837
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-kj5boG2l.mjs → builder-DYeeuJIZ.mjs} +2 -2
- package/dist/compat/mod.cjs +1 -1
- package/dist/compat/mod.js +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-BoNAYSHt.mjs → compound-proof-CxRUa-wY.mjs} +2 -2
- package/dist/{deno-ksnVeCA7.mjs → deno-CRpGtqm6.mjs} +1 -1
- package/dist/{docloader-BhVNi06k.mjs → docloader-CZtA3Qjh.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +3 -3
- package/dist/federation/handler-compound-proof.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +4 -4
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox-report.test.mjs +5 -5
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +7 -7
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.js +1 -1
- package/dist/federation/outgoing-proof.test.mjs +4 -4
- package/dist/federation/portable-actor.test.mjs +3 -3
- package/dist/federation/portable-chain.test.mjs +3 -3
- package/dist/federation/portable-collection.test.mjs +4 -4
- package/dist/federation/portable-delivery.test.mjs +2 -2
- package/dist/federation/portable-gateway-keys.test.mjs +5 -5
- package/dist/federation/portable-inbox.test.mjs +4 -4
- package/dist/federation/portable-parse-uri.test.mjs +1 -1
- package/dist/federation/portable-route-activity.test.mjs +2 -2
- 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-BtPz9sr3.cjs → federation-DkIcc4TV.cjs} +4 -4
- package/dist/{http-CeVcKQMZ.cjs → http-DWIArxRV.cjs} +6 -5
- package/dist/{http-rH230xCD.js → http-DnJvGLuL.js} +6 -5
- package/dist/{http-BSARoDPh.mjs → http-G2ORncQt.mjs} +4 -4
- package/dist/{inbox-BdZenpZQ.mjs → inbox-WfHbmNbc.mjs} +2 -2
- package/dist/{kv-cache-BpGIONmd.cjs → kv-cache-C7b-sBZL.cjs} +1 -1
- package/dist/{kv-cache-Cxn7pNMx.mjs → kv-cache-C9jAD4VW.mjs} +1 -1
- package/dist/{kv-cache-CNfNI_95.js → kv-cache-CSJwIUzA.js} +1 -1
- package/dist/{ld-DJZrjNuN.mjs → ld-CKWvh95H.mjs} +24 -5
- package/dist/{metrics-DtxsYIkN.mjs → metrics-Og1y_3kX.mjs} +1 -1
- package/dist/{middleware-DyEjt33n.mjs → middleware-BLnbBpsz.mjs} +1 -1
- package/dist/{middleware-DblGj642.mjs → middleware-CcNRQv7R.mjs} +104 -104
- package/dist/{middleware-DDvck2q9.js → middleware-ClfuKN0B.js} +4 -4
- package/dist/mod.cjs +5 -5
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-2vfqhUJw.mjs → owner-DxVC0b0R.mjs} +4 -4
- package/dist/{portable-collection-Cs--KD5A.cjs → portable-collection-8BzIIWJb.cjs} +3 -2
- package/dist/{portable-collection-B7AQ_dW7.js → portable-collection-Bz3Zn527.js} +3 -2
- package/dist/{portable-collection-DKJwGO8S.mjs → portable-collection-pWL8BrQk.mjs} +2 -2
- package/dist/{portable-key-DXGepvtD.mjs → portable-key-BGmzMBYm.mjs} +1 -1
- package/dist/portable-verifier-CPA86vIP.js +22 -0
- package/dist/portable-verifier-DiLU8c9T.cjs +26 -0
- package/dist/{proof-DW0FK6Cp.mjs → proof-Cgvg3rEH.mjs} +5 -5
- package/dist/{send-CqsocpvF.mjs → send-DheMZ6fh.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 +1 -1
- package/dist/sig/mitra-receive-interop.test.mjs +4 -4
- package/dist/sig/mitra-send-interop.test.mjs +3 -3
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/portable-collection.test.mjs +1 -1
- package/dist/sig/portable-interop.test.mjs +3 -3
- package/dist/sig/portable-key.test.mjs +5 -5
- package/dist/sig/proof.test.mjs +3 -3
- package/dist/sig/tootik-request-interop.test.mjs +4 -4
- package/dist/sig/tootik-send-interop.test.mjs +3 -3
- package/dist/sig/verification.test.mjs +3 -3
- package/dist/{temporal-Dm2E1-vs.mjs → temporal-B7odHbLs.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/{transformers-DAtXl_Kc.js → transformers-BlJ53iKs.js} +3 -2
- package/dist/{transformers-BalCrSsr.cjs → transformers-aIK89ibB.cjs} +3 -2
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/dist/utils/portable-verifier.test.d.mts +2 -0
- package/dist/utils/portable-verifier.test.mjs +126 -0
- package/package.json +6 -6
|
@@ -3,12 +3,12 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { m as parseKeyIdString } from "./portable-key-id-Ca30-hOa.mjs";
|
|
5
5
|
import { a as verificationObservation, i as triedKey, n as observeCheck, t as observeAttempt } from "./verification-Dpfcw8ml.mjs";
|
|
6
|
-
import { n as version, t as name } from "./deno-
|
|
7
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
6
|
+
import { n as version, t as name } from "./deno-CRpGtqm6.mjs";
|
|
7
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-Og1y_3kX.mjs";
|
|
8
8
|
import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-CPVqki78.mjs";
|
|
9
9
|
import { a as promoteKeyOwnerEvidence } from "./key-owner-evidence-APB6NpSk.mjs";
|
|
10
|
-
import { S as fetchKeyDetailed, T as validateCryptoKey, v as bypassKeyCacheReads } from "./ld-
|
|
11
|
-
import { n as resolvePortableActorKey, r as verifyPortableGatewayKeyDocument } from "./portable-key-
|
|
10
|
+
import { S as fetchKeyDetailed, T as validateCryptoKey, v as bypassKeyCacheReads } from "./ld-CKWvh95H.mjs";
|
|
11
|
+
import { n as resolvePortableActorKey, r as verifyPortableGatewayKeyDocument } from "./portable-key-BGmzMBYm.mjs";
|
|
12
12
|
import { getLogger } from "@logtape/logtape";
|
|
13
13
|
import { CryptographicKey } from "@fedify/vocab";
|
|
14
14
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -2,8 +2,8 @@ import { Temporal } from "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as getAuthenticationOrigin } from "./portable-key-id-Ca30-hOa.mjs";
|
|
5
|
-
import { n as version, t as name } from "./deno-
|
|
6
|
-
import { g as recordInboxActivity, n as getDurationMs, r as getFederationMetrics } from "./metrics-
|
|
5
|
+
import { n as version, t as name } from "./deno-CRpGtqm6.mjs";
|
|
6
|
+
import { g as recordInboxActivity, n as getDurationMs, r as getFederationMetrics } from "./metrics-Og1y_3kX.mjs";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { getTypeId } from "@fedify/vocab";
|
|
9
9
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
|
-
const require_http = require("./http-
|
|
2
|
+
const require_http = require("./http-DWIArxRV.cjs");
|
|
3
3
|
let _logtape_logtape = require("@logtape/logtape");
|
|
4
4
|
let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
|
|
5
5
|
let es_toolkit = require("es-toolkit");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { p as recordDocumentCache } from "./metrics-
|
|
4
|
+
import { p as recordDocumentCache } from "./metrics-Og1y_3kX.mjs";
|
|
5
5
|
import { getLogger } from "@logtape/logtape";
|
|
6
6
|
import { preloadedContexts } from "@fedify/vocab-runtime";
|
|
7
7
|
//#region src/utils/kv-cache.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { G as validateCryptoKey, ot as recordDocumentCache, t as doubleKnockScoped } from "./http-
|
|
3
|
+
import { G as validateCryptoKey, ot as recordDocumentCache, t as doubleKnockScoped } from "./http-DnJvGLuL.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, resolveDocumentLoaderTimeout, withDocumentLoaderTimeout } from "@fedify/vocab-runtime";
|
|
6
6
|
import { curry } from "es-toolkit";
|
|
@@ -3,8 +3,8 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { c as isPortableActorDocument, d as isPortableUri, l as isPortableId, m as parseKeyIdString, s as isCompatibleKeyId } from "./portable-key-id-Ca30-hOa.mjs";
|
|
5
5
|
import { a as verificationObservation, i as triedKey, n as observeCheck, t as observeAttempt } from "./verification-Dpfcw8ml.mjs";
|
|
6
|
-
import { n as version, t as name } from "./deno-
|
|
7
|
-
import { _ as recordKeyLookup, n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch, t as classifyFetchError } from "./metrics-
|
|
6
|
+
import { n as version, t as name } from "./deno-CRpGtqm6.mjs";
|
|
7
|
+
import { _ as recordKeyLookup, n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch, t as classifyFetchError } from "./metrics-Og1y_3kX.mjs";
|
|
8
8
|
import { n as attachKeyOwnerEvidence, t as MAX_PORTABLE_KEY_TTL } from "./key-owner-evidence-APB6NpSk.mjs";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
10
10
|
import { Activity, CryptographicKey, Multikey, Object as Object$1, getTypeId, isActor } from "@fedify/vocab";
|
|
@@ -13,6 +13,25 @@ import { FetchError, UrlError, getDocumentLoader, parseDidKeyVerificationMethod
|
|
|
13
13
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
14
14
|
import { encodeHex } from "byte-encodings/hex";
|
|
15
15
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
16
|
+
//#region src/utils/portable-verifier.ts
|
|
17
|
+
/**
|
|
18
|
+
* Gets the default FEP-ef61 portable object verifier of a vocabulary object,
|
|
19
|
+
* so that Fedify can pass it on to a clone of the object explicitly, since
|
|
20
|
+
* `clone()` does not inherit it.
|
|
21
|
+
*
|
|
22
|
+
* This reads the protected `_verifyPortableObject` accessor of generated
|
|
23
|
+
* vocabulary classes, which is an internal cross-package contract with
|
|
24
|
+
* `@fedify/vocab-tools`.
|
|
25
|
+
*
|
|
26
|
+
* @param object The vocabulary object.
|
|
27
|
+
* @returns The object's default verifier, or `undefined` if it has none.
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
function getDefaultPortableObjectVerifier(object) {
|
|
31
|
+
const verifier = Reflect.get(object, "_verifyPortableObject");
|
|
32
|
+
return typeof verifier === "function" ? verifier : void 0;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
16
35
|
//#region src/sig/key.ts
|
|
17
36
|
/** Classifies decoding failures without hiding unexpected loader errors. */
|
|
18
37
|
function classifyKeyJsonLdError(error, seen = /* @__PURE__ */ new Set()) {
|
|
@@ -684,7 +703,7 @@ async function resolveFetchedKey(document, cacheKey, documentUrl, keyId, cls, {
|
|
|
684
703
|
}
|
|
685
704
|
let key = null;
|
|
686
705
|
let ownerDocument = null;
|
|
687
|
-
if (object instanceof cls && (object.id == null || object.id.href === keyId)) key = object.id == null ? object.clone({ id: cacheKey }) : object;
|
|
706
|
+
if (object instanceof cls && (object.id == null || object.id.href === keyId)) key = object.id == null ? object.clone({ id: cacheKey }, { verifyPortableObject: getDefaultPortableObjectVerifier(object) }) : object;
|
|
688
707
|
else if (isActor(object)) {
|
|
689
708
|
if (object.id == null || isPortableId(object.id) || object.id.origin !== documentUrl.origin) {
|
|
690
709
|
logger.debug("Failed to verify; the document served at {documentUrl} claims to be the actor {actorId}, which belongs to another origin.", {
|
|
@@ -774,7 +793,7 @@ async function resolveFetchedKey(document, cacheKey, documentUrl, keyId, cls, {
|
|
|
774
793
|
cached: false
|
|
775
794
|
};
|
|
776
795
|
}
|
|
777
|
-
if (ownerDocument != null && claimedOwnerId == null) key = key instanceof CryptographicKey ? key.clone({ owner: ownerDocument.id }) : key.clone({ controller: ownerDocument.id });
|
|
796
|
+
if (ownerDocument != null && claimedOwnerId == null) key = key instanceof CryptographicKey ? key.clone({ owner: ownerDocument.id }, { verifyPortableObject: getDefaultPortableObjectVerifier(key) }) : key.clone({ controller: ownerDocument.id }, { verifyPortableObject: getDefaultPortableObjectVerifier(key) });
|
|
778
797
|
else if (claimedOwnerId != null && claimedOwnerId.href !== ownerDocument?.id?.href) {
|
|
779
798
|
if (await verifyKeyOwnershipInternal(key, {
|
|
780
799
|
documentLoader,
|
|
@@ -1706,4 +1725,4 @@ async function hashJsonLd(jsonLd, contextLoader) {
|
|
|
1706
1725
|
return encodeHex(await crypto.subtle.digest("SHA-256", encoder.encode(canon)));
|
|
1707
1726
|
}
|
|
1708
1727
|
//#endregion
|
|
1709
|
-
export { generateCryptoKeyPair as C, verifyKeyOwnership as E, fetchKeyDetailed as S, validateCryptoKey as T, wrapContextLoaderForJsonLd as _, compactJsonLd as a, fetchActorDocument as b, getNormalizationContextLoader as c, isClearlyMalformedContextReference as d, isInvalidUrlTypeError as f, verifySignature as g, verifyJsonLd as h, attachSignature as i, hasSignature as l, verifyCompactJsonLd as m, UnsafeJsonLdError as n, createSignature as o, signJsonLd as p, assertSafeJsonLd as r, detachSignature as s, InvalidContextReferenceError as t, hasSignatureLike as u, bypassKeyCacheReads as v, importJwk as w, fetchKey as x, exportJwk as y };
|
|
1728
|
+
export { generateCryptoKeyPair as C, getDefaultPortableObjectVerifier as D, verifyKeyOwnership as E, fetchKeyDetailed as S, validateCryptoKey as T, wrapContextLoaderForJsonLd as _, compactJsonLd as a, fetchActorDocument as b, getNormalizationContextLoader as c, isClearlyMalformedContextReference as d, isInvalidUrlTypeError as f, verifySignature as g, verifyJsonLd as h, attachSignature as i, hasSignature as l, verifyCompactJsonLd as m, UnsafeJsonLdError as n, createSignature as o, signJsonLd as p, assertSafeJsonLd as r, detachSignature as s, InvalidContextReferenceError as t, hasSignatureLike as u, bypassKeyCacheReads as v, importJwk as w, fetchKey as x, exportJwk as y };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
4
|
+
import { n as version, t as name } from "./deno-CRpGtqm6.mjs";
|
|
5
5
|
import { metrics } from "@opentelemetry/api";
|
|
6
6
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
7
7
|
//#region src/federation/metrics.ts
|
|
@@ -4,28 +4,28 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { d as isPortableUri, f as isSameObjectId, i as getPortableDid, l as isPortableId, n as getCanonicalPortableId, o as hasPortableActor, r as getGatewayKeyBase, s as isCompatibleKeyId, t as getAuthenticationOrigin, u as isPortableKeyId } from "./portable-key-id-Ca30-hOa.mjs";
|
|
5
5
|
import { n as isPubliclyAddressedNode, t as isInAudience } from "./audience-CHQ-FlLD.mjs";
|
|
6
6
|
import { a as verificationObservation, r as snapshotKey, t as observeAttempt } from "./verification-Dpfcw8ml.mjs";
|
|
7
|
-
import { n as version, t as name } from "./deno-
|
|
8
|
-
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-
|
|
7
|
+
import { n as version, t as name } from "./deno-CRpGtqm6.mjs";
|
|
8
|
+
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-Og1y_3kX.mjs";
|
|
9
9
|
import { t as formatAcceptSignature } from "./accept-CPVqki78.mjs";
|
|
10
|
-
import { T as validateCryptoKey, _ 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, w as importJwk, y as exportJwk } from "./ld-
|
|
10
|
+
import { D as getDefaultPortableObjectVerifier, T as validateCryptoKey, _ 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, w as importJwk, y as exportJwk } from "./ld-CKWvh95H.mjs";
|
|
11
11
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-4IJqPYos.mjs";
|
|
12
|
-
import { a as signObject, c as verifyPortableObjectProof, i as hasProofLike, s as verifyObject, t as InvalidPortableObjectIdError, u as verifyPortableObjectProofWithRoot } from "./proof-
|
|
13
|
-
import { c as parseRfc9421SignatureInput, f as validateMaxSignatures, l as selectRequestSignature, m as verifyRequestDetailed, o as listRequestSignatures, p as verifyRequest } from "./http-
|
|
14
|
-
import { n as getAuthenticatedDocumentLoader } from "./docloader-
|
|
15
|
-
import { n as kvCache } from "./kv-cache-
|
|
12
|
+
import { a as signObject, c as verifyPortableObjectProof, i as hasProofLike, s as verifyObject, t as InvalidPortableObjectIdError, u as verifyPortableObjectProofWithRoot } from "./proof-Cgvg3rEH.mjs";
|
|
13
|
+
import { c as parseRfc9421SignatureInput, f as validateMaxSignatures, l as selectRequestSignature, m as verifyRequestDetailed, o as listRequestSignatures, p as verifyRequest } from "./http-G2ORncQt.mjs";
|
|
14
|
+
import { n as getAuthenticatedDocumentLoader } from "./docloader-CZtA3Qjh.mjs";
|
|
15
|
+
import { n as kvCache } from "./kv-cache-C9jAD4VW.mjs";
|
|
16
16
|
import { d as MAX_BODY_SIZE, f as readBoundedText, t as getNodeInfo, u as BodyTooLargeError } from "./client-5SIFzW3q.mjs";
|
|
17
17
|
import { t as nodeInfoToJson } from "./types-DE_LV1JB.mjs";
|
|
18
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-
|
|
19
|
-
import { t as verifyPortableObject } from "./portable-collection-
|
|
20
|
-
import { a as sendActivityThroughGateways, i as sendActivity, n as extractInboxes, o as getOrderingDestination, t as SendActivityError } from "./send-
|
|
21
|
-
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-
|
|
18
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-DxVC0b0R.mjs";
|
|
19
|
+
import { t as verifyPortableObject } from "./portable-collection-pWL8BrQk.mjs";
|
|
20
|
+
import { a as sendActivityThroughGateways, i as sendActivity, n as extractInboxes, o as getOrderingDestination, t as SendActivityError } from "./send-DheMZ6fh.mjs";
|
|
21
|
+
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-DYeeuJIZ.mjs";
|
|
22
22
|
import { t as CircuitBreaker } from "./circuit-breaker-XJ53md4S.mjs";
|
|
23
23
|
import { t as buildCollectionSynchronizationHeader } from "./collection-CnnP1UAv.mjs";
|
|
24
|
-
import { a as inspectCompoundPortableObjectApplicability, c as verifyServedPortableObjects, i as findUnsupportedCompoundProofShape, o as verifyCompoundPortableObjectProofs, r as findEmbeddedProofWithoutContext, t as containsCompoundPortableObject } from "./compound-proof-
|
|
25
|
-
import { n as routeActivity, t as actorsHaveSameOrigin } from "./inbox-
|
|
24
|
+
import { a as inspectCompoundPortableObjectApplicability, c as verifyServedPortableObjects, i as findUnsupportedCompoundProofShape, o as verifyCompoundPortableObjectProofs, r as findEmbeddedProofWithoutContext, t as containsCompoundPortableObject } from "./compound-proof-CxRUa-wY.mjs";
|
|
25
|
+
import { n as routeActivity, t as actorsHaveSameOrigin } from "./inbox-WfHbmNbc.mjs";
|
|
26
26
|
import { t as KvKeyCache } from "./keycache-N2opu4-3.mjs";
|
|
27
27
|
import { t as acceptsJsonLd } from "./negotiation-CCocWT_N.mjs";
|
|
28
|
-
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-
|
|
28
|
+
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-B7odHbLs.mjs";
|
|
29
29
|
import { t as createExponentialBackoffPolicy } from "./retry-zX5xw5e0.mjs";
|
|
30
30
|
import { t as TaskCodec } from "./codec-C6rTrpIp.mjs";
|
|
31
31
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
@@ -40,6 +40,96 @@ import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_
|
|
|
40
40
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
41
41
|
import { DataPointType, MeterProvider as MeterProvider$1, MetricReader } from "@opentelemetry/sdk-metrics";
|
|
42
42
|
import { domainToASCII } from "node:url";
|
|
43
|
+
//#region src/compat/transformers.ts
|
|
44
|
+
const logger$2 = getLogger([
|
|
45
|
+
"fedify",
|
|
46
|
+
"compat",
|
|
47
|
+
"transformers"
|
|
48
|
+
]);
|
|
49
|
+
/**
|
|
50
|
+
* An activity transformer that assigns a new random ID to an activity if it
|
|
51
|
+
* does not already have one. This is useful for ensuring that activities
|
|
52
|
+
* have an ID before they are sent to other servers.
|
|
53
|
+
*
|
|
54
|
+
* The generated ID is an origin URI with a fragment which contains an activity
|
|
55
|
+
* type name with a random UUID:
|
|
56
|
+
*
|
|
57
|
+
* ```
|
|
58
|
+
* https://example.com/#Follow/12345678-1234-5678-1234-567812345678
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* @template TContextData The type of the context data.
|
|
62
|
+
* @param activity The activity to assign an ID to.
|
|
63
|
+
* @param context The context of the activity.
|
|
64
|
+
* @return The activity with an ID assigned.
|
|
65
|
+
* @since 1.4.0
|
|
66
|
+
*/
|
|
67
|
+
function autoIdAssigner(activity, context) {
|
|
68
|
+
if (activity.id != null) return activity;
|
|
69
|
+
const id = new URL(`/#${activity.constructor.name}/${crypto.randomUUID()}`, context.origin);
|
|
70
|
+
logger$2.warn("As the activity to send does not have an id, a new id {id} has been generated for it. However, it is recommended to explicitly set the id for the activity.", { id: id.href });
|
|
71
|
+
return activity.clone({ id }, { verifyPortableObject: getDefaultPortableObjectVerifier(activity) });
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* An activity transformer that dehydrates the actor property of an activity
|
|
75
|
+
* so that it only contains the actor's URI. For example, suppose we have an
|
|
76
|
+
* activity like this:
|
|
77
|
+
*
|
|
78
|
+
* ```typescript
|
|
79
|
+
* import { Follow, Person } from "@fedify/vocab";
|
|
80
|
+
* const input = new Follow({
|
|
81
|
+
* id: new URL("http://example.com/activities/1"),
|
|
82
|
+
* actor: new Person({
|
|
83
|
+
* id: new URL("http://example.com/actors/1"),
|
|
84
|
+
* name: "Alice",
|
|
85
|
+
* preferredUsername: "alice",
|
|
86
|
+
* }),
|
|
87
|
+
* object: new Person({
|
|
88
|
+
* id: new URL("http://example.com/actors/2"),
|
|
89
|
+
* name: "Bob",
|
|
90
|
+
* preferredUsername: "bob",
|
|
91
|
+
* }),
|
|
92
|
+
* });
|
|
93
|
+
* ```
|
|
94
|
+
*
|
|
95
|
+
* The result of applying this transformer would be:
|
|
96
|
+
*
|
|
97
|
+
* ```typescript
|
|
98
|
+
* import { Follow, Person } from "@fedify/vocab";
|
|
99
|
+
* const output = new Follow({
|
|
100
|
+
* id: new URL("http://example.com/activities/1"),
|
|
101
|
+
* actor: new URL("http://example.com/actors/1"),
|
|
102
|
+
* object: new Person({
|
|
103
|
+
* id: new URL("http://example.com/actors/2"),
|
|
104
|
+
* name: "Bob",
|
|
105
|
+
* preferredUsername: "bob",
|
|
106
|
+
* }),
|
|
107
|
+
* });
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* As some ActivityPub implementations like Threads fail to deal with inlined
|
|
111
|
+
* actor objects, this transformer can be used to work around this issue.
|
|
112
|
+
* @template TContextData The type of the context data.
|
|
113
|
+
* @param activity The activity to dehydrate the actor property of.
|
|
114
|
+
* @param context The context of the activity.
|
|
115
|
+
* @returns The dehydrated activity.
|
|
116
|
+
* @since 1.4.0
|
|
117
|
+
*/
|
|
118
|
+
function actorDehydrator(activity, _context) {
|
|
119
|
+
if (activity.actorIds.length < 1) return activity;
|
|
120
|
+
return activity.clone({ actors: activity.actorIds }, { verifyPortableObject: getDefaultPortableObjectVerifier(activity) });
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Gets the default activity transformers that are applied to all outgoing
|
|
124
|
+
* activities.
|
|
125
|
+
* @template TContextData The type of the context data.
|
|
126
|
+
* @returns The default activity transformers.
|
|
127
|
+
* @since 1.4.0
|
|
128
|
+
*/
|
|
129
|
+
function getDefaultActivityTransformers() {
|
|
130
|
+
return [autoIdAssigner, actorDehydrator];
|
|
131
|
+
}
|
|
132
|
+
//#endregion
|
|
43
133
|
//#region src/federation/inbox-observation.ts
|
|
44
134
|
/** Internal state owned by the ingress boundary, never serialized into queues. */
|
|
45
135
|
var InboxObservation = class {
|
|
@@ -145,96 +235,6 @@ var InboxObservation = class {
|
|
|
145
235
|
}
|
|
146
236
|
};
|
|
147
237
|
//#endregion
|
|
148
|
-
//#region src/compat/transformers.ts
|
|
149
|
-
const logger$2 = getLogger([
|
|
150
|
-
"fedify",
|
|
151
|
-
"compat",
|
|
152
|
-
"transformers"
|
|
153
|
-
]);
|
|
154
|
-
/**
|
|
155
|
-
* An activity transformer that assigns a new random ID to an activity if it
|
|
156
|
-
* does not already have one. This is useful for ensuring that activities
|
|
157
|
-
* have an ID before they are sent to other servers.
|
|
158
|
-
*
|
|
159
|
-
* The generated ID is an origin URI with a fragment which contains an activity
|
|
160
|
-
* type name with a random UUID:
|
|
161
|
-
*
|
|
162
|
-
* ```
|
|
163
|
-
* https://example.com/#Follow/12345678-1234-5678-1234-567812345678
|
|
164
|
-
* ```
|
|
165
|
-
*
|
|
166
|
-
* @template TContextData The type of the context data.
|
|
167
|
-
* @param activity The activity to assign an ID to.
|
|
168
|
-
* @param context The context of the activity.
|
|
169
|
-
* @return The activity with an ID assigned.
|
|
170
|
-
* @since 1.4.0
|
|
171
|
-
*/
|
|
172
|
-
function autoIdAssigner(activity, context) {
|
|
173
|
-
if (activity.id != null) return activity;
|
|
174
|
-
const id = new URL(`/#${activity.constructor.name}/${crypto.randomUUID()}`, context.origin);
|
|
175
|
-
logger$2.warn("As the activity to send does not have an id, a new id {id} has been generated for it. However, it is recommended to explicitly set the id for the activity.", { id: id.href });
|
|
176
|
-
return activity.clone({ id });
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* An activity transformer that dehydrates the actor property of an activity
|
|
180
|
-
* so that it only contains the actor's URI. For example, suppose we have an
|
|
181
|
-
* activity like this:
|
|
182
|
-
*
|
|
183
|
-
* ```typescript
|
|
184
|
-
* import { Follow, Person } from "@fedify/vocab";
|
|
185
|
-
* const input = new Follow({
|
|
186
|
-
* id: new URL("http://example.com/activities/1"),
|
|
187
|
-
* actor: new Person({
|
|
188
|
-
* id: new URL("http://example.com/actors/1"),
|
|
189
|
-
* name: "Alice",
|
|
190
|
-
* preferredUsername: "alice",
|
|
191
|
-
* }),
|
|
192
|
-
* object: new Person({
|
|
193
|
-
* id: new URL("http://example.com/actors/2"),
|
|
194
|
-
* name: "Bob",
|
|
195
|
-
* preferredUsername: "bob",
|
|
196
|
-
* }),
|
|
197
|
-
* });
|
|
198
|
-
* ```
|
|
199
|
-
*
|
|
200
|
-
* The result of applying this transformer would be:
|
|
201
|
-
*
|
|
202
|
-
* ```typescript
|
|
203
|
-
* import { Follow, Person } from "@fedify/vocab";
|
|
204
|
-
* const output = new Follow({
|
|
205
|
-
* id: new URL("http://example.com/activities/1"),
|
|
206
|
-
* actor: new URL("http://example.com/actors/1"),
|
|
207
|
-
* object: new Person({
|
|
208
|
-
* id: new URL("http://example.com/actors/2"),
|
|
209
|
-
* name: "Bob",
|
|
210
|
-
* preferredUsername: "bob",
|
|
211
|
-
* }),
|
|
212
|
-
* });
|
|
213
|
-
* ```
|
|
214
|
-
*
|
|
215
|
-
* As some ActivityPub implementations like Threads fail to deal with inlined
|
|
216
|
-
* actor objects, this transformer can be used to work around this issue.
|
|
217
|
-
* @template TContextData The type of the context data.
|
|
218
|
-
* @param activity The activity to dehydrate the actor property of.
|
|
219
|
-
* @param context The context of the activity.
|
|
220
|
-
* @returns The dehydrated activity.
|
|
221
|
-
* @since 1.4.0
|
|
222
|
-
*/
|
|
223
|
-
function actorDehydrator(activity, _context) {
|
|
224
|
-
if (activity.actorIds.length < 1) return activity;
|
|
225
|
-
return activity.clone({ actors: activity.actorIds });
|
|
226
|
-
}
|
|
227
|
-
/**
|
|
228
|
-
* Gets the default activity transformers that are applied to all outgoing
|
|
229
|
-
* activities.
|
|
230
|
-
* @template TContextData The type of the context data.
|
|
231
|
-
* @returns The default activity transformers.
|
|
232
|
-
* @since 1.4.0
|
|
233
|
-
*/
|
|
234
|
-
function getDefaultActivityTransformers() {
|
|
235
|
-
return [autoIdAssigner, actorDehydrator];
|
|
236
|
-
}
|
|
237
|
-
//#endregion
|
|
238
238
|
//#region src/nodeinfo/handler.ts
|
|
239
239
|
/**
|
|
240
240
|
* Handles a NodeInfo request. You would not typically call this function
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
import { t as __exportAll } from "./rolldown-runtime-BC-Eo5Mj.js";
|
|
4
|
-
import { r as getDefaultActivityTransformers } from "./transformers-
|
|
5
|
-
import { $ as instrumentDocumentLoader, A as hasSignature, At as isPortableUri, C as InvalidContextReferenceError, Ct as getGatewayKeyBase, Dt as isCompatibleKeyId, E as compactJsonLd, Et as hasPortableActor, F as verifyCompactJsonLd, G as validateCryptoKey, M as isClearlyMalformedContextReference, N as isInvalidUrlTypeError, Nt as name, O as detachSignature, Ot as isPortableId, P as signJsonLd, Pt as version, Q as getRemoteHost, R as wrapContextLoaderForJsonLd, S as normalizeOutgoingActivityJsonLd, St as getCanonicalPortableId, Tt as getRawCanonicalPortableId, W as importJwk, X as getDurationMs, Z as getFederationMetrics, _ as verifyObject, at as recordCollectionTotalItems, b as verifyPortableObjectProofWithRoot, bt as verificationObservation, c as verifyRequestDetailed, ct as recordInboxActivity, d as InvalidPortableObjectIdError, dt as recordWebFingerHandle, et as isAbortError, f as classifyFep2277CoreType, ft as registerQueueDepthGauge, g as verifyMapLocalProof, h as signObject, i as selectRequestSignature, it as recordCollectionRequest, j as hasSignatureLike, jt as isSameObjectId, k as getNormalizationContextLoader, kt as isPortableKeyId, lt as recordOutboxActivity, m as hasProofLike, mt as formatAcceptSignature, n as listRequestSignatures, nt as recordCollectionDispatchDuration, o as validateMaxSignatures, pt as preloadedOnlyDocumentLoader, q as MAX_PORTABLE_KEY_TTL, r as parseRfc9421SignatureInput, rt as recordCollectionPageItems, s as verifyRequest, st as recordFanoutRecipients, t as doubleKnockScoped, tt as recordCircuitBreakerStateChange, ut as recordOutboxEnqueue, v as verifyPortableObjectProof, vt as observeAttempt, w as assertSafeJsonLd, wt as getPortableDid, xt as getAuthenticationOrigin, y as verifyPortableObjectProofPolicy, yt as snapshotKey, z as exportJwk } from "./http-
|
|
4
|
+
import { r as getDefaultActivityTransformers } from "./transformers-BlJ53iKs.js";
|
|
5
|
+
import { $ as instrumentDocumentLoader, A as hasSignature, At as isPortableUri, C as InvalidContextReferenceError, Ct as getGatewayKeyBase, Dt as isCompatibleKeyId, E as compactJsonLd, Et as hasPortableActor, F as verifyCompactJsonLd, G as validateCryptoKey, M as isClearlyMalformedContextReference, N as isInvalidUrlTypeError, Nt as name, O as detachSignature, Ot as isPortableId, P as signJsonLd, Pt as version, Q as getRemoteHost, R as wrapContextLoaderForJsonLd, S as normalizeOutgoingActivityJsonLd, St as getCanonicalPortableId, Tt as getRawCanonicalPortableId, W as importJwk, X as getDurationMs, Z as getFederationMetrics, _ as verifyObject, at as recordCollectionTotalItems, b as verifyPortableObjectProofWithRoot, bt as verificationObservation, c as verifyRequestDetailed, ct as recordInboxActivity, d as InvalidPortableObjectIdError, dt as recordWebFingerHandle, et as isAbortError, f as classifyFep2277CoreType, ft as registerQueueDepthGauge, g as verifyMapLocalProof, h as signObject, i as selectRequestSignature, it as recordCollectionRequest, j as hasSignatureLike, jt as isSameObjectId, k as getNormalizationContextLoader, kt as isPortableKeyId, lt as recordOutboxActivity, m as hasProofLike, mt as formatAcceptSignature, n as listRequestSignatures, nt as recordCollectionDispatchDuration, o as validateMaxSignatures, pt as preloadedOnlyDocumentLoader, q as MAX_PORTABLE_KEY_TTL, r as parseRfc9421SignatureInput, rt as recordCollectionPageItems, s as verifyRequest, st as recordFanoutRecipients, t as doubleKnockScoped, tt as recordCircuitBreakerStateChange, ut as recordOutboxEnqueue, v as verifyPortableObjectProof, vt as observeAttempt, w as assertSafeJsonLd, wt as getPortableDid, xt as getAuthenticationOrigin, y as verifyPortableObjectProofPolicy, yt as snapshotKey, z as exportJwk } from "./http-DnJvGLuL.js";
|
|
6
6
|
import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-DUjZb4i6.js";
|
|
7
|
-
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-
|
|
8
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
7
|
+
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-Bz3Zn527.js";
|
|
8
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-CSJwIUzA.js";
|
|
9
9
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
10
10
|
import { Router, RouterError, assertPath } from "@fedify/uri-template";
|
|
11
11
|
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, PUBLIC_COLLECTION, Tombstone, getTypeId, isActor, lookupObject, traverseCollection } from "@fedify/vocab";
|
package/dist/mod.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
require("./rolldown-runtime-Dmm3t92W.cjs");
|
|
4
|
-
const require_transformers = require("./transformers-
|
|
4
|
+
const require_transformers = require("./transformers-aIK89ibB.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-DWIArxRV.cjs");
|
|
7
|
+
const require_federation = require("./federation-DkIcc4TV.cjs");
|
|
8
8
|
const require_types = require("./types-hKCCjii0.cjs");
|
|
9
|
-
const require_portable_collection = require("./portable-collection-
|
|
10
|
-
const require_kv_cache = require("./kv-cache-
|
|
9
|
+
const require_portable_collection = require("./portable-collection-8BzIIWJb.cjs");
|
|
10
|
+
const require_kv_cache = require("./kv-cache-C7b-sBZL.cjs");
|
|
11
11
|
require("./nodeinfo/mod.cjs");
|
|
12
12
|
require("./runtime/mod.cjs");
|
|
13
13
|
require("./sig/mod.cjs");
|
package/dist/mod.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
import "./rolldown-runtime-BC-Eo5Mj.js";
|
|
4
|
-
import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-
|
|
4
|
+
import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-BlJ53iKs.js";
|
|
5
5
|
import "./compat/mod.js";
|
|
6
|
-
import { D as createSignature, H as fetchKeyDetailed, I as verifyJsonLd, L as verifySignature, O as detachSignature, P as signJsonLd, T as attachSignature, U as generateCryptoKeyPair, V as fetchKey, W as importJwk, _ as verifyObject, _t as validateAcceptSignature, a as signRequest, c as verifyRequestDetailed, gt as parseAcceptSignature, h as signObject, ht as fulfillAcceptSignature, j as hasSignatureLike, m as hasProofLike, mt as formatAcceptSignature, p as createProof, s as verifyRequest, v as verifyPortableObjectProof, x as verifyProof, z as exportJwk } from "./http-
|
|
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 { D as createSignature, H as fetchKeyDetailed, I as verifyJsonLd, L as verifySignature, O as detachSignature, P as signJsonLd, T as attachSignature, U as generateCryptoKeyPair, V as fetchKey, W as importJwk, _ as verifyObject, _t as validateAcceptSignature, a as signRequest, c as verifyRequestDetailed, gt as parseAcceptSignature, h as signObject, ht as fulfillAcceptSignature, j as hasSignatureLike, m as hasProofLike, mt as formatAcceptSignature, p as createProof, s as verifyRequest, v as verifyPortableObjectProof, x as verifyProof, z as exportJwk } from "./http-DnJvGLuL.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-ClfuKN0B.js";
|
|
8
8
|
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-DUjZb4i6.js";
|
|
9
|
-
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-
|
|
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-Bz3Zn527.js";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-CSJwIUzA.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";
|
|
@@ -5,7 +5,7 @@ import { r as createRequestContext } from "../context-8Tu9kea0.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 { D as handleNodeInfoJrd, E as handleNodeInfo, o as createFederation } from "../middleware-
|
|
8
|
+
import { D as handleNodeInfoJrd, E as handleNodeInfo, o as createFederation } from "../middleware-CcNRQv7R.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
//#region src/nodeinfo/handler.test.ts
|
|
11
11
|
test("handleNodeInfo()", async () => {
|
|
@@ -2,10 +2,10 @@ import "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { d as isPortableUri, l as isPortableId, n as getCanonicalPortableId, p as isSamePublicKey$1, s as isCompatibleKeyId } from "./portable-key-id-Ca30-hOa.mjs";
|
|
5
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
+
import { n as version, t as name } from "./deno-CRpGtqm6.mjs";
|
|
6
6
|
import { i as parseKeyOwnerEvidence, r as getVerifiedKeyOwnerEvidence } from "./key-owner-evidence-APB6NpSk.mjs";
|
|
7
|
-
import { E as verifyKeyOwnership, b as fetchActorDocument, y as exportJwk } from "./ld-
|
|
8
|
-
import { n as resolvePortableActorKey, t as fetchPortableGatewayKey } from "./portable-key-
|
|
7
|
+
import { D as getDefaultPortableObjectVerifier, E as verifyKeyOwnership, b as fetchActorDocument, y as exportJwk } from "./ld-CKWvh95H.mjs";
|
|
8
|
+
import { n as resolvePortableActorKey, t as fetchPortableGatewayKey } from "./portable-key-BGmzMBYm.mjs";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
10
10
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
11
11
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -198,7 +198,7 @@ async function getKeyOwner(keyId, options) {
|
|
|
198
198
|
}
|
|
199
199
|
if (object instanceof CryptographicKey) {
|
|
200
200
|
if (object.id != null && object.id.href !== keyId.href) return null;
|
|
201
|
-
return await verifyKeyOwnership(object.id == null ? object.clone({ id: keyId }) : object, fetchOptions);
|
|
201
|
+
return await verifyKeyOwnership(object.id == null ? object.clone({ id: keyId }, { verifyPortableObject: getDefaultPortableObjectVerifier(object) }) : object, fetchOptions);
|
|
202
202
|
}
|
|
203
203
|
if (!isActor(object)) return null;
|
|
204
204
|
if (object.id == null || isPortableId(object.id) || object.id.origin !== documentUrl.origin) {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
|
-
const
|
|
2
|
+
const require_portable_verifier = require("./portable-verifier-DiLU8c9T.cjs");
|
|
3
|
+
const require_http = require("./http-DWIArxRV.cjs");
|
|
3
4
|
let _logtape_logtape = require("@logtape/logtape");
|
|
4
5
|
let _fedify_vocab = require("@fedify/vocab");
|
|
5
6
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
@@ -193,7 +194,7 @@ async function getKeyOwner(keyId, options) {
|
|
|
193
194
|
}
|
|
194
195
|
if (object instanceof _fedify_vocab.CryptographicKey) {
|
|
195
196
|
if (object.id != null && object.id.href !== keyId.href) return null;
|
|
196
|
-
return await require_http.verifyKeyOwnership(object.id == null ? object.clone({ id: keyId }) : object, fetchOptions);
|
|
197
|
+
return await require_http.verifyKeyOwnership(object.id == null ? object.clone({ id: keyId }, { verifyPortableObject: require_portable_verifier.getDefaultPortableObjectVerifier(object) }) : object, fetchOptions);
|
|
197
198
|
}
|
|
198
199
|
if (!(0, _fedify_vocab.isActor)(object)) return null;
|
|
199
200
|
if (object.id == null || require_http.isPortableId(object.id) || object.id.origin !== documentUrl.origin) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import {
|
|
3
|
+
import { t as getDefaultPortableObjectVerifier } from "./portable-verifier-CPA86vIP.js";
|
|
4
|
+
import { At as isPortableUri, B as fetchActorDocument, Dt as isCompatibleKeyId, J as getVerifiedKeyOwnerEvidence, K as verifyKeyOwnership, Mt as isSamePublicKey$1, Nt as name, Ot as isPortableId, Pt as version, St as getCanonicalPortableId, Y as parseKeyOwnerEvidence, b as verifyPortableObjectProofWithRoot, l as fetchPortableGatewayKey, u as resolvePortableActorKey, v as verifyPortableObjectProof, z as exportJwk } from "./http-DnJvGLuL.js";
|
|
4
5
|
import { getLogger } from "@logtape/logtape";
|
|
5
6
|
import { CollectionPage, CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
6
7
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -194,7 +195,7 @@ async function getKeyOwner(keyId, options) {
|
|
|
194
195
|
}
|
|
195
196
|
if (object instanceof CryptographicKey) {
|
|
196
197
|
if (object.id != null && object.id.href !== keyId.href) return null;
|
|
197
|
-
return await verifyKeyOwnership(object.id == null ? object.clone({ id: keyId }) : object, fetchOptions);
|
|
198
|
+
return await verifyKeyOwnership(object.id == null ? object.clone({ id: keyId }, { verifyPortableObject: getDefaultPortableObjectVerifier(object) }) : object, fetchOptions);
|
|
198
199
|
}
|
|
199
200
|
if (!isActor(object)) return null;
|
|
200
201
|
if (object.id == null || isPortableId(object.id) || object.id.origin !== documentUrl.origin) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { c as verifyPortableObjectProof, u as verifyPortableObjectProofWithRoot } from "./proof-
|
|
4
|
+
import { n as version, t as name } from "./deno-CRpGtqm6.mjs";
|
|
5
|
+
import { c as verifyPortableObjectProof, u as verifyPortableObjectProofWithRoot } from "./proof-Cgvg3rEH.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { CollectionPage, Object as Object$1, isActor } from "@fedify/vocab";
|
|
8
8
|
import { trace } from "@opentelemetry/api";
|
|
@@ -2,7 +2,7 @@ import "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { a as getRawCanonicalPortableId, c as isPortableActorDocument, d as isPortableUri, n as getCanonicalPortableId, p as isSamePublicKey } from "./portable-key-id-Ca30-hOa.mjs";
|
|
5
|
-
import { u as verifyPortableObjectProofWithRoot } from "./proof-
|
|
5
|
+
import { u as verifyPortableObjectProofWithRoot } from "./proof-Cgvg3rEH.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { CryptographicKey, Multikey, Object as Object$1 } from "@fedify/vocab";
|
|
8
8
|
import { FetchError, formatIri, getDocumentLoader, isGatewayUrl, parseIri, toCompatibleEf61Id } from "@fedify/vocab-runtime";
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Temporal } from "temporal-polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
+
//#region src/utils/portable-verifier.ts
|
|
4
|
+
/**
|
|
5
|
+
* Gets the default FEP-ef61 portable object verifier of a vocabulary object,
|
|
6
|
+
* so that Fedify can pass it on to a clone of the object explicitly, since
|
|
7
|
+
* `clone()` does not inherit it.
|
|
8
|
+
*
|
|
9
|
+
* This reads the protected `_verifyPortableObject` accessor of generated
|
|
10
|
+
* vocabulary classes, which is an internal cross-package contract with
|
|
11
|
+
* `@fedify/vocab-tools`.
|
|
12
|
+
*
|
|
13
|
+
* @param object The vocabulary object.
|
|
14
|
+
* @returns The object's default verifier, or `undefined` if it has none.
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
function getDefaultPortableObjectVerifier(object) {
|
|
18
|
+
const verifier = Reflect.get(object, "_verifyPortableObject");
|
|
19
|
+
return typeof verifier === "function" ? verifier : void 0;
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { getDefaultPortableObjectVerifier as t };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
|
+
//#region src/utils/portable-verifier.ts
|
|
3
|
+
/**
|
|
4
|
+
* Gets the default FEP-ef61 portable object verifier of a vocabulary object,
|
|
5
|
+
* so that Fedify can pass it on to a clone of the object explicitly, since
|
|
6
|
+
* `clone()` does not inherit it.
|
|
7
|
+
*
|
|
8
|
+
* This reads the protected `_verifyPortableObject` accessor of generated
|
|
9
|
+
* vocabulary classes, which is an internal cross-package contract with
|
|
10
|
+
* `@fedify/vocab-tools`.
|
|
11
|
+
*
|
|
12
|
+
* @param object The vocabulary object.
|
|
13
|
+
* @returns The object's default verifier, or `undefined` if it has none.
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
function getDefaultPortableObjectVerifier(object) {
|
|
17
|
+
const verifier = Reflect.get(object, "_verifyPortableObject");
|
|
18
|
+
return typeof verifier === "function" ? verifier : void 0;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
Object.defineProperty(exports, "getDefaultPortableObjectVerifier", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function() {
|
|
24
|
+
return getDefaultPortableObjectVerifier;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
@@ -3,9 +3,9 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { i as getPortableDid, l as isPortableId } from "./portable-key-id-Ca30-hOa.mjs";
|
|
5
5
|
import { a as verificationObservation, i as triedKey, n as observeCheck, t as observeAttempt } from "./verification-Dpfcw8ml.mjs";
|
|
6
|
-
import { n as version, t as name } from "./deno-
|
|
7
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
8
|
-
import { T as validateCryptoKey, c as getNormalizationContextLoader, v as bypassKeyCacheReads, x as fetchKey } from "./ld-
|
|
6
|
+
import { n as version, t as name } from "./deno-CRpGtqm6.mjs";
|
|
7
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-Og1y_3kX.mjs";
|
|
8
|
+
import { D as getDefaultPortableObjectVerifier, T as validateCryptoKey, c as getNormalizationContextLoader, v as bypassKeyCacheReads, x as fetchKey } from "./ld-CKWvh95H.mjs";
|
|
9
9
|
import { n as preloadedOnlyDocumentLoader } from "./public-audience--klBIOk1.mjs";
|
|
10
10
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-4IJqPYos.mjs";
|
|
11
11
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -116,7 +116,7 @@ async function captureSecuredDocument(proof, compactMsg, msgCanon, proofCanon, p
|
|
|
116
116
|
async function createProofInternal(object, privateKey, keyId, { contextLoader, context, created } = {}, capture = false) {
|
|
117
117
|
validateCryptoKey(privateKey, "private");
|
|
118
118
|
if (privateKey.algorithm.name !== "Ed25519") throw new TypeError("Unsupported algorithm: " + privateKey.algorithm.name);
|
|
119
|
-
let compactMsg = await object.clone({ proofs: [] }).toJsonLd({
|
|
119
|
+
let compactMsg = await object.clone({ proofs: [] }, { verifyPortableObject: void 0 }).toJsonLd({
|
|
120
120
|
format: "compact",
|
|
121
121
|
contextLoader,
|
|
122
122
|
context
|
|
@@ -189,7 +189,7 @@ async function signObject(object, privateKey, keyId, options = {}) {
|
|
|
189
189
|
if (proof.verificationMethodId != null) span.setAttribute("object_integrity_proofs.key_id", proof.verificationMethodId.href);
|
|
190
190
|
if (proof.proofValue != null) span.setAttribute("object_integrity_proofs.signature", encodeHex(proof.proofValue));
|
|
191
191
|
}
|
|
192
|
-
const signed = object.clone({ proofs: [...existingProofs, proof] });
|
|
192
|
+
const signed = object.clone({ proofs: [...existingProofs, proof] }, { verifyPortableObject: getDefaultPortableObjectVerifier(object) });
|
|
193
193
|
if (securedDocument != null) retainSignedRepresentation(signed, securedDocument);
|
|
194
194
|
else if (existingProofs.length > 0) logger.debug("The object {objectId} already had {proofCount} proof(s), so its signed representation is not retained for embedding; the map-local compound-proof profile accepts exactly one direct proof per map.", {
|
|
195
195
|
objectId: object.id?.href,
|