@fedify/fedify 1.7.10 → 1.7.12
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-m_MgQ1Da.js → actor-GZRoTRqg.js} +1059 -2276
- package/dist/{actor-C9RnX-Fl.js → actor-TYqJGdVq.js} +6 -9
- package/dist/{assert-DmFG7ppO.js → assert-LOEeCUK5.js} +1 -1
- package/dist/{assert_equals-CTYbeopb.js → assert_equals-B44MxcIj.js} +2 -4
- package/dist/{assert_instance_of-CF09JHYM.js → assert_instance_of-XtuFevV_.js} +1 -1
- package/dist/{assert_is_error-nrwA1GeT.js → assert_is_error-BTlryvT0.js} +1 -1
- package/dist/{assert_not_equals-Dc7y-V5Q.js → assert_not_equals-C685gKx6.js} +1 -1
- package/dist/{assert_rejects-C-sxEMM5.js → assert_rejects-DWQ4jaf9.js} +2 -2
- package/dist/{assert_throws-Cn9C6Jur.js → assert_throws-YetpVSc-.js} +2 -2
- package/dist/{authdocloader-cdK4XSRT.js → authdocloader-BopfyipD.js} +3 -3
- package/dist/{authdocloader-7OXAs5XI.js → authdocloader-hiFSyM7V.js} +4 -4
- package/dist/{builder-C7nJE1zO.js → builder-mi6RdzNE.js} +7 -10
- package/dist/{chunk-HsBuZ-b2.js → chunk-Cx8LTkjm.js} +3 -1
- package/dist/{client-DXIsEekV.js → client-DuUKk4pk.js} +6 -6
- package/dist/compat/transformers.test.js +27 -28
- package/dist/{context-Bts52fbz.js → context-RMU32mk4.js} +2 -2
- package/dist/{docloader-BK2Fp3AJ.js → docloader-DJxET2fN.js} +5 -9
- package/dist/{docloader-CgkbWVNz.js → docloader-bgBm1Hd1.js} +4 -6
- package/dist/{esm-Db4De7AS.js → esm-DO9PrujO.js} +23 -34
- package/dist/federation/builder.test.js +23 -29
- package/dist/federation/collection.test.js +9 -9
- package/dist/federation/handler.test.js +33 -33
- package/dist/federation/inbox.test.js +10 -10
- package/dist/federation/keycache.test.js +9 -9
- package/dist/federation/kv.test.js +10 -9
- package/dist/federation/middleware.test.js +76 -99
- package/dist/federation/mod.js +11 -11
- package/dist/federation/mq.test.js +10 -11
- package/dist/federation/retry.test.js +3 -3
- package/dist/federation/router.test.js +9 -9
- package/dist/federation/send.test.js +22 -22
- package/dist/{federation-BRIQn-GV.js → federation-B0aljx0V.js} +1 -2
- package/dist/fixtures/oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd.json +24 -0
- package/dist/{http-D1IBucdD.js → http-D2DkwsjA.js} +56 -17
- package/dist/{http-CwQqD0nE.js → http-vqMAvOVs.js} +56 -17
- package/dist/{inbox-BrMkm2b5.js → inbox-DAAZZl2k.js} +5 -7
- package/dist/key-5ssHQ67E.js +16 -0
- package/dist/{key-Do-Pud3s.js → key-DSJGnD10.js} +4 -4
- package/dist/{key-C6phFgFq.js → key-DmqJj57e.js} +5 -8
- package/dist/{key-DtQ4rLnr.js → key-KVhaUM92.js} +6 -9
- package/dist/{keycache-B_99o7Nj.js → keycache-C1pEuRyQ.js} +2 -2
- package/dist/{keys-BgLpfFXK.js → keys-C4XQHW5_.js} +1 -1
- package/dist/{ld-AzOj4-js.js → ld-DzlJ_IpT.js} +9 -16
- package/dist/{lookup-DJgGrigh.js → lookup-CSngxuWm.js} +2 -4
- package/dist/{lookup-CBbanOdu.js → lookup-D0je8AqR.js} +7 -11
- package/dist/{lookup-ChtUDlB-.js → lookup-DL62q3Xh.js} +3 -5
- package/dist/{middleware-BS_et69x.js → middleware-3wVT6S9E.js} +34 -52
- package/dist/middleware-CxFoFBD8.js +33 -0
- package/dist/{middleware-R0UobiAQ.js → middleware-DlDXugwZ.js} +34 -58
- package/dist/middleware-w7_U3fFi.js +17 -0
- package/dist/mod.js +11 -11
- package/dist/{multibase-DeCHcK8L.js → multibase-CnLHszip.js} +1 -2
- package/dist/nodeinfo/client.test.js +20 -23
- package/dist/nodeinfo/handler.test.js +32 -32
- package/dist/nodeinfo/mod.js +2 -2
- package/dist/nodeinfo/semver.test.js +23 -30
- package/dist/nodeinfo/types.test.js +11 -11
- package/dist/{owner-Ces3Cs3s.js → owner-81ey_76X.js} +3 -3
- package/dist/{proof-BOQF8Trx.js → proof-BlULDH4H.js} +8 -14
- package/dist/{proof-BKV4HiE8.js → proof-DlI7QNdn.js} +12 -25
- package/dist/runtime/authdocloader.test.js +21 -21
- package/dist/runtime/docloader.test.js +16 -18
- package/dist/runtime/key.test.js +17 -17
- package/dist/runtime/langstr.test.js +9 -9
- package/dist/runtime/mod.js +6 -6
- package/dist/runtime/multibase/multibase.test.js +11 -12
- package/dist/runtime/url.test.js +6 -6
- package/dist/{semver-DWClQt_5.js → semver-BNrOOAs9.js} +1 -3
- package/dist/{send-aAmnTqe8.js → send-DdxfTHo6.js} +3 -4
- package/dist/sig/http.test.js +56 -54
- package/dist/sig/key.test.js +18 -18
- package/dist/sig/ld.test.js +20 -22
- package/dist/sig/mod.js +6 -6
- package/dist/sig/owner.test.js +20 -20
- package/dist/sig/proof.test.js +19 -19
- package/dist/{std__assert-vp0TKMS1.js → std__assert-o_r9vqm1.js} +1 -1
- package/dist/testing/docloader.test.js +9 -9
- package/dist/testing/mod.js +1 -1
- package/dist/{testing-BZ0dJ4qn.js → testing-DLyvtiiW.js} +3 -5
- package/dist/{type-D2s5lmbZ.js → type-CFuiGLz9.js} +1 -2
- package/dist/{types-C7C_l-jz.js → types-CJHS5pXl.js} +1 -1
- package/dist/{types-DBIKpLqH.js → types-CmVV9LT1.js} +6 -8
- package/dist/{url-kTAI6_KP.js → url-C2xuoQD1.js} +2 -4
- package/dist/vocab/actor.test.js +104 -156
- package/dist/vocab/lookup.test.js +17 -17
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +11 -15
- package/dist/vocab/vocab.test.js +45 -49
- package/dist/{vocab-F6vbRsQh.js → vocab-BebR0kAy.js} +6 -10
- package/dist/{vocab-BOerhowX.js → vocab-DFlq4Wa6.js} +1057 -2270
- package/dist/webfinger/handler.test.js +33 -34
- package/dist/webfinger/lookup.test.js +13 -13
- package/dist/webfinger/mod.js +2 -2
- package/dist/x/cfworkers.test.js +9 -9
- package/package.json +1 -1
- package/dist/key-ZtjFeVO8.js +0 -16
- package/dist/middleware-BVMzYv1x.js +0 -33
- package/dist/middleware-CnpuCK_K.js +0 -17
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { deno_default, getDocumentLoader } from "./docloader-
|
|
7
|
-
import { Activity, CryptographicKey, Object as Object$1 } from "./vocab-
|
|
8
|
-
import { getTypeId } from "./type-
|
|
9
|
-
import { fetchKey, validateCryptoKey } from "./key-
|
|
6
|
+
import { deno_default, getDocumentLoader } from "./docloader-bgBm1Hd1.js";
|
|
7
|
+
import { Activity, CryptographicKey, Object as Object$1 } from "./vocab-DFlq4Wa6.js";
|
|
8
|
+
import { getTypeId } from "./type-CFuiGLz9.js";
|
|
9
|
+
import { fetchKey, validateCryptoKey } from "./key-KVhaUM92.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";
|
|
@@ -57,8 +57,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
|
|
|
57
57
|
const optionsHash = await hashJsonLd(options, contextLoader);
|
|
58
58
|
const docHash = await hashJsonLd(jsonLd, contextLoader);
|
|
59
59
|
const message = optionsHash + docHash;
|
|
60
|
-
const
|
|
61
|
-
const messageBytes = encoder.encode(message);
|
|
60
|
+
const messageBytes = new TextEncoder().encode(message);
|
|
62
61
|
const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, messageBytes);
|
|
63
62
|
return {
|
|
64
63
|
...options,
|
|
@@ -80,9 +79,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
|
|
|
80
79
|
* @since 1.0.0
|
|
81
80
|
*/
|
|
82
81
|
async function signJsonLd(jsonLd, privateKey, keyId, options) {
|
|
83
|
-
|
|
84
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
85
|
-
return await tracer.startActiveSpan("ld_signatures.sign", { attributes: { "ld_signatures.key_id": keyId.href } }, async (span) => {
|
|
82
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("ld_signatures.sign", { attributes: { "ld_signatures.key_id": keyId.href } }, async (span) => {
|
|
86
83
|
try {
|
|
87
84
|
const signature = await createSignature(jsonLd, privateKey, keyId, options);
|
|
88
85
|
if (span.isRecording()) {
|
|
@@ -184,8 +181,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
184
181
|
const encoder = new TextEncoder();
|
|
185
182
|
const message = sigOptsHash + docHash;
|
|
186
183
|
const messageBytes = encoder.encode(message);
|
|
187
|
-
|
|
188
|
-
if (verified) return key;
|
|
184
|
+
if (await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, signature.slice(), messageBytes)) return key;
|
|
189
185
|
if (cached) {
|
|
190
186
|
logger.debug("Failed to verify with the cached key {keyId}; signature {signatureValue} is invalid. Retrying with the freshly fetched key...", {
|
|
191
187
|
keyId: sig.creator,
|
|
@@ -199,8 +195,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
199
195
|
}
|
|
200
196
|
});
|
|
201
197
|
if (key$1 == null) return null;
|
|
202
|
-
|
|
203
|
-
return verified$1 ? key$1 : null;
|
|
198
|
+
return await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key$1.publicKey, signature.slice(), messageBytes) ? key$1 : null;
|
|
204
199
|
}
|
|
205
200
|
logger.debug("Failed to verify with the fetched key {keyId}; signature {signatureValue} is invalid. Check if the key is correct or if the signed message is correct. The message to sign is:\n{message}", {
|
|
206
201
|
keyId: sig.creator,
|
|
@@ -219,9 +214,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
219
214
|
* @returns `true` if the document is authentic; `false` otherwise.
|
|
220
215
|
*/
|
|
221
216
|
async function verifyJsonLd(jsonLd, options = {}) {
|
|
222
|
-
|
|
223
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
224
|
-
return await tracer.startActiveSpan("ld_signatures.verify", async (span) => {
|
|
217
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("ld_signatures.verify", async (span) => {
|
|
225
218
|
try {
|
|
226
219
|
const object = await Object$1.fromJsonLd(jsonLd, options);
|
|
227
220
|
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import { UrlError, deno_default, getUserAgent, validatePublicUrl } from "./docloader-
|
|
5
|
+
import { UrlError, deno_default, getUserAgent, validatePublicUrl } from "./docloader-DJxET2fN.js";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
|
|
@@ -21,9 +21,7 @@ const MAX_REDIRECTION = 5;
|
|
|
21
21
|
* @since 0.2.0
|
|
22
22
|
*/
|
|
23
23
|
async function lookupWebFinger(resource, options = {}) {
|
|
24
|
-
|
|
25
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
26
|
-
return await tracer.startActiveSpan("webfinger.lookup", {
|
|
24
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("webfinger.lookup", {
|
|
27
25
|
kind: SpanKind.CLIENT,
|
|
28
26
|
attributes: {
|
|
29
27
|
"webfinger.resource": resource.toString(),
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { deno_default, getDocumentLoader } from "./docloader-
|
|
7
|
-
import { Object as Object$1 } from "./vocab-
|
|
8
|
-
import { lookupWebFinger } from "./lookup-
|
|
9
|
-
import { getTypeId } from "./type-
|
|
6
|
+
import { deno_default, getDocumentLoader } from "./docloader-bgBm1Hd1.js";
|
|
7
|
+
import { Object as Object$1 } from "./vocab-DFlq4Wa6.js";
|
|
8
|
+
import { lookupWebFinger } from "./lookup-DL62q3Xh.js";
|
|
9
|
+
import { getTypeId } from "./type-CFuiGLz9.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,9 +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
|
-
|
|
55
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
56
|
-
return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => {
|
|
54
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.lookup_object", async (span) => {
|
|
57
55
|
try {
|
|
58
56
|
const result = await lookupObjectInternal(identifier, options);
|
|
59
57
|
if (result == null) span.setStatus({ code: SpanStatusCode.ERROR });
|
|
@@ -83,8 +81,7 @@ async function lookupObjectInternal(identifier, options = {}) {
|
|
|
83
81
|
}
|
|
84
82
|
let document = null;
|
|
85
83
|
if (identifier.protocol === "http:" || identifier.protocol === "https:") try {
|
|
86
|
-
|
|
87
|
-
document = remoteDoc.document;
|
|
84
|
+
document = (await documentLoader(identifier.href)).document;
|
|
88
85
|
} catch (error) {
|
|
89
86
|
logger.debug("Failed to fetch remote document:\n{error}", { error });
|
|
90
87
|
}
|
|
@@ -98,8 +95,7 @@ async function lookupObjectInternal(identifier, options = {}) {
|
|
|
98
95
|
for (const l of jrd.links) {
|
|
99
96
|
if (l.type !== "application/activity+json" && !l.type?.match(/application\/ld\+json;\s*profile="https:\/\/www.w3.org\/ns\/activitystreams"/) || l.rel !== "self") continue;
|
|
100
97
|
try {
|
|
101
|
-
|
|
102
|
-
document = remoteDoc.document;
|
|
98
|
+
document = (await documentLoader(l.href)).document;
|
|
103
99
|
break;
|
|
104
100
|
} catch (error) {
|
|
105
101
|
logger.debug("Failed to fetch remote document:\n{error}", { error });
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { deno_default, getUserAgent } from "./docloader-
|
|
7
|
-
import { UrlError, validatePublicUrl } from "./url-
|
|
6
|
+
import { deno_default, getUserAgent } from "./docloader-bgBm1Hd1.js";
|
|
7
|
+
import { UrlError, validatePublicUrl } from "./url-C2xuoQD1.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
|
|
@@ -23,9 +23,7 @@ const MAX_REDIRECTION = 5;
|
|
|
23
23
|
* @since 0.2.0
|
|
24
24
|
*/
|
|
25
25
|
async function lookupWebFinger(resource, options = {}) {
|
|
26
|
-
|
|
27
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
28
|
-
return await tracer.startActiveSpan("webfinger.lookup", {
|
|
26
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("webfinger.lookup", {
|
|
29
27
|
kind: SpanKind.CLIENT,
|
|
30
28
|
attributes: {
|
|
31
29
|
"webfinger.resource": resource.toString(),
|
|
@@ -3,26 +3,26 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { deno_default, getDocumentLoader, kvCache } from "./docloader-
|
|
7
|
-
import { getNodeInfo } from "./client-
|
|
6
|
+
import { deno_default, getDocumentLoader, kvCache } from "./docloader-bgBm1Hd1.js";
|
|
7
|
+
import { getNodeInfo } from "./client-DuUKk4pk.js";
|
|
8
8
|
import { RouterError } from "./router-D_aVZZUc.js";
|
|
9
|
-
import { nodeInfoToJson } from "./types-
|
|
10
|
-
import { Activity, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage } from "./vocab-
|
|
11
|
-
import { lookupWebFinger } from "./lookup-
|
|
12
|
-
import { getTypeId } from "./type-
|
|
13
|
-
import { exportJwk, importJwk, validateCryptoKey } from "./key-
|
|
14
|
-
import { verifyRequest } from "./http-
|
|
15
|
-
import { getAuthenticatedDocumentLoader } from "./authdocloader-
|
|
16
|
-
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-
|
|
17
|
-
import { doesActorOwnKey, getKeyOwner } from "./owner-
|
|
18
|
-
import { signObject, verifyObject } from "./proof-
|
|
19
|
-
import { lookupObject, traverseCollection } from "./lookup-
|
|
20
|
-
import { routeActivity } from "./inbox-
|
|
21
|
-
import { FederationBuilderImpl } from "./builder-
|
|
9
|
+
import { nodeInfoToJson } from "./types-CJHS5pXl.js";
|
|
10
|
+
import { Activity, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage } from "./vocab-DFlq4Wa6.js";
|
|
11
|
+
import { lookupWebFinger } from "./lookup-DL62q3Xh.js";
|
|
12
|
+
import { getTypeId } from "./type-CFuiGLz9.js";
|
|
13
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-KVhaUM92.js";
|
|
14
|
+
import { verifyRequest } from "./http-D2DkwsjA.js";
|
|
15
|
+
import { getAuthenticatedDocumentLoader } from "./authdocloader-hiFSyM7V.js";
|
|
16
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-DzlJ_IpT.js";
|
|
17
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-81ey_76X.js";
|
|
18
|
+
import { signObject, verifyObject } from "./proof-BlULDH4H.js";
|
|
19
|
+
import { lookupObject, traverseCollection } from "./lookup-D0je8AqR.js";
|
|
20
|
+
import { routeActivity } from "./inbox-DAAZZl2k.js";
|
|
21
|
+
import { FederationBuilderImpl } from "./builder-mi6RdzNE.js";
|
|
22
22
|
import { buildCollectionSynchronizationHeader } from "./collection-Dfb0TPno.js";
|
|
23
|
-
import { KvKeyCache } from "./keycache-
|
|
23
|
+
import { KvKeyCache } from "./keycache-C1pEuRyQ.js";
|
|
24
24
|
import { createExponentialBackoffPolicy } from "./retry-BiIhZWgD.js";
|
|
25
|
-
import { extractInboxes, sendActivity } from "./send-
|
|
25
|
+
import { extractInboxes, sendActivity } from "./send-DdxfTHo6.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";
|
|
@@ -352,8 +352,7 @@ function getFullType(spec) {
|
|
|
352
352
|
return `${spec.type}/${spec.subtype}`;
|
|
353
353
|
}
|
|
354
354
|
function preferredMediaTypes(accept) {
|
|
355
|
-
|
|
356
|
-
return accepts.filter(isQuality).sort(compareSpecs).map(getFullType);
|
|
355
|
+
return parseAccept(accept === void 0 ? "*/*" : accept ?? "").filter(isQuality).sort(compareSpecs).map(getFullType);
|
|
357
356
|
}
|
|
358
357
|
|
|
359
358
|
//#endregion
|
|
@@ -444,8 +443,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
|
|
|
444
443
|
const spanName = name.trim().replace(/\s+/g, "_");
|
|
445
444
|
tracerProvider = tracerProvider ?? trace.getTracerProvider();
|
|
446
445
|
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
447
|
-
const
|
|
448
|
-
const cursor = url.searchParams.get("cursor");
|
|
446
|
+
const cursor = new URL(request.url).searchParams.get("cursor");
|
|
449
447
|
if (collectionCallbacks == null) return await onNotFound(request);
|
|
450
448
|
let collection;
|
|
451
449
|
const baseUri = uriGetter(identifier);
|
|
@@ -605,9 +603,7 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
|
605
603
|
return result;
|
|
606
604
|
}
|
|
607
605
|
async function handleInbox(request, options) {
|
|
608
|
-
|
|
609
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
610
|
-
return await tracer.startActiveSpan("activitypub.inbox", {
|
|
606
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.inbox", {
|
|
611
607
|
kind: options.queue == null ? SpanKind.SERVER : SpanKind.PRODUCER,
|
|
612
608
|
attributes: { "activitypub.shared_inbox": options.recipient == null }
|
|
613
609
|
}, async (span) => {
|
|
@@ -639,8 +635,7 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
|
|
|
639
635
|
});
|
|
640
636
|
return await onNotFound(request);
|
|
641
637
|
} else if (recipient != null) {
|
|
642
|
-
|
|
643
|
-
if (actor == null) {
|
|
638
|
+
if (await actorDispatcher(ctx, recipient) == null) {
|
|
644
639
|
logger$2.error("Actor {recipient} not found.", { recipient });
|
|
645
640
|
span.setStatus({
|
|
646
641
|
code: SpanStatusCode.ERROR,
|
|
@@ -787,11 +782,10 @@ async function handleInboxInternal(request, { recipient, context: ctx, inboxCont
|
|
|
787
782
|
code: SpanStatusCode.ERROR,
|
|
788
783
|
message: `Failed to verify the request's HTTP Signatures.`
|
|
789
784
|
});
|
|
790
|
-
|
|
785
|
+
return new Response("Failed to verify the request signature.", {
|
|
791
786
|
status: 401,
|
|
792
787
|
headers: { "Content-Type": "text/plain; charset=utf-8" }
|
|
793
788
|
});
|
|
794
|
-
return response;
|
|
795
789
|
} else logger$2.debug("HTTP Signatures are verified.", { recipient });
|
|
796
790
|
httpSigKey = key;
|
|
797
791
|
}
|
|
@@ -1099,12 +1093,11 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1099
1093
|
});
|
|
1100
1094
|
}
|
|
1101
1095
|
async #listenFanoutMessage(data, message) {
|
|
1102
|
-
|
|
1096
|
+
getLogger([
|
|
1103
1097
|
"fedify",
|
|
1104
1098
|
"federation",
|
|
1105
1099
|
"fanout"
|
|
1106
|
-
])
|
|
1107
|
-
logger$2.debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
|
|
1100
|
+
]).debug("Fanning out activity {activityId} to {inboxes} inbox(es)...", {
|
|
1108
1101
|
activityId: message.activityId,
|
|
1109
1102
|
inboxes: globalThis.Object.keys(message.inboxes).length
|
|
1110
1103
|
});
|
|
@@ -1237,8 +1230,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1237
1230
|
activity.id.href
|
|
1238
1231
|
];
|
|
1239
1232
|
if (cacheKey != null) {
|
|
1240
|
-
|
|
1241
|
-
if (cached === true) {
|
|
1233
|
+
if (await this.kv.get(cacheKey) === true) {
|
|
1242
1234
|
logger$2.debug("Activity {activityId} has already been processed.", {
|
|
1243
1235
|
activityId: activity.id?.href,
|
|
1244
1236
|
activity: message.activity,
|
|
@@ -1485,8 +1477,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
1485
1477
|
const { outboxQueue } = this;
|
|
1486
1478
|
if (outboxQueue.enqueueMany == null) {
|
|
1487
1479
|
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
1488
|
-
const
|
|
1489
|
-
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
1480
|
+
const errors = (await Promise.allSettled(promises)).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
1490
1481
|
if (errors.length > 0) {
|
|
1491
1482
|
logger$2.error("Failed to enqueue activity {activityId} to send later: {errors}", {
|
|
1492
1483
|
activityId: activity.id.href,
|
|
@@ -1885,7 +1876,6 @@ var ContextImpl = class ContextImpl {
|
|
|
1885
1876
|
identifier: void 0,
|
|
1886
1877
|
get handle() {
|
|
1887
1878
|
logger$2.warn("The ParseUriResult.handle property is deprecated; use ParseUriResult.identifier instead.");
|
|
1888
|
-
return void 0;
|
|
1889
1879
|
}
|
|
1890
1880
|
};
|
|
1891
1881
|
const identifier = "identifier" in route.values ? route.values.identifier : route.values.handle;
|
|
@@ -2068,8 +2058,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2068
2058
|
} else identifierPromise = Promise.resolve(identity.identifier);
|
|
2069
2059
|
return identifierPromise.then((identifier) => {
|
|
2070
2060
|
if (identifier == null) return this.documentLoader;
|
|
2071
|
-
|
|
2072
|
-
return keyPair.then((pair) => pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair));
|
|
2061
|
+
return this.getRsaKeyPairFromIdentifier(identifier).then((pair) => pair == null ? this.documentLoader : this.federation.authenticatedDocumentLoaderFactory(pair));
|
|
2073
2062
|
});
|
|
2074
2063
|
}
|
|
2075
2064
|
return this.federation.authenticatedDocumentLoaderFactory(identity);
|
|
@@ -2111,8 +2100,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2111
2100
|
});
|
|
2112
2101
|
}
|
|
2113
2102
|
sendActivity(sender, recipients, activity, options = {}) {
|
|
2114
|
-
|
|
2115
|
-
return tracer.startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
|
2103
|
+
return this.tracerProvider.getTracer(deno_default.name, deno_default.version).startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
|
2116
2104
|
kind: this.federation.outboxQueue == null || options.immediate ? SpanKind.CLIENT : SpanKind.PRODUCER,
|
|
2117
2105
|
attributes: {
|
|
2118
2106
|
"activitypub.activity.type": getTypeId(activity).href,
|
|
@@ -2257,9 +2245,7 @@ var ContextImpl = class ContextImpl {
|
|
|
2257
2245
|
}
|
|
2258
2246
|
}
|
|
2259
2247
|
routeActivity(recipient, activity, options = {}) {
|
|
2260
|
-
|
|
2261
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
2262
|
-
return tracer.startActiveSpan("activitypub.inbox", {
|
|
2248
|
+
return (this.tracerProvider ?? this.tracerProvider).getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.inbox", {
|
|
2263
2249
|
kind: this.federation.inboxQueue == null || options.immediate ? SpanKind.INTERNAL : SpanKind.PRODUCER,
|
|
2264
2250
|
attributes: { "activitypub.activity.type": getTypeId(activity).href }
|
|
2265
2251
|
}, async (span) => {
|
|
@@ -2295,13 +2281,12 @@ var ContextImpl = class ContextImpl {
|
|
|
2295
2281
|
const contextLoader = options.contextLoader ?? this.contextLoader;
|
|
2296
2282
|
const json = await activity.toJsonLd({ contextLoader });
|
|
2297
2283
|
const keyCache = new KvKeyCache(this.federation.kv, this.federation.kvPrefixes.publicKey, this);
|
|
2298
|
-
|
|
2284
|
+
if (await verifyObject(Activity, json, {
|
|
2299
2285
|
contextLoader,
|
|
2300
2286
|
documentLoader: options.documentLoader ?? this.documentLoader,
|
|
2301
2287
|
tracerProvider: options.tracerProvider ?? this.tracerProvider,
|
|
2302
2288
|
keyCache
|
|
2303
|
-
})
|
|
2304
|
-
if (verified == null) {
|
|
2289
|
+
}) == null) {
|
|
2305
2290
|
logger$2.debug("Object Integrity Proofs are not verified.", {
|
|
2306
2291
|
recipient,
|
|
2307
2292
|
activity: json
|
|
@@ -2475,8 +2460,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
2475
2460
|
});
|
|
2476
2461
|
}
|
|
2477
2462
|
forwardActivity(forwarder, recipients, options) {
|
|
2478
|
-
|
|
2479
|
-
return tracer.startActiveSpan("activitypub.outbox", {
|
|
2463
|
+
return this.tracerProvider.getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.outbox", {
|
|
2480
2464
|
kind: this.federation.outboxQueue == null || options?.immediate ? SpanKind.CLIENT : SpanKind.PRODUCER,
|
|
2481
2465
|
attributes: { "activitypub.activity.type": this.activityType }
|
|
2482
2466
|
}, async (span) => {
|
|
@@ -2527,8 +2511,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
2527
2511
|
if (!hasSignature(this.activity)) {
|
|
2528
2512
|
let hasProof;
|
|
2529
2513
|
try {
|
|
2530
|
-
|
|
2531
|
-
hasProof = await activity.getProof() != null;
|
|
2514
|
+
hasProof = await (await Activity.fromJsonLd(this.activity, this)).getProof() != null;
|
|
2532
2515
|
} catch {
|
|
2533
2516
|
hasProof = false;
|
|
2534
2517
|
}
|
|
@@ -2606,8 +2589,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
|
2606
2589
|
const { outboxQueue } = this.federation;
|
|
2607
2590
|
if (outboxQueue.enqueueMany == null) {
|
|
2608
2591
|
const promises = messages.map((m) => outboxQueue.enqueue(m));
|
|
2609
|
-
const
|
|
2610
|
-
const errors = results.filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2592
|
+
const errors = (await Promise.allSettled(promises)).filter((r) => r.status === "rejected").map((r) => r.reason);
|
|
2611
2593
|
if (errors.length > 0) {
|
|
2612
2594
|
logger$2.error("Failed to enqueue activity {activityId} to forward later:\n{errors}", {
|
|
2613
2595
|
activityId: this.activityId,
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
globalThis.addEventListener = () => {};
|
|
5
|
+
|
|
6
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-3wVT6S9E.js";
|
|
7
|
+
import "./docloader-bgBm1Hd1.js";
|
|
8
|
+
import "./url-C2xuoQD1.js";
|
|
9
|
+
import "./semver-BNrOOAs9.js";
|
|
10
|
+
import "./client-DuUKk4pk.js";
|
|
11
|
+
import "./router-D_aVZZUc.js";
|
|
12
|
+
import "./types-CJHS5pXl.js";
|
|
13
|
+
import "./multibase-CnLHszip.js";
|
|
14
|
+
import "./vocab-DFlq4Wa6.js";
|
|
15
|
+
import "./langstr-DbWheeIS.js";
|
|
16
|
+
import "./lookup-DL62q3Xh.js";
|
|
17
|
+
import "./type-CFuiGLz9.js";
|
|
18
|
+
import "./actor-TYqJGdVq.js";
|
|
19
|
+
import "./key-KVhaUM92.js";
|
|
20
|
+
import "./http-D2DkwsjA.js";
|
|
21
|
+
import "./authdocloader-hiFSyM7V.js";
|
|
22
|
+
import "./ld-DzlJ_IpT.js";
|
|
23
|
+
import "./owner-81ey_76X.js";
|
|
24
|
+
import "./proof-BlULDH4H.js";
|
|
25
|
+
import "./lookup-D0je8AqR.js";
|
|
26
|
+
import "./inbox-DAAZZl2k.js";
|
|
27
|
+
import "./builder-mi6RdzNE.js";
|
|
28
|
+
import "./collection-Dfb0TPno.js";
|
|
29
|
+
import "./keycache-C1pEuRyQ.js";
|
|
30
|
+
import "./retry-BiIhZWgD.js";
|
|
31
|
+
import "./send-DdxfTHo6.js";
|
|
32
|
+
|
|
33
|
+
export { FederationImpl };
|