@fedify/fedify 1.6.11 → 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-KrOvzFz1.js → actor-CcchiJa2.js} +6 -6
- package/dist/{actor-CxnKxfwH.js → actor-_hg-8_KF.js} +329 -465
- 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-CsnXlm3V.js → authdocloader-1Ja0Him4.js} +7 -9
- package/dist/{authdocloader-DsULyH5D.js → authdocloader-D0Ds92Vk.js} +6 -8
- package/dist/{builder-BjJSVOvs.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-BlntqhE9.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-CiyuTkCx.js → context-D7ltDKkC.js} +5 -5
- package/dist/{docloader-09nVWLAZ.js → docloader-BDSHZfTJ.js} +1 -1
- package/dist/{docloader-BYgIBZvh.js → docloader-C8QMM0lt.js} +32 -152
- package/dist/{docloader-DlUDOVSe.d.ts → docloader-DecYq5GI.d.ts} +2 -2
- package/dist/{docloader-DOrb0fRp.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-LsE7i_Zq.js → http-BDLuDcCk.js} +17 -26
- package/dist/{http-Dc8RIaDE.js → http-BHjHzW-Y.js} +17 -26
- package/dist/{http-BkUCISGt.d.ts → http-ByqMVN52.d.ts} +3 -3
- package/dist/{inbox-BVwejjm8.js → inbox-FoFUUhTd.js} +5 -5
- package/dist/{key-BTcmhZp7.js → key-BABKdX0W.js} +5 -5
- package/dist/{key-Bg_PKGpe.js → key-Bj3ZyKd0.js} +4 -4
- package/dist/key-CragWqc4.js +16 -0
- package/dist/key-OMbKIYLU.js +10 -0
- package/dist/{keycache-BnCTs9sG.js → keycache-DONR-3XM.js} +2 -2
- package/dist/{keys-pbGG00jU.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-n_kUCeXG.js → ld-DWSCvUJ-.js} +9 -12
- package/dist/{lookup-vJccIKCS.d.ts → lookup-BULfTwGb.d.ts} +2 -2
- package/dist/{lookup-Cutk-FXA.js → lookup-C2TcPqxv.js} +4 -4
- package/dist/{lookup-DrAS097Q.js → lookup-DIQCWtDD.js} +3 -3
- package/dist/{lookup-1pupHJbK.js → lookup-DZBZTzld.js} +6 -6
- package/dist/middleware-BdpSheEs.js +32 -0
- package/dist/{middleware-CMTirIyg.js → middleware-C9cbWvtY.js} +35 -39
- package/dist/middleware-CZQPvn1Y.js +17 -0
- package/dist/{middleware-kjrPMCqA.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-c-Zzpacz.js → owner-BSBuyxV4.js} +4 -4
- package/dist/{proof-BTx3Maj-.js → proof-B8LPOkvZ.js} +14 -19
- package/dist/{proof-CTOU2zFF.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-SniNSIKd.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-DG1qZLU9.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 +109 -105
- package/dist/{vocab-lzEJg2bH.js → vocab-B0flx0SI.js} +328 -464
- package/dist/{vocab-DSFLLLe6.d.ts → vocab-BQaYsnhp.d.ts} +2 -2
- package/dist/{vocab-oKloyO0F.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-BP-Oky5H.js +0 -16
- package/dist/key-DxKqQgGm.js +0 -10
- package/dist/middleware-CDYmpOKW.js +0 -33
- package/dist/middleware-CXZvlTVn.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-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,20 +3,18 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import "../
|
|
10
|
-
import "../
|
|
11
|
-
import "../
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import "../
|
|
15
|
-
import "../
|
|
16
|
-
import "../
|
|
17
|
-
import "../
|
|
18
|
-
import "../assert_throws-YetpVSc-.js";
|
|
19
|
-
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 "../docloader-C8QMM0lt.js";
|
|
9
|
+
import "../url-BdNvnK9P.js";
|
|
10
|
+
import "../semver-D9d-VO-_.js";
|
|
11
|
+
import { a as parseProtocol, c as parseUsage, i as parseOutboundService, n as parseInboundService, o as parseServices, r as parseNodeInfo, s as parseSoftware, t as getNodeInfo } from "../client-C0yKnQtt.js";
|
|
12
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
13
|
+
import "../std__assert-BdP_WkD-.js";
|
|
14
|
+
import "../assert_rejects-Bkh5lA1a.js";
|
|
15
|
+
import "../assert_is_error-CIYFACrT.js";
|
|
16
|
+
import "../assert_throws-CmpfkWEM.js";
|
|
17
|
+
import { t as esm_default } from "../esm-BRXvTSrx.js";
|
|
20
18
|
|
|
21
19
|
//#region nodeinfo/client.test.ts
|
|
22
20
|
test("getNodeInfo()", async (t) => {
|
|
@@ -58,32 +56,25 @@ test("getNodeInfo()", async (t) => {
|
|
|
58
56
|
}
|
|
59
57
|
};
|
|
60
58
|
await t.step("indirect", async () => {
|
|
61
|
-
|
|
62
|
-
assertEquals(
|
|
63
|
-
const raw = await getNodeInfo("https://example.com/", { parse: "none" });
|
|
64
|
-
assertEquals(raw, rawExpected);
|
|
59
|
+
assertEquals(await getNodeInfo("https://example.com/"), expected);
|
|
60
|
+
assertEquals(await getNodeInfo("https://example.com/", { parse: "none" }), rawExpected);
|
|
65
61
|
});
|
|
66
62
|
await t.step("direct", async () => {
|
|
67
|
-
|
|
68
|
-
assertEquals(info, expected);
|
|
63
|
+
assertEquals(await getNodeInfo("https://example.com/nodeinfo/2.1", { direct: true }), expected);
|
|
69
64
|
});
|
|
70
65
|
esm_default.removeRoutes();
|
|
71
66
|
esm_default.get("https://example.com/.well-known/nodeinfo", { body: { links: [] } });
|
|
72
67
|
await t.step("indirect: no links", async () => {
|
|
73
|
-
|
|
74
|
-
assertEquals(info, void 0);
|
|
68
|
+
assertEquals(await getNodeInfo("https://example.com/"), void 0);
|
|
75
69
|
});
|
|
76
70
|
esm_default.removeRoutes();
|
|
77
71
|
esm_default.get("https://example.com/.well-known/nodeinfo", { status: 404 });
|
|
78
72
|
await t.step("indirect: 404", async () => {
|
|
79
|
-
|
|
80
|
-
assertEquals(info, void 0);
|
|
73
|
+
assertEquals(await getNodeInfo("https://example.com/"), void 0);
|
|
81
74
|
});
|
|
82
75
|
await t.step("direct: 404", async () => {
|
|
83
|
-
|
|
84
|
-
assertEquals(
|
|
85
|
-
const info2 = await getNodeInfo("https://example.com/404", { direct: true });
|
|
86
|
-
assertEquals(info2, void 0);
|
|
76
|
+
assertEquals(await getNodeInfo("https://example.com/nodeinfo/2.0", { direct: true }), void 0);
|
|
77
|
+
assertEquals(await getNodeInfo("https://example.com/404", { direct: true }), void 0);
|
|
87
78
|
});
|
|
88
79
|
esm_default.hardReset();
|
|
89
80
|
});
|
|
@@ -3,51 +3,46 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import "../
|
|
12
|
-
import "../
|
|
13
|
-
import
|
|
14
|
-
import "../
|
|
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 "../
|
|
30
|
-
import "../
|
|
31
|
-
import "../
|
|
32
|
-
import "../
|
|
33
|
-
import "../
|
|
34
|
-
import "../
|
|
35
|
-
import "../
|
|
36
|
-
import
|
|
37
|
-
import "../
|
|
38
|
-
import "../
|
|
39
|
-
import "../
|
|
40
|
-
import "../assert_not_equals-C685gKx6.js";
|
|
41
|
-
import "../assert_throws-YetpVSc-.js";
|
|
42
|
-
import "../docloader-09nVWLAZ.js";
|
|
43
|
-
import { createRequestContext } from "../context-CiyuTkCx.js";
|
|
6
|
+
import "../chunk-DvTpRkcT.js";
|
|
7
|
+
import { t as assertEquals } from "../assert_equals-Dy0MG_Zw.js";
|
|
8
|
+
import { t as MemoryKvStore } from "../kv-DosGYGwV.js";
|
|
9
|
+
import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-C9cbWvtY.js";
|
|
10
|
+
import "../docloader-C8QMM0lt.js";
|
|
11
|
+
import "../url-BdNvnK9P.js";
|
|
12
|
+
import { n as parseSemVer } from "../semver-D9d-VO-_.js";
|
|
13
|
+
import "../client-C0yKnQtt.js";
|
|
14
|
+
import "../router-BuDkN4RQ.js";
|
|
15
|
+
import "../types-CB_2uuCA.js";
|
|
16
|
+
import "../multibase-DBcKTV2a.js";
|
|
17
|
+
import "../vocab-B0flx0SI.js";
|
|
18
|
+
import "../langstr-pFHBDU4y.js";
|
|
19
|
+
import "../lookup-C2TcPqxv.js";
|
|
20
|
+
import "../actor-CcchiJa2.js";
|
|
21
|
+
import "../key-BABKdX0W.js";
|
|
22
|
+
import "../http-BHjHzW-Y.js";
|
|
23
|
+
import "../authdocloader-1Ja0Him4.js";
|
|
24
|
+
import "../ld-DWSCvUJ-.js";
|
|
25
|
+
import "../owner-BSBuyxV4.js";
|
|
26
|
+
import "../proof-CBHYxfh3.js";
|
|
27
|
+
import "../lookup-DZBZTzld.js";
|
|
28
|
+
import "../inbox-FoFUUhTd.js";
|
|
29
|
+
import "../builder-MOXlzktX.js";
|
|
30
|
+
import "../collection-XNLQhehO.js";
|
|
31
|
+
import "../keycache-DONR-3XM.js";
|
|
32
|
+
import "../send-Cah-Z3UO.js";
|
|
33
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
34
|
+
import "../std__assert-BdP_WkD-.js";
|
|
35
|
+
import "../assert_rejects-Bkh5lA1a.js";
|
|
36
|
+
import "../assert_is_error-CIYFACrT.js";
|
|
37
|
+
import "../assert_throws-CmpfkWEM.js";
|
|
38
|
+
import "../docloader-BDSHZfTJ.js";
|
|
39
|
+
import { n as createRequestContext } from "../context-D7ltDKkC.js";
|
|
44
40
|
|
|
45
41
|
//#region nodeinfo/handler.test.ts
|
|
46
42
|
test("handleNodeInfo()", async () => {
|
|
47
43
|
const request = new Request("https://example.com/nodeinfo/2.1");
|
|
48
|
-
const federation = createFederation({ kv: new MemoryKvStore() });
|
|
49
44
|
const context = createRequestContext({
|
|
50
|
-
federation,
|
|
45
|
+
federation: createFederation({ kv: new MemoryKvStore() }),
|
|
51
46
|
data: void 0,
|
|
52
47
|
request,
|
|
53
48
|
url: new URL(request.url)
|
|
@@ -74,8 +69,7 @@ test("handleNodeInfo()", async () => {
|
|
|
74
69
|
});
|
|
75
70
|
assertEquals(response.status, 200);
|
|
76
71
|
assertEquals(response.headers.get("Content-Type"), "application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.1#\"");
|
|
77
|
-
|
|
78
|
-
assertEquals(json, {
|
|
72
|
+
assertEquals(await response.json(), {
|
|
79
73
|
"$schema": "http://nodeinfo.diaspora.software/ns/schema/2.1#",
|
|
80
74
|
version: "2.1",
|
|
81
75
|
software: {
|
|
@@ -102,9 +96,8 @@ test("handleNodeInfo()", async () => {
|
|
|
102
96
|
});
|
|
103
97
|
test("handleNodeInfoJrd()", async () => {
|
|
104
98
|
const request = new Request("https://example.com/.well-known/nodeinfo");
|
|
105
|
-
const federation = createFederation({ kv: new MemoryKvStore() });
|
|
106
99
|
let context = createRequestContext({
|
|
107
|
-
federation,
|
|
100
|
+
federation: createFederation({ kv: new MemoryKvStore() }),
|
|
108
101
|
data: void 0,
|
|
109
102
|
request,
|
|
110
103
|
url: new URL(request.url)
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
+
import { a as InboundService, c as OutboundService, d as Software, f as Usage, g as parseSemVer, h as formatSemVer, i as parseNodeInfo, l as Protocol, m as SemVer, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "../client-BvbhJik1.js";
|
|
4
|
+
export { type GetNodeInfoOptions, InboundService, JsonValue, NodeInfo, OutboundService, type ParseNodeInfoOptions, Protocol, type SemVer, Services, Software, Usage, formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer };
|
package/dist/nodeinfo/mod.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import "../docloader-
|
|
6
|
-
import { formatSemVer, getNodeInfo,
|
|
7
|
-
import "../nodeinfo-CyEbLjHs.js";
|
|
5
|
+
import "../docloader-M1Np6SYc.js";
|
|
6
|
+
import { a as parseSemVer, i as formatSemVer, n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "../types-BXvx0wJm.js";
|
|
8
7
|
|
|
9
8
|
export { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer };
|
|
@@ -3,16 +3,14 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import "../
|
|
12
|
-
import "../
|
|
13
|
-
import "../
|
|
14
|
-
import "../assert_not_equals-C685gKx6.js";
|
|
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 { n as parseSemVer, t as formatSemVer } from "../semver-D9d-VO-_.js";
|
|
9
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
10
|
+
import "../std__assert-BdP_WkD-.js";
|
|
11
|
+
import "../assert_rejects-Bkh5lA1a.js";
|
|
12
|
+
import "../assert_is_error-CIYFACrT.js";
|
|
13
|
+
import { t as assertThrows } from "../assert_throws-CmpfkWEM.js";
|
|
16
14
|
|
|
17
15
|
//#region nodeinfo/semver.test.ts
|
|
18
16
|
test("parseSemVer() handles major", async (t) => {
|
|
@@ -25,8 +23,7 @@ test("parseSemVer() handles major", async (t) => {
|
|
|
25
23
|
[" v8.2.3 ", 8],
|
|
26
24
|
[" 13.2.3", 13]
|
|
27
25
|
]) await t.step(v, () => {
|
|
28
|
-
|
|
29
|
-
assertEquals(version.major, expected);
|
|
26
|
+
assertEquals(parseSemVer(v).major, expected);
|
|
30
27
|
});
|
|
31
28
|
});
|
|
32
29
|
test("parseSemVer() handles minor", async (t) => {
|
|
@@ -39,8 +36,7 @@ test("parseSemVer() handles minor", async (t) => {
|
|
|
39
36
|
[" v1.8.3 ", 8],
|
|
40
37
|
[" 1.13.3", 13]
|
|
41
38
|
]) await t.step(v, () => {
|
|
42
|
-
|
|
43
|
-
assertEquals(version.minor, expected);
|
|
39
|
+
assertEquals(parseSemVer(v).minor, expected);
|
|
44
40
|
});
|
|
45
41
|
});
|
|
46
42
|
test("parseSemVer() handles patch", async (t) => {
|
|
@@ -68,8 +64,7 @@ test("parseSemVer() handles prerelease", async (t) => {
|
|
|
68
64
|
["1.2.0-3.6-pre2", [3, "6-pre2"]],
|
|
69
65
|
["2.0.0", []]
|
|
70
66
|
]) await t.step(`${v} : ${JSON.stringify(expected)}`, () => {
|
|
71
|
-
|
|
72
|
-
assertEquals(semver.prerelease, expected);
|
|
67
|
+
assertEquals(parseSemVer(v).prerelease, expected);
|
|
73
68
|
});
|
|
74
69
|
});
|
|
75
70
|
test({
|
|
@@ -109,8 +104,7 @@ test("parseSemVer() throws on invalid versions", async (t) => {
|
|
|
109
104
|
});
|
|
110
105
|
});
|
|
111
106
|
test("parseSemVer() handles big numeric prerelease", function() {
|
|
112
|
-
|
|
113
|
-
assertEquals(r.prerelease, ["beta", "90071992547409910"]);
|
|
107
|
+
assertEquals(parseSemVer(`1.2.3-beta.${Number.MAX_SAFE_INTEGER}0`).prerelease, ["beta", "90071992547409910"]);
|
|
114
108
|
});
|
|
115
109
|
test("formatSemVer()", async (t) => {
|
|
116
110
|
for (const [version, expected] of [
|
|
@@ -124,9 +118,7 @@ test("formatSemVer()", async (t) => {
|
|
|
124
118
|
]) await t.step({
|
|
125
119
|
name: version,
|
|
126
120
|
fn: () => {
|
|
127
|
-
|
|
128
|
-
const actual = formatSemVer(v);
|
|
129
|
-
assertEquals(actual, expected);
|
|
121
|
+
assertEquals(formatSemVer(parseSemVer(version)), expected);
|
|
130
122
|
}
|
|
131
123
|
});
|
|
132
124
|
});
|
|
@@ -3,17 +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 {
|
|
11
|
-
import
|
|
12
|
-
import "../
|
|
13
|
-
import "../
|
|
14
|
-
import "../
|
|
15
|
-
import "../assert_not_equals-C685gKx6.js";
|
|
16
|
-
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 "../semver-D9d-VO-_.js";
|
|
9
|
+
import { t as nodeInfoToJson } from "../types-CB_2uuCA.js";
|
|
10
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
11
|
+
import "../std__assert-BdP_WkD-.js";
|
|
12
|
+
import "../assert_rejects-Bkh5lA1a.js";
|
|
13
|
+
import "../assert_is_error-CIYFACrT.js";
|
|
14
|
+
import { t as assertThrows } from "../assert_throws-CmpfkWEM.js";
|
|
17
15
|
|
|
18
16
|
//#region nodeinfo/types.test.ts
|
|
19
17
|
test("nodeInfoToJson()", () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { DocumentLoader } from "./docloader-
|
|
4
|
-
import {
|
|
5
|
-
import { Actor } from "./actor-
|
|
3
|
+
import { n as DocumentLoader } from "./docloader-DecYq5GI.js";
|
|
4
|
+
import { m as CryptographicKey, n as Activity } from "./vocab-BQaYsnhp.js";
|
|
5
|
+
import { t as Actor } from "./actor-5yLVgYbM.js";
|
|
6
6
|
import { TracerProvider } from "@opentelemetry/api";
|
|
7
7
|
|
|
8
8
|
//#region sig/owner.d.ts
|
|
@@ -66,4 +66,4 @@ interface GetKeyOwnerOptions {
|
|
|
66
66
|
*/
|
|
67
67
|
declare function getKeyOwner(keyId: URL | CryptographicKey, options: GetKeyOwnerOptions): Promise<Actor | null>;
|
|
68
68
|
//#endregion
|
|
69
|
-
export {
|
|
69
|
+
export { getKeyOwner as i, GetKeyOwnerOptions as n, doesActorOwnKey as r, DoesActorOwnKeyOptions as t };
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { getDocumentLoader } from "./docloader-
|
|
7
|
-
import {
|
|
8
|
-
import { isActor } from "./actor-
|
|
6
|
+
import { i as getDocumentLoader } 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 { trace } from "@opentelemetry/api";
|
|
10
10
|
|
|
11
11
|
//#region sig/owner.ts
|
|
@@ -86,4 +86,4 @@ async function getKeyOwner(keyId, options) {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
//#endregion
|
|
89
|
-
export {
|
|
89
|
+
export { getKeyOwner as n, doesActorOwnKey as t };
|
|
@@ -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 {
|
|
7
|
-
import {
|
|
5
|
+
import { d as name, f as version, i as getDocumentLoader } from "./docloader-M1Np6SYc.js";
|
|
6
|
+
import { G as Multikey, Tt as getTypeId, b as DataIntegrityProof, i as isActor, q as Object$1, s as Activity, 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 jsonld from "jsonld";
|
|
@@ -53,9 +53,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
|
|
|
53
53
|
creator: keyId.href,
|
|
54
54
|
created: created?.toString() ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
55
55
|
};
|
|
56
|
-
const
|
|
57
|
-
const docHash = await hashJsonLd(jsonLd, contextLoader);
|
|
58
|
-
const message = optionsHash + docHash;
|
|
56
|
+
const message = await hashJsonLd(options, contextLoader) + await hashJsonLd(jsonLd, contextLoader);
|
|
59
57
|
const messageBytes = new TextEncoder().encode(message);
|
|
60
58
|
const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, messageBytes);
|
|
61
59
|
return {
|
|
@@ -78,7 +76,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
|
|
|
78
76
|
* @since 1.0.0
|
|
79
77
|
*/
|
|
80
78
|
async function signJsonLd(jsonLd, privateKey, keyId, options) {
|
|
81
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
79
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("ld_signatures.sign", { attributes: { "ld_signatures.key_id": keyId.href } }, async (span) => {
|
|
82
80
|
try {
|
|
83
81
|
const signature = await createSignature(jsonLd, privateKey, keyId, options);
|
|
84
82
|
if (span.isRecording()) {
|
|
@@ -213,7 +211,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
213
211
|
* @returns `true` if the document is authentic; `false` otherwise.
|
|
214
212
|
*/
|
|
215
213
|
async function verifyJsonLd(jsonLd, options = {}) {
|
|
216
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
214
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("ld_signatures.verify", async (span) => {
|
|
217
215
|
try {
|
|
218
216
|
const object = await Object$1.fromJsonLd(jsonLd, options);
|
|
219
217
|
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
@@ -254,8 +252,7 @@ async function hashJsonLd(jsonLd, contextLoader) {
|
|
|
254
252
|
documentLoader: contextLoader ?? getDocumentLoader()
|
|
255
253
|
});
|
|
256
254
|
const encoder = new TextEncoder();
|
|
257
|
-
|
|
258
|
-
return encodeHex(hash);
|
|
255
|
+
return encodeHex(await crypto.subtle.digest("SHA-256", encoder.encode(canon)));
|
|
259
256
|
}
|
|
260
257
|
|
|
261
258
|
//#endregion
|
|
@@ -366,15 +363,14 @@ async function createProof(object, privateKey, keyId, { contextLoader, context:
|
|
|
366
363
|
const msgBytes = encoder.encode(msgCanon);
|
|
367
364
|
const msgDigest = await crypto.subtle.digest("SHA-256", msgBytes);
|
|
368
365
|
created ??= Temporal.Now.instant();
|
|
369
|
-
const
|
|
366
|
+
const proofCanon = serialize({
|
|
370
367
|
"@context": compactMsg["@context"],
|
|
371
368
|
type: "DataIntegrityProof",
|
|
372
369
|
cryptosuite: "eddsa-jcs-2022",
|
|
373
370
|
verificationMethod: keyId.href,
|
|
374
371
|
proofPurpose: "assertionMethod",
|
|
375
372
|
created: created.toString()
|
|
376
|
-
};
|
|
377
|
-
const proofCanon = serialize(proofConfig);
|
|
373
|
+
});
|
|
378
374
|
const proofBytes = encoder.encode(proofCanon);
|
|
379
375
|
const proofDigest = await crypto.subtle.digest("SHA-256", proofBytes);
|
|
380
376
|
const digest = new Uint8Array(proofDigest.byteLength + msgDigest.byteLength);
|
|
@@ -400,7 +396,7 @@ async function createProof(object, privateKey, keyId, { contextLoader, context:
|
|
|
400
396
|
* @since 0.10.0
|
|
401
397
|
*/
|
|
402
398
|
async function signObject(object, privateKey, keyId, options = {}) {
|
|
403
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
399
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("object_integrity_proofs.sign", { attributes: { "activitypub.object.type": getTypeId(object).href } }, async (span) => {
|
|
404
400
|
try {
|
|
405
401
|
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
406
402
|
const existingProofs = [];
|
|
@@ -434,7 +430,7 @@ async function signObject(object, privateKey, keyId, options = {}) {
|
|
|
434
430
|
* @since 0.10.0
|
|
435
431
|
*/
|
|
436
432
|
async function verifyProof(jsonLd, proof, options = {}) {
|
|
437
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
433
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("object_integrity_proofs.verify", async (span) => {
|
|
438
434
|
if (span.isRecording()) {
|
|
439
435
|
if (proof.cryptosuite != null) span.setAttribute("object_integrity_proofs.cryptosuite", proof.cryptosuite);
|
|
440
436
|
if (proof.verificationMethodId != null) span.setAttribute("object_integrity_proofs.key_id", proof.verificationMethodId.href);
|
|
@@ -458,15 +454,14 @@ async function verifyProof(jsonLd, proof, options = {}) {
|
|
|
458
454
|
async function verifyProofInternal(jsonLd, proof, options) {
|
|
459
455
|
if (typeof jsonLd !== "object" || proof.cryptosuite !== "eddsa-jcs-2022" || proof.verificationMethodId == null || proof.proofPurpose !== "assertionMethod" || proof.proofValue == null || proof.created == null) return null;
|
|
460
456
|
const publicKeyPromise = fetchKey(proof.verificationMethodId, Multikey, options);
|
|
461
|
-
const
|
|
457
|
+
const proofCanon = serialize({
|
|
462
458
|
"@context": jsonLd["@context"],
|
|
463
459
|
type: "DataIntegrityProof",
|
|
464
460
|
cryptosuite: proof.cryptosuite,
|
|
465
461
|
verificationMethod: proof.verificationMethodId.href,
|
|
466
462
|
proofPurpose: proof.proofPurpose,
|
|
467
463
|
created: proof.created.toString()
|
|
468
|
-
};
|
|
469
|
-
const proofCanon = serialize(proofConfig);
|
|
464
|
+
});
|
|
470
465
|
const encoder = new TextEncoder();
|
|
471
466
|
const proofBytes = encoder.encode(proofCanon);
|
|
472
467
|
const proofDigest = await crypto.subtle.digest("SHA-256", proofBytes);
|
|
@@ -579,4 +574,4 @@ async function verifyObject(cls, jsonLd, options = {}) {
|
|
|
579
574
|
}
|
|
580
575
|
|
|
581
576
|
//#endregion
|
|
582
|
-
export {
|
|
577
|
+
export { doesActorOwnKey as a, createSignature as c, signJsonLd as d, verifyJsonLd as f, verifyProof as i, detachSignature as l, signObject as n, getKeyOwner as o, verifySignature as p, verifyObject as r, attachSignature as s, createProof as t, hasSignature as u };
|
|
@@ -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, u as name } from "./docloader-C8QMM0lt.js";
|
|
7
|
+
import { h as Multikey, s as DataIntegrityProof, 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 { encodeHex } from "byte-encodings/hex";
|
|
@@ -41,15 +41,14 @@ async function createProof(object, privateKey, keyId, { contextLoader, context:
|
|
|
41
41
|
const msgBytes = encoder.encode(msgCanon);
|
|
42
42
|
const msgDigest = await crypto.subtle.digest("SHA-256", msgBytes);
|
|
43
43
|
created ??= Temporal.Now.instant();
|
|
44
|
-
const
|
|
44
|
+
const proofCanon = serialize({
|
|
45
45
|
"@context": compactMsg["@context"],
|
|
46
46
|
type: "DataIntegrityProof",
|
|
47
47
|
cryptosuite: "eddsa-jcs-2022",
|
|
48
48
|
verificationMethod: keyId.href,
|
|
49
49
|
proofPurpose: "assertionMethod",
|
|
50
50
|
created: created.toString()
|
|
51
|
-
};
|
|
52
|
-
const proofCanon = serialize(proofConfig);
|
|
51
|
+
});
|
|
53
52
|
const proofBytes = encoder.encode(proofCanon);
|
|
54
53
|
const proofDigest = await crypto.subtle.digest("SHA-256", proofBytes);
|
|
55
54
|
const digest = new Uint8Array(proofDigest.byteLength + msgDigest.byteLength);
|
|
@@ -75,7 +74,7 @@ async function createProof(object, privateKey, keyId, { contextLoader, context:
|
|
|
75
74
|
* @since 0.10.0
|
|
76
75
|
*/
|
|
77
76
|
async function signObject(object, privateKey, keyId, options = {}) {
|
|
78
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
77
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("object_integrity_proofs.sign", { attributes: { "activitypub.object.type": getTypeId(object).href } }, async (span) => {
|
|
79
78
|
try {
|
|
80
79
|
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
81
80
|
const existingProofs = [];
|
|
@@ -109,7 +108,7 @@ async function signObject(object, privateKey, keyId, options = {}) {
|
|
|
109
108
|
* @since 0.10.0
|
|
110
109
|
*/
|
|
111
110
|
async function verifyProof(jsonLd, proof, options = {}) {
|
|
112
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
111
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("object_integrity_proofs.verify", async (span) => {
|
|
113
112
|
if (span.isRecording()) {
|
|
114
113
|
if (proof.cryptosuite != null) span.setAttribute("object_integrity_proofs.cryptosuite", proof.cryptosuite);
|
|
115
114
|
if (proof.verificationMethodId != null) span.setAttribute("object_integrity_proofs.key_id", proof.verificationMethodId.href);
|
|
@@ -133,15 +132,14 @@ async function verifyProof(jsonLd, proof, options = {}) {
|
|
|
133
132
|
async function verifyProofInternal(jsonLd, proof, options) {
|
|
134
133
|
if (typeof jsonLd !== "object" || proof.cryptosuite !== "eddsa-jcs-2022" || proof.verificationMethodId == null || proof.proofPurpose !== "assertionMethod" || proof.proofValue == null || proof.created == null) return null;
|
|
135
134
|
const publicKeyPromise = fetchKey(proof.verificationMethodId, Multikey, options);
|
|
136
|
-
const
|
|
135
|
+
const proofCanon = serialize({
|
|
137
136
|
"@context": jsonLd["@context"],
|
|
138
137
|
type: "DataIntegrityProof",
|
|
139
138
|
cryptosuite: proof.cryptosuite,
|
|
140
139
|
verificationMethod: proof.verificationMethodId.href,
|
|
141
140
|
proofPurpose: proof.proofPurpose,
|
|
142
141
|
created: proof.created.toString()
|
|
143
|
-
};
|
|
144
|
-
const proofCanon = serialize(proofConfig);
|
|
142
|
+
});
|
|
145
143
|
const encoder = new TextEncoder();
|
|
146
144
|
const proofBytes = encoder.encode(proofCanon);
|
|
147
145
|
const proofDigest = await crypto.subtle.digest("SHA-256", proofBytes);
|
|
@@ -254,4 +252,4 @@ async function verifyObject(cls, jsonLd, options = {}) {
|
|
|
254
252
|
}
|
|
255
253
|
|
|
256
254
|
//#endregion
|
|
257
|
-
export {
|
|
255
|
+
export { verifyProof as i, signObject as n, verifyObject as r, createProof as t };
|
|
@@ -3,29 +3,26 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import "../
|
|
10
|
-
import
|
|
11
|
-
import "../
|
|
12
|
-
import "../
|
|
13
|
-
import "../
|
|
14
|
-
import "../
|
|
15
|
-
import "../
|
|
16
|
-
import "../
|
|
17
|
-
import "../
|
|
18
|
-
import {
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import "../
|
|
22
|
-
import
|
|
23
|
-
import "../
|
|
24
|
-
import "../
|
|
25
|
-
import "../
|
|
26
|
-
import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
|
|
27
|
-
import { rsaPrivateKey2 } from "../keys-pbGG00jU.js";
|
|
28
|
-
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 "../docloader-C8QMM0lt.js";
|
|
9
|
+
import { t as UrlError } from "../url-BdNvnK9P.js";
|
|
10
|
+
import "../multibase-DBcKTV2a.js";
|
|
11
|
+
import "../vocab-B0flx0SI.js";
|
|
12
|
+
import "../langstr-pFHBDU4y.js";
|
|
13
|
+
import "../lookup-C2TcPqxv.js";
|
|
14
|
+
import "../actor-CcchiJa2.js";
|
|
15
|
+
import "../key-BABKdX0W.js";
|
|
16
|
+
import { l as verifyRequest } from "../http-BHjHzW-Y.js";
|
|
17
|
+
import { t as getAuthenticatedDocumentLoader } from "../authdocloader-1Ja0Him4.js";
|
|
18
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
19
|
+
import "../std__assert-BdP_WkD-.js";
|
|
20
|
+
import { t as assertRejects } from "../assert_rejects-Bkh5lA1a.js";
|
|
21
|
+
import "../assert_is_error-CIYFACrT.js";
|
|
22
|
+
import "../assert_throws-CmpfkWEM.js";
|
|
23
|
+
import { t as mockDocumentLoader } from "../docloader-BDSHZfTJ.js";
|
|
24
|
+
import { i as rsaPrivateKey2 } from "../keys-KKGS1cpG.js";
|
|
25
|
+
import { t as esm_default } from "../esm-BRXvTSrx.js";
|
|
29
26
|
|
|
30
27
|
//#region runtime/authdocloader.test.ts
|
|
31
28
|
test("getAuthenticatedDocumentLoader()", async (t) => {
|
|
@@ -39,11 +36,10 @@ test("getAuthenticatedDocumentLoader()", async (t) => {
|
|
|
39
36
|
return new Response(JSON.stringify(v != null), { headers: { "Content-Type": "application/json" } });
|
|
40
37
|
});
|
|
41
38
|
await t.step("test", async () => {
|
|
42
|
-
|
|
39
|
+
assertEquals(await (await getAuthenticatedDocumentLoader({
|
|
43
40
|
keyId: new URL("https://example.com/key2"),
|
|
44
41
|
privateKey: rsaPrivateKey2
|
|
45
|
-
})
|
|
46
|
-
assertEquals(await loader("https://example.com/object"), {
|
|
42
|
+
}))("https://example.com/object"), {
|
|
47
43
|
contextUrl: null,
|
|
48
44
|
documentUrl: "https://example.com/object",
|
|
49
45
|
document: true
|