@fedify/fedify 1.6.12 → 1.6.13
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-5yLVgYbM.d.ts} +3 -3
- package/dist/{actor-BxaCJsn8.js → actor-CcchiJa2.js} +6 -6
- package/dist/{actor-7vCpWIGd.js → actor-_hg-8_KF.js} +319 -455
- package/dist/{assert-LOEeCUK5.js → assert-C-mZuSQl.js} +2 -2
- package/dist/{assert_equals-B44MxcIj.js → assert_equals-Dy0MG_Zw.js} +16 -16
- package/dist/{assert_instance_of-XtuFevV_.js → assert_instance_of-lS0Jr2iu.js} +2 -2
- package/dist/{assert_is_error-BTlryvT0.js → assert_is_error-CIYFACrT.js} +2 -2
- package/dist/{assert_not_equals-C685gKx6.js → assert_not_equals-C1azCAB0.js} +3 -6
- package/dist/{assert_rejects-DWQ4jaf9.js → assert_rejects-Bkh5lA1a.js} +3 -3
- package/dist/{assert_throws-YetpVSc-.js → assert_throws-CmpfkWEM.js} +3 -3
- package/dist/{authdocloader-CVhMTbv4.js → authdocloader-1Ja0Him4.js} +7 -9
- package/dist/{authdocloader-niAJMnCQ.js → authdocloader-D0Ds92Vk.js} +6 -8
- package/dist/{builder-DboGa9iv.js → builder-MOXlzktX.js} +7 -7
- package/dist/{chunk-Cx8LTkjm.js → chunk-DvTpRkcT.js} +22 -15
- package/dist/{client-Cd552pKL.d.ts → client-BvbhJik1.d.ts} +2 -2
- package/dist/{client-De_5-2EG.js → client-C0yKnQtt.js} +3 -3
- package/dist/{collection-Dfb0TPno.js → collection-XNLQhehO.js} +2 -3
- package/dist/{mod-CgmTOt4z.d.ts → compat/mod-MHHm8HmK.d.ts} +3 -3
- package/dist/compat/mod.js +1 -2
- package/dist/compat/transformers.test.js +34 -38
- package/dist/{context-DRhhOsMk.d.ts → context-C0X9n1tC.d.ts} +10 -10
- package/dist/{context-KOy1fHBn.js → context-D7ltDKkC.js} +5 -5
- package/dist/{docloader-09nVWLAZ.js → docloader-BDSHZfTJ.js} +1 -1
- package/dist/{docloader-CPBLJsVK.js → docloader-C8QMM0lt.js} +32 -152
- package/dist/{docloader-DlUDOVSe.d.ts → docloader-DecYq5GI.d.ts} +2 -2
- package/dist/{docloader-RFcxdgI8.js → docloader-M1Np6SYc.js} +31 -151
- package/dist/{esm-DO9PrujO.js → esm-BRXvTSrx.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-CLkToKJa.d.ts +6 -0
- 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-B__WhFrv.js → http-BDLuDcCk.js} +17 -26
- package/dist/{http-CnSGudcE.js → http-BHjHzW-Y.js} +17 -26
- package/dist/{http-BkUCISGt.d.ts → http-ByqMVN52.d.ts} +3 -3
- package/dist/{inbox-L4MTtAQ4.js → inbox-FoFUUhTd.js} +5 -5
- package/dist/{key-Dlbuqhbr.js → key-BABKdX0W.js} +5 -5
- package/dist/{key-BQg3A7eo.js → key-Bj3ZyKd0.js} +4 -4
- package/dist/key-CragWqc4.js +16 -0
- package/dist/key-OMbKIYLU.js +10 -0
- package/dist/{keycache-BEb0DSk7.js → keycache-DONR-3XM.js} +2 -2
- package/dist/{keys-CqpeF-EG.js → keys-KKGS1cpG.js} +2 -2
- package/dist/{kv-p8sC8PTT.d.ts → kv-CyvhW67T.d.ts} +1 -1
- package/dist/{kv-DohFOP2C.js → kv-DosGYGwV.js} +1 -1
- package/dist/{langstr-DbWheeIS.js → langstr-pFHBDU4y.js} +1 -1
- package/dist/{ld-45SsuOmB.js → ld-DWSCvUJ-.js} +9 -12
- package/dist/{lookup-vJccIKCS.d.ts → lookup-BULfTwGb.d.ts} +2 -2
- package/dist/{lookup-HY083HcK.js → lookup-C2TcPqxv.js} +4 -4
- package/dist/{lookup-CdHTw-tQ.js → lookup-DIQCWtDD.js} +3 -3
- package/dist/{lookup-CWdbkwKD.js → lookup-DZBZTzld.js} +6 -6
- package/dist/middleware-BdpSheEs.js +32 -0
- package/dist/{middleware-D2HU0DhQ.js → middleware-C9cbWvtY.js} +35 -39
- package/dist/middleware-CZQPvn1Y.js +17 -0
- package/dist/{middleware-Cg-eSyqX.js → middleware-DRRaBIs3.js} +38 -43
- package/dist/{mod-j45KmAfR.d.ts → mod-C3OG1oK4.d.ts} +4 -4
- package/dist/{mod-DSPyncxx.d.ts → mod-CMpqcqIz.d.ts} +3 -3
- package/dist/mod-zMq7BLOW.d.ts +20 -0
- package/dist/mod.js +17 -17
- package/dist/{mq-nceTGCuc.d.ts → mq-CITHOe0n.d.ts} +1 -1
- package/dist/{multibase-CnLHszip.js → multibase-DBcKTV2a.js} +1 -1
- package/dist/nodeinfo/client.test.js +19 -28
- package/dist/nodeinfo/handler.test.js +37 -44
- package/dist/nodeinfo/mod-DY5OWSvB.d.ts +4 -0
- 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-BPGFI8Z3.d.ts} +4 -4
- package/dist/{owner-BYxqeMiw.js → owner-BSBuyxV4.js} +4 -4
- package/dist/{proof-DVYup76O.js → proof-B8LPOkvZ.js} +14 -19
- package/dist/{proof-BjHA4H_1.js → proof-CBHYxfh3.js} +11 -13
- package/dist/{retry-BiIhZWgD.js → retry-BQet39_l.js} +1 -1
- package/dist/{router-D_aVZZUc.js → router-BuDkN4RQ.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/{mod-BTHfUeLo.d.ts → runtime/mod-C4NyJ6RS.d.ts} +4 -3
- 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-D9d-VO-_.js} +7 -17
- package/dist/{send-BQA1p7vs.js → send-Cah-Z3UO.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-DM0ceGER.d.ts +6 -0
- 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-BdP_WkD-.js} +7 -13
- package/dist/testing/docloader.test.js +9 -12
- package/dist/testing/mod.js +2 -1
- package/dist/{testing-DLyvtiiW.js → testing-qaAD4B0t.js} +2 -2
- package/dist/{transformers-ghwJuzGY.js → transformers-CFSWUhNi.js} +1 -1
- package/dist/{type-CFuiGLz9.js → type-DFsmi-p1.js} +1 -1
- package/dist/{types-D7_MRRa4.js → types-BXvx0wJm.js} +8 -18
- package/dist/{types-CJHS5pXl.js → types-CB_2uuCA.js} +2 -2
- package/dist/{url-C2xuoQD1.js → url-BdNvnK9P.js} +1 -1
- package/dist/vocab/actor.test.js +76 -128
- package/dist/vocab/lookup.test.js +19 -23
- package/dist/vocab/mod-CgB887se.d.ts +6 -0
- 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-DVEzP_bQ.js → vocab-B0flx0SI.js} +318 -454
- package/dist/{vocab-DSFLLLe6.d.ts → vocab-BQaYsnhp.d.ts} +2 -2
- package/dist/{vocab-aaGb1Tji.js → vocab-BXeM76FR.js} +5 -5
- package/dist/webfinger/handler.test.js +40 -48
- package/dist/webfinger/lookup.test.js +12 -15
- package/dist/webfinger/mod-CE5bmzpH.d.ts +4 -0
- package/dist/webfinger/mod.js +2 -3
- package/dist/x/{cfworkers.d.ts → cfworkers-D_9uuXWs.d.ts} +2 -2
- package/dist/x/cfworkers.test.js +7 -9
- package/dist/x/{hono.d.ts → hono-TxxAGdy4.d.ts} +2 -11
- package/dist/x/{sveltekit.d.ts → sveltekit-KCF9gOdN.d.ts} +2 -11
- package/package.json +1 -1
- package/dist/compat/mod.d.ts +0 -15
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/federation/mod.d.ts +0 -15
- package/dist/federation-DyRlaC4X.js +0 -192
- package/dist/key-BG_CTepE.js +0 -10
- package/dist/key-CeY-eted.js +0 -16
- package/dist/middleware-BP-XbRGC.js +0 -17
- package/dist/middleware-JoLpCiMC.js +0 -33
- package/dist/mod-1pDWKvUL.d.ts +0 -2
- package/dist/mod-GIh5OYxW.d.ts +0 -2
- package/dist/mod-g0xFzAP9.d.ts +0 -2
- package/dist/mod.d.ts +0 -20
- package/dist/nodeinfo/mod.d.ts +0 -7
- package/dist/nodeinfo-CyEbLjHs.js +0 -4
- package/dist/runtime/mod.d.ts +0 -8
- package/dist/runtime-BSkOVUWM.js +0 -4
- package/dist/sig/mod.d.ts +0 -10
- package/dist/sig-BXJO--F9.js +0 -4
- package/dist/vocab/mod.d.ts +0 -8
- package/dist/webfinger/mod.d.ts +0 -7
- package/dist/webfinger-C3GIyXIg.js +0 -4
- /package/dist/compat/{transformers.test.d.ts → transformers.test-DnJbd34u.d.ts} +0 -0
- /package/dist/{denokv-B_GFWjrl.js → denokv-XeyH3cFs.js} +0 -0
- /package/dist/federation/{builder.test.d.ts → builder.test-Bpt6NOZ6.d.ts} +0 -0
- /package/dist/federation/{collection.test.d.ts → collection.test-DKJ6JOZz.d.ts} +0 -0
- /package/dist/federation/{handler.test.d.ts → handler.test-BMT7uLC0.d.ts} +0 -0
- /package/dist/federation/{inbox.test.d.ts → inbox.test-Do6i02Qp.d.ts} +0 -0
- /package/dist/federation/{keycache.test.d.ts → keycache.test-BT83IPZY.d.ts} +0 -0
- /package/dist/federation/{kv.test.d.ts → kv.test-kFzzF2VN.d.ts} +0 -0
- /package/dist/federation/{middleware.test.d.ts → middleware.test-B1R4_e3-.d.ts} +0 -0
- /package/dist/federation/{mq.test.d.ts → mq.test-l79EQQOe.d.ts} +0 -0
- /package/dist/federation/{retry.test.d.ts → retry.test-BqS50VCX.d.ts} +0 -0
- /package/dist/federation/{router.test.d.ts → router.test-CYQl4po-.d.ts} +0 -0
- /package/dist/federation/{send.test.d.ts → send.test-COUnNUzv.d.ts} +0 -0
- /package/dist/nodeinfo/{client.test.d.ts → client.test-CZLe79hL.d.ts} +0 -0
- /package/dist/nodeinfo/{handler.test.d.ts → handler.test-B-EDZ_hK.d.ts} +0 -0
- /package/dist/nodeinfo/{semver.test.d.ts → semver.test-BEuuQSEM.d.ts} +0 -0
- /package/dist/nodeinfo/{types.test.d.ts → types.test-B5AT89WV.d.ts} +0 -0
- /package/dist/runtime/{authdocloader.test.d.ts → authdocloader.test-hCRKzn9v.d.ts} +0 -0
- /package/dist/runtime/{docloader.test.d.ts → docloader.test-CVd7i_5h.d.ts} +0 -0
- /package/dist/runtime/{key.test.d.ts → key.test-DBsILYSD.d.ts} +0 -0
- /package/dist/runtime/{langstr.test.d.ts → langstr.test-CiKxuuRY.d.ts} +0 -0
- /package/dist/runtime/multibase/{multibase.test.d.ts → multibase.test-Brh6gPBP.d.ts} +0 -0
- /package/dist/runtime/{url.test.d.ts → url.test-DlRqkU2j.d.ts} +0 -0
- /package/dist/sig/{http.test.d.ts → http.test-BpXNAWNI.d.ts} +0 -0
- /package/dist/sig/{key.test.d.ts → key.test-B2iLIugy.d.ts} +0 -0
- /package/dist/sig/{ld.test.d.ts → ld.test-D-cI70Gw.d.ts} +0 -0
- /package/dist/sig/{owner.test.d.ts → owner.test-B_YRjMPj.d.ts} +0 -0
- /package/dist/sig/{proof.test.d.ts → proof.test-BagEM_-4.d.ts} +0 -0
- /package/dist/testing/{docloader.test.d.ts → docloader.test-lrzf6sDZ.d.ts} +0 -0
- /package/dist/testing/{mod.d.ts → mod-3uM8ZvS7.d.ts} +0 -0
- /package/dist/vocab/{actor.test.d.ts → actor.test-ClC-iVWk.d.ts} +0 -0
- /package/dist/vocab/{lookup.test.d.ts → lookup.test-Cq1I-27w.d.ts} +0 -0
- /package/dist/vocab/{type.test.d.ts → type.test-bfFiYGcs.d.ts} +0 -0
- /package/dist/vocab/{vocab.test.d.ts → vocab.test-h-ZTisfu.d.ts} +0 -0
- /package/dist/webfinger/{handler.test.d.ts → handler.test-DiUeEDDD.d.ts} +0 -0
- /package/dist/webfinger/{lookup.test.d.ts → lookup.test-D9onm3U3.d.ts} +0 -0
- /package/dist/x/{cfworkers.test.d.ts → cfworkers.test-KXHlJ29z.d.ts} +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-DvTpRkcT.js";
|
|
7
|
+
import { t as assertEquals } from "../assert_equals-Dy0MG_Zw.js";
|
|
8
|
+
import { t as assert } from "../assert-C-mZuSQl.js";
|
|
9
|
+
import "../docloader-C8QMM0lt.js";
|
|
10
|
+
import "../url-BdNvnK9P.js";
|
|
11
|
+
import "../multibase-DBcKTV2a.js";
|
|
12
|
+
import { S as Person, T as Service, c as Endpoints, r as Application, t as Activity, u as Group } from "../vocab-B0flx0SI.js";
|
|
13
|
+
import "../langstr-pFHBDU4y.js";
|
|
14
|
+
import "../lookup-C2TcPqxv.js";
|
|
15
|
+
import "../actor-CcchiJa2.js";
|
|
16
|
+
import "../key-BABKdX0W.js";
|
|
17
|
+
import { l as verifyRequest } from "../http-BHjHzW-Y.js";
|
|
18
|
+
import { t as doesActorOwnKey } from "../owner-BSBuyxV4.js";
|
|
19
|
+
import { n as sendActivity, t as extractInboxes } from "../send-Cah-Z3UO.js";
|
|
20
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
21
|
+
import "../std__assert-BdP_WkD-.js";
|
|
22
|
+
import { n as assertFalse, t as assertRejects } from "../assert_rejects-Bkh5lA1a.js";
|
|
23
|
+
import "../assert_is_error-CIYFACrT.js";
|
|
24
|
+
import { t as assertNotEquals } from "../assert_not_equals-C1azCAB0.js";
|
|
25
|
+
import "../assert_throws-CmpfkWEM.js";
|
|
26
|
+
import { t as mockDocumentLoader } from "../docloader-BDSHZfTJ.js";
|
|
27
|
+
import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-KKGS1cpG.js";
|
|
28
|
+
import { t as esm_default } from "../esm-BRXvTSrx.js";
|
|
30
29
|
|
|
31
30
|
//#region federation/send.test.ts
|
|
32
31
|
test("extractInboxes()", () => {
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import { CryptographicKey } from "./actor-
|
|
7
|
-
import {
|
|
5
|
+
import { d as name, f as version } from "./docloader-M1Np6SYc.js";
|
|
6
|
+
import { y as CryptographicKey } from "./actor-_hg-8_KF.js";
|
|
7
|
+
import { a as validateCryptoKey, n as fetchKey } from "./key-Bj3ZyKd0.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
@@ -24,7 +24,7 @@ import { Item, decodeDict, encodeItem } from "structured-field-values";
|
|
|
24
24
|
*/
|
|
25
25
|
async function signRequest(request, privateKey, keyId, options = {}) {
|
|
26
26
|
validateCryptoKey(privateKey, "private");
|
|
27
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
27
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.sign", async (span) => {
|
|
28
28
|
try {
|
|
29
29
|
const spec = options.spec ?? "draft-cavage-http-signatures-12";
|
|
30
30
|
let signed;
|
|
@@ -33,7 +33,7 @@ async function signRequest(request, privateKey, keyId, options = {}) {
|
|
|
33
33
|
if (span.isRecording()) {
|
|
34
34
|
span.setAttribute(ATTR_HTTP_REQUEST_METHOD, signed.method);
|
|
35
35
|
span.setAttribute(ATTR_URL_FULL, signed.url);
|
|
36
|
-
for (const [name, value] of signed.headers) span.setAttribute(ATTR_HTTP_REQUEST_HEADER(name), value);
|
|
36
|
+
for (const [name$1, value] of signed.headers) span.setAttribute(ATTR_HTTP_REQUEST_HEADER(name$1), value);
|
|
37
37
|
span.setAttribute("http_signatures.key_id", keyId.href);
|
|
38
38
|
}
|
|
39
39
|
return signed;
|
|
@@ -61,8 +61,8 @@ async function signRequestDraft(request, privateKey, keyId, span, currentTime) {
|
|
|
61
61
|
}
|
|
62
62
|
if (!headers.has("Date")) headers.set("Date", currentTime == null ? (/* @__PURE__ */ new Date()).toUTCString() : new Date(currentTime.toString()).toUTCString());
|
|
63
63
|
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");
|
|
64
|
+
const headerNames = serialized.map(([name$1]) => name$1);
|
|
65
|
+
const message = serialized.map(([name$1, value]) => `${name$1}: ${value.trim()}`).join("\n");
|
|
66
66
|
const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, new TextEncoder().encode(message));
|
|
67
67
|
const sigHeader = `keyId="${keyId.href}",algorithm="rsa-sha256",headers="${headerNames.join(" ")}",signature="${encodeBase64(signature)}"`;
|
|
68
68
|
headers.set("Signature", sigHeader);
|
|
@@ -119,9 +119,7 @@ function createRfc9421SignatureBase(request, components, parameters) {
|
|
|
119
119
|
* @returns The formatted signature string.
|
|
120
120
|
*/
|
|
121
121
|
function formatRfc9421Signature(signature, components, parameters) {
|
|
122
|
-
|
|
123
|
-
const signatureValue = `sig1=:${encodeBase64(signature)}:`;
|
|
124
|
-
return [signatureInputValue, signatureValue];
|
|
122
|
+
return [`sig1=("${components.join("\" \"")}");${parameters}`, `sig1=:${encodeBase64(signature)}:`];
|
|
125
123
|
}
|
|
126
124
|
/**
|
|
127
125
|
* Parse RFC 9421 Signature-Input header.
|
|
@@ -251,11 +249,11 @@ const supportedHashAlgorithms = {
|
|
|
251
249
|
* could not be verified.
|
|
252
250
|
*/
|
|
253
251
|
async function verifyRequest(request, options = {}) {
|
|
254
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
252
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.verify", async (span) => {
|
|
255
253
|
if (span.isRecording()) {
|
|
256
254
|
span.setAttribute(ATTR_HTTP_REQUEST_METHOD, request.method);
|
|
257
255
|
span.setAttribute(ATTR_URL_FULL, request.url);
|
|
258
|
-
for (const [name, value] of request.headers) span.setAttribute(ATTR_HTTP_REQUEST_HEADER(name), value);
|
|
256
|
+
for (const [name$1, value] of request.headers) span.setAttribute(ATTR_HTTP_REQUEST_HEADER(name$1), value);
|
|
259
257
|
}
|
|
260
258
|
try {
|
|
261
259
|
let spec = options.spec;
|
|
@@ -438,7 +436,7 @@ async function verifyRequestDraft(request, span, { documentLoader, contextLoader
|
|
|
438
436
|
logger.debug("Failed to verify; required headers missing in the Signature header: {headers}.", { headers });
|
|
439
437
|
return null;
|
|
440
438
|
}
|
|
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");
|
|
439
|
+
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
440
|
const sig = decodeBase64(signature);
|
|
443
441
|
span?.setAttribute("http_signatures.signature", encodeHex(sig));
|
|
444
442
|
if (!await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, sig, new TextEncoder().encode(message))) {
|
|
@@ -605,8 +603,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
|
|
|
605
603
|
logger.debug("Failed to verify; Content-Digest header required but not found.", { components: sigInput.components });
|
|
606
604
|
continue;
|
|
607
605
|
}
|
|
608
|
-
|
|
609
|
-
if (!await verifyRfc9421ContentDigest(contentDigestHeader, body)) {
|
|
606
|
+
if (!await verifyRfc9421ContentDigest(contentDigestHeader, await request.arrayBuffer())) {
|
|
610
607
|
logger.debug("Failed to verify; Content-Digest verification failed.", { contentDigest: contentDigestHeader });
|
|
611
608
|
continue;
|
|
612
609
|
}
|
|
@@ -726,11 +723,8 @@ async function doubleKnock(request, identity, options = {}) {
|
|
|
726
723
|
});
|
|
727
724
|
log?.(signedRequest);
|
|
728
725
|
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) {
|
|
726
|
+
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);
|
|
727
|
+
else if (response.status === 400 || response.status === 401 || response.status > 401) {
|
|
734
728
|
const spec = firstTrySpec === "draft-cavage-http-signatures-12" ? "rfc9421" : "draft-cavage-http-signatures-12";
|
|
735
729
|
getLogger([
|
|
736
730
|
"fedify",
|
|
@@ -748,11 +742,8 @@ async function doubleKnock(request, identity, options = {}) {
|
|
|
748
742
|
});
|
|
749
743
|
log?.(signedRequest);
|
|
750
744
|
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);
|
|
745
|
+
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);
|
|
746
|
+
else if (response.status !== 400 && response.status !== 401) await specDeterminer?.rememberSpec(origin, spec);
|
|
756
747
|
} else await specDeterminer?.rememberSpec(origin, firstTrySpec);
|
|
757
748
|
return response;
|
|
758
749
|
}
|
|
@@ -785,4 +776,4 @@ function timingSafeEqual(a, b) {
|
|
|
785
776
|
}
|
|
786
777
|
|
|
787
778
|
//#endregion
|
|
788
|
-
export {
|
|
779
|
+
export { signRequest as n, verifyRequest as r, doubleKnock as t };
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { CryptographicKey } from "./vocab-
|
|
8
|
-
import {
|
|
6
|
+
import { d as version, u as name } from "./docloader-C8QMM0lt.js";
|
|
7
|
+
import { o as CryptographicKey } from "./vocab-B0flx0SI.js";
|
|
8
|
+
import { a as validateCryptoKey, n as fetchKey } from "./key-BABKdX0W.js";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
10
10
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
11
11
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
@@ -25,7 +25,7 @@ import { Item, decodeDict, encodeItem } from "structured-field-values";
|
|
|
25
25
|
*/
|
|
26
26
|
async function signRequest(request, privateKey, keyId, options = {}) {
|
|
27
27
|
validateCryptoKey(privateKey, "private");
|
|
28
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
28
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.sign", async (span) => {
|
|
29
29
|
try {
|
|
30
30
|
const spec = options.spec ?? "draft-cavage-http-signatures-12";
|
|
31
31
|
let signed;
|
|
@@ -34,7 +34,7 @@ async function signRequest(request, privateKey, keyId, options = {}) {
|
|
|
34
34
|
if (span.isRecording()) {
|
|
35
35
|
span.setAttribute(ATTR_HTTP_REQUEST_METHOD, signed.method);
|
|
36
36
|
span.setAttribute(ATTR_URL_FULL, signed.url);
|
|
37
|
-
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);
|
|
38
38
|
span.setAttribute("http_signatures.key_id", keyId.href);
|
|
39
39
|
}
|
|
40
40
|
return signed;
|
|
@@ -62,8 +62,8 @@ async function signRequestDraft(request, privateKey, keyId, span, currentTime) {
|
|
|
62
62
|
}
|
|
63
63
|
if (!headers.has("Date")) headers.set("Date", currentTime == null ? (/* @__PURE__ */ new Date()).toUTCString() : new Date(currentTime.toString()).toUTCString());
|
|
64
64
|
const serialized = [["(request-target)", `${request.method.toLowerCase()} ${url.pathname}`], ...headers];
|
|
65
|
-
const headerNames = serialized.map(([name]) => name);
|
|
66
|
-
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");
|
|
67
67
|
const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, new TextEncoder().encode(message));
|
|
68
68
|
const sigHeader = `keyId="${keyId.href}",algorithm="rsa-sha256",headers="${headerNames.join(" ")}",signature="${encodeBase64(signature)}"`;
|
|
69
69
|
headers.set("Signature", sigHeader);
|
|
@@ -120,9 +120,7 @@ function createRfc9421SignatureBase(request, components, parameters) {
|
|
|
120
120
|
* @returns The formatted signature string.
|
|
121
121
|
*/
|
|
122
122
|
function formatRfc9421Signature(signature, components, parameters) {
|
|
123
|
-
|
|
124
|
-
const signatureValue = `sig1=:${encodeBase64(signature)}:`;
|
|
125
|
-
return [signatureInputValue, signatureValue];
|
|
123
|
+
return [`sig1=("${components.join("\" \"")}");${parameters}`, `sig1=:${encodeBase64(signature)}:`];
|
|
126
124
|
}
|
|
127
125
|
/**
|
|
128
126
|
* Parse RFC 9421 Signature-Input header.
|
|
@@ -252,11 +250,11 @@ const supportedHashAlgorithms = {
|
|
|
252
250
|
* could not be verified.
|
|
253
251
|
*/
|
|
254
252
|
async function verifyRequest(request, options = {}) {
|
|
255
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
253
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.verify", async (span) => {
|
|
256
254
|
if (span.isRecording()) {
|
|
257
255
|
span.setAttribute(ATTR_HTTP_REQUEST_METHOD, request.method);
|
|
258
256
|
span.setAttribute(ATTR_URL_FULL, request.url);
|
|
259
|
-
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);
|
|
260
258
|
}
|
|
261
259
|
try {
|
|
262
260
|
let spec = options.spec;
|
|
@@ -439,7 +437,7 @@ async function verifyRequestDraft(request, span, { documentLoader, contextLoader
|
|
|
439
437
|
logger.debug("Failed to verify; required headers missing in the Signature header: {headers}.", { headers });
|
|
440
438
|
return null;
|
|
441
439
|
}
|
|
442
|
-
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");
|
|
443
441
|
const sig = decodeBase64(signature);
|
|
444
442
|
span?.setAttribute("http_signatures.signature", encodeHex(sig));
|
|
445
443
|
if (!await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, sig, new TextEncoder().encode(message))) {
|
|
@@ -606,8 +604,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
|
|
|
606
604
|
logger.debug("Failed to verify; Content-Digest header required but not found.", { components: sigInput.components });
|
|
607
605
|
continue;
|
|
608
606
|
}
|
|
609
|
-
|
|
610
|
-
if (!await verifyRfc9421ContentDigest(contentDigestHeader, body)) {
|
|
607
|
+
if (!await verifyRfc9421ContentDigest(contentDigestHeader, await request.arrayBuffer())) {
|
|
611
608
|
logger.debug("Failed to verify; Content-Digest verification failed.", { contentDigest: contentDigestHeader });
|
|
612
609
|
continue;
|
|
613
610
|
}
|
|
@@ -727,11 +724,8 @@ async function doubleKnock(request, identity, options = {}) {
|
|
|
727
724
|
});
|
|
728
725
|
log?.(signedRequest);
|
|
729
726
|
let response = await fetch(signedRequest, { redirect: "manual" });
|
|
730
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location"))
|
|
731
|
-
|
|
732
|
-
const body = request.method !== "GET" && request.method !== "HEAD" ? await request.clone().arrayBuffer() : void 0;
|
|
733
|
-
return doubleKnock(createRedirectRequest(request, location, body), identity, options);
|
|
734
|
-
} 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) {
|
|
735
729
|
const spec = firstTrySpec === "draft-cavage-http-signatures-12" ? "rfc9421" : "draft-cavage-http-signatures-12";
|
|
736
730
|
getLogger([
|
|
737
731
|
"fedify",
|
|
@@ -749,11 +743,8 @@ async function doubleKnock(request, identity, options = {}) {
|
|
|
749
743
|
});
|
|
750
744
|
log?.(signedRequest);
|
|
751
745
|
response = await fetch(signedRequest, { redirect: "manual" });
|
|
752
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location"))
|
|
753
|
-
|
|
754
|
-
const body = request.method !== "GET" && request.method !== "HEAD" ? await request.clone().arrayBuffer() : void 0;
|
|
755
|
-
return doubleKnock(createRedirectRequest(request, location, body), identity, options);
|
|
756
|
-
} 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);
|
|
757
748
|
} else await specDeterminer?.rememberSpec(origin, firstTrySpec);
|
|
758
749
|
return response;
|
|
759
750
|
}
|
|
@@ -786,4 +777,4 @@ function timingSafeEqual(a, b) {
|
|
|
786
777
|
}
|
|
787
778
|
|
|
788
779
|
//#endregion
|
|
789
|
-
export {
|
|
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 };
|
|
@@ -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-DecYq5GI.js";
|
|
4
|
+
import { B as Multikey, m as CryptographicKey } from "./vocab-BQaYsnhp.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 };
|
|
@@ -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-C8QMM0lt.js";
|
|
7
|
+
import { t as Activity } from "./vocab-B0flx0SI.js";
|
|
8
|
+
import { t as getTypeId } from "./type-DFsmi-p1.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 };
|
|
@@ -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-C8QMM0lt.js";
|
|
7
|
+
import { _ as Object$1, o as CryptographicKey } from "./vocab-B0flx0SI.js";
|
|
8
|
+
import { i as isActor } from "./actor-CcchiJa2.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 };
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { d as name, f as version, i as getDocumentLoader } from "./docloader-M1Np6SYc.js";
|
|
6
|
+
import { i as isActor, q as Object$1, y as CryptographicKey } from "./actor-_hg-8_KF.js";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
|
|
@@ -100,7 +100,7 @@ async function importJwk(jwk, type) {
|
|
|
100
100
|
* @since 1.3.0
|
|
101
101
|
*/
|
|
102
102
|
function fetchKey(keyId, cls, options = {}) {
|
|
103
|
-
const tracer = (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
103
|
+
const tracer = (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version);
|
|
104
104
|
keyId = typeof keyId === "string" ? new URL(keyId) : keyId;
|
|
105
105
|
return tracer.startActiveSpan("activitypub.fetch_key", {
|
|
106
106
|
kind: SpanKind.CLIENT,
|
|
@@ -254,4 +254,4 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
//#endregion
|
|
257
|
-
export {
|
|
257
|
+
export { validateCryptoKey as a, importJwk as i, fetchKey as n, generateCryptoKeyPair as r, exportJwk as t };
|
|
@@ -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-DvTpRkcT.js";
|
|
7
|
+
import "./docloader-C8QMM0lt.js";
|
|
8
|
+
import "./url-BdNvnK9P.js";
|
|
9
|
+
import "./multibase-DBcKTV2a.js";
|
|
10
|
+
import "./vocab-B0flx0SI.js";
|
|
11
|
+
import "./langstr-pFHBDU4y.js";
|
|
12
|
+
import "./lookup-C2TcPqxv.js";
|
|
13
|
+
import "./actor-CcchiJa2.js";
|
|
14
|
+
import { a as validateCryptoKey, i as importJwk, n as fetchKey, r as generateCryptoKeyPair, t as exportJwk } from "./key-BABKdX0W.js";
|
|
15
|
+
|
|
16
|
+
export { validateCryptoKey };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
|
|
5
|
+
import "./docloader-M1Np6SYc.js";
|
|
6
|
+
import "./actor-_hg-8_KF.js";
|
|
7
|
+
import "./lookup-DIQCWtDD.js";
|
|
8
|
+
import { a as validateCryptoKey, i as importJwk, n as fetchKey, r as generateCryptoKeyPair, t as exportJwk } from "./key-Bj3ZyKd0.js";
|
|
9
|
+
|
|
10
|
+
export { validateCryptoKey };
|
|
@@ -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-B0flx0SI.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-B0flx0SI.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-C8QMM0lt.js";
|
|
7
|
+
import { _ as Object$1, o as CryptographicKey, t as Activity } from "./vocab-B0flx0SI.js";
|
|
8
|
+
import { t as getTypeId } from "./type-DFsmi-p1.js";
|
|
9
|
+
import { a as validateCryptoKey, n as fetchKey } from "./key-BABKdX0W.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-DecYq5GI.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-C8QMM0lt.js";
|
|
7
|
+
import { a as validatePublicUrl, t as UrlError } from "./url-BdNvnK9P.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 };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { d as name, f as version, l as UrlError, o as getUserAgent, u as validatePublicUrl } from "./docloader-M1Np6SYc.js";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
|
|
@@ -21,7 +21,7 @@ const MAX_REDIRECTION = 5;
|
|
|
21
21
|
* @since 0.2.0
|
|
22
22
|
*/
|
|
23
23
|
async function lookupWebFinger(resource, options = {}) {
|
|
24
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
24
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("webfinger.lookup", {
|
|
25
25
|
kind: SpanKind.CLIENT,
|
|
26
26
|
attributes: {
|
|
27
27
|
"webfinger.resource": resource.toString(),
|
|
@@ -124,4 +124,4 @@ async function lookupWebFingerInternal(resource, options = {}) {
|
|
|
124
124
|
}
|
|
125
125
|
|
|
126
126
|
//#endregion
|
|
127
|
-
export { lookupWebFinger };
|
|
127
|
+
export { lookupWebFinger as t };
|