@fedify/fedify 2.0.0-pr.449.1725 → 2.0.0-pr.451.1730
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-T6RyhRgk.d.ts → actor-Cd2CREO0.d.ts} +2 -2
- package/dist/{actor-VrXd7EdX.js → actor-Cg8ZhoVF.js} +1 -1
- package/dist/{actor-CsRJa7wV.cjs → actor-D020hlx3.cjs} +922 -1451
- package/dist/{actor-D6K058Tb.d.cts → actor-DDhZuMGl.d.cts} +2 -2
- package/dist/{actor-C0gLJq8I.js → actor-DPD6Gbdn.js} +190 -677
- package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-Ce45JcFg.js} +1 -1
- package/dist/{assert_is_error-BPGph1Jx.js → assert_throws-BNXdRGWP.js} +31 -1
- package/dist/{builder-JjsppXTK.js → builder-Dn87hy75.js} +3 -4
- package/dist/{client-bgSdkFa2.d.ts → client-Bkaw0_PR.d.ts} +1 -1
- package/dist/{client-CegPX0Rn.d.cts → client-Cle5j1T1.d.cts} +1 -1
- package/dist/{client-BS-GE3XI.js → client-D6-5okV1.js} +1 -1
- package/dist/compat/mod.d.cts +11 -11
- package/dist/compat/mod.d.ts +12 -12
- package/dist/compat/transformers.test.js +20 -20
- package/dist/{context-DYCJXr7J.d.cts → context-BOYzcFSe.d.cts} +10 -10
- package/dist/{context-B1X8-X33.d.ts → context-DqFifMwj.d.ts} +11 -11
- package/dist/{authdocloader-C8LXxsmU.js → docloader-B2BFBGqv.js} +18 -8
- package/dist/{esm-CvUgdJZ_.js → esm-CU0Dnk7T.js} +11 -11
- package/dist/federation/builder.test.js +8 -10
- package/dist/federation/collection.test.js +7 -9
- package/dist/federation/handler.test.js +25 -26
- package/dist/federation/idempotency.test.js +25 -26
- package/dist/federation/inbox.test.js +4 -6
- package/dist/federation/keycache.test.js +3 -4
- package/dist/federation/kv.test.js +6 -8
- package/dist/federation/middleware.test.js +26 -27
- package/dist/federation/mod.cjs +10 -11
- package/dist/federation/mod.d.cts +10 -10
- package/dist/federation/mod.d.ts +12 -12
- package/dist/federation/mod.js +10 -11
- package/dist/federation/mq.test.js +8 -10
- package/dist/federation/negotiation.test.js +7 -9
- package/dist/federation/retry.test.js +4 -5
- package/dist/federation/router.test.js +6 -8
- package/dist/federation/send.test.js +13 -15
- package/dist/{http-D-e6AFwR.d.cts → http-B6SKO6NJ.d.cts} +2 -2
- package/dist/{http-D6Uj2x2y.d.ts → http-BE7aFuqn.d.ts} +2 -2
- package/dist/{http-D_BI5KHC.cjs → http-DMsjudj8.cjs} +289 -9
- package/dist/{http-DbyMqL2X.js → http-DN0v2zoF.js} +2 -2
- package/dist/{http-DVQEn98K.js → http-DcDb8r1W.js} +256 -6
- package/dist/{inbox-DQlf_-Dz.js → inbox-CgGy7Hzc.js} +1 -1
- package/dist/{key-BSJX6n9o.js → key-jSvnymAk.js} +3 -2
- package/dist/{keycache-CcIfdj0m.js → keycache-IVLjlAK9.js} +1 -1
- package/dist/{keys-DnSaJmvD.js → keys-BKM2Mqu2.js} +2 -1
- package/dist/{docloader-BdF5STdg.cjs → kv-cache-BHIupktM.cjs} +69 -651
- package/dist/kv-cache-DNvS-egZ.js +4236 -0
- package/dist/{docloader-AMdJU291.js → kv-cache-ydIs4Ul6.js} +68 -596
- package/dist/{ld-CAJ6Q2od.js → ld-CcsryBo0.js} +3 -2
- package/dist/{lookup-BGCuyJRy.js → lookup-BV3A9Zbc.js} +63 -2
- package/dist/{type-COb6KNlm.js → lookup-BbEekiru.js} +588 -5303
- package/dist/{lookup-B2Bsau2g.cjs → lookup-CMAGfQ1Q.cjs} +78 -5
- package/dist/{middleware-1oxZY_0z.js → middleware-D-vPitR-.js} +11 -11
- package/dist/{middleware-BDqkoMAQ.js → middleware-Dm8sXYUr.js} +18 -17
- package/dist/middleware-DzA970CF.js +16 -0
- package/dist/middleware-VpoC5jyA.js +26 -0
- package/dist/middleware-W_-inBoE.cjs +16 -0
- package/dist/{middleware-D0XMPoN8.cjs → middleware-ekn2KaOw.cjs} +31 -31
- package/dist/{mod-CxkWO3Mg.d.cts → mod--K7l84wp.d.cts} +3 -2
- package/dist/{mod-DBzN0aCM.d.ts → mod-CB80AlIA.d.ts} +1 -1
- package/dist/mod-CLKu6Uo_.d.cts +107 -0
- package/dist/{mod-Djzcw2ry.d.cts → mod-COlOrmr9.d.cts} +3 -3
- package/dist/{mod-DlU8ISoa.d.ts → mod-CRENK2dd.d.ts} +3 -2
- package/dist/{mod-DcKxhFQ8.d.ts → mod-CaWbCg0N.d.ts} +2 -2
- package/dist/mod-Cm97bAiT.d.ts +109 -0
- package/dist/{mod-twdvV2hR.d.cts → mod-D9XZsft2.d.cts} +2 -2
- package/dist/{mod-BhUKmBJD.d.ts → mod-DLIidI_j.d.ts} +3 -3
- package/dist/{mod-jQ4OODsl.d.cts → mod-DuclhZjh.d.cts} +1 -1
- package/dist/mod.cjs +21 -32
- package/dist/mod.d.cts +14 -14
- package/dist/mod.d.ts +17 -17
- package/dist/mod.js +15 -16
- package/dist/nodeinfo/client.test.js +8 -10
- package/dist/nodeinfo/handler.test.js +24 -25
- package/dist/nodeinfo/mod.cjs +3 -3
- package/dist/nodeinfo/mod.d.cts +2 -3
- package/dist/nodeinfo/mod.d.ts +3 -4
- package/dist/nodeinfo/mod.js +3 -3
- package/dist/nodeinfo/types.test.js +7 -9
- package/dist/{owner-hd9lvQcP.d.ts → owner-CktUdA0h.d.ts} +3 -3
- package/dist/{owner-BN_tO3cY.d.cts → owner-dkg5OpSC.d.cts} +3 -3
- package/dist/{owner-CaIfLBwg.js → owner-n5c_oZ_M.js} +3 -2
- package/dist/{proof-CKXppjee.js → proof-CLwByIT1.js} +5 -4
- package/dist/{proof-AhyVJcNZ.cjs → proof-CZfrp13P.cjs} +17 -16
- package/dist/{proof-BQwXHakc.js → proof-CsFR7fiS.js} +2 -2
- package/dist/request-BbHkedIU.d.cts +35 -0
- package/dist/request-DKGQaofB.js +184 -0
- package/dist/request-U1t6zZtk.d.ts +39 -0
- package/dist/request-XHWUW2bi.cjs +208 -0
- package/dist/{send-DQd3R1Oc.js → send-eW9JIzQV.js} +2 -2
- package/dist/sig/http.test.js +12 -13
- package/dist/sig/key.test.js +9 -11
- package/dist/sig/ld.test.js +8 -10
- package/dist/sig/mod.cjs +10 -11
- package/dist/sig/mod.d.cts +6 -7
- package/dist/sig/mod.d.ts +6 -7
- package/dist/sig/mod.js +6 -7
- package/dist/sig/owner.test.js +10 -12
- package/dist/sig/proof.test.js +13 -14
- package/dist/testing/docloader.test.js +6 -8
- package/dist/testing/mod.d.ts +3 -62
- package/dist/testing/mod.js +2 -3
- package/dist/{testing-BljKU-GG.js → testing-ClYSmXdi.js} +1 -2
- package/dist/{types-DI0yutHB.cjs → types-BT0xc4-R.cjs} +3 -3
- package/dist/{types-CEn4wB51.js → types-DaPoJTSc.js} +1 -1
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +13 -15
- package/dist/utils/kv-cache.test.js +208 -0
- package/dist/utils/mod.cjs +14 -0
- package/dist/utils/mod.d.cts +6 -0
- package/dist/utils/mod.d.ts +8 -0
- package/dist/utils/mod.js +12 -0
- package/dist/utils/request.test.js +48 -0
- package/dist/utils/url.test.js +41 -0
- package/dist/vocab/actor.test.js +8 -10
- package/dist/vocab/lookup.test.js +7 -9
- package/dist/vocab/mod.cjs +4 -4
- package/dist/vocab/mod.d.cts +4 -5
- package/dist/vocab/mod.d.ts +4 -5
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +2 -3
- package/dist/vocab/vocab.test.js +9 -10
- package/dist/{vocab-NZXL5Pr-.cjs → vocab-CxTuoEVd.cjs} +6 -5
- package/dist/{vocab-Dw1-yVGg.d.cts → vocab-DCBw44JZ.d.cts} +2 -21
- package/dist/{vocab-BI0Ak5lL.d.ts → vocab-ivDKb439.d.ts} +2 -21
- package/dist/{vocab-CkWH9P5l.js → vocab-yFT-fQBj.js} +4 -3
- package/dist/webfinger/handler.test.js +24 -25
- package/dist/webfinger/lookup.test.js +7 -9
- package/dist/webfinger/mod.cjs +3 -3
- package/dist/webfinger/mod.d.cts +2 -3
- package/dist/webfinger/mod.d.ts +2 -3
- package/dist/webfinger/mod.js +3 -3
- package/dist/x/cfworkers.d.cts +1 -1
- package/dist/x/cfworkers.d.ts +2 -2
- package/dist/x/cfworkers.test.js +6 -8
- package/dist/x/hono.d.cts +10 -10
- package/dist/x/hono.d.ts +11 -11
- package/dist/x/sveltekit.d.cts +10 -10
- package/dist/x/sveltekit.d.ts +11 -11
- package/package.json +16 -14
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-6F9IP-VO.js +0 -52
- package/dist/authdocloader-BkuVo8LL.cjs +0 -58
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- package/dist/docloader-D-MrRyHl.d.cts +0 -219
- package/dist/key-BBzfhQGE.js +0 -10
- package/dist/key-BMz_uAnc.cjs +0 -10
- package/dist/key-D-RgWfcf.cjs +0 -290
- package/dist/key-DFefr8X2.js +0 -260
- package/dist/key-DW2DrPGl.js +0 -10
- package/dist/lookup-C3pnuyiD.js +0 -331
- package/dist/middleware-B8WWe8Q2.js +0 -26
- package/dist/middleware-DipQbJmB.js +0 -17
- package/dist/middleware-mLaQeD_Z.cjs +0 -17
- package/dist/mod-CerN_Sza.d.ts +0 -104
- package/dist/mod-Cj1tHXBR.d.cts +0 -102
- package/dist/runtime/docloader.test.js +0 -522
- package/dist/runtime/key.test.js +0 -103
- package/dist/runtime/langstr.test.d.ts +0 -3
- package/dist/runtime/langstr.test.js +0 -39
- package/dist/runtime/link.test.d.ts +0 -3
- package/dist/runtime/link.test.js +0 -61
- package/dist/runtime/mod.cjs +0 -25
- package/dist/runtime/mod.d.cts +0 -6
- package/dist/runtime/mod.d.ts +0 -8
- package/dist/runtime/mod.js +0 -13
- package/dist/runtime/multibase/multibase.test.d.ts +0 -3
- package/dist/runtime/multibase/multibase.test.js +0 -358
- package/dist/runtime/url.test.js +0 -45
- /package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-C80BG-_5.js} +0 -0
- /package/dist/{collection-CcnIw1qY.js → collection-BzWsN9pB.js} +0 -0
- /package/dist/{denokv-Bv33Xxea.js → denokv-CCssOzMJ.js} +0 -0
- /package/dist/{federation-H2_En3j5.cjs → federation-DOuZpcAw.cjs} +0 -0
- /package/dist/{federation-D1U8YY9t.js → federation-pZJsapBn.js} +0 -0
- /package/dist/{kv-63Cil1MD.d.cts → kv-BMKIFXNW.d.cts} +0 -0
- /package/dist/{kv-C7sopW2E.d.ts → kv-Dt06smFt.d.ts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-B-ZQqbGe.d.ts} +0 -0
- /package/dist/{mod-g0xFzAP9.d.ts → mod-CjsiSl7_.d.ts} +0 -0
- /package/dist/{mq-CRGm1e_F.d.ts → mq-CPRJk4mZ.d.ts} +0 -0
- /package/dist/{negotiation-5NPJL6zp.js → negotiation-C4nFufNk.js} +0 -0
- /package/dist/{nodeinfo-DfycQ8Wf.js → nodeinfo-B0UefMXO.js} +0 -0
- /package/dist/{nodeinfo-Co9lJrWl.cjs → nodeinfo-ByTd7HpT.cjs} +0 -0
- /package/dist/{retry-D4GJ670a.js → retry-CfF8Gn4d.js} +0 -0
- /package/dist/{runtime-C58AJWSv.cjs → sig-DE_NC_VQ.cjs} +0 -0
- /package/dist/{runtime-DPYEDf-o.js → sig-Dx59zAgn.js} +0 -0
- /package/dist/{std__assert-X-_kMxKM.js → std__assert-DWivtrGR.js} +0 -0
- /package/dist/{types-BSuWJsOm.js → types-C2XVl6gj.js} +0 -0
- /package/dist/{runtime → utils}/docloader.test.d.ts +0 -0
- /package/dist/{runtime/authdocloader.test.d.ts → utils/kv-cache.test.d.ts} +0 -0
- /package/dist/{runtime/key.test.d.ts → utils/request.test.d.ts} +0 -0
- /package/dist/{runtime → utils}/url.test.d.ts +0 -0
- /package/dist/{sig-ByHXzqUi.cjs → utils-B6yXfxAQ.cjs} +0 -0
- /package/dist/{sig-Cj3tk-ig.js → utils-BXMGcmqK.js} +0 -0
- /package/dist/{webfinger-BjOEdFPs.cjs → webfinger-C949bxcD.cjs} +0 -0
- /package/dist/{webfinger-De_bU0iE.js → webfinger-qG8R5jc3.js} +0 -0
@@ -3,10 +3,71 @@
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
4
4
|
|
5
5
|
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
6
|
-
const
|
6
|
+
const require_request = require('./request-XHWUW2bi.cjs');
|
7
7
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
8
8
|
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
9
|
+
const node_dns_promises = require_chunk.__toESM(require("node:dns/promises"));
|
10
|
+
const node_net = require_chunk.__toESM(require("node:net"));
|
9
11
|
|
12
|
+
//#region src/utils/url.ts
|
13
|
+
var UrlError = class extends Error {
|
14
|
+
constructor(message) {
|
15
|
+
super(message);
|
16
|
+
this.name = "UrlError";
|
17
|
+
}
|
18
|
+
};
|
19
|
+
/**
|
20
|
+
* Validates a URL to prevent SSRF attacks.
|
21
|
+
*/
|
22
|
+
async function validatePublicUrl(url) {
|
23
|
+
const parsed = new URL(url);
|
24
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") throw new UrlError(`Unsupported protocol: ${parsed.protocol}`);
|
25
|
+
let hostname = parsed.hostname;
|
26
|
+
if (hostname.startsWith("[") && hostname.endsWith("]")) hostname = hostname.substring(1, hostname.length - 2);
|
27
|
+
if (hostname === "localhost") throw new UrlError("Localhost is not allowed");
|
28
|
+
if ("Deno" in globalThis && !(0, node_net.isIP)(hostname)) {
|
29
|
+
const netPermission = await Deno.permissions.query({ name: "net" });
|
30
|
+
if (netPermission.state !== "granted") return;
|
31
|
+
}
|
32
|
+
if ("Bun" in globalThis) {
|
33
|
+
if (hostname === "example.com" || hostname.endsWith(".example.com")) return;
|
34
|
+
else if (hostname === "fedify-test.internal") throw new UrlError("Invalid or private address: fedify-test.internal");
|
35
|
+
}
|
36
|
+
let addresses;
|
37
|
+
try {
|
38
|
+
addresses = await (0, node_dns_promises.lookup)(hostname, { all: true });
|
39
|
+
} catch {
|
40
|
+
addresses = [];
|
41
|
+
}
|
42
|
+
for (const { address, family } of addresses) if (family === 4 && !isValidPublicIPv4Address(address) || family === 6 && !isValidPublicIPv6Address(address) || family < 4 || family === 5 || family > 6) throw new UrlError(`Invalid or private address: ${address}`);
|
43
|
+
}
|
44
|
+
function isValidPublicIPv4Address(address) {
|
45
|
+
const parts = address.split(".");
|
46
|
+
const first = parseInt(parts[0]);
|
47
|
+
if (first === 0 || first === 10 || first === 127) return false;
|
48
|
+
const second = parseInt(parts[1]);
|
49
|
+
if (first === 169 && second === 254) return false;
|
50
|
+
if (first === 172 && second >= 16 && second <= 31) return false;
|
51
|
+
if (first === 192 && second === 168) return false;
|
52
|
+
return true;
|
53
|
+
}
|
54
|
+
function isValidPublicIPv6Address(address) {
|
55
|
+
address = expandIPv6Address(address);
|
56
|
+
if (address.at(4) !== ":") return false;
|
57
|
+
const firstWord = parseInt(address.substring(0, 4), 16);
|
58
|
+
return !(firstWord >= 64512 && firstWord <= 65023 || firstWord >= 65152 && firstWord <= 65215 || firstWord === 0 || firstWord >= 65280);
|
59
|
+
}
|
60
|
+
function expandIPv6Address(address) {
|
61
|
+
address = address.toLowerCase();
|
62
|
+
if (address === "::") return "0000:0000:0000:0000:0000:0000:0000:0000";
|
63
|
+
if (address.startsWith("::")) address = "0000" + address;
|
64
|
+
if (address.endsWith("::")) address = address + "0000";
|
65
|
+
address = address.replace("::", ":0000".repeat(8 - (address.match(/:/g) || []).length) + ":");
|
66
|
+
const parts = address.split(":");
|
67
|
+
return parts.map((part) => part.padStart(4, "0")).join(":");
|
68
|
+
}
|
69
|
+
|
70
|
+
//#endregion
|
10
71
|
//#region src/webfinger/lookup.ts
|
11
72
|
const logger = (0, __logtape_logtape.getLogger)([
|
12
73
|
"fedify",
|
@@ -23,7 +84,7 @@ const DEFAULT_MAX_REDIRECTION = 5;
|
|
23
84
|
*/
|
24
85
|
async function lookupWebFinger(resource, options = {}) {
|
25
86
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
26
|
-
const tracer = tracerProvider.getTracer(
|
87
|
+
const tracer = tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
|
27
88
|
return await tracer.startActiveSpan("webfinger.lookup", {
|
28
89
|
kind: __opentelemetry_api.SpanKind.CLIENT,
|
29
90
|
attributes: {
|
@@ -66,9 +127,9 @@ async function lookupWebFingerInternal(resource, options = {}) {
|
|
66
127
|
logger.debug("Fetching WebFinger resource descriptor from {url}...", { url: url.href });
|
67
128
|
let response;
|
68
129
|
if (options.allowPrivateAddress !== true) try {
|
69
|
-
await
|
130
|
+
await validatePublicUrl(url.href);
|
70
131
|
} catch (e) {
|
71
|
-
if (e instanceof
|
132
|
+
if (e instanceof UrlError) {
|
72
133
|
logger.error("Invalid URL for WebFinger resource descriptor: {error}", { error: e });
|
73
134
|
return null;
|
74
135
|
}
|
@@ -78,7 +139,7 @@ async function lookupWebFingerInternal(resource, options = {}) {
|
|
78
139
|
response = await fetch(url, {
|
79
140
|
headers: {
|
80
141
|
Accept: "application/jrd+json",
|
81
|
-
"User-Agent": typeof options.userAgent === "string" ? options.userAgent :
|
142
|
+
"User-Agent": typeof options.userAgent === "string" ? options.userAgent : require_request.getUserAgent(options.userAgent)
|
82
143
|
},
|
83
144
|
redirect: "manual",
|
84
145
|
signal: options.signal
|
@@ -129,9 +190,21 @@ async function lookupWebFingerInternal(resource, options = {}) {
|
|
129
190
|
}
|
130
191
|
|
131
192
|
//#endregion
|
193
|
+
Object.defineProperty(exports, 'UrlError', {
|
194
|
+
enumerable: true,
|
195
|
+
get: function () {
|
196
|
+
return UrlError;
|
197
|
+
}
|
198
|
+
});
|
132
199
|
Object.defineProperty(exports, 'lookupWebFinger', {
|
133
200
|
enumerable: true,
|
134
201
|
get: function () {
|
135
202
|
return lookupWebFinger;
|
136
203
|
}
|
204
|
+
});
|
205
|
+
Object.defineProperty(exports, 'validatePublicUrl', {
|
206
|
+
enumerable: true,
|
207
|
+
get: function () {
|
208
|
+
return validatePublicUrl;
|
209
|
+
}
|
137
210
|
});
|
@@ -3,21 +3,21 @@
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
4
4
|
|
5
5
|
import { getDefaultActivityTransformers } from "./transformers-BFT6d7J5.js";
|
6
|
-
import { deno_default
|
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 "./
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import { lookupObject, traverseCollection } from "./vocab-CkWH9P5l.js";
|
6
|
+
import { deno_default } from "./request-DKGQaofB.js";
|
7
|
+
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId } from "./actor-DPD6Gbdn.js";
|
8
|
+
import { lookupWebFinger } from "./lookup-BV3A9Zbc.js";
|
9
|
+
import { doubleKnock, exportJwk, importJwk, validateCryptoKey, verifyRequest } from "./http-DcDb8r1W.js";
|
10
|
+
import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-CLwByIT1.js";
|
11
|
+
import { getNodeInfo, nodeInfoToJson } from "./types-DaPoJTSc.js";
|
12
|
+
import { getAuthenticatedDocumentLoader, kvCache } from "./kv-cache-ydIs4Ul6.js";
|
13
|
+
import { lookupObject, traverseCollection } from "./vocab-yFT-fQBj.js";
|
15
14
|
import { getLogger, withContext } from "@logtape/logtape";
|
16
15
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
17
|
-
import {
|
16
|
+
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
18
17
|
import { cloneDeep } from "es-toolkit";
|
19
18
|
import { Router } from "uri-template-router";
|
20
19
|
import { parseTemplate } from "url-template";
|
20
|
+
import { encodeHex } from "byte-encodings/hex";
|
21
21
|
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";
|
22
22
|
import { domainToASCII } from "node:url";
|
23
23
|
|
@@ -339,7 +339,7 @@ var FederationBuilderImpl = class {
|
|
339
339
|
this.collectionTypeIds = {};
|
340
340
|
}
|
341
341
|
async build(options) {
|
342
|
-
const { FederationImpl: FederationImpl$1 } = await import("./middleware-
|
342
|
+
const { FederationImpl: FederationImpl$1 } = await import("./middleware-DzA970CF.js");
|
343
343
|
const f = new FederationImpl$1(options);
|
344
344
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
345
345
|
f.router = this.router.clone();
|
@@ -3,23 +3,24 @@
|
|
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,
|
7
|
-
import { getNodeInfo } from "./client-
|
8
|
-
import {
|
9
|
-
import {
|
10
|
-
import {
|
11
|
-
import {
|
12
|
-
import {
|
13
|
-
import {
|
14
|
-
import {
|
15
|
-
import {
|
16
|
-
import { routeActivity } from "./inbox-
|
17
|
-
import { FederationBuilderImpl } from "./builder-
|
18
|
-
import { buildCollectionSynchronizationHeader } from "./collection-
|
19
|
-
import { KvKeyCache } from "./keycache-
|
20
|
-
import { acceptsJsonLd } from "./negotiation-
|
21
|
-
import { createExponentialBackoffPolicy } from "./retry-
|
22
|
-
import { extractInboxes, sendActivity } from "./send-
|
6
|
+
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, RouterError, deno_default, getTypeId, lookupObject, lookupWebFinger, traverseCollection } from "./lookup-BbEekiru.js";
|
7
|
+
import { getNodeInfo } from "./client-D6-5okV1.js";
|
8
|
+
import { nodeInfoToJson } from "./types-C2XVl6gj.js";
|
9
|
+
import { exportJwk, importJwk, validateCryptoKey } from "./key-jSvnymAk.js";
|
10
|
+
import { verifyRequest } from "./http-DN0v2zoF.js";
|
11
|
+
import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-CcsryBo0.js";
|
12
|
+
import { doesActorOwnKey, getKeyOwner } from "./owner-n5c_oZ_M.js";
|
13
|
+
import { signObject, verifyObject } from "./proof-CsFR7fiS.js";
|
14
|
+
import { getAuthenticatedDocumentLoader } from "./docloader-B2BFBGqv.js";
|
15
|
+
import { kvCache } from "./kv-cache-DNvS-egZ.js";
|
16
|
+
import { routeActivity } from "./inbox-CgGy7Hzc.js";
|
17
|
+
import { FederationBuilderImpl } from "./builder-Dn87hy75.js";
|
18
|
+
import { buildCollectionSynchronizationHeader } from "./collection-BzWsN9pB.js";
|
19
|
+
import { KvKeyCache } from "./keycache-IVLjlAK9.js";
|
20
|
+
import { acceptsJsonLd } from "./negotiation-C4nFufNk.js";
|
21
|
+
import { createExponentialBackoffPolicy } from "./retry-CfF8Gn4d.js";
|
22
|
+
import { extractInboxes, sendActivity } from "./send-eW9JIzQV.js";
|
23
|
+
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
23
24
|
import { getLogger, withContext } from "@logtape/logtape";
|
24
25
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
25
26
|
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";
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
|
5
|
+
import "./transformers-BFT6d7J5.js";
|
6
|
+
import "./request-DKGQaofB.js";
|
7
|
+
import "./actor-DPD6Gbdn.js";
|
8
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-D-vPitR-.js";
|
9
|
+
import "./lookup-BV3A9Zbc.js";
|
10
|
+
import "./http-DcDb8r1W.js";
|
11
|
+
import "./proof-CLwByIT1.js";
|
12
|
+
import "./types-DaPoJTSc.js";
|
13
|
+
import "./kv-cache-ydIs4Ul6.js";
|
14
|
+
import "./vocab-yFT-fQBj.js";
|
15
|
+
|
16
|
+
export { FederationImpl };
|
@@ -0,0 +1,26 @@
|
|
1
|
+
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
4
|
+
globalThis.addEventListener = () => {};
|
5
|
+
|
6
|
+
import "./lookup-BbEekiru.js";
|
7
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-Dm8sXYUr.js";
|
8
|
+
import "./client-D6-5okV1.js";
|
9
|
+
import "./types-C2XVl6gj.js";
|
10
|
+
import "./actor-Cg8ZhoVF.js";
|
11
|
+
import "./key-jSvnymAk.js";
|
12
|
+
import "./http-DN0v2zoF.js";
|
13
|
+
import "./ld-CcsryBo0.js";
|
14
|
+
import "./owner-n5c_oZ_M.js";
|
15
|
+
import "./proof-CsFR7fiS.js";
|
16
|
+
import "./docloader-B2BFBGqv.js";
|
17
|
+
import "./kv-cache-DNvS-egZ.js";
|
18
|
+
import "./inbox-CgGy7Hzc.js";
|
19
|
+
import "./builder-Dn87hy75.js";
|
20
|
+
import "./collection-BzWsN9pB.js";
|
21
|
+
import "./keycache-IVLjlAK9.js";
|
22
|
+
import "./negotiation-C4nFufNk.js";
|
23
|
+
import "./retry-CfF8Gn4d.js";
|
24
|
+
import "./send-eW9JIzQV.js";
|
25
|
+
|
26
|
+
export { FederationImpl };
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
4
|
+
|
5
|
+
require('./transformers-CoBS-oFG.cjs');
|
6
|
+
require('./request-XHWUW2bi.cjs');
|
7
|
+
require('./actor-D020hlx3.cjs');
|
8
|
+
const require_middleware = require('./middleware-ekn2KaOw.cjs');
|
9
|
+
require('./lookup-CMAGfQ1Q.cjs');
|
10
|
+
require('./http-DMsjudj8.cjs');
|
11
|
+
require('./proof-CZfrp13P.cjs');
|
12
|
+
require('./types-BT0xc4-R.cjs');
|
13
|
+
require('./kv-cache-BHIupktM.cjs');
|
14
|
+
require('./vocab-CxTuoEVd.cjs');
|
15
|
+
|
16
|
+
exports.FederationImpl = require_middleware.FederationImpl;
|
@@ -4,21 +4,21 @@
|
|
4
4
|
|
5
5
|
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
6
6
|
const require_transformers = require('./transformers-CoBS-oFG.cjs');
|
7
|
-
const
|
8
|
-
const require_actor = require('./actor-
|
9
|
-
const require_lookup = require('./lookup-
|
10
|
-
const
|
11
|
-
const
|
12
|
-
const
|
13
|
-
const
|
14
|
-
const
|
15
|
-
const require_vocab = require('./vocab-NZXL5Pr-.cjs');
|
7
|
+
const require_request = require('./request-XHWUW2bi.cjs');
|
8
|
+
const require_actor = require('./actor-D020hlx3.cjs');
|
9
|
+
const require_lookup = require('./lookup-CMAGfQ1Q.cjs');
|
10
|
+
const require_http = require('./http-DMsjudj8.cjs');
|
11
|
+
const require_proof = require('./proof-CZfrp13P.cjs');
|
12
|
+
const require_types = require('./types-BT0xc4-R.cjs');
|
13
|
+
const require_kv_cache = require('./kv-cache-BHIupktM.cjs');
|
14
|
+
const require_vocab = require('./vocab-CxTuoEVd.cjs');
|
16
15
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
17
16
|
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
18
|
-
const
|
17
|
+
const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
|
19
18
|
const es_toolkit = require_chunk.__toESM(require("es-toolkit"));
|
20
19
|
const uri_template_router = require_chunk.__toESM(require("uri-template-router"));
|
21
20
|
const url_template = require_chunk.__toESM(require("url-template"));
|
21
|
+
const byte_encodings_hex = require_chunk.__toESM(require("byte-encodings/hex"));
|
22
22
|
const __opentelemetry_semantic_conventions = require_chunk.__toESM(require("@opentelemetry/semantic-conventions"));
|
23
23
|
const node_url = require_chunk.__toESM(require("node:url"));
|
24
24
|
|
@@ -143,7 +143,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
|
|
143
143
|
return "enqueued";
|
144
144
|
}
|
145
145
|
tracerProvider = tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
146
|
-
const tracer = tracerProvider.getTracer(
|
146
|
+
const tracer = tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
|
147
147
|
return await tracer.startActiveSpan("activitypub.dispatch_inbox_listener", { kind: __opentelemetry_api.SpanKind.INTERNAL }, async (span$1) => {
|
148
148
|
const dispatched = inboxListeners?.dispatchWithClass(activity);
|
149
149
|
if (dispatched == null) {
|
@@ -340,7 +340,7 @@ var FederationBuilderImpl = class {
|
|
340
340
|
this.collectionTypeIds = {};
|
341
341
|
}
|
342
342
|
async build(options) {
|
343
|
-
const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-
|
343
|
+
const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-W_-inBoE.cjs"));
|
344
344
|
const f = new FederationImpl$1(options);
|
345
345
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
346
346
|
f.router = this.router.clone();
|
@@ -366,7 +366,7 @@ var FederationBuilderImpl = class {
|
|
366
366
|
return f;
|
367
367
|
}
|
368
368
|
_getTracer() {
|
369
|
-
return __opentelemetry_api.trace.getTracer(
|
369
|
+
return __opentelemetry_api.trace.getTracer(require_request.deno_default.name, require_request.deno_default.version);
|
370
370
|
}
|
371
371
|
setActorDispatcher(path, dispatcher) {
|
372
372
|
if (this.router.has("actor")) throw new RouterError("Actor dispatcher already set.");
|
@@ -1113,7 +1113,7 @@ async function handleObject(request, { values, context: context$2, objectDispatc
|
|
1113
1113
|
async function handleCollection(request, { name, identifier, uriGetter, filter, filterPredicate, context: context$2, collectionCallbacks, tracerProvider, onUnauthorized, onNotFound }) {
|
1114
1114
|
const spanName = name.trim().replace(/\s+/g, "_");
|
1115
1115
|
tracerProvider = tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
1116
|
-
const tracer = tracerProvider.getTracer(
|
1116
|
+
const tracer = tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
|
1117
1117
|
const url = new URL(request.url);
|
1118
1118
|
const cursor = url.searchParams.get("cursor");
|
1119
1119
|
if (collectionCallbacks == null) return await onNotFound(request);
|
@@ -1290,7 +1290,7 @@ function filterCollectionItems(items, collectionName, filterPredicate) {
|
|
1290
1290
|
*/
|
1291
1291
|
async function handleInbox(request, options) {
|
1292
1292
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
1293
|
-
const tracer = tracerProvider.getTracer(
|
1293
|
+
const tracer = tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
|
1294
1294
|
return await tracer.startActiveSpan("activitypub.inbox", {
|
1295
1295
|
kind: options.queue == null ? __opentelemetry_api.SpanKind.SERVER : __opentelemetry_api.SpanKind.PRODUCER,
|
1296
1296
|
attributes: { "activitypub.shared_inbox": options.recipient == null }
|
@@ -1642,7 +1642,7 @@ var CustomCollectionHandler = class {
|
|
1642
1642
|
this.CollectionPage = CollectionPage$1;
|
1643
1643
|
this.filterPredicate = filterPredicate;
|
1644
1644
|
this.name = this.name.trim().replace(/\s+/g, "_");
|
1645
|
-
this.#tracer = this.tracerProvider.getTracer(
|
1645
|
+
this.#tracer = this.tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
|
1646
1646
|
this.#id = new URL(this.context.url);
|
1647
1647
|
this.#dispatcher = callbacks.dispatcher.bind(callbacks);
|
1648
1648
|
}
|
@@ -2233,7 +2233,7 @@ function extractInboxes({ recipients, preferSharedInbox, excludeBaseUris }) {
|
|
2233
2233
|
*/
|
2234
2234
|
function sendActivity(options) {
|
2235
2235
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
2236
|
-
const tracer = tracerProvider.getTracer(
|
2236
|
+
const tracer = tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
|
2237
2237
|
return tracer.startActiveSpan("activitypub.send_activity", {
|
2238
2238
|
kind: __opentelemetry_api.SpanKind.CLIENT,
|
2239
2239
|
attributes: { "activitypub.shared_inbox": options.sharedInbox ?? false }
|
@@ -2404,8 +2404,8 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2404
2404
|
const { allowPrivateAddress, userAgent } = options;
|
2405
2405
|
this.allowPrivateAddress = allowPrivateAddress ?? false;
|
2406
2406
|
this.documentLoaderFactory = options.documentLoaderFactory ?? ((opts) => {
|
2407
|
-
return
|
2408
|
-
loader:
|
2407
|
+
return require_kv_cache.kvCache({
|
2408
|
+
loader: (0, __fedify_vocab_runtime.getDocumentLoader)({
|
2409
2409
|
allowPrivateAddress: opts?.allowPrivateAddress ?? allowPrivateAddress,
|
2410
2410
|
userAgent: opts?.userAgent ?? userAgent
|
2411
2411
|
}),
|
@@ -2414,7 +2414,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2414
2414
|
});
|
2415
2415
|
});
|
2416
2416
|
this.contextLoaderFactory = options.contextLoaderFactory ?? this.documentLoaderFactory;
|
2417
|
-
this.authenticatedDocumentLoaderFactory = options.authenticatedDocumentLoaderFactory ?? ((identity) =>
|
2417
|
+
this.authenticatedDocumentLoaderFactory = options.authenticatedDocumentLoaderFactory ?? ((identity) => require_kv_cache.getAuthenticatedDocumentLoader(identity, {
|
2418
2418
|
allowPrivateAddress,
|
2419
2419
|
userAgent,
|
2420
2420
|
specDeterminer: new KvSpecDeterminer(this.kv, this.kvPrefixes.httpMessageSignaturesSpec, options.firstKnock),
|
@@ -2435,7 +2435,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2435
2435
|
this.router.add("/.well-known/nodeinfo", "nodeInfoJrd");
|
2436
2436
|
}
|
2437
2437
|
_getTracer() {
|
2438
|
-
return this.tracerProvider.getTracer(
|
2438
|
+
return this.tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
|
2439
2439
|
}
|
2440
2440
|
async _startQueueInternal(ctxData, signal, queue) {
|
2441
2441
|
if (this.inboxQueue == null && this.outboxQueue == null) return;
|
@@ -2533,7 +2533,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2533
2533
|
});
|
2534
2534
|
const keys = await Promise.all(message.keys.map(async ({ keyId, privateKey }) => ({
|
2535
2535
|
keyId: new URL(keyId),
|
2536
|
-
privateKey: await
|
2536
|
+
privateKey: await require_http.importJwk(privateKey, "private")
|
2537
2537
|
})));
|
2538
2538
|
const activity = await require_actor.Activity.fromJsonLd(message.activity, {
|
2539
2539
|
contextLoader: this.contextLoaderFactory({
|
@@ -2574,7 +2574,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2574
2574
|
for (const { keyId, privateKey } of message.keys) {
|
2575
2575
|
const pair = {
|
2576
2576
|
keyId: new URL(keyId),
|
2577
|
-
privateKey: await
|
2577
|
+
privateKey: await require_http.importJwk(privateKey, "private")
|
2578
2578
|
};
|
2579
2579
|
if (rsaKeyPair == null && pair.privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") rsaKeyPair = pair;
|
2580
2580
|
keys.push(pair);
|
@@ -2809,7 +2809,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2809
2809
|
let proofCreated = false;
|
2810
2810
|
let rsaKey = null;
|
2811
2811
|
for (const { keyId, privateKey } of keys) {
|
2812
|
-
|
2812
|
+
require_http.validateCryptoKey(privateKey, "private");
|
2813
2813
|
if (rsaKey == null && privateKey.algorithm.name === "RSASSA-PKCS1-v1_5") {
|
2814
2814
|
rsaKey = {
|
2815
2815
|
keyId,
|
@@ -2877,7 +2877,7 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
2877
2877
|
});
|
2878
2878
|
const keyJwkPairs = [];
|
2879
2879
|
for (const { keyId, privateKey } of keys) {
|
2880
|
-
const privateKeyJwk = await
|
2880
|
+
const privateKeyJwk = await require_http.exportJwk(privateKey);
|
2881
2881
|
keyJwkPairs.push({
|
2882
2882
|
keyId: keyId.href,
|
2883
2883
|
privateKey: privateKeyJwk
|
@@ -3577,7 +3577,7 @@ var ContextImpl = class ContextImpl {
|
|
3577
3577
|
});
|
3578
3578
|
}
|
3579
3579
|
sendActivity(sender, recipients, activity, options = {}) {
|
3580
|
-
const tracer = this.tracerProvider.getTracer(
|
3580
|
+
const tracer = this.tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
|
3581
3581
|
return tracer.startActiveSpan(this.federation.outboxQueue == null || options.immediate ? "activitypub.outbox" : "activitypub.fanout", {
|
3582
3582
|
kind: this.federation.outboxQueue == null || options.immediate ? __opentelemetry_api.SpanKind.CLIENT : __opentelemetry_api.SpanKind.PRODUCER,
|
3583
3583
|
attributes: {
|
@@ -3634,7 +3634,7 @@ var ContextImpl = class ContextImpl {
|
|
3634
3634
|
keys = sender;
|
3635
3635
|
} else keys = [sender];
|
3636
3636
|
if (keys.length < 1) throw new TypeError("The sender's keys must not be empty.");
|
3637
|
-
for (const { privateKey } of keys)
|
3637
|
+
for (const { privateKey } of keys) require_http.validateCryptoKey(privateKey, "private");
|
3638
3638
|
const opts = { context: this };
|
3639
3639
|
let expandedRecipients;
|
3640
3640
|
if (Array.isArray(recipients)) expandedRecipients = recipients;
|
@@ -3675,7 +3675,7 @@ var ContextImpl = class ContextImpl {
|
|
3675
3675
|
}
|
3676
3676
|
const keyJwkPairs = await Promise.all(keys.map(async ({ keyId, privateKey }) => ({
|
3677
3677
|
keyId: keyId.href,
|
3678
|
-
privateKey: await
|
3678
|
+
privateKey: await require_http.exportJwk(privateKey)
|
3679
3679
|
})));
|
3680
3680
|
const carrier = {};
|
3681
3681
|
__opentelemetry_api.propagation.inject(__opentelemetry_api.context.active(), carrier);
|
@@ -3723,7 +3723,7 @@ var ContextImpl = class ContextImpl {
|
|
3723
3723
|
}
|
3724
3724
|
routeActivity(recipient, activity, options = {}) {
|
3725
3725
|
const tracerProvider = this.tracerProvider ?? this.tracerProvider;
|
3726
|
-
const tracer = tracerProvider.getTracer(
|
3726
|
+
const tracer = tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
|
3727
3727
|
return tracer.startActiveSpan("activitypub.inbox", {
|
3728
3728
|
kind: this.federation.inboxQueue == null || options.immediate ? __opentelemetry_api.SpanKind.INTERNAL : __opentelemetry_api.SpanKind.PRODUCER,
|
3729
3729
|
attributes: { "activitypub.activity.type": require_actor.getTypeId(activity).href }
|
@@ -3941,7 +3941,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
3941
3941
|
});
|
3942
3942
|
}
|
3943
3943
|
forwardActivity(forwarder, recipients, options) {
|
3944
|
-
const tracer = this.tracerProvider.getTracer(
|
3944
|
+
const tracer = this.tracerProvider.getTracer(require_request.deno_default.name, require_request.deno_default.version);
|
3945
3945
|
return tracer.startActiveSpan("activitypub.outbox", {
|
3946
3946
|
kind: this.federation.outboxQueue == null || options?.immediate ? __opentelemetry_api.SpanKind.CLIENT : __opentelemetry_api.SpanKind.PRODUCER,
|
3947
3947
|
attributes: { "activitypub.activity.type": this.activityType }
|
@@ -4042,7 +4042,7 @@ var InboxContextImpl = class InboxContextImpl extends ContextImpl {
|
|
4042
4042
|
});
|
4043
4043
|
const keyJwkPairs = [];
|
4044
4044
|
for (const { keyId, privateKey } of keys) {
|
4045
|
-
const privateKeyJwk = await
|
4045
|
+
const privateKeyJwk = await require_http.exportJwk(privateKey);
|
4046
4046
|
keyJwkPairs.push({
|
4047
4047
|
keyId: keyId.href,
|
4048
4048
|
privateKey: privateKeyJwk
|
@@ -1,5 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
import { Collection, Link, Object as Object$1 } from "./vocab-
|
1
|
+
import { GetUserAgentOptions } from "./request-BbHkedIU.cjs";
|
2
|
+
import { Collection, Link, Object as Object$1 } from "./vocab-DCBw44JZ.cjs";
|
3
|
+
import { DocumentLoader } from "@fedify/vocab-runtime";
|
3
4
|
import { TracerProvider } from "@opentelemetry/api";
|
4
5
|
|
5
6
|
//#region src/vocab/lookup.d.ts
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import { GetUserAgentOptions } from "./
|
3
|
+
import { GetUserAgentOptions } from "./request-U1t6zZtk.js";
|
4
4
|
import { TracerProvider } from "@opentelemetry/api";
|
5
5
|
|
6
6
|
//#region src/webfinger/jrd.d.ts
|
@@ -0,0 +1,107 @@
|
|
1
|
+
import { HttpMessageSignaturesSpecDeterminer } from "./http-B6SKO6NJ.cjs";
|
2
|
+
import { KvKey, KvStore } from "./kv-BMKIFXNW.cjs";
|
3
|
+
import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
|
4
|
+
import { TracerProvider } from "@opentelemetry/api";
|
5
|
+
|
6
|
+
//#region src/utils/docloader.d.ts
|
7
|
+
/**
|
8
|
+
* Options for {@link getAuthenticatedDocumentLoader}.
|
9
|
+
* @see {@link getAuthenticatedDocumentLoader}
|
10
|
+
* @since 1.3.0
|
11
|
+
*/
|
12
|
+
interface GetAuthenticatedDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
13
|
+
/**
|
14
|
+
* An optional spec determiner for HTTP Message Signatures.
|
15
|
+
* It determines the spec to use for signing requests.
|
16
|
+
* It is used for double-knocking
|
17
|
+
* (see <https://swicg.github.io/activitypub-http-signature/#how-to-upgrade-supported-versions>).
|
18
|
+
* @since 1.6.0
|
19
|
+
*/
|
20
|
+
specDeterminer?: HttpMessageSignaturesSpecDeterminer;
|
21
|
+
/**
|
22
|
+
* The OpenTelemetry tracer provider. If omitted, the global tracer provider
|
23
|
+
* is used.
|
24
|
+
* @since 1.6.0
|
25
|
+
*/
|
26
|
+
tracerProvider?: TracerProvider;
|
27
|
+
}
|
28
|
+
/**
|
29
|
+
* Gets an authenticated {@link DocumentLoader} for the given identity.
|
30
|
+
* Note that an authenticated document loader intentionally does not cache
|
31
|
+
* the fetched documents.
|
32
|
+
* @param identity The identity to get the document loader for.
|
33
|
+
* The actor's key pair.
|
34
|
+
* @param options The options for the document loader.
|
35
|
+
* @returns The authenticated document loader.
|
36
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
37
|
+
* @since 0.4.0
|
38
|
+
*/
|
39
|
+
declare function getAuthenticatedDocumentLoader(identity: {
|
40
|
+
keyId: URL;
|
41
|
+
privateKey: CryptoKey;
|
42
|
+
}, {
|
43
|
+
allowPrivateAddress,
|
44
|
+
userAgent,
|
45
|
+
specDeterminer,
|
46
|
+
tracerProvider
|
47
|
+
}?: GetAuthenticatedDocumentLoaderOptions): DocumentLoader;
|
48
|
+
/**
|
49
|
+
* A JSON-LD document loader that utilizes the browser's `fetch` API.
|
50
|
+
*
|
51
|
+
* This loader preloads the below frequently used contexts:
|
52
|
+
*
|
53
|
+
* - <https://www.w3.org/ns/activitystreams>
|
54
|
+
* - <https://w3id.org/security/v1>
|
55
|
+
* - <https://w3id.org/security/data-integrity/v1>
|
56
|
+
* - <https://www.w3.org/ns/did/v1>
|
57
|
+
* - <https://w3id.org/security/multikey/v1>
|
58
|
+
* - <https://purl.archive.org/socialweb/webfinger>
|
59
|
+
* - <http://schema.org/>
|
60
|
+
* @param url The URL of the document to load.
|
61
|
+
* @param allowPrivateAddress Whether to allow fetching private network
|
62
|
+
* addresses. Turned off by default.
|
63
|
+
* @returns The remote document.
|
64
|
+
* @deprecated Use {@link getDocumentLoader} instead.
|
65
|
+
*/
|
66
|
+
//#endregion
|
67
|
+
//#region src/utils/kv-cache.d.ts
|
68
|
+
/**
|
69
|
+
* The parameters for {@link kvCache} function.
|
70
|
+
*/
|
71
|
+
interface KvCacheParameters {
|
72
|
+
/**
|
73
|
+
* The document loader to decorate with a cache.
|
74
|
+
*/
|
75
|
+
loader: DocumentLoader;
|
76
|
+
/**
|
77
|
+
* The key–value store to use for backing the cache.
|
78
|
+
*/
|
79
|
+
kv: KvStore;
|
80
|
+
/**
|
81
|
+
* The key prefix to use for namespacing the cache.
|
82
|
+
* `["_fedify", "remoteDocument"]` by default.
|
83
|
+
*/
|
84
|
+
prefix?: KvKey;
|
85
|
+
/**
|
86
|
+
* The per-URL cache rules in the array of `[urlPattern, duration]` pairs
|
87
|
+
* where `urlPattern` is either a string, a {@link URL}, or
|
88
|
+
* a {@link URLPattern} and `duration` is a {@link Temporal.Duration}.
|
89
|
+
* The `duration` is allowed to be at most 30 days.
|
90
|
+
*
|
91
|
+
* By default, 5 minutes for all URLs.
|
92
|
+
*/
|
93
|
+
rules?: [string | URL | URLPattern, Temporal.Duration][];
|
94
|
+
}
|
95
|
+
/**
|
96
|
+
* Decorates a {@link DocumentLoader} with a cache backed by a {@link Deno.Kv}.
|
97
|
+
* @param parameters The parameters for the cache.
|
98
|
+
* @returns The decorated document loader which is cache-enabled.
|
99
|
+
*/
|
100
|
+
declare function kvCache({
|
101
|
+
loader,
|
102
|
+
kv,
|
103
|
+
prefix,
|
104
|
+
rules
|
105
|
+
}: KvCacheParameters): DocumentLoader;
|
106
|
+
//#endregion
|
107
|
+
export { getAuthenticatedDocumentLoader, kvCache };
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
1
|
+
import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "./vocab-DCBw44JZ.cjs";
|
2
|
+
import { KeyCache } from "./http-B6SKO6NJ.cjs";
|
3
|
+
import { DocumentLoader } from "@fedify/vocab-runtime";
|
4
4
|
import { TracerProvider } from "@opentelemetry/api";
|
5
5
|
|
6
6
|
//#region src/sig/ld.d.ts
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import {
|
4
|
-
import { Collection, Link, Object as Object$1 } from "./vocab-
|
3
|
+
import { GetUserAgentOptions } from "./request-U1t6zZtk.js";
|
4
|
+
import { Collection, Link, Object as Object$1 } from "./vocab-ivDKb439.js";
|
5
5
|
import { TracerProvider } from "@opentelemetry/api";
|
6
|
+
import { DocumentLoader } from "@fedify/vocab-runtime";
|
6
7
|
|
7
8
|
//#region src/vocab/lookup.d.ts
|
8
9
|
/**
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
3
|
-
import { Activity } from "./vocab-
|
4
|
-
import { ActivityTransformer, Context } from "./context-
|
3
|
+
import { Activity } from "./vocab-ivDKb439.js";
|
4
|
+
import { ActivityTransformer, Context } from "./context-DqFifMwj.js";
|
5
5
|
|
6
6
|
//#region src/compat/transformers.d.ts
|
7
7
|
|