@fedify/fedify 1.7.11 → 1.7.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/dist/{actor-DgWryCk8.js → actor-GZRoTRqg.js} +1059 -2276
  2. package/dist/{actor-2ENhJMd7.js → actor-TYqJGdVq.js} +6 -9
  3. package/dist/{assert-DmFG7ppO.js → assert-LOEeCUK5.js} +1 -1
  4. package/dist/{assert_equals-CTYbeopb.js → assert_equals-B44MxcIj.js} +2 -4
  5. package/dist/{assert_instance_of-CF09JHYM.js → assert_instance_of-XtuFevV_.js} +1 -1
  6. package/dist/{assert_is_error-nrwA1GeT.js → assert_is_error-BTlryvT0.js} +1 -1
  7. package/dist/{assert_not_equals-Dc7y-V5Q.js → assert_not_equals-C685gKx6.js} +1 -1
  8. package/dist/{assert_rejects-C-sxEMM5.js → assert_rejects-DWQ4jaf9.js} +2 -2
  9. package/dist/{assert_throws-Cn9C6Jur.js → assert_throws-YetpVSc-.js} +2 -2
  10. package/dist/{authdocloader-BUJAQQAE.js → authdocloader-BopfyipD.js} +3 -3
  11. package/dist/{authdocloader-CK17fG7y.js → authdocloader-hiFSyM7V.js} +4 -4
  12. package/dist/{builder-CZM8EtHh.js → builder-mi6RdzNE.js} +7 -10
  13. package/dist/{chunk-HsBuZ-b2.js → chunk-Cx8LTkjm.js} +3 -1
  14. package/dist/{client-D83KwIk4.js → client-DuUKk4pk.js} +6 -6
  15. package/dist/compat/transformers.test.js +27 -28
  16. package/dist/{context-MUHrGcK9.js → context-RMU32mk4.js} +2 -2
  17. package/dist/{docloader-BcyuO_kK.js → docloader-DJxET2fN.js} +5 -9
  18. package/dist/{docloader-D4wl8z_4.js → docloader-bgBm1Hd1.js} +4 -6
  19. package/dist/{esm-Db4De7AS.js → esm-DO9PrujO.js} +23 -34
  20. package/dist/federation/builder.test.js +23 -29
  21. package/dist/federation/collection.test.js +9 -9
  22. package/dist/federation/handler.test.js +33 -33
  23. package/dist/federation/inbox.test.js +10 -10
  24. package/dist/federation/keycache.test.js +9 -9
  25. package/dist/federation/kv.test.js +10 -9
  26. package/dist/federation/middleware.test.js +76 -99
  27. package/dist/federation/mod.js +11 -11
  28. package/dist/federation/mq.test.js +10 -11
  29. package/dist/federation/retry.test.js +3 -3
  30. package/dist/federation/router.test.js +9 -9
  31. package/dist/federation/send.test.js +22 -22
  32. package/dist/{federation-BRIQn-GV.js → federation-B0aljx0V.js} +1 -2
  33. package/dist/{http-DFHfa9tA.js → http-D2DkwsjA.js} +8 -15
  34. package/dist/{http-Dsj_eYDw.js → http-vqMAvOVs.js} +8 -15
  35. package/dist/{inbox-CltmHpHc.js → inbox-DAAZZl2k.js} +5 -7
  36. package/dist/key-5ssHQ67E.js +16 -0
  37. package/dist/{key-bBurC_PZ.js → key-DSJGnD10.js} +4 -4
  38. package/dist/{key-qFVeObG1.js → key-DmqJj57e.js} +5 -8
  39. package/dist/{key-bttcdrh5.js → key-KVhaUM92.js} +6 -9
  40. package/dist/{keycache-DijbBawF.js → keycache-C1pEuRyQ.js} +2 -2
  41. package/dist/{keys-DJ5t4jB4.js → keys-C4XQHW5_.js} +1 -1
  42. package/dist/{ld-U-lGfuzj.js → ld-DzlJ_IpT.js} +9 -16
  43. package/dist/{lookup-BlPHJ-Ff.js → lookup-CSngxuWm.js} +2 -4
  44. package/dist/{lookup-C8ZpflGI.js → lookup-D0je8AqR.js} +7 -11
  45. package/dist/{lookup-BGqnk7rW.js → lookup-DL62q3Xh.js} +3 -5
  46. package/dist/{middleware-D66R1UZl.js → middleware-3wVT6S9E.js} +34 -52
  47. package/dist/middleware-CxFoFBD8.js +33 -0
  48. package/dist/{middleware-BRzqW-QG.js → middleware-DlDXugwZ.js} +34 -58
  49. package/dist/middleware-w7_U3fFi.js +17 -0
  50. package/dist/mod.js +11 -11
  51. package/dist/{multibase-DeCHcK8L.js → multibase-CnLHszip.js} +1 -2
  52. package/dist/nodeinfo/client.test.js +20 -23
  53. package/dist/nodeinfo/handler.test.js +32 -32
  54. package/dist/nodeinfo/mod.js +2 -2
  55. package/dist/nodeinfo/semver.test.js +23 -30
  56. package/dist/nodeinfo/types.test.js +11 -11
  57. package/dist/{owner-2zho-3Ew.js → owner-81ey_76X.js} +3 -3
  58. package/dist/{proof-BYHc1mMr.js → proof-BlULDH4H.js} +8 -14
  59. package/dist/{proof-3J23UdVg.js → proof-DlI7QNdn.js} +12 -25
  60. package/dist/runtime/authdocloader.test.js +21 -21
  61. package/dist/runtime/docloader.test.js +16 -18
  62. package/dist/runtime/key.test.js +17 -17
  63. package/dist/runtime/langstr.test.js +9 -9
  64. package/dist/runtime/mod.js +6 -6
  65. package/dist/runtime/multibase/multibase.test.js +11 -12
  66. package/dist/runtime/url.test.js +6 -6
  67. package/dist/{semver-DWClQt_5.js → semver-BNrOOAs9.js} +1 -3
  68. package/dist/{send-CW7iJ-b9.js → send-DdxfTHo6.js} +3 -4
  69. package/dist/sig/http.test.js +40 -54
  70. package/dist/sig/key.test.js +18 -18
  71. package/dist/sig/ld.test.js +20 -22
  72. package/dist/sig/mod.js +6 -6
  73. package/dist/sig/owner.test.js +20 -20
  74. package/dist/sig/proof.test.js +19 -19
  75. package/dist/{std__assert-vp0TKMS1.js → std__assert-o_r9vqm1.js} +1 -1
  76. package/dist/testing/docloader.test.js +9 -9
  77. package/dist/testing/mod.js +1 -1
  78. package/dist/{testing-BZ0dJ4qn.js → testing-DLyvtiiW.js} +3 -5
  79. package/dist/{type-D2s5lmbZ.js → type-CFuiGLz9.js} +1 -2
  80. package/dist/{types-C7C_l-jz.js → types-CJHS5pXl.js} +1 -1
  81. package/dist/{types-DXmLob1B.js → types-CmVV9LT1.js} +6 -8
  82. package/dist/{url-kTAI6_KP.js → url-C2xuoQD1.js} +2 -4
  83. package/dist/vocab/actor.test.js +104 -156
  84. package/dist/vocab/lookup.test.js +17 -17
  85. package/dist/vocab/mod.js +4 -4
  86. package/dist/vocab/type.test.js +11 -15
  87. package/dist/vocab/vocab.test.js +45 -49
  88. package/dist/{vocab-Cy9XhW_T.js → vocab-BebR0kAy.js} +6 -10
  89. package/dist/{vocab-BojAnGjI.js → vocab-DFlq4Wa6.js} +1057 -2270
  90. package/dist/webfinger/handler.test.js +33 -34
  91. package/dist/webfinger/lookup.test.js +13 -13
  92. package/dist/webfinger/mod.js +2 -2
  93. package/dist/x/cfworkers.test.js +9 -9
  94. package/package.json +1 -1
  95. package/dist/key-BROjrzkW.js +0 -16
  96. package/dist/middleware-BhqeOJrC.js +0 -17
  97. package/dist/middleware-DFra19vb.js +0 -33
@@ -3,20 +3,20 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import "../assert-DmFG7ppO.js";
8
- import "../assert_instance_of-CF09JHYM.js";
9
- import "../docloader-D4wl8z_4.js";
10
- import "../url-kTAI6_KP.js";
11
- import "../semver-DWClQt_5.js";
12
- import { getNodeInfo, parseInboundService, parseNodeInfo, parseOutboundService, parseProtocol, parseServices, parseSoftware, parseUsage } from "../client-D83KwIk4.js";
13
- import { test } from "../testing-BZ0dJ4qn.js";
14
- import "../std__assert-vp0TKMS1.js";
15
- import "../assert_rejects-C-sxEMM5.js";
16
- import "../assert_is_error-nrwA1GeT.js";
17
- import "../assert_not_equals-Dc7y-V5Q.js";
18
- import "../assert_throws-Cn9C6Jur.js";
19
- import { esm_default } from "../esm-Db4De7AS.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import "../assert-LOEeCUK5.js";
8
+ import "../assert_instance_of-XtuFevV_.js";
9
+ import "../docloader-bgBm1Hd1.js";
10
+ import "../url-C2xuoQD1.js";
11
+ import "../semver-BNrOOAs9.js";
12
+ import { getNodeInfo, parseInboundService, parseNodeInfo, parseOutboundService, parseProtocol, parseServices, parseSoftware, parseUsage } from "../client-DuUKk4pk.js";
13
+ import { test } from "../testing-DLyvtiiW.js";
14
+ import "../std__assert-o_r9vqm1.js";
15
+ import "../assert_rejects-DWQ4jaf9.js";
16
+ import "../assert_is_error-BTlryvT0.js";
17
+ import "../assert_not_equals-C685gKx6.js";
18
+ import "../assert_throws-YetpVSc-.js";
19
+ import { esm_default } from "../esm-DO9PrujO.js";
20
20
 
21
21
  //#region nodeinfo/client.test.ts
22
22
  test("getNodeInfo()", async (t) => {
@@ -446,7 +446,7 @@ test("parseSoftware()", () => {
446
446
  });
447
447
  });
448
448
  test("parseProtocol()", () => {
449
- const protocols = [
449
+ for (const protocol of [
450
450
  "activitypub",
451
451
  "buddycloud",
452
452
  "dfrn",
@@ -457,8 +457,7 @@ test("parseProtocol()", () => {
457
457
  "tent",
458
458
  "xmpp",
459
459
  "zot"
460
- ];
461
- for (const protocol of protocols) assertEquals(parseProtocol(protocol), protocol);
460
+ ]) assertEquals(parseProtocol(protocol), protocol);
462
461
  assertEquals(parseProtocol("foo"), null);
463
462
  });
464
463
  test("parseServices()", () => {
@@ -559,7 +558,7 @@ test("parseServices()", () => {
559
558
  });
560
559
  });
561
560
  test("parseInboundService()", () => {
562
- const services = [
561
+ for (const service of [
563
562
  "atom1.0",
564
563
  "gnusocial",
565
564
  "imap",
@@ -568,12 +567,11 @@ test("parseInboundService()", () => {
568
567
  "pumpio",
569
568
  "rss2.0",
570
569
  "twitter"
571
- ];
572
- for (const service of services) assertEquals(parseInboundService(service), service);
570
+ ]) assertEquals(parseInboundService(service), service);
573
571
  assertEquals(parseInboundService("foo"), null);
574
572
  });
575
573
  test("parseOutboundService()", () => {
576
- const services = [
574
+ for (const service of [
577
575
  "atom1.0",
578
576
  "blogger",
579
577
  "buddycloud",
@@ -602,8 +600,7 @@ test("parseOutboundService()", () => {
602
600
  "twitter",
603
601
  "wordpress",
604
602
  "xmpp"
605
- ];
606
- for (const service of services) assertEquals(parseOutboundService(service), service);
603
+ ]) assertEquals(parseOutboundService(service), service);
607
604
  assertEquals(parseOutboundService("foo"), null);
608
605
  });
609
606
  test("parseUsage()", () => {
@@ -3,44 +3,44 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import "../assert-DmFG7ppO.js";
8
- import "../assert_instance_of-CF09JHYM.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import "../assert-LOEeCUK5.js";
8
+ import "../assert_instance_of-XtuFevV_.js";
9
9
  import { MemoryKvStore } from "../kv-BMY6Qf_A.js";
10
- import { createFederation, handleNodeInfo, handleNodeInfoJrd } from "../middleware-D66R1UZl.js";
11
- import "../docloader-D4wl8z_4.js";
12
- import "../url-kTAI6_KP.js";
13
- import { parseSemVer } from "../semver-DWClQt_5.js";
14
- import "../client-D83KwIk4.js";
10
+ import { createFederation, handleNodeInfo, handleNodeInfoJrd } from "../middleware-3wVT6S9E.js";
11
+ import "../docloader-bgBm1Hd1.js";
12
+ import "../url-C2xuoQD1.js";
13
+ import { parseSemVer } from "../semver-BNrOOAs9.js";
14
+ import "../client-DuUKk4pk.js";
15
15
  import "../router-D_aVZZUc.js";
16
- import "../types-C7C_l-jz.js";
17
- import "../multibase-DeCHcK8L.js";
18
- import "../vocab-BojAnGjI.js";
16
+ import "../types-CJHS5pXl.js";
17
+ import "../multibase-CnLHszip.js";
18
+ import "../vocab-DFlq4Wa6.js";
19
19
  import "../langstr-DbWheeIS.js";
20
- import "../lookup-BGqnk7rW.js";
21
- import "../type-D2s5lmbZ.js";
22
- import "../actor-2ENhJMd7.js";
23
- import "../key-bttcdrh5.js";
24
- import "../http-DFHfa9tA.js";
25
- import "../authdocloader-CK17fG7y.js";
26
- import "../ld-U-lGfuzj.js";
27
- import "../owner-2zho-3Ew.js";
28
- import "../proof-BYHc1mMr.js";
29
- import "../lookup-C8ZpflGI.js";
30
- import "../inbox-CltmHpHc.js";
31
- import "../builder-CZM8EtHh.js";
20
+ import "../lookup-DL62q3Xh.js";
21
+ import "../type-CFuiGLz9.js";
22
+ import "../actor-TYqJGdVq.js";
23
+ import "../key-KVhaUM92.js";
24
+ import "../http-D2DkwsjA.js";
25
+ import "../authdocloader-hiFSyM7V.js";
26
+ import "../ld-DzlJ_IpT.js";
27
+ import "../owner-81ey_76X.js";
28
+ import "../proof-BlULDH4H.js";
29
+ import "../lookup-D0je8AqR.js";
30
+ import "../inbox-DAAZZl2k.js";
31
+ import "../builder-mi6RdzNE.js";
32
32
  import "../collection-Dfb0TPno.js";
33
- import "../keycache-DijbBawF.js";
33
+ import "../keycache-C1pEuRyQ.js";
34
34
  import "../retry-BiIhZWgD.js";
35
- import "../send-CW7iJ-b9.js";
36
- import { test } from "../testing-BZ0dJ4qn.js";
37
- import "../std__assert-vp0TKMS1.js";
38
- import "../assert_rejects-C-sxEMM5.js";
39
- import "../assert_is_error-nrwA1GeT.js";
40
- import "../assert_not_equals-Dc7y-V5Q.js";
41
- import "../assert_throws-Cn9C6Jur.js";
35
+ import "../send-DdxfTHo6.js";
36
+ import { test } from "../testing-DLyvtiiW.js";
37
+ import "../std__assert-o_r9vqm1.js";
38
+ import "../assert_rejects-DWQ4jaf9.js";
39
+ import "../assert_is_error-BTlryvT0.js";
40
+ import "../assert_not_equals-C685gKx6.js";
41
+ import "../assert_throws-YetpVSc-.js";
42
42
  import "../docloader-09nVWLAZ.js";
43
- import { createRequestContext } from "../context-MUHrGcK9.js";
43
+ import { createRequestContext } from "../context-RMU32mk4.js";
44
44
 
45
45
  //#region nodeinfo/handler.test.ts
46
46
  test("handleNodeInfo()", async () => {
@@ -2,8 +2,8 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import "../docloader-BcyuO_kK.js";
6
- import { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer } from "../types-DXmLob1B.js";
5
+ import "../docloader-DJxET2fN.js";
6
+ import { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer } from "../types-CmVV9LT1.js";
7
7
  import "../nodeinfo-CyEbLjHs.js";
8
8
 
9
9
  export { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer };
@@ -3,20 +3,20 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import "../assert-DmFG7ppO.js";
8
- import "../assert_instance_of-CF09JHYM.js";
9
- import { formatSemVer, parseSemVer } from "../semver-DWClQt_5.js";
10
- import { test } from "../testing-BZ0dJ4qn.js";
11
- import "../std__assert-vp0TKMS1.js";
12
- import "../assert_rejects-C-sxEMM5.js";
13
- import "../assert_is_error-nrwA1GeT.js";
14
- import "../assert_not_equals-Dc7y-V5Q.js";
15
- import { assertThrows } from "../assert_throws-Cn9C6Jur.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import "../assert-LOEeCUK5.js";
8
+ import "../assert_instance_of-XtuFevV_.js";
9
+ import { formatSemVer, parseSemVer } from "../semver-BNrOOAs9.js";
10
+ import { test } from "../testing-DLyvtiiW.js";
11
+ import "../std__assert-o_r9vqm1.js";
12
+ import "../assert_rejects-DWQ4jaf9.js";
13
+ import "../assert_is_error-BTlryvT0.js";
14
+ import "../assert_not_equals-C685gKx6.js";
15
+ import { assertThrows } from "../assert_throws-YetpVSc-.js";
16
16
 
17
17
  //#region nodeinfo/semver.test.ts
18
18
  test("parseSemVer() handles major", async (t) => {
19
- const versions = [
19
+ for (const [v, expected] of [
20
20
  ["1.2.3", 1],
21
21
  [" 1.2.3 ", 1],
22
22
  [" 2.2.3-4 ", 2],
@@ -24,14 +24,13 @@ test("parseSemVer() handles major", async (t) => {
24
24
  ["v5.2.3", 5],
25
25
  [" v8.2.3 ", 8],
26
26
  [" 13.2.3", 13]
27
- ];
28
- for (const [v, expected] of versions) await t.step(v, () => {
27
+ ]) await t.step(v, () => {
29
28
  const version = parseSemVer(v);
30
29
  assertEquals(version.major, expected);
31
30
  });
32
31
  });
33
32
  test("parseSemVer() handles minor", async (t) => {
34
- const versions = [
33
+ for (const [v, expected] of [
35
34
  ["1.1.3", 1],
36
35
  [" 1.1.3 ", 1],
37
36
  [" 1.2.3-4 ", 2],
@@ -39,14 +38,13 @@ test("parseSemVer() handles minor", async (t) => {
39
38
  ["v1.5.3", 5],
40
39
  [" v1.8.3 ", 8],
41
40
  [" 1.13.3", 13]
42
- ];
43
- for (const [v, expected] of versions) await t.step(v, () => {
41
+ ]) await t.step(v, () => {
44
42
  const version = parseSemVer(v);
45
43
  assertEquals(version.minor, expected);
46
44
  });
47
45
  });
48
46
  test("parseSemVer() handles patch", async (t) => {
49
- const versions = [
47
+ for (const [v, expected] of [
50
48
  ["1.2.1", 1],
51
49
  [" 1.2.1 ", 1],
52
50
  [" 1.2.2-4 ", 2],
@@ -54,15 +52,13 @@ test("parseSemVer() handles patch", async (t) => {
54
52
  ["v1.2.5", 5],
55
53
  [" v1.2.8 ", 8],
56
54
  [" 1.2.13", 13]
57
- ];
58
- for (const [v, expected] of versions) await t.step(v, () => {
59
- const semver = parseSemVer(v);
60
- const actual = semver.patch;
55
+ ]) await t.step(v, () => {
56
+ const actual = parseSemVer(v).patch;
61
57
  assertEquals(actual, expected);
62
58
  });
63
59
  });
64
60
  test("parseSemVer() handles prerelease", async (t) => {
65
- const versions = [
61
+ for (const [v, expected] of [
66
62
  ["1.2.2-alpha.1", ["alpha", 1]],
67
63
  ["0.6.1-1", [1]],
68
64
  ["1.0.0-beta.2", ["beta", 2]],
@@ -71,8 +67,7 @@ test("parseSemVer() handles prerelease", async (t) => {
71
67
  ["1.2.0-1b3-4", ["1b3-4"]],
72
68
  ["1.2.0-3.6-pre2", [3, "6-pre2"]],
73
69
  ["2.0.0", []]
74
- ];
75
- for (const [v, expected] of versions) await t.step(`${v} : ${JSON.stringify(expected)}`, () => {
70
+ ]) await t.step(`${v} : ${JSON.stringify(expected)}`, () => {
76
71
  const semver = parseSemVer(v);
77
72
  assertEquals(semver.prerelease, expected);
78
73
  });
@@ -101,14 +96,13 @@ test({
101
96
  }
102
97
  });
103
98
  test("parseSemVer() throws on invalid versions", async (t) => {
104
- const versions = [
99
+ for (const v of [
105
100
  "1.2.3.4",
106
101
  "NOT VALID",
107
102
  1.2,
108
103
  null,
109
104
  "Infinity.NaN.Infinity"
110
- ];
111
- for (const v of versions) await t.step(`invalid ${v}`, () => {
105
+ ]) await t.step(`invalid ${v}`, () => {
112
106
  assertThrows(function() {
113
107
  parseSemVer(v);
114
108
  }, TypeError);
@@ -119,7 +113,7 @@ test("parseSemVer() handles big numeric prerelease", function() {
119
113
  assertEquals(r.prerelease, ["beta", "90071992547409910"]);
120
114
  });
121
115
  test("formatSemVer()", async (t) => {
122
- const versions = [
116
+ for (const [version, expected] of [
123
117
  ["0.0.0", "0.0.0"],
124
118
  ["1.2.3", "1.2.3"],
125
119
  ["1.2.3-pre", "1.2.3-pre"],
@@ -127,8 +121,7 @@ test("formatSemVer()", async (t) => {
127
121
  ["1.2.3+b", "1.2.3+b"],
128
122
  ["1.2.3+b.0", "1.2.3+b.0"],
129
123
  ["1.2.3-pre.0+b.0", "1.2.3-pre.0+b.0"]
130
- ];
131
- for (const [version, expected] of versions) await t.step({
124
+ ]) await t.step({
132
125
  name: version,
133
126
  fn: () => {
134
127
  const v = parseSemVer(version);
@@ -3,17 +3,17 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import "../assert-DmFG7ppO.js";
8
- import "../assert_instance_of-CF09JHYM.js";
9
- import "../semver-DWClQt_5.js";
10
- import { nodeInfoToJson } from "../types-C7C_l-jz.js";
11
- import { test } from "../testing-BZ0dJ4qn.js";
12
- import "../std__assert-vp0TKMS1.js";
13
- import "../assert_rejects-C-sxEMM5.js";
14
- import "../assert_is_error-nrwA1GeT.js";
15
- import "../assert_not_equals-Dc7y-V5Q.js";
16
- import { assertThrows } from "../assert_throws-Cn9C6Jur.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import "../assert-LOEeCUK5.js";
8
+ import "../assert_instance_of-XtuFevV_.js";
9
+ import "../semver-BNrOOAs9.js";
10
+ import { nodeInfoToJson } from "../types-CJHS5pXl.js";
11
+ import { test } from "../testing-DLyvtiiW.js";
12
+ import "../std__assert-o_r9vqm1.js";
13
+ import "../assert_rejects-DWQ4jaf9.js";
14
+ import "../assert_is_error-BTlryvT0.js";
15
+ import "../assert_not_equals-C685gKx6.js";
16
+ import { assertThrows } from "../assert_throws-YetpVSc-.js";
17
17
 
18
18
  //#region nodeinfo/types.test.ts
19
19
  test("nodeInfoToJson()", () => {
@@ -3,9 +3,9 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { getDocumentLoader } from "./docloader-D4wl8z_4.js";
7
- import { CryptographicKey, Object as Object$1 } from "./vocab-BojAnGjI.js";
8
- import { isActor } from "./actor-2ENhJMd7.js";
6
+ import { getDocumentLoader } from "./docloader-bgBm1Hd1.js";
7
+ import { CryptographicKey, Object as Object$1 } from "./vocab-DFlq4Wa6.js";
8
+ import { isActor } from "./actor-TYqJGdVq.js";
9
9
  import { trace } from "@opentelemetry/api";
10
10
 
11
11
  //#region sig/owner.ts
@@ -3,10 +3,10 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default } from "./docloader-D4wl8z_4.js";
7
- import { Activity, DataIntegrityProof, Multikey } from "./vocab-BojAnGjI.js";
8
- import { getTypeId } from "./type-D2s5lmbZ.js";
9
- import { fetchKey, validateCryptoKey } from "./key-bttcdrh5.js";
6
+ import { deno_default } from "./docloader-bgBm1Hd1.js";
7
+ import { Activity, DataIntegrityProof, Multikey } from "./vocab-DFlq4Wa6.js";
8
+ import { getTypeId } from "./type-CFuiGLz9.js";
9
+ import { fetchKey, validateCryptoKey } from "./key-KVhaUM92.js";
10
10
  import { getLogger } from "@logtape/logtape";
11
11
  import { SpanStatusCode, trace } from "@opentelemetry/api";
12
12
  import { encodeHex } from "byte-encodings/hex";
@@ -31,8 +31,7 @@ const logger = getLogger([
31
31
  async function createProof(object, privateKey, keyId, { contextLoader, context: context$1, created } = {}) {
32
32
  validateCryptoKey(privateKey, "private");
33
33
  if (privateKey.algorithm.name !== "Ed25519") throw new TypeError("Unsupported algorithm: " + privateKey.algorithm.name);
34
- const objectWithoutProofs = object.clone({ proofs: [] });
35
- const compactMsg = await objectWithoutProofs.toJsonLd({
34
+ const compactMsg = await object.clone({ proofs: [] }).toJsonLd({
36
35
  format: "compact",
37
36
  contextLoader,
38
37
  context: context$1
@@ -76,9 +75,7 @@ async function createProof(object, privateKey, keyId, { contextLoader, context:
76
75
  * @since 0.10.0
77
76
  */
78
77
  async function signObject(object, privateKey, keyId, options = {}) {
79
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
80
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
81
- return await tracer.startActiveSpan("object_integrity_proofs.sign", { attributes: { "activitypub.object.type": getTypeId(object).href } }, async (span) => {
78
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("object_integrity_proofs.sign", { attributes: { "activitypub.object.type": getTypeId(object).href } }, async (span) => {
82
79
  try {
83
80
  if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
84
81
  const existingProofs = [];
@@ -112,9 +109,7 @@ async function signObject(object, privateKey, keyId, options = {}) {
112
109
  * @since 0.10.0
113
110
  */
114
111
  async function verifyProof(jsonLd, proof, options = {}) {
115
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
116
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
117
- return await tracer.startActiveSpan("object_integrity_proofs.verify", async (span) => {
112
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("object_integrity_proofs.verify", async (span) => {
118
113
  if (span.isRecording()) {
119
114
  if (proof.cryptosuite != null) span.setAttribute("object_integrity_proofs.cryptosuite", proof.cryptosuite);
120
115
  if (proof.verificationMethodId != null) span.setAttribute("object_integrity_proofs.key_id", proof.verificationMethodId.href);
@@ -197,8 +192,7 @@ async function verifyProofInternal(jsonLd, proof, options) {
197
192
  });
198
193
  return null;
199
194
  }
200
- const verified = await crypto.subtle.verify("Ed25519", publicKey.publicKey, proof.proofValue, digest);
201
- if (!verified) {
195
+ if (!await crypto.subtle.verify("Ed25519", publicKey.publicKey, proof.proofValue.slice(), digest)) {
202
196
  if (fetchedKey.cached) {
203
197
  logger.debug("Failed to verify the proof with the cached key {keyId}; retrying with the freshly fetched key...", {
204
198
  keyId: proof.verificationMethodId.href,
@@ -2,9 +2,9 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import { deno_default, getDocumentLoader } from "./docloader-BcyuO_kK.js";
6
- import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, getTypeId, isActor } from "./actor-DgWryCk8.js";
7
- import { fetchKey, validateCryptoKey } from "./key-qFVeObG1.js";
5
+ import { deno_default, getDocumentLoader } from "./docloader-DJxET2fN.js";
6
+ import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, getTypeId, isActor } from "./actor-GZRoTRqg.js";
7
+ import { fetchKey, validateCryptoKey } from "./key-DmqJj57e.js";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
  import { SpanStatusCode, trace } from "@opentelemetry/api";
10
10
  import jsonld from "jsonld";
@@ -56,8 +56,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
56
56
  const optionsHash = await hashJsonLd(options, contextLoader);
57
57
  const docHash = await hashJsonLd(jsonLd, contextLoader);
58
58
  const message = optionsHash + docHash;
59
- const encoder = new TextEncoder();
60
- const messageBytes = encoder.encode(message);
59
+ const messageBytes = new TextEncoder().encode(message);
61
60
  const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, messageBytes);
62
61
  return {
63
62
  ...options,
@@ -79,9 +78,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
79
78
  * @since 1.0.0
80
79
  */
81
80
  async function signJsonLd(jsonLd, privateKey, keyId, options) {
82
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
83
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
84
- return await tracer.startActiveSpan("ld_signatures.sign", { attributes: { "ld_signatures.key_id": keyId.href } }, async (span) => {
81
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("ld_signatures.sign", { attributes: { "ld_signatures.key_id": keyId.href } }, async (span) => {
85
82
  try {
86
83
  const signature = await createSignature(jsonLd, privateKey, keyId, options);
87
84
  if (span.isRecording()) {
@@ -183,8 +180,7 @@ async function verifySignature(jsonLd, options = {}) {
183
180
  const encoder = new TextEncoder();
184
181
  const message = sigOptsHash + docHash;
185
182
  const messageBytes = encoder.encode(message);
186
- const verified = await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, signature, messageBytes);
187
- if (verified) return key;
183
+ if (await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, signature.slice(), messageBytes)) return key;
188
184
  if (cached) {
189
185
  logger$1.debug("Failed to verify with the cached key {keyId}; signature {signatureValue} is invalid. Retrying with the freshly fetched key...", {
190
186
  keyId: sig.creator,
@@ -198,8 +194,7 @@ async function verifySignature(jsonLd, options = {}) {
198
194
  }
199
195
  });
200
196
  if (key$1 == null) return null;
201
- const verified$1 = await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key$1.publicKey, signature, messageBytes);
202
- return verified$1 ? key$1 : null;
197
+ return await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key$1.publicKey, signature.slice(), messageBytes) ? key$1 : null;
203
198
  }
204
199
  logger$1.debug("Failed to verify with the fetched key {keyId}; signature {signatureValue} is invalid. Check if the key is correct or if the signed message is correct. The message to sign is:\n{message}", {
205
200
  keyId: sig.creator,
@@ -218,9 +213,7 @@ async function verifySignature(jsonLd, options = {}) {
218
213
  * @returns `true` if the document is authentic; `false` otherwise.
219
214
  */
220
215
  async function verifyJsonLd(jsonLd, options = {}) {
221
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
222
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
223
- return await tracer.startActiveSpan("ld_signatures.verify", async (span) => {
216
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("ld_signatures.verify", async (span) => {
224
217
  try {
225
218
  const object = await Object$1.fromJsonLd(jsonLd, options);
226
219
  if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
@@ -363,8 +356,7 @@ const logger = getLogger([
363
356
  async function createProof(object, privateKey, keyId, { contextLoader, context: context$1, created } = {}) {
364
357
  validateCryptoKey(privateKey, "private");
365
358
  if (privateKey.algorithm.name !== "Ed25519") throw new TypeError("Unsupported algorithm: " + privateKey.algorithm.name);
366
- const objectWithoutProofs = object.clone({ proofs: [] });
367
- const compactMsg = await objectWithoutProofs.toJsonLd({
359
+ const compactMsg = await object.clone({ proofs: [] }).toJsonLd({
368
360
  format: "compact",
369
361
  contextLoader,
370
362
  context: context$1
@@ -408,9 +400,7 @@ async function createProof(object, privateKey, keyId, { contextLoader, context:
408
400
  * @since 0.10.0
409
401
  */
410
402
  async function signObject(object, privateKey, keyId, options = {}) {
411
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
412
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
413
- return await tracer.startActiveSpan("object_integrity_proofs.sign", { attributes: { "activitypub.object.type": getTypeId(object).href } }, async (span) => {
403
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("object_integrity_proofs.sign", { attributes: { "activitypub.object.type": getTypeId(object).href } }, async (span) => {
414
404
  try {
415
405
  if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
416
406
  const existingProofs = [];
@@ -444,9 +434,7 @@ async function signObject(object, privateKey, keyId, options = {}) {
444
434
  * @since 0.10.0
445
435
  */
446
436
  async function verifyProof(jsonLd, proof, options = {}) {
447
- const tracerProvider = options.tracerProvider ?? trace.getTracerProvider();
448
- const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
449
- return await tracer.startActiveSpan("object_integrity_proofs.verify", async (span) => {
437
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("object_integrity_proofs.verify", async (span) => {
450
438
  if (span.isRecording()) {
451
439
  if (proof.cryptosuite != null) span.setAttribute("object_integrity_proofs.cryptosuite", proof.cryptosuite);
452
440
  if (proof.verificationMethodId != null) span.setAttribute("object_integrity_proofs.key_id", proof.verificationMethodId.href);
@@ -529,8 +517,7 @@ async function verifyProofInternal(jsonLd, proof, options) {
529
517
  });
530
518
  return null;
531
519
  }
532
- const verified = await crypto.subtle.verify("Ed25519", publicKey.publicKey, proof.proofValue, digest);
533
- if (!verified) {
520
+ if (!await crypto.subtle.verify("Ed25519", publicKey.publicKey, proof.proofValue.slice(), digest)) {
534
521
  if (fetchedKey.cached) {
535
522
  logger.debug("Failed to verify the proof with the cached key {keyId}; retrying with the freshly fetched key...", {
536
523
  keyId: proof.verificationMethodId.href,
@@ -3,29 +3,29 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import "../assert-DmFG7ppO.js";
8
- import "../assert_instance_of-CF09JHYM.js";
9
- import "../docloader-D4wl8z_4.js";
10
- import { UrlError } from "../url-kTAI6_KP.js";
11
- import "../multibase-DeCHcK8L.js";
12
- import "../vocab-BojAnGjI.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import "../assert-LOEeCUK5.js";
8
+ import "../assert_instance_of-XtuFevV_.js";
9
+ import "../docloader-bgBm1Hd1.js";
10
+ import { UrlError } from "../url-C2xuoQD1.js";
11
+ import "../multibase-CnLHszip.js";
12
+ import "../vocab-DFlq4Wa6.js";
13
13
  import "../langstr-DbWheeIS.js";
14
- import "../lookup-BGqnk7rW.js";
15
- import "../type-D2s5lmbZ.js";
16
- import "../actor-2ENhJMd7.js";
17
- import "../key-bttcdrh5.js";
18
- import { verifyRequest } from "../http-DFHfa9tA.js";
19
- import { getAuthenticatedDocumentLoader } from "../authdocloader-CK17fG7y.js";
20
- import { test } from "../testing-BZ0dJ4qn.js";
21
- import "../std__assert-vp0TKMS1.js";
22
- import { assertRejects } from "../assert_rejects-C-sxEMM5.js";
23
- import "../assert_is_error-nrwA1GeT.js";
24
- import "../assert_not_equals-Dc7y-V5Q.js";
25
- import "../assert_throws-Cn9C6Jur.js";
14
+ import "../lookup-DL62q3Xh.js";
15
+ import "../type-CFuiGLz9.js";
16
+ import "../actor-TYqJGdVq.js";
17
+ import "../key-KVhaUM92.js";
18
+ import { verifyRequest } from "../http-D2DkwsjA.js";
19
+ import { getAuthenticatedDocumentLoader } from "../authdocloader-hiFSyM7V.js";
20
+ import { test } from "../testing-DLyvtiiW.js";
21
+ import "../std__assert-o_r9vqm1.js";
22
+ import { assertRejects } from "../assert_rejects-DWQ4jaf9.js";
23
+ import "../assert_is_error-BTlryvT0.js";
24
+ import "../assert_not_equals-C685gKx6.js";
25
+ import "../assert_throws-YetpVSc-.js";
26
26
  import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
27
- import { rsaPrivateKey2 } from "../keys-DJ5t4jB4.js";
28
- import { esm_default } from "../esm-Db4De7AS.js";
27
+ import { rsaPrivateKey2 } from "../keys-C4XQHW5_.js";
28
+ import { esm_default } from "../esm-DO9PrujO.js";
29
29
 
30
30
  //#region runtime/authdocloader.test.ts
31
31
  test("getAuthenticatedDocumentLoader()", async (t) => {
@@ -3,20 +3,20 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-CTYbeopb.js";
7
- import "../assert-DmFG7ppO.js";
8
- import "../assert_instance_of-CF09JHYM.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import "../assert-LOEeCUK5.js";
8
+ import "../assert_instance_of-XtuFevV_.js";
9
9
  import { MemoryKvStore } from "../kv-BMY6Qf_A.js";
10
- import { FetchError, contexts_default, deno_default, getDocumentLoader, getUserAgent, kvCache } from "../docloader-D4wl8z_4.js";
11
- import { UrlError } from "../url-kTAI6_KP.js";
12
- import { test } from "../testing-BZ0dJ4qn.js";
13
- import "../std__assert-vp0TKMS1.js";
14
- import { assertRejects } from "../assert_rejects-C-sxEMM5.js";
15
- import "../assert_is_error-nrwA1GeT.js";
16
- import "../assert_not_equals-Dc7y-V5Q.js";
17
- import { assertThrows } from "../assert_throws-Cn9C6Jur.js";
10
+ import { FetchError, contexts_default, deno_default, getDocumentLoader, getUserAgent, kvCache } from "../docloader-bgBm1Hd1.js";
11
+ import { UrlError } from "../url-C2xuoQD1.js";
12
+ import { test } from "../testing-DLyvtiiW.js";
13
+ import "../std__assert-o_r9vqm1.js";
14
+ import { assertRejects } from "../assert_rejects-DWQ4jaf9.js";
15
+ import "../assert_is_error-BTlryvT0.js";
16
+ import "../assert_not_equals-C685gKx6.js";
17
+ import { assertThrows } from "../assert_throws-YetpVSc-.js";
18
18
  import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
19
- import { esm_default } from "../esm-Db4De7AS.js";
19
+ import { esm_default } from "../esm-DO9PrujO.js";
20
20
  import process from "node:process";
21
21
 
22
22
  //#region runtime/docloader.test.ts
@@ -351,13 +351,12 @@ test("kvCache()", async (t) => {
351
351
  });
352
352
  });
353
353
  await t.step("not cached", async () => {
354
- const loader = kvCache({
354
+ const result = await kvCache({
355
355
  kv,
356
356
  loader: mockDocumentLoader,
357
357
  rules: [],
358
358
  prefix: ["_test", "not cached"]
359
- });
360
- const result = await loader("https://example.com/object");
359
+ })("https://example.com/object");
361
360
  assertEquals(result, {
362
361
  contextUrl: null,
363
362
  documentUrl: "https://example.com/object",
@@ -405,7 +404,7 @@ test("kvCache()", async (t) => {
405
404
  throw new Error("Failed to delete key");
406
405
  }
407
406
  }
408
- const loader = kvCache({
407
+ const result = await kvCache({
409
408
  kv: new KvStoreThrowsException(),
410
409
  loader: mockDocumentLoader,
411
410
  rules: [
@@ -414,8 +413,7 @@ test("kvCache()", async (t) => {
414
413
  [new URLPattern("https://example.com/*"), Temporal.Duration.from({ days: 30 })]
415
414
  ],
416
415
  prefix: ["_test", "not cached"]
417
- });
418
- const result = await loader("https://example.com/object");
416
+ })("https://example.com/object");
419
417
  assertEquals(result, {
420
418
  contextUrl: null,
421
419
  documentUrl: "https://example.com/object",