@fedify/fedify 1.7.12 → 1.7.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{actor-CPpvuBKU.d.ts → actor-Dx5YX74F.d.ts} +3 -3
- package/dist/{actor-GZRoTRqg.js → actor-OYVgkiZG.js} +329 -465
- package/dist/{actor-TYqJGdVq.js → actor-y7shp0CR.js} +6 -6
- 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-hiFSyM7V.js → authdocloader-C0JcfxUs.js} +7 -9
- package/dist/{authdocloader-BopfyipD.js → authdocloader-C2krvRo1.js} +6 -8
- package/dist/{builder-mi6RdzNE.js → builder-DaECqbbT.js} +7 -7
- package/dist/{chunk-Cx8LTkjm.js → chunk-DvTpRkcT.js} +22 -15
- package/dist/{client-DuUKk4pk.js → client-dfu57WLy.js} +3 -3
- package/dist/{client-DvtwXO7t.d.ts → client-wKLuY12i.d.ts} +2 -2
- package/dist/{collection-Dfb0TPno.js → collection-XNLQhehO.js} +2 -3
- package/dist/{mod-DFncUgcE.d.ts → compat/mod-Bwqav33K.d.ts} +3 -3
- package/dist/compat/mod.js +1 -2
- package/dist/compat/transformers.test.js +34 -38
- package/dist/{context-OBWjptjU.d.ts → context-CW_8R4BH.d.ts} +11 -11
- package/dist/{context-RMU32mk4.js → context-nxDPfAiA.js} +5 -5
- package/dist/{docloader-09nVWLAZ.js → docloader-BDSHZfTJ.js} +1 -1
- package/dist/{docloader-DJxET2fN.js → docloader-BU25UQLB.js} +31 -151
- package/dist/{docloader-Q42SMRIB.d.ts → docloader-D_MGP37Q.d.ts} +2 -2
- package/dist/{docloader-bgBm1Hd1.js → docloader-sGz4vcrK.js} +32 -152
- 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 +105 -134
- package/dist/federation/mod-DvlLc8Ru.d.ts +6 -0
- package/dist/federation/mod.js +206 -12
- package/dist/federation/mq.test.js +12 -17
- 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-D2DkwsjA.js → http-BhES0Sg9.js} +23 -30
- package/dist/{http-DMTrO3Ye.d.ts → http-DFZRNfDP.d.ts} +3 -3
- package/dist/{http-vqMAvOVs.js → http-DRePVWfE.js} +23 -30
- package/dist/{inbox-DAAZZl2k.js → inbox-Z_QlSGYN.js} +5 -5
- package/dist/key-CJuc1GE1.js +10 -0
- package/dist/{key-DmqJj57e.js → key-D2HZrCxh.js} +4 -4
- package/dist/{key-KVhaUM92.js → key-bMrDyA2T.js} +5 -5
- package/dist/key-eP5Yk7hl.js +16 -0
- package/dist/{keycache-C1pEuRyQ.js → keycache-B5Rr8Lbc.js} +2 -2
- package/dist/{keys-C4XQHW5_.js → keys-DK4k1R8e.js} +2 -2
- package/dist/{kv-DRaeSXco.d.ts → kv-CKqSUxHd.d.ts} +1 -1
- package/dist/{kv-BMY6Qf_A.js → kv-QeuZ51go.js} +1 -1
- package/dist/{langstr-DbWheeIS.js → langstr-pFHBDU4y.js} +1 -1
- package/dist/{ld-DzlJ_IpT.js → ld--auFISy7.js} +9 -12
- package/dist/{lookup-CSngxuWm.js → lookup-4uc2jh52.js} +3 -3
- package/dist/{lookup-DL62q3Xh.js → lookup-Bq8vhIG4.js} +4 -4
- package/dist/{lookup-Bf-K85bV.d.ts → lookup-CqI9jhXo.d.ts} +2 -2
- package/dist/{lookup-D0je8AqR.js → lookup-cHV4n1IB.js} +6 -6
- package/dist/middleware-72Tuh6Iw.js +17 -0
- package/dist/{middleware-3wVT6S9E.js → middleware-B7p-onxQ.js} +35 -39
- package/dist/middleware-DB3BUysJ.js +32 -0
- package/dist/{middleware-DlDXugwZ.js → middleware-QJjRfjjc.js} +38 -43
- package/dist/{mod-CCL2cvnI.d.ts → mod-BEZy4WHZ.d.ts} +4 -4
- package/dist/mod-DMn4Bxyg.d.ts +20 -0
- package/dist/{mod-CDzlVCUF.d.ts → mod-DjGYGrBd.d.ts} +3 -3
- package/dist/mod.js +17 -17
- package/dist/{mq-DYKDDJmp.d.ts → mq-Cgfbl44M.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--upgPcaX.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-D0cOz8R5.d.ts → owner-CewLNqWO.d.ts} +4 -4
- package/dist/{owner-81ey_76X.js → owner-DkTRLQAV.js} +4 -4
- package/dist/{proof-DlI7QNdn.js → proof-D4HXHDPz.js} +14 -19
- package/dist/{proof-BlULDH4H.js → proof-DT_xxRPF.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 +56 -56
- package/dist/runtime/key.test.js +31 -53
- package/dist/runtime/langstr.test.js +8 -10
- package/dist/{mod-qFMzZ3iF.d.ts → runtime/mod-BaH1vtHp.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-DdxfTHo6.js → send-axIyQX2p.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-BmJQTnPT.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-CmVV9LT1.js → types-Bk4b1bGc.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-BkXGAYkx.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 +109 -105
- package/dist/{vocab-DFlq4Wa6.js → vocab-DCHRuBGF.js} +328 -464
- package/dist/{vocab-CzEfWQk2.d.ts → vocab-DoBcp8ow.d.ts} +2 -2
- package/dist/{vocab-BebR0kAy.js → vocab-sMuiKIWm.js} +5 -5
- package/dist/webfinger/handler.test.js +40 -48
- package/dist/webfinger/lookup.test.js +12 -15
- package/dist/webfinger/mod-B1UhCvlL.d.ts +4 -0
- package/dist/webfinger/mod.js +2 -3
- package/dist/x/{cfworkers.d.ts → cfworkers-BIcR64Sf.d.ts} +2 -2
- package/dist/x/cfworkers.test.js +7 -9
- package/dist/x/{hono.d.ts → hono-DmQmp8wi.d.ts} +2 -11
- package/dist/x/{sveltekit.d.ts → sveltekit-Cvh0XnN4.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-B0aljx0V.js +0 -203
- package/dist/key-5ssHQ67E.js +0 -16
- package/dist/key-DSJGnD10.js +0 -10
- package/dist/middleware-CxFoFBD8.js +0 -33
- package/dist/middleware-w7_U3fFi.js +0 -17
- 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-CvROlGYX.js → denokv-NcJeZ6rP.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,10 +3,11 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import "../chunk-DvTpRkcT.js";
|
|
7
|
+
import { t as assertEquals, u as AssertionError } from "../assert_equals-Dy0MG_Zw.js";
|
|
8
|
+
import { t as createExponentialBackoffPolicy } from "../retry-BQet39_l.js";
|
|
9
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
10
|
+
import { t as assertNotEquals } from "../assert_not_equals-C1azCAB0.js";
|
|
10
11
|
|
|
11
12
|
//#region federation/retry.test.ts
|
|
12
13
|
test("createExponentialBackoffPolicy()", () => {
|
|
@@ -3,16 +3,15 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
8
|
-
import "../
|
|
9
|
-
import {
|
|
10
|
-
import { test } from "../testing-
|
|
11
|
-
import "../std__assert-
|
|
12
|
-
import { assertFalse } from "../assert_rejects-
|
|
13
|
-
import "../assert_is_error-
|
|
14
|
-
import "../
|
|
15
|
-
import { assertThrows } from "../assert_throws-YetpVSc-.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 { n as RouterError, t as Router } from "../router-BuDkN4RQ.js";
|
|
10
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
11
|
+
import "../std__assert-BdP_WkD-.js";
|
|
12
|
+
import { n as assertFalse } from "../assert_rejects-Bkh5lA1a.js";
|
|
13
|
+
import "../assert_is_error-CIYFACrT.js";
|
|
14
|
+
import { t as assertThrows } from "../assert_throws-CmpfkWEM.js";
|
|
16
15
|
|
|
17
16
|
//#region federation/router.test.ts
|
|
18
17
|
function setUp(options = {}) {
|
|
@@ -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-sGz4vcrK.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-DCHRuBGF.js";
|
|
13
|
+
import "../langstr-pFHBDU4y.js";
|
|
14
|
+
import "../lookup-Bq8vhIG4.js";
|
|
15
|
+
import "../actor-y7shp0CR.js";
|
|
16
|
+
import "../key-bMrDyA2T.js";
|
|
17
|
+
import { l as verifyRequest } from "../http-BhES0Sg9.js";
|
|
18
|
+
import { t as doesActorOwnKey } from "../owner-DkTRLQAV.js";
|
|
19
|
+
import { n as sendActivity, t as extractInboxes } from "../send-axIyQX2p.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-DK4k1R8e.js";
|
|
28
|
+
import { t as esm_default } from "../esm-BRXvTSrx.js";
|
|
30
29
|
|
|
31
30
|
//#region federation/send.test.ts
|
|
32
31
|
test("extractInboxes()", () => {
|
|
@@ -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-sGz4vcrK.js";
|
|
7
|
+
import { o as CryptographicKey } from "./vocab-DCHRuBGF.js";
|
|
8
|
+
import { a as validateCryptoKey, n as fetchKey } from "./key-bMrDyA2T.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, b
|
|
|
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
|
}
|
|
@@ -729,13 +726,11 @@ async function doubleKnock(request, identity, options = {}) {
|
|
|
729
726
|
});
|
|
730
727
|
log?.(signedRequest);
|
|
731
728
|
let response = await fetch(signedRequest, { redirect: "manual" });
|
|
732
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
});
|
|
738
|
-
} else if (response.status === 400 || response.status === 401 || response.status > 401) {
|
|
729
|
+
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) return doubleKnock(createRedirectRequest(request, response.headers.get("Location"), body), identity, {
|
|
730
|
+
...options,
|
|
731
|
+
body
|
|
732
|
+
});
|
|
733
|
+
else if (response.status === 400 || response.status === 401 || response.status > 401) {
|
|
739
734
|
const spec = firstTrySpec === "draft-cavage-http-signatures-12" ? "rfc9421" : "draft-cavage-http-signatures-12";
|
|
740
735
|
getLogger([
|
|
741
736
|
"fedify",
|
|
@@ -754,13 +749,11 @@ async function doubleKnock(request, identity, options = {}) {
|
|
|
754
749
|
});
|
|
755
750
|
log?.(signedRequest);
|
|
756
751
|
response = await fetch(signedRequest, { redirect: "manual" });
|
|
757
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
});
|
|
763
|
-
} else if (response.status !== 400 && response.status !== 401) await specDeterminer?.rememberSpec(origin, spec);
|
|
752
|
+
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) return doubleKnock(createRedirectRequest(request, response.headers.get("Location"), body), identity, {
|
|
753
|
+
...options,
|
|
754
|
+
body
|
|
755
|
+
});
|
|
756
|
+
else if (response.status !== 400 && response.status !== 401) await specDeterminer?.rememberSpec(origin, spec);
|
|
764
757
|
} else await specDeterminer?.rememberSpec(origin, firstTrySpec);
|
|
765
758
|
return response;
|
|
766
759
|
}
|
|
@@ -793,4 +786,4 @@ function timingSafeEqual(a, b) {
|
|
|
793
786
|
}
|
|
794
787
|
|
|
795
788
|
//#endregion
|
|
796
|
-
export {
|
|
789
|
+
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-D_MGP37Q.js";
|
|
4
|
+
import { B as Multikey, m as CryptographicKey } from "./vocab-DoBcp8ow.js";
|
|
5
5
|
import { TracerProvider } from "@opentelemetry/api";
|
|
6
6
|
|
|
7
7
|
//#region sig/key.d.ts
|
|
@@ -252,4 +252,4 @@ interface HttpMessageSignaturesSpecDeterminer {
|
|
|
252
252
|
* @since 1.6.0
|
|
253
253
|
*/
|
|
254
254
|
//#endregion
|
|
255
|
-
export {
|
|
255
|
+
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 };
|
|
@@ -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-BU25UQLB.js";
|
|
6
|
+
import { y as CryptographicKey } from "./actor-OYVgkiZG.js";
|
|
7
|
+
import { a as validateCryptoKey, n as fetchKey } from "./key-D2HZrCxh.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, b
|
|
|
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
|
}
|
|
@@ -728,13 +725,11 @@ async function doubleKnock(request, identity, options = {}) {
|
|
|
728
725
|
});
|
|
729
726
|
log?.(signedRequest);
|
|
730
727
|
let response = await fetch(signedRequest, { redirect: "manual" });
|
|
731
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
});
|
|
737
|
-
} else if (response.status === 400 || response.status === 401 || response.status > 401) {
|
|
728
|
+
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) return doubleKnock(createRedirectRequest(request, response.headers.get("Location"), body), identity, {
|
|
729
|
+
...options,
|
|
730
|
+
body
|
|
731
|
+
});
|
|
732
|
+
else if (response.status === 400 || response.status === 401 || response.status > 401) {
|
|
738
733
|
const spec = firstTrySpec === "draft-cavage-http-signatures-12" ? "rfc9421" : "draft-cavage-http-signatures-12";
|
|
739
734
|
getLogger([
|
|
740
735
|
"fedify",
|
|
@@ -753,13 +748,11 @@ async function doubleKnock(request, identity, options = {}) {
|
|
|
753
748
|
});
|
|
754
749
|
log?.(signedRequest);
|
|
755
750
|
response = await fetch(signedRequest, { redirect: "manual" });
|
|
756
|
-
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
});
|
|
762
|
-
} else if (response.status !== 400 && response.status !== 401) await specDeterminer?.rememberSpec(origin, spec);
|
|
751
|
+
if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) return doubleKnock(createRedirectRequest(request, response.headers.get("Location"), body), identity, {
|
|
752
|
+
...options,
|
|
753
|
+
body
|
|
754
|
+
});
|
|
755
|
+
else if (response.status !== 400 && response.status !== 401) await specDeterminer?.rememberSpec(origin, spec);
|
|
763
756
|
} else await specDeterminer?.rememberSpec(origin, firstTrySpec);
|
|
764
757
|
return response;
|
|
765
758
|
}
|
|
@@ -792,4 +785,4 @@ function timingSafeEqual(a, b) {
|
|
|
792
785
|
}
|
|
793
786
|
|
|
794
787
|
//#endregion
|
|
795
|
-
export {
|
|
788
|
+
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 { Activity } from "./vocab-
|
|
8
|
-
import { getTypeId } from "./type-
|
|
6
|
+
import { d as version, u as name } from "./docloader-sGz4vcrK.js";
|
|
7
|
+
import { t as Activity } from "./vocab-DCHRuBGF.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 };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
|
|
5
|
+
import "./docloader-BU25UQLB.js";
|
|
6
|
+
import "./actor-OYVgkiZG.js";
|
|
7
|
+
import "./lookup-4uc2jh52.js";
|
|
8
|
+
import { a as validateCryptoKey, i as importJwk, n as fetchKey, r as generateCryptoKeyPair, t as exportJwk } from "./key-D2HZrCxh.js";
|
|
9
|
+
|
|
10
|
+
export { validateCryptoKey };
|
|
@@ -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-BU25UQLB.js";
|
|
6
|
+
import { i as isActor, q as Object$1, y as CryptographicKey } from "./actor-OYVgkiZG.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 };
|
|
@@ -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-sGz4vcrK.js";
|
|
7
|
+
import { _ as Object$1, o as CryptographicKey } from "./vocab-DCHRuBGF.js";
|
|
8
|
+
import { i as isActor } from "./actor-y7shp0CR.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 };
|
|
@@ -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-sGz4vcrK.js";
|
|
8
|
+
import "./url-BdNvnK9P.js";
|
|
9
|
+
import "./multibase-DBcKTV2a.js";
|
|
10
|
+
import "./vocab-DCHRuBGF.js";
|
|
11
|
+
import "./langstr-pFHBDU4y.js";
|
|
12
|
+
import "./lookup-Bq8vhIG4.js";
|
|
13
|
+
import "./actor-y7shp0CR.js";
|
|
14
|
+
import { a as validateCryptoKey, i as importJwk, n as fetchKey, r as generateCryptoKeyPair, t as exportJwk } from "./key-bMrDyA2T.js";
|
|
15
|
+
|
|
16
|
+
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-DCHRuBGF.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-DCHRuBGF.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-sGz4vcrK.js";
|
|
7
|
+
import { _ as Object$1, o as CryptographicKey, t as Activity } from "./vocab-DCHRuBGF.js";
|
|
8
|
+
import { t as getTypeId } from "./type-DFsmi-p1.js";
|
|
9
|
+
import { a as validateCryptoKey, n as fetchKey } from "./key-bMrDyA2T.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 };
|
|
@@ -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-BU25UQLB.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 };
|