@fedify/fedify 1.9.2-dev.1890 → 1.10.0-dev.11
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-LJkP7iVc.js → actor-BrjBSlv8.js} +187 -187
- package/dist/{actor-C2kxp5Fl.cjs → actor-CdCyXIiy.cjs} +187 -187
- package/dist/{actor-DyfGDQJB.js → actor-CzhWrNYT.js} +1 -1
- package/dist/{authdocloader-DaFhFZWS.cjs → authdocloader-BJPbXGjs.cjs} +3 -3
- package/dist/{authdocloader-8jtTmnjn.js → authdocloader-DWc5tH1y.js} +3 -3
- package/dist/{authdocloader-Djn6Z8TB.js → authdocloader-Y9lwp2q3.js} +3 -3
- package/dist/{builder-DG1srBKu.js → builder-D9HmXe-c.js} +4 -4
- package/dist/{client-Dq-zkC8Y.js → client-DPYh54yM.js} +1 -1
- package/dist/compat/transformers.test.js +16 -16
- package/dist/{docloader-Uh0ciwr4.cjs → docloader-Cgy1RCqb.cjs} +67 -29
- package/dist/{docloader-B_A2nB2W.js → docloader-Crf5jJS0.js} +67 -29
- package/dist/{esm-D-py171v.js → esm-D6gwWBFZ.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-jrUnvC1R.js → http-BqvHtYhP.js} +2 -2
- package/dist/{http-CJ7SfCok.js → http-CSJ1EReB.js} +3 -3
- package/dist/{http-DNoRdF3N.cjs → http-DBJHuWVd.cjs} +3 -3
- package/dist/{inbox-C3N4s1QJ.js → inbox-BuzNfn3x.js} +1 -1
- package/dist/{key-CAH7GCWj.js → key-1YPBM8c7.js} +2 -2
- package/dist/{key-CtByaj7Q.js → key-B5Hkq3o6.js} +4 -4
- package/dist/key-BgW3veKX.cjs +10 -0
- package/dist/{key-CkxzRYsV.cjs → key-CHl3R_Y6.cjs} +2 -2
- package/dist/{key-D-Vs5Xls.js → key-CJW3qlT7.js} +3 -3
- package/dist/{key-Ci7FKLpn.js → key-DZXdhUze.js} +2 -2
- package/dist/{keycache-CEs327f0.js → keycache-CGSAu6vs.js} +1 -1
- package/dist/{keys-BgYAMY7I.js → keys-CfLhGOby.js} +1 -1
- package/dist/{ld-CF-_Iv3N.js → ld-CmJQd-xc.js} +2 -2
- package/dist/{lookup-DqmSkJVj.js → lookup--mgANXmv.js} +1 -1
- package/dist/{lookup-BqEeMRXW.cjs → lookup-BQeZoGI4.cjs} +1 -1
- package/dist/{lookup-BA3bNgf4.js → lookup-pw97bxAu.js} +6 -1
- package/dist/{middleware-BhU7xqzl.cjs → middleware-Bh5EE6vq.cjs} +24 -12
- package/dist/middleware-DATy40bZ.cjs +17 -0
- package/dist/{middleware-DFDGXfT5.js → middleware-DfeWQSw-.js} +24 -12
- package/dist/middleware-V-6KSCRG.js +17 -0
- package/dist/{middleware-8Utrfm2B.js → middleware-_hA7WuDf.js} +20 -13
- package/dist/middleware-qKLKzVpT.js +26 -0
- 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-D2N6v5Gm.js → owner-B7WLWS8V.js} +44 -8
- package/dist/{proof-XCcYDcHk.js → proof-BSHkn7FC.js} +45 -9
- package/dist/{proof-GwNAN3ln.js → proof-BSpRVVLc.js} +2 -2
- package/dist/{proof-CbitzfgJ.cjs → proof-Dkb2_kGH.cjs} +44 -8
- package/dist/runtime/authdocloader.test.js +9 -9
- package/dist/runtime/docloader.test.js +82 -5
- 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-D_f3mgyD.js → send-CKzTk_tF.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-hVeFvsZ9.js → testing-DiHxoGZd.js} +2 -2
- package/dist/{type-CfrcT6D9.js → type-Bjc-_Rom.js} +253 -216
- package/dist/{types-apcavnI7.js → types-B5V7vlb3.js} +1 -1
- package/dist/{types-DvsdrWOg.cjs → types-DWiBkfCv.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-0FCIW9qL.cjs → vocab-BdU947qD.cjs} +8 -3
- package/dist/{vocab-DGzlpjfi.js → vocab-ChCCqvR3.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-CEK-2eTr.cjs +0 -10
- package/dist/middleware-BQ3VcPQj.js +0 -17
- package/dist/middleware-BxBgtIG4.js +0 -26
- package/dist/middleware-UJYNu-kk.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-Cgy1RCqb.cjs');
|
|
8
|
+
const require_actor = require('./actor-CdCyXIiy.cjs');
|
|
9
|
+
const require_lookup = require('./lookup-BQeZoGI4.cjs');
|
|
10
|
+
const require_key = require('./key-CHl3R_Y6.cjs');
|
|
11
|
+
const require_http = require('./http-DBJHuWVd.cjs');
|
|
12
|
+
const require_proof = require('./proof-Dkb2_kGH.cjs');
|
|
13
|
+
const require_types = require('./types-DWiBkfCv.cjs');
|
|
14
|
+
const require_authdocloader = require('./authdocloader-BJPbXGjs.cjs');
|
|
15
|
+
const require_vocab = require('./vocab-BdU947qD.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-DATy40bZ.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
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
|
+
|
|
5
|
+
require('./transformers-CoBS-oFG.cjs');
|
|
6
|
+
require('./docloader-Cgy1RCqb.cjs');
|
|
7
|
+
require('./actor-CdCyXIiy.cjs');
|
|
8
|
+
const require_middleware = require('./middleware-Bh5EE6vq.cjs');
|
|
9
|
+
require('./lookup-BQeZoGI4.cjs');
|
|
10
|
+
require('./key-CHl3R_Y6.cjs');
|
|
11
|
+
require('./http-DBJHuWVd.cjs');
|
|
12
|
+
require('./proof-Dkb2_kGH.cjs');
|
|
13
|
+
require('./types-DWiBkfCv.cjs');
|
|
14
|
+
require('./authdocloader-BJPbXGjs.cjs');
|
|
15
|
+
require('./vocab-BdU947qD.cjs');
|
|
16
|
+
|
|
17
|
+
exports.FederationImpl = require_middleware.FederationImpl;
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
5
|
import { getDefaultActivityTransformers } from "./transformers-BFT6d7J5.js";
|
|
6
|
-
import { deno_default, getDocumentLoader, kvCache } from "./docloader-
|
|
7
|
-
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-
|
|
8
|
-
import { lookupWebFinger } from "./lookup
|
|
9
|
-
import { exportJwk, importJwk, validateCryptoKey } from "./key-
|
|
10
|
-
import { doubleKnock, verifyRequest } from "./http-
|
|
11
|
-
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-
|
|
12
|
-
import { getNodeInfo, nodeInfoToJson } from "./types-
|
|
13
|
-
import { getAuthenticatedDocumentLoader } from "./authdocloader-
|
|
14
|
-
import { lookupObject, traverseCollection } from "./vocab-
|
|
6
|
+
import { deno_default, getDocumentLoader, kvCache } from "./docloader-Crf5jJS0.js";
|
|
7
|
+
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-BrjBSlv8.js";
|
|
8
|
+
import { lookupWebFinger } from "./lookup--mgANXmv.js";
|
|
9
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-1YPBM8c7.js";
|
|
10
|
+
import { doubleKnock, verifyRequest } from "./http-CSJ1EReB.js";
|
|
11
|
+
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-BSHkn7FC.js";
|
|
12
|
+
import { getNodeInfo, nodeInfoToJson } from "./types-B5V7vlb3.js";
|
|
13
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-Y9lwp2q3.js";
|
|
14
|
+
import { lookupObject, traverseCollection } from "./vocab-ChCCqvR3.js";
|
|
15
15
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
16
16
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
17
17
|
import { encodeHex } from "byte-encodings/hex";
|
|
@@ -344,7 +344,7 @@ var FederationBuilderImpl = class {
|
|
|
344
344
|
this.collectionTypeIds = {};
|
|
345
345
|
}
|
|
346
346
|
async build(options) {
|
|
347
|
-
const { FederationImpl: FederationImpl$1 } = await import("./middleware-
|
|
347
|
+
const { FederationImpl: FederationImpl$1 } = await import("./middleware-V-6KSCRG.js");
|
|
348
348
|
const f = new FederationImpl$1(options);
|
|
349
349
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
350
350
|
f.router = this.router.clone();
|
|
@@ -1499,6 +1499,13 @@ async function handleInboxInternal(request, parameters, span) {
|
|
|
1499
1499
|
}
|
|
1500
1500
|
if (activity.id != null) span.setAttribute("activitypub.activity.id", activity.id.href);
|
|
1501
1501
|
span.setAttribute("activitypub.activity.type", getTypeId(activity).href);
|
|
1502
|
+
span.addEvent("activitypub.activity.received", {
|
|
1503
|
+
"activitypub.activity.json": JSON.stringify(json),
|
|
1504
|
+
"activitypub.activity.verified": activity != null,
|
|
1505
|
+
"ld_signatures.verified": ldSigVerified,
|
|
1506
|
+
"http_signatures.verified": httpSigKey != null,
|
|
1507
|
+
"http_signatures.key_id": httpSigKey?.id?.href ?? ""
|
|
1508
|
+
});
|
|
1502
1509
|
if (httpSigKey != null && !await doesActorOwnKey(activity, httpSigKey, ctx)) {
|
|
1503
1510
|
logger$1.error("The signer ({keyId}) and the actor ({actorId}) do not match.", {
|
|
1504
1511
|
activity: json,
|
|
@@ -2272,7 +2279,7 @@ function sendActivity(options) {
|
|
|
2272
2279
|
await sendActivityInternal({
|
|
2273
2280
|
...options,
|
|
2274
2281
|
tracerProvider
|
|
2275
|
-
});
|
|
2282
|
+
}, span);
|
|
2276
2283
|
} catch (e) {
|
|
2277
2284
|
span.setStatus({
|
|
2278
2285
|
code: SpanStatusCode.ERROR,
|
|
@@ -2284,7 +2291,7 @@ function sendActivity(options) {
|
|
|
2284
2291
|
}
|
|
2285
2292
|
});
|
|
2286
2293
|
}
|
|
2287
|
-
async function sendActivityInternal({ activity, activityId, keys, inbox, headers, specDeterminer, tracerProvider }) {
|
|
2294
|
+
async function sendActivityInternal({ activity, activityId, keys, inbox, headers, specDeterminer, tracerProvider }, span) {
|
|
2288
2295
|
const logger$1 = getLogger([
|
|
2289
2296
|
"fedify",
|
|
2290
2297
|
"federation",
|
|
@@ -2339,6 +2346,11 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
|
|
|
2339
2346
|
});
|
|
2340
2347
|
throw new Error(`Failed to send activity ${activityId} to ${inbox.href} (${response.status} ${response.statusText}):\n${error}`);
|
|
2341
2348
|
}
|
|
2349
|
+
span.addEvent("activitypub.activity.sent", {
|
|
2350
|
+
"activitypub.activity.json": JSON.stringify(activity),
|
|
2351
|
+
"activitypub.inbox.url": inbox.href,
|
|
2352
|
+
"activitypub.activity.id": activityId ?? ""
|
|
2353
|
+
});
|
|
2342
2354
|
}
|
|
2343
2355
|
|
|
2344
2356
|
//#endregion
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
|
|
5
|
+
import "./transformers-BFT6d7J5.js";
|
|
6
|
+
import "./docloader-Crf5jJS0.js";
|
|
7
|
+
import "./actor-BrjBSlv8.js";
|
|
8
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-DfeWQSw-.js";
|
|
9
|
+
import "./lookup--mgANXmv.js";
|
|
10
|
+
import "./key-1YPBM8c7.js";
|
|
11
|
+
import "./http-CSJ1EReB.js";
|
|
12
|
+
import "./proof-BSHkn7FC.js";
|
|
13
|
+
import "./types-B5V7vlb3.js";
|
|
14
|
+
import "./authdocloader-Y9lwp2q3.js";
|
|
15
|
+
import "./vocab-ChCCqvR3.js";
|
|
16
|
+
|
|
17
|
+
export { FederationImpl };
|
|
@@ -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-Bjc-_Rom.js";
|
|
7
|
+
import { getNodeInfo } from "./client-DPYh54yM.js";
|
|
8
|
+
import { RouterError, lookupObject, traverseCollection } from "./lookup-pw97bxAu.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-DZXdhUze.js";
|
|
11
|
+
import { verifyRequest } from "./http-BqvHtYhP.js";
|
|
12
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-DWc5tH1y.js";
|
|
13
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-CmJQd-xc.js";
|
|
14
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-B7WLWS8V.js";
|
|
15
|
+
import { signObject, verifyObject } from "./proof-BSpRVVLc.js";
|
|
16
|
+
import { routeActivity } from "./inbox-BuzNfn3x.js";
|
|
17
|
+
import { FederationBuilderImpl } from "./builder-D9HmXe-c.js";
|
|
18
18
|
import { buildCollectionSynchronizationHeader } from "./collection-CSzG2j1P.js";
|
|
19
|
-
import { KvKeyCache } from "./keycache-
|
|
19
|
+
import { KvKeyCache } from "./keycache-CGSAu6vs.js";
|
|
20
20
|
import { createExponentialBackoffPolicy } from "./retry-D4GJ670a.js";
|
|
21
|
-
import { extractInboxes, sendActivity } from "./send-
|
|
21
|
+
import { extractInboxes, sendActivity } from "./send-CKzTk_tF.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,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
globalThis.addEventListener = () => {};
|
|
5
|
+
|
|
6
|
+
import "./type-Bjc-_Rom.js";
|
|
7
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-_hA7WuDf.js";
|
|
8
|
+
import "./semver-dArNLkR9.js";
|
|
9
|
+
import "./client-DPYh54yM.js";
|
|
10
|
+
import "./lookup-pw97bxAu.js";
|
|
11
|
+
import "./types-BIgY6c-l.js";
|
|
12
|
+
import "./actor-CzhWrNYT.js";
|
|
13
|
+
import "./key-DZXdhUze.js";
|
|
14
|
+
import "./http-BqvHtYhP.js";
|
|
15
|
+
import "./authdocloader-DWc5tH1y.js";
|
|
16
|
+
import "./ld-CmJQd-xc.js";
|
|
17
|
+
import "./owner-B7WLWS8V.js";
|
|
18
|
+
import "./proof-BSpRVVLc.js";
|
|
19
|
+
import "./inbox-BuzNfn3x.js";
|
|
20
|
+
import "./builder-D9HmXe-c.js";
|
|
21
|
+
import "./collection-CSzG2j1P.js";
|
|
22
|
+
import "./keycache-CGSAu6vs.js";
|
|
23
|
+
import "./retry-D4GJ670a.js";
|
|
24
|
+
import "./send-CKzTk_tF.js";
|
|
25
|
+
|
|
26
|
+
export { FederationImpl };
|
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-Cgy1RCqb.cjs');
|
|
8
|
+
const require_actor = require('./actor-CdCyXIiy.cjs');
|
|
9
|
+
const require_middleware = require('./middleware-Bh5EE6vq.cjs');
|
|
10
|
+
const require_lookup = require('./lookup-BQeZoGI4.cjs');
|
|
11
|
+
const require_key = require('./key-CHl3R_Y6.cjs');
|
|
12
|
+
const require_http = require('./http-DBJHuWVd.cjs');
|
|
13
|
+
const require_proof = require('./proof-Dkb2_kGH.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-DWiBkfCv.cjs');
|
|
16
|
+
const require_authdocloader = require('./authdocloader-BJPbXGjs.cjs');
|
|
17
|
+
const require_vocab = require('./vocab-BdU947qD.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-Crf5jJS0.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-BrjBSlv8.js";
|
|
9
|
+
import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "./middleware-DfeWQSw-.js";
|
|
10
|
+
import { lookupWebFinger } from "./lookup--mgANXmv.js";
|
|
11
|
+
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk } from "./key-1YPBM8c7.js";
|
|
12
|
+
import { signRequest, verifyRequest } from "./http-CSJ1EReB.js";
|
|
13
|
+
import { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, getKeyOwner, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "./proof-BSHkn7FC.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-B5V7vlb3.js";
|
|
16
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-Y9lwp2q3.js";
|
|
17
|
+
import { PUBLIC_COLLECTION, isFediverseHandle, lookupObject, parseFediverseHandle, toAcctUrl, traverseCollection } from "./vocab-ChCCqvR3.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-Bjc-_Rom.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-DPYh54yM.js";
|
|
12
|
+
import "../lookup-pw97bxAu.js";
|
|
13
|
+
import { test } from "../testing-DiHxoGZd.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-D6gwWBFZ.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-Bjc-_Rom.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-_hA7WuDf.js";
|
|
12
12
|
import { parseSemVer } from "../semver-dArNLkR9.js";
|
|
13
|
-
import "../client-
|
|
14
|
-
import "../lookup-
|
|
13
|
+
import "../client-DPYh54yM.js";
|
|
14
|
+
import "../lookup-pw97bxAu.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-CzhWrNYT.js";
|
|
17
|
+
import "../key-DZXdhUze.js";
|
|
18
|
+
import "../http-BqvHtYhP.js";
|
|
19
|
+
import "../authdocloader-DWc5tH1y.js";
|
|
20
|
+
import "../ld-CmJQd-xc.js";
|
|
21
|
+
import "../owner-B7WLWS8V.js";
|
|
22
|
+
import "../proof-BSpRVVLc.js";
|
|
23
|
+
import "../inbox-BuzNfn3x.js";
|
|
24
|
+
import "../builder-D9HmXe-c.js";
|
|
25
25
|
import "../collection-CSzG2j1P.js";
|
|
26
|
-
import "../keycache-
|
|
26
|
+
import "../keycache-CGSAu6vs.js";
|
|
27
27
|
import "../retry-D4GJ670a.js";
|
|
28
|
-
import "../send-
|
|
29
|
-
import { createRequestContext, test } from "../testing-
|
|
28
|
+
import "../send-CKzTk_tF.js";
|
|
29
|
+
import { createRequestContext, test } from "../testing-DiHxoGZd.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-Cgy1RCqb.cjs');
|
|
6
|
+
const require_types = require('../types-DWiBkfCv.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-Crf5jJS0.js";
|
|
6
|
+
import { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer } from "../types-B5V7vlb3.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-Bjc-_Rom.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-pw97bxAu.js";
|
|
12
|
+
import { test } from "../testing-DiHxoGZd.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-Bjc-_Rom.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-pw97bxAu.js";
|
|
12
12
|
import { nodeInfoToJson } from "../types-BIgY6c-l.js";
|
|
13
|
-
import { test } from "../testing-
|
|
13
|
+
import { test } from "../testing-DiHxoGZd.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-Bjc-_Rom.js";
|
|
7
|
+
import { isActor } from "./actor-CzhWrNYT.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
|