@fedify/fedify 1.10.0-dev.1871 → 1.10.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -0
- package/dist/{actor-DhtSf14w.cjs → actor-8zynMl2a.cjs} +187 -187
- package/dist/{actor-CfGzhUAX.js → actor-Bv7llTFW.js} +1 -1
- package/dist/{actor-D4WHPSCH.js → actor-eIATKOh7.js} +187 -187
- package/dist/{authdocloader-pF-wLmI7.cjs → authdocloader-BEPeTSD8.cjs} +3 -3
- package/dist/{authdocloader-zjoY3BuQ.js → authdocloader-BNIyrORx.js} +3 -3
- package/dist/{authdocloader-BQrpfeKZ.js → authdocloader-TNeksncq.js} +3 -3
- package/dist/{builder-VDUOlO5_.js → builder-C7fApQY_.js} +4 -4
- package/dist/{client-CSgYHRLI.js → client-Bwnrdh_A.js} +1 -1
- package/dist/compat/transformers.test.js +16 -16
- package/dist/{docloader-CncYs8UV.js → docloader-CLYexeNv.js} +38 -9
- package/dist/{docloader-B0LuS-cg.cjs → docloader-CdsuyjrU.cjs} +38 -9
- package/dist/{esm-3ldbheMA.js → esm-aj4vkb76.js} +1 -1
- package/dist/federation/builder.test.js +5 -5
- package/dist/federation/collection.test.js +3 -3
- package/dist/federation/handler.test.js +104 -17
- package/dist/federation/idempotency.test.js +17 -17
- package/dist/federation/inbox.test.js +4 -4
- package/dist/federation/keycache.test.js +4 -4
- package/dist/federation/kv.test.js +3 -3
- package/dist/federation/middleware.test.js +18 -18
- package/dist/federation/mod.cjs +10 -10
- package/dist/federation/mod.js +10 -10
- package/dist/federation/mq.test.js +5 -5
- package/dist/federation/retry.test.js +3 -3
- package/dist/federation/router.test.js +3 -3
- package/dist/federation/send.test.js +53 -10
- package/dist/{http-CrHQ9vvq.cjs → http-CK80ff9S.cjs} +3 -3
- package/dist/{http-DDUtYyG2.js → http-DMJrVRf0.js} +3 -3
- package/dist/{http-BEgyqh3n.js → http-DXmKLE1t.js} +2 -2
- package/dist/{inbox-CrJDO5ET.js → inbox-Dt-Q2rJt.js} +1 -1
- package/dist/{key-CA9cZx7Z.js → key-BL8DRhuI.js} +3 -3
- package/dist/{key-N3d_lqdx.cjs → key-BU1Vsq8S.cjs} +2 -2
- package/dist/{key-xnit_Im0.js → key-DTzAk78O.js} +4 -4
- package/dist/{key-C-Kzj_i9.js → key-DWDJFZzD.js} +2 -2
- package/dist/{key-CEEnIH7N.js → key-Tt9B2Qkj.js} +2 -2
- package/dist/key-gZEWdYwT.cjs +10 -0
- package/dist/{keycache-E2u97dp7.js → keycache-CXF4YAON.js} +1 -1
- package/dist/{keys-B-M9Ls7Y.js → keys-CAUbEZtV.js} +1 -1
- package/dist/{ld-DwL3K4gH.js → ld-CqoYKNwB.js} +2 -2
- package/dist/{lookup-k3pOXnRa.js → lookup-8Ik9lSMm.js} +1 -1
- package/dist/{lookup-DwfTz04L.cjs → lookup-BXlOCJsH.cjs} +1 -1
- package/dist/{lookup-xSRoxGFY.js → lookup-Co4Y1ycg.js} +6 -1
- package/dist/middleware-09gZVY21.cjs +17 -0
- package/dist/middleware-B8Q9c1ys.js +26 -0
- package/dist/middleware-DHUCp8iq.js +17 -0
- package/dist/{middleware-DZWqnOfo.js → middleware-DnXc8LK4.js} +24 -12
- package/dist/{middleware-D1GeKqxh.cjs → middleware-bN29Orv5.cjs} +24 -12
- package/dist/{middleware-DVCHqnbp.js → middleware-nSw7nWf8.js} +20 -13
- package/dist/mod.cjs +10 -10
- package/dist/mod.js +10 -10
- package/dist/nodeinfo/client.test.js +5 -5
- package/dist/nodeinfo/handler.test.js +16 -16
- package/dist/nodeinfo/mod.cjs +2 -2
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/nodeinfo/semver.test.js +3 -3
- package/dist/nodeinfo/types.test.js +3 -3
- package/dist/otel-Chy5T2Xh.js +64 -0
- package/dist/{owner-BOcBaBC_.js → owner-9jSx_21P.js} +44 -8
- package/dist/{proof-DTd3ilzM.js → proof-B5YI7sn5.js} +2 -2
- package/dist/{proof-MQ-8pB0L.js → proof-BT3OPhWQ.js} +45 -9
- package/dist/{proof-DrwSFIzI.cjs → proof-BuLnngRI.cjs} +44 -8
- package/dist/runtime/authdocloader.test.js +9 -9
- package/dist/runtime/docloader.test.js +70 -4
- package/dist/runtime/key.test.js +5 -5
- package/dist/runtime/langstr.test.js +3 -3
- package/dist/runtime/link.test.js +3 -3
- package/dist/runtime/mod.cjs +6 -6
- package/dist/runtime/mod.js +6 -6
- package/dist/runtime/multibase/multibase.test.js +3 -3
- package/dist/runtime/url.test.js +3 -3
- package/dist/{send-tJvLIgDs.js → send-DlPE7bKe.js} +9 -4
- package/dist/sig/http.test.js +8 -8
- package/dist/sig/key.test.js +6 -6
- package/dist/sig/ld.test.js +7 -7
- package/dist/sig/mod.cjs +6 -6
- package/dist/sig/mod.js +6 -6
- package/dist/sig/owner.test.js +31 -7
- package/dist/sig/proof.test.js +7 -7
- package/dist/testing/docloader.test.js +3 -3
- package/dist/testing/mod.js +3 -3
- package/dist/{testing-f_tNP1r1.js → testing-B17zODFD.js} +2 -2
- package/dist/{type-Bw-d0BzW.js → type-E_91dusN.js} +222 -194
- package/dist/{types-CKbB6z5P.js → types-By5LByL1.js} +1 -1
- package/dist/{types-CAnLnfUh.cjs → types-Ci8XKEfO.cjs} +1 -1
- package/dist/vocab/actor.test.js +5 -5
- package/dist/vocab/lookup.test.js +27 -5
- package/dist/vocab/mod.cjs +4 -4
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +3 -3
- package/dist/vocab/vocab.test.js +4 -4
- package/dist/{vocab-UCjgY_zC.cjs → vocab-BjnZ49Xt.cjs} +8 -3
- package/dist/{vocab-fCO9uHPr.js → vocab-CthegyUc.js} +8 -3
- package/dist/webfinger/handler.test.js +16 -16
- package/dist/webfinger/lookup.test.js +4 -4
- package/dist/webfinger/mod.cjs +2 -2
- package/dist/webfinger/mod.js +2 -2
- package/dist/x/cfworkers.test.js +3 -3
- package/package.json +5 -3
- package/dist/key-NTXsO1Hj.cjs +0 -10
- package/dist/middleware-BV0aY-JU.js +0 -17
- package/dist/middleware-CkF8G921.js +0 -26
- package/dist/middleware-D3WSJHlb.cjs +0 -17
- /package/dist/{denokv-Bv33Xxea.js → denokv-D0nfNQ1x.js} +0 -0
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
|
|
5
5
|
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
|
6
6
|
const require_transformers = require('./transformers-CoBS-oFG.cjs');
|
|
7
|
-
const require_docloader = require('./docloader-
|
|
8
|
-
const require_actor = require('./actor-
|
|
9
|
-
const require_lookup = require('./lookup-
|
|
10
|
-
const require_key = require('./key-
|
|
11
|
-
const require_http = require('./http-
|
|
12
|
-
const require_proof = require('./proof-
|
|
13
|
-
const require_types = require('./types-
|
|
14
|
-
const require_authdocloader = require('./authdocloader-
|
|
15
|
-
const require_vocab = require('./vocab-
|
|
7
|
+
const require_docloader = require('./docloader-CdsuyjrU.cjs');
|
|
8
|
+
const require_actor = require('./actor-8zynMl2a.cjs');
|
|
9
|
+
const require_lookup = require('./lookup-BXlOCJsH.cjs');
|
|
10
|
+
const require_key = require('./key-BU1Vsq8S.cjs');
|
|
11
|
+
const require_http = require('./http-CK80ff9S.cjs');
|
|
12
|
+
const require_proof = require('./proof-BuLnngRI.cjs');
|
|
13
|
+
const require_types = require('./types-Ci8XKEfO.cjs');
|
|
14
|
+
const require_authdocloader = require('./authdocloader-BEPeTSD8.cjs');
|
|
15
|
+
const require_vocab = require('./vocab-BjnZ49Xt.cjs');
|
|
16
16
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
|
17
17
|
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
|
18
18
|
const byte_encodings_hex = require_chunk.__toESM(require("byte-encodings/hex"));
|
|
@@ -345,7 +345,7 @@ var FederationBuilderImpl = class {
|
|
|
345
345
|
this.collectionTypeIds = {};
|
|
346
346
|
}
|
|
347
347
|
async build(options) {
|
|
348
|
-
const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-
|
|
348
|
+
const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-09gZVY21.cjs"));
|
|
349
349
|
const f = new FederationImpl$1(options);
|
|
350
350
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
351
351
|
f.router = this.router.clone();
|
|
@@ -1500,6 +1500,13 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1500
1500
|
}
|
|
1501
1501
|
if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
|
|
1502
1502
|
span.setAttribute("activitypub.activity.type", require_actor.getTypeId(activity).href);
|
|
1503
|
+
span.addEvent("activitypub.activity.received", {
|
|
1504
|
+
"activitypub.activity.json": JSON.stringify(json),
|
|
1505
|
+
"activitypub.activity.verified": activity != null,
|
|
1506
|
+
"ld_signatures.verified": ldSigVerified,
|
|
1507
|
+
"http_signatures.verified": httpSigKey != null,
|
|
1508
|
+
"http_signatures.key_id": httpSigKey?.id?.href ?? ""
|
|
1509
|
+
});
|
|
1503
1510
|
if (httpSigKey != null && !await require_proof.doesActorOwnKey(activity, httpSigKey, ctx)) {
|
|
1504
1511
|
logger$1.error("The signer ({keyId}) and the actor ({actorId}) do not match.", {
|
|
1505
1512
|
activity: json,
|
|
@@ -2273,7 +2280,7 @@ function sendActivity(options) {
|
|
|
2273
2280
|
await sendActivityInternal({
|
|
2274
2281
|
...options,
|
|
2275
2282
|
tracerProvider
|
|
2276
|
-
});
|
|
2283
|
+
}, span);
|
|
2277
2284
|
} catch (e) {
|
|
2278
2285
|
span.setStatus({
|
|
2279
2286
|
code: __opentelemetry_api.SpanStatusCode.ERROR,
|
|
@@ -2285,7 +2292,7 @@ function sendActivity(options) {
|
|
|
2285
2292
|
}
|
|
2286
2293
|
});
|
|
2287
2294
|
}
|
|
2288
|
-
async function sendActivityInternal({ activity, activityId, keys, inbox, headers, specDeterminer, tracerProvider }) {
|
|
2295
|
+
async function sendActivityInternal({ activity, activityId, keys, inbox, headers, specDeterminer, tracerProvider }, span) {
|
|
2289
2296
|
const logger$1 = (0, __logtape_logtape.getLogger)([
|
|
2290
2297
|
"fedify",
|
|
2291
2298
|
"federation",
|
|
@@ -2340,6 +2347,11 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
|
|
|
2340
2347
|
});
|
|
2341
2348
|
throw new Error(`Failed to send activity ${activityId} to ${inbox.href} (${response.status} ${response.statusText}):\n${error}`);
|
|
2342
2349
|
}
|
|
2350
|
+
span.addEvent("activitypub.activity.sent", {
|
|
2351
|
+
"activitypub.activity.json": JSON.stringify(activity),
|
|
2352
|
+
"activitypub.inbox.url": inbox.href,
|
|
2353
|
+
"activitypub.activity.id": activityId ?? ""
|
|
2354
|
+
});
|
|
2343
2355
|
}
|
|
2344
2356
|
|
|
2345
2357
|
//#endregion
|
|
@@ -3,22 +3,22 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, deno_default, getDocumentLoader, getTypeId, kvCache, lookupWebFinger } from "./type-
|
|
7
|
-
import { getNodeInfo } from "./client-
|
|
8
|
-
import { RouterError, lookupObject, traverseCollection } from "./lookup-
|
|
6
|
+
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, deno_default, getDocumentLoader, getTypeId, kvCache, lookupWebFinger } from "./type-E_91dusN.js";
|
|
7
|
+
import { getNodeInfo } from "./client-Bwnrdh_A.js";
|
|
8
|
+
import { RouterError, lookupObject, traverseCollection } from "./lookup-Co4Y1ycg.js";
|
|
9
9
|
import { nodeInfoToJson } from "./types-BIgY6c-l.js";
|
|
10
|
-
import { exportJwk, importJwk, validateCryptoKey } from "./key-
|
|
11
|
-
import { verifyRequest } from "./http-
|
|
12
|
-
import { getAuthenticatedDocumentLoader } from "./authdocloader-
|
|
13
|
-
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-
|
|
14
|
-
import { doesActorOwnKey, getKeyOwner } from "./owner-
|
|
15
|
-
import { signObject, verifyObject } from "./proof-
|
|
16
|
-
import { routeActivity } from "./inbox-
|
|
17
|
-
import { FederationBuilderImpl } from "./builder-
|
|
10
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-Tt9B2Qkj.js";
|
|
11
|
+
import { verifyRequest } from "./http-DXmKLE1t.js";
|
|
12
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-TNeksncq.js";
|
|
13
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-CqoYKNwB.js";
|
|
14
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-9jSx_21P.js";
|
|
15
|
+
import { signObject, verifyObject } from "./proof-B5YI7sn5.js";
|
|
16
|
+
import { routeActivity } from "./inbox-Dt-Q2rJt.js";
|
|
17
|
+
import { FederationBuilderImpl } from "./builder-C7fApQY_.js";
|
|
18
18
|
import { buildCollectionSynchronizationHeader } from "./collection-CSzG2j1P.js";
|
|
19
|
-
import { KvKeyCache } from "./keycache-
|
|
19
|
+
import { KvKeyCache } from "./keycache-CXF4YAON.js";
|
|
20
20
|
import { createExponentialBackoffPolicy } from "./retry-D4GJ670a.js";
|
|
21
|
-
import { extractInboxes, sendActivity } from "./send-
|
|
21
|
+
import { extractInboxes, sendActivity } from "./send-DlPE7bKe.js";
|
|
22
22
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
23
23
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
24
24
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
@@ -846,6 +846,13 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
846
846
|
}
|
|
847
847
|
if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
|
|
848
848
|
span.setAttribute("activitypub.activity.type", getTypeId(activity).href);
|
|
849
|
+
span.addEvent("activitypub.activity.received", {
|
|
850
|
+
"activitypub.activity.json": JSON.stringify(json),
|
|
851
|
+
"activitypub.activity.verified": activity != null,
|
|
852
|
+
"ld_signatures.verified": ldSigVerified,
|
|
853
|
+
"http_signatures.verified": httpSigKey != null,
|
|
854
|
+
"http_signatures.key_id": httpSigKey?.id?.href ?? ""
|
|
855
|
+
});
|
|
849
856
|
if (httpSigKey != null && !await doesActorOwnKey(activity, httpSigKey, ctx)) {
|
|
850
857
|
logger$2.error("The signer ({keyId}) and the actor ({actorId}) do not match.", {
|
|
851
858
|
activity: json,
|
package/dist/mod.cjs
CHANGED
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
const require_transformers = require('./transformers-CoBS-oFG.cjs');
|
|
6
6
|
require('./compat-DmDDELst.cjs');
|
|
7
|
-
const require_docloader = require('./docloader-
|
|
8
|
-
const require_actor = require('./actor-
|
|
9
|
-
const require_middleware = require('./middleware-
|
|
10
|
-
const require_lookup = require('./lookup-
|
|
11
|
-
const require_key = require('./key-
|
|
12
|
-
const require_http = require('./http-
|
|
13
|
-
const require_proof = require('./proof-
|
|
7
|
+
const require_docloader = require('./docloader-CdsuyjrU.cjs');
|
|
8
|
+
const require_actor = require('./actor-8zynMl2a.cjs');
|
|
9
|
+
const require_middleware = require('./middleware-bN29Orv5.cjs');
|
|
10
|
+
const require_lookup = require('./lookup-BXlOCJsH.cjs');
|
|
11
|
+
const require_key = require('./key-BU1Vsq8S.cjs');
|
|
12
|
+
const require_http = require('./http-CK80ff9S.cjs');
|
|
13
|
+
const require_proof = require('./proof-BuLnngRI.cjs');
|
|
14
14
|
const require_federation = require('./federation-H2_En3j5.cjs');
|
|
15
|
-
const require_types = require('./types-
|
|
16
|
-
const require_authdocloader = require('./authdocloader-
|
|
17
|
-
const require_vocab = require('./vocab-
|
|
15
|
+
const require_types = require('./types-Ci8XKEfO.cjs');
|
|
16
|
+
const require_authdocloader = require('./authdocloader-BEPeTSD8.cjs');
|
|
17
|
+
const require_vocab = require('./vocab-BjnZ49Xt.cjs');
|
|
18
18
|
require('./nodeinfo-Co9lJrWl.cjs');
|
|
19
19
|
require('./runtime-C58AJWSv.cjs');
|
|
20
20
|
require('./sig-ByHXzqUi.cjs');
|
package/dist/mod.js
CHANGED
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
|
|
5
5
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./transformers-BFT6d7J5.js";
|
|
6
6
|
import "./compat-nxUqe4Z-.js";
|
|
7
|
-
import { FetchError, fetchDocumentLoader, getDocumentLoader, getUserAgent, kvCache } from "./docloader-
|
|
8
|
-
import { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, LanguageString, Leave, Like, Link, Listen, Mention, Move, Multikey, Note, Object as Object$1, Offer, OrderedCollection, OrderedCollectionPage, Organization, Page, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View, exportMultibaseKey, exportSpki, getActorClassByTypeName, getActorHandle, getActorTypeName, getTypeId, importMultibaseKey, importPem, importPkcs1, importSpki, isActor, normalizeActorHandle } from "./actor-
|
|
9
|
-
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "./middleware-
|
|
10
|
-
import { lookupWebFinger } from "./lookup-
|
|
11
|
-
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk } from "./key-
|
|
12
|
-
import { signRequest, verifyRequest } from "./http-
|
|
13
|
-
import { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, getKeyOwner, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "./proof-
|
|
7
|
+
import { FetchError, fetchDocumentLoader, getDocumentLoader, getUserAgent, kvCache } from "./docloader-CLYexeNv.js";
|
|
8
|
+
import { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, LanguageString, Leave, Like, Link, Listen, Mention, Move, Multikey, Note, Object as Object$1, Offer, OrderedCollection, OrderedCollectionPage, Organization, Page, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View, exportMultibaseKey, exportSpki, getActorClassByTypeName, getActorHandle, getActorTypeName, getTypeId, importMultibaseKey, importPem, importPkcs1, importSpki, isActor, normalizeActorHandle } from "./actor-eIATKOh7.js";
|
|
9
|
+
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "./middleware-DnXc8LK4.js";
|
|
10
|
+
import { lookupWebFinger } from "./lookup-8Ik9lSMm.js";
|
|
11
|
+
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk } from "./key-DWDJFZzD.js";
|
|
12
|
+
import { signRequest, verifyRequest } from "./http-DMJrVRf0.js";
|
|
13
|
+
import { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, getKeyOwner, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "./proof-BT3OPhWQ.js";
|
|
14
14
|
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation-D1U8YY9t.js";
|
|
15
|
-
import { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer } from "./types-
|
|
16
|
-
import { getAuthenticatedDocumentLoader } from "./authdocloader-
|
|
17
|
-
import { PUBLIC_COLLECTION, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "./vocab-
|
|
15
|
+
import { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer } from "./types-By5LByL1.js";
|
|
16
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-BNIyrORx.js";
|
|
17
|
+
import { PUBLIC_COLLECTION, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "./vocab-CthegyUc.js";
|
|
18
18
|
import "./nodeinfo-DfycQ8Wf.js";
|
|
19
19
|
import "./runtime-DPYEDf-o.js";
|
|
20
20
|
import "./sig-Cj3tk-ig.js";
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import "../type-
|
|
6
|
+
import "../type-E_91dusN.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import "../assert-MZs1qjMx.js";
|
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
10
|
import "../semver-dArNLkR9.js";
|
|
11
|
-
import { getNodeInfo, parseInboundService, parseNodeInfo, parseOutboundService, parseProtocol, parseServices, parseSoftware, parseUsage } from "../client-
|
|
12
|
-
import "../lookup-
|
|
13
|
-
import { test } from "../testing-
|
|
11
|
+
import { getNodeInfo, parseInboundService, parseNodeInfo, parseOutboundService, parseProtocol, parseServices, parseSoftware, parseUsage } from "../client-Bwnrdh_A.js";
|
|
12
|
+
import "../lookup-Co4Y1ycg.js";
|
|
13
|
+
import { test } from "../testing-B17zODFD.js";
|
|
14
14
|
import "../std__assert-X-_kMxKM.js";
|
|
15
15
|
import "../assert_rejects-DiIiJbZn.js";
|
|
16
16
|
import "../assert_is_error-BPGph1Jx.js";
|
|
17
17
|
import "../assert_not_equals-f3m3epl3.js";
|
|
18
18
|
import "../assert_throws-BOO88avQ.js";
|
|
19
|
-
import { esm_default } from "../esm-
|
|
19
|
+
import { esm_default } from "../esm-aj4vkb76.js";
|
|
20
20
|
|
|
21
21
|
//#region src/nodeinfo/client.test.ts
|
|
22
22
|
test("getNodeInfo()", async (t) => {
|
|
@@ -3,30 +3,30 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import "../type-
|
|
6
|
+
import "../type-E_91dusN.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import "../assert-MZs1qjMx.js";
|
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
10
|
import { MemoryKvStore } from "../kv-CRZrzyXm.js";
|
|
11
|
-
import { createFederation, handleNodeInfo, handleNodeInfoJrd } from "../middleware-
|
|
11
|
+
import { createFederation, handleNodeInfo, handleNodeInfoJrd } from "../middleware-nSw7nWf8.js";
|
|
12
12
|
import { parseSemVer } from "../semver-dArNLkR9.js";
|
|
13
|
-
import "../client-
|
|
14
|
-
import "../lookup-
|
|
13
|
+
import "../client-Bwnrdh_A.js";
|
|
14
|
+
import "../lookup-Co4Y1ycg.js";
|
|
15
15
|
import "../types-BIgY6c-l.js";
|
|
16
|
-
import "../actor-
|
|
17
|
-
import "../key-
|
|
18
|
-
import "../http-
|
|
19
|
-
import "../authdocloader-
|
|
20
|
-
import "../ld-
|
|
21
|
-
import "../owner-
|
|
22
|
-
import "../proof-
|
|
23
|
-
import "../inbox-
|
|
24
|
-
import "../builder-
|
|
16
|
+
import "../actor-Bv7llTFW.js";
|
|
17
|
+
import "../key-Tt9B2Qkj.js";
|
|
18
|
+
import "../http-DXmKLE1t.js";
|
|
19
|
+
import "../authdocloader-TNeksncq.js";
|
|
20
|
+
import "../ld-CqoYKNwB.js";
|
|
21
|
+
import "../owner-9jSx_21P.js";
|
|
22
|
+
import "../proof-B5YI7sn5.js";
|
|
23
|
+
import "../inbox-Dt-Q2rJt.js";
|
|
24
|
+
import "../builder-C7fApQY_.js";
|
|
25
25
|
import "../collection-CSzG2j1P.js";
|
|
26
|
-
import "../keycache-
|
|
26
|
+
import "../keycache-CXF4YAON.js";
|
|
27
27
|
import "../retry-D4GJ670a.js";
|
|
28
|
-
import "../send-
|
|
29
|
-
import { createRequestContext, test } from "../testing-
|
|
28
|
+
import "../send-DlPE7bKe.js";
|
|
29
|
+
import { createRequestContext, test } from "../testing-B17zODFD.js";
|
|
30
30
|
import "../std__assert-X-_kMxKM.js";
|
|
31
31
|
import "../assert_rejects-DiIiJbZn.js";
|
|
32
32
|
import "../assert_is_error-BPGph1Jx.js";
|
package/dist/nodeinfo/mod.cjs
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
4
|
|
|
5
|
-
require('../docloader-
|
|
6
|
-
const require_types = require('../types-
|
|
5
|
+
require('../docloader-CdsuyjrU.cjs');
|
|
6
|
+
const require_types = require('../types-Ci8XKEfO.cjs');
|
|
7
7
|
require('../nodeinfo-Co9lJrWl.cjs');
|
|
8
8
|
|
|
9
9
|
exports.formatSemVer = require_types.formatSemVer;
|
package/dist/nodeinfo/mod.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import "../docloader-
|
|
6
|
-
import { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer } from "../types-
|
|
5
|
+
import "../docloader-CLYexeNv.js";
|
|
6
|
+
import { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer } from "../types-By5LByL1.js";
|
|
7
7
|
import "../nodeinfo-DfycQ8Wf.js";
|
|
8
8
|
|
|
9
9
|
export { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer };
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import "../type-
|
|
6
|
+
import "../type-E_91dusN.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import "../assert-MZs1qjMx.js";
|
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
10
|
import { formatSemVer, parseSemVer } from "../semver-dArNLkR9.js";
|
|
11
|
-
import "../lookup-
|
|
12
|
-
import { test } from "../testing-
|
|
11
|
+
import "../lookup-Co4Y1ycg.js";
|
|
12
|
+
import { test } from "../testing-B17zODFD.js";
|
|
13
13
|
import "../std__assert-X-_kMxKM.js";
|
|
14
14
|
import "../assert_rejects-DiIiJbZn.js";
|
|
15
15
|
import "../assert_is_error-BPGph1Jx.js";
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import "../type-
|
|
6
|
+
import "../type-E_91dusN.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import "../assert-MZs1qjMx.js";
|
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
10
|
import "../semver-dArNLkR9.js";
|
|
11
|
-
import "../lookup-
|
|
11
|
+
import "../lookup-Co4Y1ycg.js";
|
|
12
12
|
import { nodeInfoToJson } from "../types-BIgY6c-l.js";
|
|
13
|
-
import { test } from "../testing-
|
|
13
|
+
import { test } from "../testing-B17zODFD.js";
|
|
14
14
|
import "../std__assert-X-_kMxKM.js";
|
|
15
15
|
import "../assert_rejects-DiIiJbZn.js";
|
|
16
16
|
import "../assert_is_error-BPGph1Jx.js";
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
globalThis.addEventListener = () => {};
|
|
5
|
+
|
|
6
|
+
import { BasicTracerProvider, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
|
|
7
|
+
import { ExportResultCode } from "@opentelemetry/core";
|
|
8
|
+
|
|
9
|
+
//#region src/testing/otel.ts
|
|
10
|
+
/**
|
|
11
|
+
* A test spy for OpenTelemetry spans that captures all spans and events.
|
|
12
|
+
*/
|
|
13
|
+
var TestSpanExporter = class {
|
|
14
|
+
spans = [];
|
|
15
|
+
export(spans, resultCallback) {
|
|
16
|
+
this.spans.push(...spans);
|
|
17
|
+
resultCallback({ code: ExportResultCode.SUCCESS });
|
|
18
|
+
}
|
|
19
|
+
async forceFlush() {}
|
|
20
|
+
shutdown() {
|
|
21
|
+
this.spans = [];
|
|
22
|
+
return Promise.resolve();
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets all spans with the given name.
|
|
26
|
+
*/
|
|
27
|
+
getSpans(name) {
|
|
28
|
+
return this.spans.filter((span) => span.name === name);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets the first span with the given name.
|
|
32
|
+
*/
|
|
33
|
+
getSpan(name) {
|
|
34
|
+
return this.spans.find((span) => span.name === name);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Gets all events from spans with the given name.
|
|
38
|
+
*/
|
|
39
|
+
getEvents(spanName, eventName) {
|
|
40
|
+
const spans = this.getSpans(spanName);
|
|
41
|
+
const events = spans.flatMap((span) => span.events);
|
|
42
|
+
if (eventName) return events.filter((event) => event.name === eventName);
|
|
43
|
+
return events;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Clears all captured spans.
|
|
47
|
+
*/
|
|
48
|
+
clear() {
|
|
49
|
+
this.spans = [];
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Creates a test tracer provider with a test exporter.
|
|
54
|
+
* @returns A tuple of [tracerProvider, testExporter]
|
|
55
|
+
*/
|
|
56
|
+
function createTestTracerProvider() {
|
|
57
|
+
const exporter = new TestSpanExporter();
|
|
58
|
+
const provider = new BasicTracerProvider();
|
|
59
|
+
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
|
|
60
|
+
return [provider, exporter];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { createTestTracerProvider };
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { CryptographicKey, Object as Object$1, getDocumentLoader } from "./type-
|
|
7
|
-
import { isActor } from "./actor-
|
|
8
|
-
import { trace } from "@opentelemetry/api";
|
|
6
|
+
import { CryptographicKey, Object as Object$1, deno_default, getDocumentLoader } from "./type-E_91dusN.js";
|
|
7
|
+
import { isActor } from "./actor-Bv7llTFW.js";
|
|
8
|
+
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
|
|
10
10
|
//#region src/sig/owner.ts
|
|
11
11
|
/**
|
|
@@ -16,11 +16,47 @@ import { trace } from "@opentelemetry/api";
|
|
|
16
16
|
* @returns Whether the actor is the owner of the key.
|
|
17
17
|
*/
|
|
18
18
|
async function doesActorOwnKey(activity, key, options) {
|
|
19
|
-
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
|
|
20
|
+
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
21
|
+
return await tracer.startActiveSpan("activitypub.verify_key_ownership", {
|
|
22
|
+
kind: SpanKind.INTERNAL,
|
|
23
|
+
attributes: {
|
|
24
|
+
"activitypub.actor.id": activity.actorId?.href ?? "",
|
|
25
|
+
"activitypub.key.id": key.id?.href ?? ""
|
|
26
|
+
}
|
|
27
|
+
}, async (span) => {
|
|
28
|
+
try {
|
|
29
|
+
if (key.ownerId != null) {
|
|
30
|
+
const owns = key.ownerId.href === activity.actorId?.href;
|
|
31
|
+
span.setAttribute("activitypub.key_ownership.verified", owns);
|
|
32
|
+
span.setAttribute("activitypub.key_ownership.method", "owner_id");
|
|
33
|
+
return owns;
|
|
34
|
+
}
|
|
35
|
+
const actor = await activity.getActor(options);
|
|
36
|
+
if (actor == null || !isActor(actor)) {
|
|
37
|
+
span.setAttribute("activitypub.key_ownership.verified", false);
|
|
38
|
+
span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
for (const publicKeyId of actor.publicKeyIds) if (key.id != null && publicKeyId.href === key.id.href) {
|
|
42
|
+
span.setAttribute("activitypub.key_ownership.verified", true);
|
|
43
|
+
span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
span.setAttribute("activitypub.key_ownership.verified", false);
|
|
47
|
+
span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
|
|
48
|
+
return false;
|
|
49
|
+
} catch (error) {
|
|
50
|
+
span.recordException(error);
|
|
51
|
+
span.setStatus({
|
|
52
|
+
code: SpanStatusCode.ERROR,
|
|
53
|
+
message: String(error)
|
|
54
|
+
});
|
|
55
|
+
throw error;
|
|
56
|
+
} finally {
|
|
57
|
+
span.end();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
24
60
|
}
|
|
25
61
|
/**
|
|
26
62
|
* Gets the actor that owns the specified key. Returns `null` if the key has no
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { Activity, DataIntegrityProof, Multikey, deno_default, getTypeId } from "./type-
|
|
7
|
-
import { fetchKey, validateCryptoKey } from "./key-
|
|
6
|
+
import { Activity, DataIntegrityProof, Multikey, deno_default, getTypeId } from "./type-E_91dusN.js";
|
|
7
|
+
import { fetchKey, validateCryptoKey } from "./key-Tt9B2Qkj.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
import { encodeHex } from "byte-encodings/hex";
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import { deno_default, getDocumentLoader } from "./docloader-
|
|
6
|
-
import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, getTypeId, isActor } from "./actor-
|
|
7
|
-
import { fetchKey, validateCryptoKey } from "./key-
|
|
5
|
+
import { deno_default, getDocumentLoader } from "./docloader-CLYexeNv.js";
|
|
6
|
+
import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, getTypeId, isActor } from "./actor-eIATKOh7.js";
|
|
7
|
+
import { fetchKey, validateCryptoKey } from "./key-DWDJFZzD.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
|
-
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
|
+
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
import jsonld from "jsonld";
|
|
11
11
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
12
12
|
import { encodeHex } from "byte-encodings/hex";
|
|
@@ -275,11 +275,47 @@ async function hashJsonLd(jsonLd, contextLoader) {
|
|
|
275
275
|
* @returns Whether the actor is the owner of the key.
|
|
276
276
|
*/
|
|
277
277
|
async function doesActorOwnKey(activity, key, options) {
|
|
278
|
-
|
|
279
|
-
const
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
278
|
+
const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
|
|
279
|
+
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
280
|
+
return await tracer.startActiveSpan("activitypub.verify_key_ownership", {
|
|
281
|
+
kind: SpanKind.INTERNAL,
|
|
282
|
+
attributes: {
|
|
283
|
+
"activitypub.actor.id": activity.actorId?.href ?? "",
|
|
284
|
+
"activitypub.key.id": key.id?.href ?? ""
|
|
285
|
+
}
|
|
286
|
+
}, async (span) => {
|
|
287
|
+
try {
|
|
288
|
+
if (key.ownerId != null) {
|
|
289
|
+
const owns = key.ownerId.href === activity.actorId?.href;
|
|
290
|
+
span.setAttribute("activitypub.key_ownership.verified", owns);
|
|
291
|
+
span.setAttribute("activitypub.key_ownership.method", "owner_id");
|
|
292
|
+
return owns;
|
|
293
|
+
}
|
|
294
|
+
const actor = await activity.getActor(options);
|
|
295
|
+
if (actor == null || !isActor(actor)) {
|
|
296
|
+
span.setAttribute("activitypub.key_ownership.verified", false);
|
|
297
|
+
span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
for (const publicKeyId of actor.publicKeyIds) if (key.id != null && publicKeyId.href === key.id.href) {
|
|
301
|
+
span.setAttribute("activitypub.key_ownership.verified", true);
|
|
302
|
+
span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
span.setAttribute("activitypub.key_ownership.verified", false);
|
|
306
|
+
span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
|
|
307
|
+
return false;
|
|
308
|
+
} catch (error) {
|
|
309
|
+
span.recordException(error);
|
|
310
|
+
span.setStatus({
|
|
311
|
+
code: SpanStatusCode.ERROR,
|
|
312
|
+
message: String(error)
|
|
313
|
+
});
|
|
314
|
+
throw error;
|
|
315
|
+
} finally {
|
|
316
|
+
span.end();
|
|
317
|
+
}
|
|
318
|
+
});
|
|
283
319
|
}
|
|
284
320
|
/**
|
|
285
321
|
* Gets the actor that owns the specified key. Returns `null` if the key has no
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
4
|
|
|
5
5
|
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
|
6
|
-
const require_docloader = require('./docloader-
|
|
7
|
-
const require_actor = require('./actor-
|
|
8
|
-
const require_key = require('./key-
|
|
6
|
+
const require_docloader = require('./docloader-CdsuyjrU.cjs');
|
|
7
|
+
const require_actor = require('./actor-8zynMl2a.cjs');
|
|
8
|
+
const require_key = require('./key-BU1Vsq8S.cjs');
|
|
9
9
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
|
10
10
|
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
|
11
11
|
const jsonld = require_chunk.__toESM(require("jsonld"));
|
|
@@ -276,11 +276,47 @@ async function hashJsonLd(jsonLd, contextLoader) {
|
|
|
276
276
|
* @returns Whether the actor is the owner of the key.
|
|
277
277
|
*/
|
|
278
278
|
async function doesActorOwnKey(activity, key, options) {
|
|
279
|
-
|
|
280
|
-
const
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
279
|
+
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
|
280
|
+
const tracer = tracerProvider.getTracer(require_docloader.deno_default.name, require_docloader.deno_default.version);
|
|
281
|
+
return await tracer.startActiveSpan("activitypub.verify_key_ownership", {
|
|
282
|
+
kind: __opentelemetry_api.SpanKind.INTERNAL,
|
|
283
|
+
attributes: {
|
|
284
|
+
"activitypub.actor.id": activity.actorId?.href ?? "",
|
|
285
|
+
"activitypub.key.id": key.id?.href ?? ""
|
|
286
|
+
}
|
|
287
|
+
}, async (span) => {
|
|
288
|
+
try {
|
|
289
|
+
if (key.ownerId != null) {
|
|
290
|
+
const owns = key.ownerId.href === activity.actorId?.href;
|
|
291
|
+
span.setAttribute("activitypub.key_ownership.verified", owns);
|
|
292
|
+
span.setAttribute("activitypub.key_ownership.method", "owner_id");
|
|
293
|
+
return owns;
|
|
294
|
+
}
|
|
295
|
+
const actor = await activity.getActor(options);
|
|
296
|
+
if (actor == null || !require_actor.isActor(actor)) {
|
|
297
|
+
span.setAttribute("activitypub.key_ownership.verified", false);
|
|
298
|
+
span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
|
|
299
|
+
return false;
|
|
300
|
+
}
|
|
301
|
+
for (const publicKeyId of actor.publicKeyIds) if (key.id != null && publicKeyId.href === key.id.href) {
|
|
302
|
+
span.setAttribute("activitypub.key_ownership.verified", true);
|
|
303
|
+
span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
span.setAttribute("activitypub.key_ownership.verified", false);
|
|
307
|
+
span.setAttribute("activitypub.key_ownership.method", "actor_fetch");
|
|
308
|
+
return false;
|
|
309
|
+
} catch (error) {
|
|
310
|
+
span.recordException(error);
|
|
311
|
+
span.setStatus({
|
|
312
|
+
code: __opentelemetry_api.SpanStatusCode.ERROR,
|
|
313
|
+
message: String(error)
|
|
314
|
+
});
|
|
315
|
+
throw error;
|
|
316
|
+
} finally {
|
|
317
|
+
span.end();
|
|
318
|
+
}
|
|
319
|
+
});
|
|
284
320
|
}
|
|
285
321
|
/**
|
|
286
322
|
* Gets the actor that owns the specified key. Returns `null` if the key has no
|
|
@@ -3,23 +3,23 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { UrlError } from "../type-
|
|
6
|
+
import { UrlError } from "../type-E_91dusN.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import "../assert-MZs1qjMx.js";
|
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
|
-
import "../lookup-
|
|
11
|
-
import "../actor-
|
|
12
|
-
import "../key-
|
|
13
|
-
import { verifyRequest } from "../http-
|
|
14
|
-
import { getAuthenticatedDocumentLoader } from "../authdocloader-
|
|
15
|
-
import { mockDocumentLoader, test } from "../testing-
|
|
10
|
+
import "../lookup-Co4Y1ycg.js";
|
|
11
|
+
import "../actor-Bv7llTFW.js";
|
|
12
|
+
import "../key-Tt9B2Qkj.js";
|
|
13
|
+
import { verifyRequest } from "../http-DXmKLE1t.js";
|
|
14
|
+
import { getAuthenticatedDocumentLoader } from "../authdocloader-TNeksncq.js";
|
|
15
|
+
import { mockDocumentLoader, test } from "../testing-B17zODFD.js";
|
|
16
16
|
import "../std__assert-X-_kMxKM.js";
|
|
17
17
|
import { assertRejects } from "../assert_rejects-DiIiJbZn.js";
|
|
18
18
|
import "../assert_is_error-BPGph1Jx.js";
|
|
19
19
|
import "../assert_not_equals-f3m3epl3.js";
|
|
20
20
|
import "../assert_throws-BOO88avQ.js";
|
|
21
|
-
import { rsaPrivateKey2 } from "../keys-
|
|
22
|
-
import { esm_default } from "../esm-
|
|
21
|
+
import { rsaPrivateKey2 } from "../keys-CAUbEZtV.js";
|
|
22
|
+
import { esm_default } from "../esm-aj4vkb76.js";
|
|
23
23
|
|
|
24
24
|
//#region src/runtime/authdocloader.test.ts
|
|
25
25
|
test("getAuthenticatedDocumentLoader()", async (t) => {
|