@fedify/fedify 1.6.12 → 1.6.14
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/{actor-tT_B0pDn.d.ts → actor.d.ts} +3 -3
- package/dist/{actor-BxaCJsn8.js → actor.js} +6 -6
- package/dist/{assert-LOEeCUK5.js → assert.js} +2 -2
- package/dist/{assert_equals-B44MxcIj.js → assert_equals.js} +16 -16
- package/dist/{assert_instance_of-XtuFevV_.js → assert_instance_of.js} +2 -2
- package/dist/{assert_is_error-BTlryvT0.js → assert_is_error.js} +2 -2
- package/dist/{assert_not_equals-C685gKx6.js → assert_not_equals.js} +3 -6
- package/dist/{assert_rejects-DWQ4jaf9.js → assert_rejects.js} +3 -3
- package/dist/{assert_throws-YetpVSc-.js → assert_throws.js} +3 -3
- package/dist/{authdocloader-niAJMnCQ.js → authdocloader.js} +8 -8
- package/dist/{builder-DboGa9iv.js → builder.js} +7 -7
- package/dist/{chunk-Cx8LTkjm.js → chunk.js} +22 -15
- package/dist/{client-Cd552pKL.d.ts → client.d.ts} +2 -2
- package/dist/{client-De_5-2EG.js → client.js} +3 -3
- package/dist/{collection-Dfb0TPno.js → collection.js} +2 -3
- package/dist/compat/mod.d.ts +79 -12
- package/dist/compat/mod.js +1 -2
- package/dist/compat/transformers.test.js +34 -38
- package/dist/{context-DRhhOsMk.d.ts → context.d.ts} +10 -10
- package/dist/{context-KOy1fHBn.js → context.js} +5 -5
- package/dist/{docloader-DlUDOVSe.d.ts → docloader.d.ts} +2 -2
- package/dist/{docloader-CPBLJsVK.js → docloader.js} +32 -152
- package/dist/{docloader-09nVWLAZ.js → docloader2.js} +1 -1
- package/dist/{esm-DO9PrujO.js → esm.js} +36 -22
- package/dist/federation/builder.test.js +20 -26
- package/dist/federation/collection.test.js +11 -16
- package/dist/federation/handler.test.js +41 -48
- package/dist/federation/inbox.test.js +11 -11
- package/dist/federation/keycache.test.js +12 -11
- package/dist/federation/kv.test.js +8 -10
- package/dist/federation/middleware.test.js +99 -120
- package/dist/federation/mod.d.ts +4 -13
- package/dist/federation/mod.js +195 -12
- package/dist/federation/mq.test.js +9 -14
- package/dist/federation/retry.test.js +5 -4
- package/dist/federation/router.test.js +9 -10
- package/dist/federation/send.test.js +23 -24
- package/dist/{http-BkUCISGt.d.ts → http.d.ts} +3 -3
- package/dist/{http-B__WhFrv.js → http.js} +19 -27
- package/dist/{inbox-L4MTtAQ4.js → inbox.js} +5 -5
- package/dist/key.js +16 -0
- package/dist/{key-Dlbuqhbr.js → key2.js} +5 -5
- package/dist/{keycache-BEb0DSk7.js → keycache.js} +2 -2
- package/dist/{keys-CqpeF-EG.js → keys.js} +2 -2
- package/dist/{kv-p8sC8PTT.d.ts → kv.d.ts} +1 -1
- package/dist/{kv-DohFOP2C.js → kv.js} +1 -1
- package/dist/{langstr-DbWheeIS.js → langstr.js} +1 -1
- package/dist/{ld-45SsuOmB.js → ld.js} +9 -12
- package/dist/{lookup-vJccIKCS.d.ts → lookup.d.ts} +2 -2
- package/dist/{lookup-HY083HcK.js → lookup.js} +4 -4
- package/dist/{lookup-CWdbkwKD.js → lookup2.js} +6 -6
- package/dist/{middleware-D2HU0DhQ.js → middleware.js} +35 -39
- package/dist/middleware2.js +32 -0
- package/dist/mod.d.ts +17 -17
- package/dist/mod.js +17 -17
- package/dist/{mod-DSPyncxx.d.ts → mod2.d.ts} +3 -3
- package/dist/{mod-j45KmAfR.d.ts → mod3.d.ts} +4 -4
- package/dist/{mq-nceTGCuc.d.ts → mq.d.ts} +1 -1
- package/dist/{multibase-CnLHszip.js → multibase.js} +1 -1
- package/dist/nodeinfo/client.test.js +19 -28
- package/dist/nodeinfo/handler.test.js +37 -44
- package/dist/nodeinfo/mod.d.ts +2 -5
- package/dist/nodeinfo/mod.js +2 -3
- package/dist/nodeinfo/semver.test.js +13 -21
- package/dist/nodeinfo/types.test.js +9 -11
- package/dist/{owner-CbRc94FP.d.ts → owner.d.ts} +4 -4
- package/dist/{owner-BYxqeMiw.js → owner.js} +4 -4
- package/dist/{proof-BjHA4H_1.js → proof.js} +11 -13
- package/dist/{retry-BiIhZWgD.js → retry.js} +1 -1
- package/dist/{router-D_aVZZUc.js → router.js} +1 -1
- package/dist/runtime/authdocloader.test.js +22 -26
- package/dist/runtime/docloader.test.js +50 -46
- package/dist/runtime/key.test.js +31 -53
- package/dist/runtime/langstr.test.js +8 -10
- package/dist/runtime/mod.d.ts +103 -6
- package/dist/runtime/mod.js +6 -7
- package/dist/runtime/multibase/multibase.test.js +12 -18
- package/dist/runtime/url.test.js +7 -6
- package/dist/{semver-BNrOOAs9.js → semver.js} +7 -17
- package/dist/{send-BQA1p7vs.js → send.js} +4 -4
- package/dist/sig/http.test.js +104 -168
- package/dist/sig/key.test.js +17 -20
- package/dist/sig/ld.test.js +28 -35
- package/dist/sig/mod.d.ts +3 -7
- package/dist/sig/mod.js +6 -7
- package/dist/sig/owner.test.js +24 -30
- package/dist/sig/proof.test.js +24 -29
- package/dist/{std__assert-o_r9vqm1.js → std__assert.js} +7 -13
- package/dist/testing/docloader.test.js +9 -12
- package/dist/testing/mod.js +2 -1
- package/dist/{testing-DLyvtiiW.js → testing.js} +2 -2
- package/dist/{transformers-ghwJuzGY.js → transformers.js} +1 -1
- package/dist/{type-CFuiGLz9.js → type.js} +1 -1
- package/dist/{types-CJHS5pXl.js → types.js} +2 -2
- package/dist/{url-C2xuoQD1.js → url.js} +1 -1
- package/dist/vocab/actor.test.js +76 -128
- package/dist/vocab/lookup.test.js +19 -23
- package/dist/vocab/mod.d.ts +3 -5
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +10 -10
- package/dist/vocab/vocab.test.js +90 -109
- package/dist/{vocab-DSFLLLe6.d.ts → vocab.d.ts} +2 -2
- package/dist/{vocab-DVEzP_bQ.js → vocab.js} +318 -454
- package/dist/webfinger/handler.test.js +40 -48
- package/dist/webfinger/lookup.test.js +12 -15
- package/dist/webfinger/mod.d.ts +1 -4
- package/dist/webfinger/mod.js +2 -3
- package/dist/x/cfworkers.d.ts +2 -2
- package/dist/x/cfworkers.test.js +7 -9
- package/dist/x/hono.d.ts +2 -11
- package/dist/x/sveltekit.d.ts +2 -11
- package/package.json +1 -1
- package/dist/actor-7vCpWIGd.js +0 -34925
- package/dist/authdocloader-CVhMTbv4.js +0 -53
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/docloader-RFcxdgI8.js +0 -4590
- package/dist/federation-DyRlaC4X.js +0 -192
- package/dist/http-CnSGudcE.js +0 -789
- package/dist/key-BG_CTepE.js +0 -10
- package/dist/key-BQg3A7eo.js +0 -257
- package/dist/key-CeY-eted.js +0 -16
- package/dist/lookup-CdHTw-tQ.js +0 -127
- package/dist/middleware-BP-XbRGC.js +0 -17
- package/dist/middleware-Cg-eSyqX.js +0 -3501
- package/dist/middleware-JoLpCiMC.js +0 -33
- package/dist/mod-1pDWKvUL.d.ts +0 -2
- package/dist/mod-BTHfUeLo.d.ts +0 -104
- package/dist/mod-CgmTOt4z.d.ts +0 -82
- package/dist/mod-GIh5OYxW.d.ts +0 -2
- package/dist/mod-g0xFzAP9.d.ts +0 -2
- package/dist/nodeinfo-CyEbLjHs.js +0 -4
- package/dist/proof-DVYup76O.js +0 -582
- package/dist/runtime-BSkOVUWM.js +0 -4
- package/dist/sig-BXJO--F9.js +0 -4
- package/dist/types-D7_MRRa4.js +0 -455
- package/dist/vocab-aaGb1Tji.js +0 -168
- package/dist/webfinger-C3GIyXIg.js +0 -4
- /package/dist/{denokv-B_GFWjrl.js → denokv.js} +0 -0
|
@@ -3,30 +3,29 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import "../
|
|
9
|
-
import "../docloader
|
|
10
|
-
import "../url
|
|
11
|
-
import "../multibase
|
|
12
|
-
import {
|
|
13
|
-
import "../langstr
|
|
14
|
-
import "../lookup
|
|
15
|
-
import "../
|
|
16
|
-
import "../
|
|
17
|
-
import "../
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
22
|
-
import "../
|
|
23
|
-
import
|
|
24
|
-
import "../
|
|
25
|
-
import
|
|
26
|
-
import "../
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import { esm_default } from "../esm-DO9PrujO.js";
|
|
6
|
+
import "../chunk.js";
|
|
7
|
+
import { t as assertEquals } from "../assert_equals.js";
|
|
8
|
+
import { t as assert } from "../assert.js";
|
|
9
|
+
import "../docloader.js";
|
|
10
|
+
import "../url.js";
|
|
11
|
+
import "../multibase.js";
|
|
12
|
+
import { S as Person, T as Service, c as Endpoints, r as Application, t as Activity, u as Group } from "../vocab.js";
|
|
13
|
+
import "../langstr.js";
|
|
14
|
+
import "../lookup.js";
|
|
15
|
+
import "../actor.js";
|
|
16
|
+
import "../key2.js";
|
|
17
|
+
import { l as verifyRequest } from "../http.js";
|
|
18
|
+
import { t as doesActorOwnKey } from "../owner.js";
|
|
19
|
+
import { n as sendActivity, t as extractInboxes } from "../send.js";
|
|
20
|
+
import { t as test } from "../testing.js";
|
|
21
|
+
import "../std__assert.js";
|
|
22
|
+
import { n as assertFalse, t as assertRejects } from "../assert_rejects.js";
|
|
23
|
+
import "../assert_is_error.js";
|
|
24
|
+
import { t as assertNotEquals } from "../assert_not_equals.js";
|
|
25
|
+
import "../assert_throws.js";
|
|
26
|
+
import { t as mockDocumentLoader } from "../docloader2.js";
|
|
27
|
+
import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys.js";
|
|
28
|
+
import { t as esm_default } from "../esm.js";
|
|
30
29
|
|
|
31
30
|
//#region federation/send.test.ts
|
|
32
31
|
test("extractInboxes()", () => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { DocumentLoader } from "./docloader
|
|
4
|
-
import {
|
|
3
|
+
import { n as DocumentLoader } from "./docloader.js";
|
|
4
|
+
import { B as Multikey, m as CryptographicKey } from "./vocab.js";
|
|
5
5
|
import { TracerProvider } from "@opentelemetry/api";
|
|
6
6
|
|
|
7
7
|
//#region sig/key.d.ts
|
|
@@ -247,4 +247,4 @@ interface HttpMessageSignaturesSpecDeterminer {
|
|
|
247
247
|
* @since 1.6.0
|
|
248
248
|
*/
|
|
249
249
|
//#endregion
|
|
250
|
-
export {
|
|
250
|
+
export { signRequest as a, FetchKeyResult as c, fetchKey as d, generateCryptoKeyPair as f, VerifyRequestOptions as i, KeyCache as l, HttpMessageSignaturesSpecDeterminer as n, verifyRequest as o, importJwk as p, SignRequestOptions as r, FetchKeyOptions as s, HttpMessageSignaturesSpec as t, exportJwk as u };
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
globalThis.addEventListener = () => {};
|
|
4
5
|
|
|
5
|
-
import {
|
|
6
|
-
import { CryptographicKey } from "./
|
|
7
|
-
import {
|
|
6
|
+
import { d as version, u as name } from "./docloader.js";
|
|
7
|
+
import { o as CryptographicKey } from "./vocab.js";
|
|
8
|
+
import { a as validateCryptoKey, n as fetchKey } from "./key2.js";
|
|
8
9
|
import { getLogger } from "@logtape/logtape";
|
|
9
10
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
11
|
+
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
10
12
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
11
13
|
import { encodeHex } from "byte-encodings/hex";
|
|
12
|
-
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
13
14
|
import { Item, decodeDict, encodeItem } from "structured-field-values";
|
|
14
15
|
|
|
15
16
|
//#region sig/http.ts
|
|
@@ -24,7 +25,7 @@ import { Item, decodeDict, encodeItem } from "structured-field-values";
|
|
|
24
25
|
*/
|
|
25
26
|
async function signRequest(request, privateKey, keyId, options = {}) {
|
|
26
27
|
validateCryptoKey(privateKey, "private");
|
|
27
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
28
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.sign", async (span) => {
|
|
28
29
|
try {
|
|
29
30
|
const spec = options.spec ?? "draft-cavage-http-signatures-12";
|
|
30
31
|
let signed;
|
|
@@ -33,7 +34,7 @@ async function signRequest(request, privateKey, keyId, options = {}) {
|
|
|
33
34
|
if (span.isRecording()) {
|
|
34
35
|
span.setAttribute(ATTR_HTTP_REQUEST_METHOD, signed.method);
|
|
35
36
|
span.setAttribute(ATTR_URL_FULL, signed.url);
|
|
36
|
-
for (const [name, value] of signed.headers) span.setAttribute(ATTR_HTTP_REQUEST_HEADER(name), value);
|
|
37
|
+
for (const [name$1, value] of signed.headers) span.setAttribute(ATTR_HTTP_REQUEST_HEADER(name$1), value);
|
|
37
38
|
span.setAttribute("http_signatures.key_id", keyId.href);
|
|
38
39
|
}
|
|
39
40
|
return signed;
|
|
@@ -61,8 +62,8 @@ async function signRequestDraft(request, privateKey, keyId, span, currentTime) {
|
|
|
61
62
|
}
|
|
62
63
|
if (!headers.has("Date")) headers.set("Date", currentTime == null ? (/* @__PURE__ */ new Date()).toUTCString() : new Date(currentTime.toString()).toUTCString());
|
|
63
64
|
const serialized = [["(request-target)", `${request.method.toLowerCase()} ${url.pathname}`], ...headers];
|
|
64
|
-
const headerNames = serialized.map(([name]) => name);
|
|
65
|
-
const message = serialized.map(([name, value]) => `${name}: ${value.trim()}`).join("\n");
|
|
65
|
+
const headerNames = serialized.map(([name$1]) => name$1);
|
|
66
|
+
const message = serialized.map(([name$1, value]) => `${name$1}: ${value.trim()}`).join("\n");
|
|
66
67
|
const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, new TextEncoder().encode(message));
|
|
67
68
|
const sigHeader = `keyId="${keyId.href}",algorithm="rsa-sha256",headers="${headerNames.join(" ")}",signature="${encodeBase64(signature)}"`;
|
|
68
69
|
headers.set("Signature", sigHeader);
|
|
@@ -119,9 +120,7 @@ function createRfc9421SignatureBase(request, components, parameters) {
|
|
|
119
120
|
* @returns The formatted signature string.
|
|
120
121
|
*/
|
|
121
122
|
function formatRfc9421Signature(signature, components, parameters) {
|
|
122
|
-
|
|
123
|
-
const signatureValue = `sig1=:${encodeBase64(signature)}:`;
|
|
124
|
-
return [signatureInputValue, signatureValue];
|
|
123
|
+
return [`sig1=("${components.join("\" \"")}");${parameters}`, `sig1=:${encodeBase64(signature)}:`];
|
|
125
124
|
}
|
|
126
125
|
/**
|
|
127
126
|
* Parse RFC 9421 Signature-Input header.
|
|
@@ -251,11 +250,11 @@ const supportedHashAlgorithms = {
|
|
|
251
250
|
* could not be verified.
|
|
252
251
|
*/
|
|
253
252
|
async function verifyRequest(request, options = {}) {
|
|
254
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
253
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.verify", async (span) => {
|
|
255
254
|
if (span.isRecording()) {
|
|
256
255
|
span.setAttribute(ATTR_HTTP_REQUEST_METHOD, request.method);
|
|
257
256
|
span.setAttribute(ATTR_URL_FULL, request.url);
|
|
258
|
-
for (const [name, value] of request.headers) span.setAttribute(ATTR_HTTP_REQUEST_HEADER(name), value);
|
|
257
|
+
for (const [name$1, value] of request.headers) span.setAttribute(ATTR_HTTP_REQUEST_HEADER(name$1), value);
|
|
259
258
|
}
|
|
260
259
|
try {
|
|
261
260
|
let spec = options.spec;
|
|
@@ -438,7 +437,7 @@ async function verifyRequestDraft(request, span, { documentLoader, contextLoader
|
|
|
438
437
|
logger.debug("Failed to verify; required headers missing in the Signature header: {headers}.", { headers });
|
|
439
438
|
return null;
|
|
440
439
|
}
|
|
441
|
-
const message = headerNames.map((name) => `${name}: ` + (name === "(request-target)" ? `${request.method.toLowerCase()} ${new URL(request.url).pathname}` : name === "(created)" ? sigValues.created ?? "" : name === "(expires)" ? sigValues.expires ?? "" : name === "host" ? request.headers.get("host") ?? new URL(request.url).host : request.headers.get(name))).join("\n");
|
|
440
|
+
const message = headerNames.map((name$1) => `${name$1}: ` + (name$1 === "(request-target)" ? `${request.method.toLowerCase()} ${new URL(request.url).pathname}` : name$1 === "(created)" ? sigValues.created ?? "" : name$1 === "(expires)" ? sigValues.expires ?? "" : name$1 === "host" ? request.headers.get("host") ?? new URL(request.url).host : request.headers.get(name$1))).join("\n");
|
|
442
441
|
const sig = decodeBase64(signature);
|
|
443
442
|
span?.setAttribute("http_signatures.signature", encodeHex(sig));
|
|
444
443
|
if (!await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, sig, new TextEncoder().encode(message))) {
|
|
@@ -605,8 +604,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
|
|
|
605
604
|
logger.debug("Failed to verify; Content-Digest header required but not found.", { components: sigInput.components });
|
|
606
605
|
continue;
|
|
607
606
|
}
|
|
608
|
-
|
|
609
|
-
if (!await verifyRfc9421ContentDigest(contentDigestHeader, body)) {
|
|
607
|
+
if (!await verifyRfc9421ContentDigest(contentDigestHeader, await request.arrayBuffer())) {
|
|
610
608
|
logger.debug("Failed to verify; Content-Digest verification failed.", { contentDigest: contentDigestHeader });
|
|
611
609
|
continue;
|
|
612
610
|
}
|
|
@@ -726,11 +724,8 @@ async function doubleKnock(request, identity, options = {}) {
|
|
|
726
724
|
});
|
|
727
725
|
log?.(signedRequest);
|
|
728
726
|
let response = await fetch(signedRequest, { redirect: "manual" });
|
|
729
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location"))
|
|
730
|
-
|
|
731
|
-
const body = request.method !== "GET" && request.method !== "HEAD" ? await request.clone().arrayBuffer() : void 0;
|
|
732
|
-
return doubleKnock(createRedirectRequest(request, location, body), identity, options);
|
|
733
|
-
} else if (response.status === 400 || response.status === 401 || response.status > 401) {
|
|
727
|
+
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) return doubleKnock(createRedirectRequest(request, response.headers.get("Location"), request.method !== "GET" && request.method !== "HEAD" ? await request.clone().arrayBuffer() : void 0), identity, options);
|
|
728
|
+
else if (response.status === 400 || response.status === 401 || response.status > 401) {
|
|
734
729
|
const spec = firstTrySpec === "draft-cavage-http-signatures-12" ? "rfc9421" : "draft-cavage-http-signatures-12";
|
|
735
730
|
getLogger([
|
|
736
731
|
"fedify",
|
|
@@ -748,11 +743,8 @@ async function doubleKnock(request, identity, options = {}) {
|
|
|
748
743
|
});
|
|
749
744
|
log?.(signedRequest);
|
|
750
745
|
response = await fetch(signedRequest, { redirect: "manual" });
|
|
751
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location"))
|
|
752
|
-
|
|
753
|
-
const body = request.method !== "GET" && request.method !== "HEAD" ? await request.clone().arrayBuffer() : void 0;
|
|
754
|
-
return doubleKnock(createRedirectRequest(request, location, body), identity, options);
|
|
755
|
-
} else if (response.status !== 400 && response.status !== 401) await specDeterminer?.rememberSpec(origin, spec);
|
|
746
|
+
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) return doubleKnock(createRedirectRequest(request, response.headers.get("Location"), request.method !== "GET" && request.method !== "HEAD" ? await request.clone().arrayBuffer() : void 0), identity, options);
|
|
747
|
+
else if (response.status !== 400 && response.status !== 401) await specDeterminer?.rememberSpec(origin, spec);
|
|
756
748
|
} else await specDeterminer?.rememberSpec(origin, firstTrySpec);
|
|
757
749
|
return response;
|
|
758
750
|
}
|
|
@@ -785,4 +777,4 @@ function timingSafeEqual(a, b) {
|
|
|
785
777
|
}
|
|
786
778
|
|
|
787
779
|
//#endregion
|
|
788
|
-
export { doubleKnock, signRequest,
|
|
780
|
+
export { parseRfc9421Signature as a, timingSafeEqual as c, formatRfc9421SignatureParameters as i, verifyRequest as l, doubleKnock as n, parseRfc9421SignatureInput as o, formatRfc9421Signature as r, signRequest as s, createRfc9421SignatureBase as t };
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { Activity } from "./vocab
|
|
8
|
-
import { getTypeId } from "./type
|
|
6
|
+
import { d as version, u as name } from "./docloader.js";
|
|
7
|
+
import { t as Activity } from "./vocab.js";
|
|
8
|
+
import { t as getTypeId } from "./type.js";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
10
10
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
11
11
|
|
|
@@ -112,7 +112,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
112
112
|
return "enqueued";
|
|
113
113
|
}
|
|
114
114
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
115
|
-
return await tracerProvider.getTracer(
|
|
115
|
+
return await tracerProvider.getTracer(name, version).startActiveSpan("activitypub.dispatch_inbox_listener", { kind: SpanKind.INTERNAL }, async (span$1) => {
|
|
116
116
|
const dispatched = inboxListeners?.dispatchWithClass(activity);
|
|
117
117
|
if (dispatched == null) {
|
|
118
118
|
logger.error("Unsupported activity type:\n{activity}", {
|
|
@@ -166,4 +166,4 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
//#endregion
|
|
169
|
-
export {
|
|
169
|
+
export { routeActivity as n, InboxListenerSet as t };
|
package/dist/key.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
globalThis.addEventListener = () => {};
|
|
5
|
+
|
|
6
|
+
import "./chunk.js";
|
|
7
|
+
import "./docloader.js";
|
|
8
|
+
import "./url.js";
|
|
9
|
+
import "./multibase.js";
|
|
10
|
+
import "./vocab.js";
|
|
11
|
+
import "./langstr.js";
|
|
12
|
+
import "./lookup.js";
|
|
13
|
+
import "./actor.js";
|
|
14
|
+
import { a as validateCryptoKey, i as importJwk, n as fetchKey, r as generateCryptoKeyPair, t as exportJwk } from "./key2.js";
|
|
15
|
+
|
|
16
|
+
export { validateCryptoKey };
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { isActor } from "./actor
|
|
6
|
+
import { d as version, i as getDocumentLoader, u as name } from "./docloader.js";
|
|
7
|
+
import { _ as Object$1, o as CryptographicKey } from "./vocab.js";
|
|
8
|
+
import { i as isActor } from "./actor.js";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
10
10
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
11
11
|
|
|
@@ -102,7 +102,7 @@ async function importJwk(jwk, type) {
|
|
|
102
102
|
* @since 1.3.0
|
|
103
103
|
*/
|
|
104
104
|
function fetchKey(keyId, cls, options = {}) {
|
|
105
|
-
const tracer = (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
105
|
+
const tracer = (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version);
|
|
106
106
|
keyId = typeof keyId === "string" ? new URL(keyId) : keyId;
|
|
107
107
|
return tracer.startActiveSpan("activitypub.fetch_key", {
|
|
108
108
|
kind: SpanKind.CLIENT,
|
|
@@ -256,4 +256,4 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
|
256
256
|
}
|
|
257
257
|
|
|
258
258
|
//#endregion
|
|
259
|
-
export {
|
|
259
|
+
export { validateCryptoKey as a, importJwk as i, fetchKey as n, generateCryptoKeyPair as r, exportJwk as t };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { h as Multikey, o as CryptographicKey } from "./vocab.js";
|
|
7
7
|
|
|
8
8
|
//#region federation/keycache.ts
|
|
9
9
|
var KvKeyCache = class {
|
|
@@ -45,4 +45,4 @@ var KvKeyCache = class {
|
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
//#endregion
|
|
48
|
-
export { KvKeyCache };
|
|
48
|
+
export { KvKeyCache as t };
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { P as importSpki, h as Multikey, o as CryptographicKey } from "./vocab.js";
|
|
7
7
|
|
|
8
8
|
//#region testing/keys.ts
|
|
9
9
|
const rsaPublicKey1 = new CryptographicKey({
|
|
@@ -120,4 +120,4 @@ const ed25519Multikey = new Multikey({
|
|
|
120
120
|
});
|
|
121
121
|
|
|
122
122
|
//#endregion
|
|
123
|
-
export {
|
|
123
|
+
export { rsaPrivateKey3 as a, rsaPublicKey3 as c, rsaPrivateKey2 as i, rsaPublicKey5 as l, ed25519PrivateKey as n, rsaPublicKey1 as o, ed25519PublicKey as r, rsaPublicKey2 as s, ed25519Multikey as t };
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { getTypeId } from "./type
|
|
9
|
-
import {
|
|
6
|
+
import { d as version, i as getDocumentLoader, u as name } from "./docloader.js";
|
|
7
|
+
import { _ as Object$1, o as CryptographicKey, t as Activity } from "./vocab.js";
|
|
8
|
+
import { t as getTypeId } from "./type.js";
|
|
9
|
+
import { a as validateCryptoKey, n as fetchKey } from "./key2.js";
|
|
10
10
|
import { getLogger } from "@logtape/logtape";
|
|
11
11
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
12
12
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
@@ -54,9 +54,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
|
|
|
54
54
|
creator: keyId.href,
|
|
55
55
|
created: created?.toString() ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
56
56
|
};
|
|
57
|
-
const
|
|
58
|
-
const docHash = await hashJsonLd(jsonLd, contextLoader);
|
|
59
|
-
const message = optionsHash + docHash;
|
|
57
|
+
const message = await hashJsonLd(options, contextLoader) + await hashJsonLd(jsonLd, contextLoader);
|
|
60
58
|
const messageBytes = new TextEncoder().encode(message);
|
|
61
59
|
const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, messageBytes);
|
|
62
60
|
return {
|
|
@@ -79,7 +77,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
|
|
|
79
77
|
* @since 1.0.0
|
|
80
78
|
*/
|
|
81
79
|
async function signJsonLd(jsonLd, privateKey, keyId, options) {
|
|
82
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
80
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("ld_signatures.sign", { attributes: { "ld_signatures.key_id": keyId.href } }, async (span) => {
|
|
83
81
|
try {
|
|
84
82
|
const signature = await createSignature(jsonLd, privateKey, keyId, options);
|
|
85
83
|
if (span.isRecording()) {
|
|
@@ -214,7 +212,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
214
212
|
* @returns `true` if the document is authentic; `false` otherwise.
|
|
215
213
|
*/
|
|
216
214
|
async function verifyJsonLd(jsonLd, options = {}) {
|
|
217
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
215
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("ld_signatures.verify", async (span) => {
|
|
218
216
|
try {
|
|
219
217
|
const object = await Object$1.fromJsonLd(jsonLd, options);
|
|
220
218
|
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
@@ -255,9 +253,8 @@ async function hashJsonLd(jsonLd, contextLoader) {
|
|
|
255
253
|
documentLoader: contextLoader ?? getDocumentLoader()
|
|
256
254
|
});
|
|
257
255
|
const encoder = new TextEncoder();
|
|
258
|
-
|
|
259
|
-
return encodeHex(hash);
|
|
256
|
+
return encodeHex(await crypto.subtle.digest("SHA-256", encoder.encode(canon)));
|
|
260
257
|
}
|
|
261
258
|
|
|
262
259
|
//#endregion
|
|
263
|
-
export {
|
|
260
|
+
export { signJsonLd as a, hasSignature as i, createSignature as n, verifyJsonLd as o, detachSignature as r, verifySignature as s, attachSignature as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { GetUserAgentOptions } from "./docloader
|
|
3
|
+
import { s as GetUserAgentOptions } from "./docloader.js";
|
|
4
4
|
import { TracerProvider } from "@opentelemetry/api";
|
|
5
5
|
|
|
6
6
|
//#region webfinger/jrd.d.ts
|
|
@@ -93,4 +93,4 @@ interface LookupWebFingerOptions {
|
|
|
93
93
|
*/
|
|
94
94
|
declare function lookupWebFinger(resource: URL | string, options?: LookupWebFingerOptions): Promise<ResourceDescriptor | null>;
|
|
95
95
|
//#endregion
|
|
96
|
-
export {
|
|
96
|
+
export { ResourceDescriptor as i, lookupWebFinger as n, Link as r, LookupWebFingerOptions as t };
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { d as version, o as getUserAgent, u as name } from "./docloader.js";
|
|
7
|
+
import { a as validatePublicUrl, t as UrlError } from "./url.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
|
|
@@ -23,7 +23,7 @@ const MAX_REDIRECTION = 5;
|
|
|
23
23
|
* @since 0.2.0
|
|
24
24
|
*/
|
|
25
25
|
async function lookupWebFinger(resource, options = {}) {
|
|
26
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
26
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("webfinger.lookup", {
|
|
27
27
|
kind: SpanKind.CLIENT,
|
|
28
28
|
attributes: {
|
|
29
29
|
"webfinger.resource": resource.toString(),
|
|
@@ -126,4 +126,4 @@ async function lookupWebFingerInternal(resource, options = {}) {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
//#endregion
|
|
129
|
-
export { lookupWebFinger };
|
|
129
|
+
export { lookupWebFinger as t };
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { lookupWebFinger } from "./lookup
|
|
9
|
-
import { getTypeId } from "./type
|
|
6
|
+
import { d as version, i as getDocumentLoader, u as name } from "./docloader.js";
|
|
7
|
+
import { _ as Object$1 } from "./vocab.js";
|
|
8
|
+
import { t as lookupWebFinger } from "./lookup.js";
|
|
9
|
+
import { t as getTypeId } from "./type.js";
|
|
10
10
|
import { getLogger } from "@logtape/logtape";
|
|
11
11
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
12
12
|
import { delay } from "@es-toolkit/es-toolkit";
|
|
@@ -51,7 +51,7 @@ const handleRegexp = /^@?((?:[-A-Za-z0-9._~!$&'()*+,;=]|%[A-Fa-f0-9]{2})+)@([^@]
|
|
|
51
51
|
* @since 0.2.0
|
|
52
52
|
*/
|
|
53
53
|
async function lookupObject(identifier, options = {}) {
|
|
54
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
54
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("activitypub.lookup_object", async (span) => {
|
|
55
55
|
try {
|
|
56
56
|
const result = await lookupObjectInternal(identifier, options);
|
|
57
57
|
if (result == null) span.setStatus({ code: SpanStatusCode.ERROR });
|
|
@@ -155,4 +155,4 @@ async function* traverseCollection(collection, options = {}) {
|
|
|
155
155
|
}
|
|
156
156
|
|
|
157
157
|
//#endregion
|
|
158
|
-
export {
|
|
158
|
+
export { traverseCollection as n, lookupObject as t };
|
|
@@ -3,26 +3,26 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { getNodeInfo } from "./client
|
|
8
|
-
import { RouterError } from "./router
|
|
9
|
-
import { nodeInfoToJson } from "./types
|
|
10
|
-
import {
|
|
11
|
-
import { lookupWebFinger } from "./lookup
|
|
12
|
-
import { getTypeId } from "./type
|
|
13
|
-
import {
|
|
14
|
-
import { verifyRequest } from "./http
|
|
15
|
-
import { getAuthenticatedDocumentLoader } from "./authdocloader
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { signObject, verifyObject } from "./proof
|
|
19
|
-
import {
|
|
20
|
-
import { routeActivity } from "./inbox
|
|
21
|
-
import { FederationBuilderImpl } from "./builder
|
|
22
|
-
import { buildCollectionSynchronizationHeader } from "./collection
|
|
23
|
-
import { KvKeyCache } from "./keycache
|
|
24
|
-
import { createExponentialBackoffPolicy } from "./retry
|
|
25
|
-
import {
|
|
6
|
+
import { d as version, i as getDocumentLoader, s as kvCache, u as name } from "./docloader.js";
|
|
7
|
+
import { t as getNodeInfo } from "./client.js";
|
|
8
|
+
import { n as RouterError } from "./router.js";
|
|
9
|
+
import { t as nodeInfoToJson } from "./types.js";
|
|
10
|
+
import { _ as Object$1, b as OrderedCollectionPage, h as Multikey, m as Link, o as CryptographicKey, t as Activity, y as OrderedCollection } from "./vocab.js";
|
|
11
|
+
import { t as lookupWebFinger } from "./lookup.js";
|
|
12
|
+
import { t as getTypeId } from "./type.js";
|
|
13
|
+
import { a as validateCryptoKey, i as importJwk, t as exportJwk } from "./key2.js";
|
|
14
|
+
import { l as verifyRequest } from "./http.js";
|
|
15
|
+
import { t as getAuthenticatedDocumentLoader } from "./authdocloader.js";
|
|
16
|
+
import { a as signJsonLd, i as hasSignature, o as verifyJsonLd, r as detachSignature } from "./ld.js";
|
|
17
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner.js";
|
|
18
|
+
import { n as signObject, r as verifyObject } from "./proof.js";
|
|
19
|
+
import { n as traverseCollection, t as lookupObject } from "./lookup2.js";
|
|
20
|
+
import { n as routeActivity } from "./inbox.js";
|
|
21
|
+
import { t as FederationBuilderImpl } from "./builder.js";
|
|
22
|
+
import { t as buildCollectionSynchronizationHeader } from "./collection.js";
|
|
23
|
+
import { t as KvKeyCache } from "./keycache.js";
|
|
24
|
+
import { t as createExponentialBackoffPolicy } from "./retry.js";
|
|
25
|
+
import { n as sendActivity, t as extractInboxes } from "./send.js";
|
|
26
26
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
27
27
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
28
28
|
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";
|
|
@@ -129,8 +129,7 @@ function getDefaultActivityTransformers() {
|
|
|
129
129
|
*/
|
|
130
130
|
async function handleNodeInfo(_request, { context: context$1, nodeInfoDispatcher }) {
|
|
131
131
|
const promise = nodeInfoDispatcher(context$1);
|
|
132
|
-
const
|
|
133
|
-
const json = nodeInfoToJson(nodeInfo);
|
|
132
|
+
const json = nodeInfoToJson(promise instanceof Promise ? await promise : promise);
|
|
134
133
|
return new Response(JSON.stringify(json), { headers: { "Content-Type": "application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.1#\"" } });
|
|
135
134
|
}
|
|
136
135
|
/**
|
|
@@ -439,10 +438,10 @@ async function handleObject(request, { values, context: context$1, objectDispatc
|
|
|
439
438
|
Vary: "Accept"
|
|
440
439
|
} });
|
|
441
440
|
}
|
|
442
|
-
async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context: context$1, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound, onNotAcceptable }) {
|
|
443
|
-
const spanName = name.trim().replace(/\s+/g, "_");
|
|
441
|
+
async function handleCollection(request, { name: name$1, identifier, uriGetter, filter, filterPredicate, context: context$1, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound, onNotAcceptable }) {
|
|
442
|
+
const spanName = name$1.trim().replace(/\s+/g, "_");
|
|
444
443
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
445
|
-
const tracer = tracerProvider.getTracer(
|
|
444
|
+
const tracer = tracerProvider.getTracer(name, version);
|
|
446
445
|
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
447
446
|
if (collectionCallbacks == null) return await onNotFound(request);
|
|
448
447
|
let collection;
|
|
@@ -482,7 +481,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
482
481
|
collection = new OrderedCollection({
|
|
483
482
|
id: baseUri,
|
|
484
483
|
totalItems: totalItems == null ? null : Number(totalItems),
|
|
485
|
-
items: filterCollectionItems(itemsOrResponse, name, filterPredicate)
|
|
484
|
+
items: filterCollectionItems(itemsOrResponse, name$1, filterPredicate)
|
|
486
485
|
});
|
|
487
486
|
} else {
|
|
488
487
|
const lastCursor = await collectionCallbacks.lastCursor?.(context$1, identifier);
|
|
@@ -503,7 +502,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
503
502
|
} else {
|
|
504
503
|
const uri = new URL(baseUri);
|
|
505
504
|
uri.searchParams.set("cursor", cursor);
|
|
506
|
-
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name}`, {
|
|
505
|
+
const pageOrResponse = await tracer.startActiveSpan(`activitypub.dispatch_collection_page ${name$1}`, {
|
|
507
506
|
kind: SpanKind.SERVER,
|
|
508
507
|
attributes: {
|
|
509
508
|
"activitypub.collection.id": uri.href,
|
|
@@ -547,7 +546,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
547
546
|
id: uri,
|
|
548
547
|
prev,
|
|
549
548
|
next,
|
|
550
|
-
items: filterCollectionItems(items, name, filterPredicate),
|
|
549
|
+
items: filterCollectionItems(items, name$1, filterPredicate),
|
|
551
550
|
partOf
|
|
552
551
|
});
|
|
553
552
|
}
|
|
@@ -603,7 +602,7 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
|
603
602
|
return result;
|
|
604
603
|
}
|
|
605
604
|
async function handleInbox(request, options) {
|
|
606
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
605
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("activitypub.inbox", {
|
|
607
606
|
kind: options.queue == null ? SpanKind.SERVER : SpanKind.PRODUCER,
|
|
608
607
|
attributes: { "activitypub.shared_inbox": options.recipient == null }
|
|
609
608
|
}, async (span) => {
|
|
@@ -1004,7 +1003,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1004
1003
|
this.router.add("/.well-known/nodeinfo", "nodeInfoJrd");
|
|
1005
1004
|
}
|
|
1006
1005
|
_getTracer() {
|
|
1007
|
-
return this.tracerProvider.getTracer(
|
|
1006
|
+
return this.tracerProvider.getTracer(name, version);
|
|
1008
1007
|
}
|
|
1009
1008
|
async _startQueueInternal(ctxData, signal, queue) {
|
|
1010
1009
|
if (this.inboxQueue == null && this.outboxQueue == null) return;
|
|
@@ -1474,8 +1473,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1474
1473
|
}
|
|
1475
1474
|
}
|
|
1476
1475
|
fetch(request, options) {
|
|
1477
|
-
|
|
1478
|
-
return withContext({ requestId }, async () => {
|
|
1476
|
+
return withContext({ requestId: getRequestId(request) }, async () => {
|
|
1479
1477
|
const tracer = this._getTracer();
|
|
1480
1478
|
return await tracer.startActiveSpan(request.method, {
|
|
1481
1479
|
kind: SpanKind.SERVER,
|
|
@@ -2077,7 +2075,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2077
2075
|
});
|
|
2078
2076
|
}
|
|
2079
2077
|
sendActivity(sender, recipients, activity, options = {}) {
|
|
2080
|
-
return this.tracerProvider.getTracer(
|
|
2078
|
+
return this.tracerProvider.getTracer(name, version).startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
|
2081
2079
|
kind: this.federation.outboxQueue == null || options.immediate ? SpanKind.CLIENT : SpanKind.PRODUCER,
|
|
2082
2080
|
attributes: {
|
|
2083
2081
|
"activitypub.activity.type": getTypeId(activity).href,
|
|
@@ -2222,7 +2220,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2222
2220
|
}
|
|
2223
2221
|
}
|
|
2224
2222
|
routeActivity(recipient, activity, options = {}) {
|
|
2225
|
-
return (this.tracerProvider ?? this.tracerProvider).getTracer(
|
|
2223
|
+
return (this.tracerProvider ?? this.tracerProvider).getTracer(name, version).startActiveSpan("activitypub.inbox", {
|
|
2226
2224
|
kind: this.federation.inboxQueue == null || options.immediate ? SpanKind.INTERNAL : SpanKind.PRODUCER,
|
|
2227
2225
|
attributes: { "activitypub.activity.type": getTypeId(activity).href }
|
|
2228
2226
|
}, async (span) => {
|
|
@@ -2437,7 +2435,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
2437
2435
|
});
|
|
2438
2436
|
}
|
|
2439
2437
|
forwardActivity(forwarder, recipients, options) {
|
|
2440
|
-
return this.tracerProvider.getTracer(
|
|
2438
|
+
return this.tracerProvider.getTracer(name, version).startActiveSpan("activitypub.outbox", {
|
|
2441
2439
|
kind: this.federation.outboxQueue == null || options?.immediate ? SpanKind.CLIENT : SpanKind.PRODUCER,
|
|
2442
2440
|
attributes: { "activitypub.activity.type": this.activityType }
|
|
2443
2441
|
}, async (span) => {
|
|
@@ -2633,10 +2631,8 @@ function unauthorized(_request) {
|
|
|
2633
2631
|
function getRequestId(request) {
|
|
2634
2632
|
const traceId = request.headers.get("X-Request-Id") || request.headers.get("X-Correlation-Id") || request.headers.get("Traceparent")?.split("-")[1];
|
|
2635
2633
|
if (traceId != null) return traceId;
|
|
2636
|
-
|
|
2637
|
-
const random = Math.random().toString(36).slice(2, 8);
|
|
2638
|
-
return `req_${timestamp}${random}`;
|
|
2634
|
+
return `req_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
2639
2635
|
}
|
|
2640
2636
|
|
|
2641
2637
|
//#endregion
|
|
2642
|
-
export {
|
|
2638
|
+
export { autoIdAssigner as _, createFederation as a, handleCollection as c, respondWithObject as d, respondWithObjectIfAcceptable as f, actorDehydrator as g, handleNodeInfoJrd as h, KvSpecDeterminer as i, handleInbox as l, handleNodeInfo as m, FederationImpl as n, acceptsJsonLd as o, handleWebFinger as p, InboxContextImpl as r, handleActor as s, ContextImpl as t, handleObject as u };
|