@fedify/fedify 1.6.9 → 1.6.11

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 (98) hide show
  1. package/dist/{actor-DY_ediuQ.js → actor-CxnKxfwH.js} +1059 -2276
  2. package/dist/{actor-qNVQigMJ.js → actor-KrOvzFz1.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-DTpSS6vq.js → authdocloader-CsnXlm3V.js} +4 -4
  11. package/dist/{authdocloader-ColUu5fh.js → authdocloader-DsULyH5D.js} +3 -3
  12. package/dist/{builder-CTAic_n3.js → builder-BjJSVOvs.js} +7 -10
  13. package/dist/{chunk-HsBuZ-b2.js → chunk-Cx8LTkjm.js} +3 -1
  14. package/dist/{client-Bp-TqQI6.js → client-BlntqhE9.js} +6 -6
  15. package/dist/compat/transformers.test.js +27 -28
  16. package/dist/{context-BAx407GT.js → context-CiyuTkCx.js} +2 -2
  17. package/dist/{docloader-UqcHJRjL.js → docloader-BYgIBZvh.js} +4 -6
  18. package/dist/{docloader-NmruKwBX.js → docloader-DOrb0fRp.js} +5 -9
  19. package/dist/{esm-Db4De7AS.js → esm-DO9PrujO.js} +23 -34
  20. package/dist/federation/builder.test.js +20 -23
  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 +53 -68
  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-3B6BDKCK.js → federation-DyRlaC4X.js} +1 -2
  33. package/dist/fixtures/oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd.json +24 -0
  34. package/dist/{http-DjFoawa6.js → http-Dc8RIaDE.js} +56 -17
  35. package/dist/{http-XWz7prGl.js → http-LsE7i_Zq.js} +56 -17
  36. package/dist/{inbox-eAHML3xw.js → inbox-BVwejjm8.js} +5 -7
  37. package/dist/key-BP-Oky5H.js +16 -0
  38. package/dist/{key-CUEyp_yz.js → key-BTcmhZp7.js} +6 -9
  39. package/dist/{key-B4UFmNvL.js → key-Bg_PKGpe.js} +5 -8
  40. package/dist/{key-C1UhN1LT.js → key-DxKqQgGm.js} +4 -4
  41. package/dist/{keycache-YqFJn7EL.js → keycache-BnCTs9sG.js} +2 -2
  42. package/dist/{keys-Dd_v3HDs.js → keys-pbGG00jU.js} +1 -1
  43. package/dist/{ld-D8WCx-VU.js → ld-n_kUCeXG.js} +9 -16
  44. package/dist/{lookup-DggOHyrB.js → lookup-1pupHJbK.js} +7 -11
  45. package/dist/{lookup-DEN8lvde.js → lookup-Cutk-FXA.js} +3 -5
  46. package/dist/{lookup-DHlMvC3Q.js → lookup-DrAS097Q.js} +2 -4
  47. package/dist/middleware-CDYmpOKW.js +33 -0
  48. package/dist/{middleware-D_j7IO2V.js → middleware-CMTirIyg.js} +34 -52
  49. package/dist/middleware-CXZvlTVn.js +17 -0
  50. package/dist/{middleware-mmR5eUDI.js → middleware-kjrPMCqA.js} +34 -58
  51. package/dist/mod.js +11 -11
  52. package/dist/{multibase-DeCHcK8L.js → multibase-CnLHszip.js} +1 -2
  53. package/dist/nodeinfo/client.test.js +20 -23
  54. package/dist/nodeinfo/handler.test.js +32 -32
  55. package/dist/nodeinfo/mod.js +2 -2
  56. package/dist/nodeinfo/semver.test.js +23 -30
  57. package/dist/nodeinfo/types.test.js +11 -11
  58. package/dist/{owner-lYBh2f5Z.js → owner-c-Zzpacz.js} +3 -3
  59. package/dist/{proof-CPamyAcG.js → proof-BTx3Maj-.js} +12 -25
  60. package/dist/{proof-BAoGg0DQ.js → proof-CTOU2zFF.js} +8 -14
  61. package/dist/runtime/authdocloader.test.js +21 -21
  62. package/dist/runtime/docloader.test.js +16 -18
  63. package/dist/runtime/key.test.js +17 -17
  64. package/dist/runtime/langstr.test.js +9 -9
  65. package/dist/runtime/mod.js +6 -6
  66. package/dist/runtime/multibase/multibase.test.js +11 -12
  67. package/dist/runtime/url.test.js +6 -6
  68. package/dist/{semver-DWClQt_5.js → semver-BNrOOAs9.js} +1 -3
  69. package/dist/{send-CrbpYrfD.js → send-SniNSIKd.js} +3 -4
  70. package/dist/sig/http.test.js +55 -53
  71. package/dist/sig/key.test.js +18 -18
  72. package/dist/sig/ld.test.js +20 -22
  73. package/dist/sig/mod.js +6 -6
  74. package/dist/sig/owner.test.js +20 -20
  75. package/dist/sig/proof.test.js +19 -19
  76. package/dist/{std__assert-vp0TKMS1.js → std__assert-o_r9vqm1.js} +1 -1
  77. package/dist/testing/docloader.test.js +9 -9
  78. package/dist/testing/mod.js +1 -1
  79. package/dist/{testing-BZ0dJ4qn.js → testing-DLyvtiiW.js} +3 -5
  80. package/dist/{type-D2s5lmbZ.js → type-CFuiGLz9.js} +1 -2
  81. package/dist/{types-C7C_l-jz.js → types-CJHS5pXl.js} +1 -1
  82. package/dist/{types-Bl1hBU1t.js → types-DG1qZLU9.js} +6 -8
  83. package/dist/{url-kTAI6_KP.js → url-C2xuoQD1.js} +2 -4
  84. package/dist/vocab/actor.test.js +104 -156
  85. package/dist/vocab/lookup.test.js +17 -17
  86. package/dist/vocab/mod.js +4 -4
  87. package/dist/vocab/type.test.js +11 -15
  88. package/dist/vocab/vocab.test.js +45 -49
  89. package/dist/{vocab-Cs9KbJAx.js → vocab-lzEJg2bH.js} +1057 -2270
  90. package/dist/{vocab-DSVoOj6P.js → vocab-oKloyO0F.js} +6 -10
  91. package/dist/webfinger/handler.test.js +33 -34
  92. package/dist/webfinger/lookup.test.js +13 -13
  93. package/dist/webfinger/mod.js +2 -2
  94. package/dist/x/cfworkers.test.js +9 -9
  95. package/package.json +1 -1
  96. package/dist/key-ByAyOg3m.js +0 -16
  97. package/dist/middleware-B-ysz1Gc.js +0 -17
  98. package/dist/middleware-Bmr-V4-W.js +0 -33
package/dist/mod.js CHANGED
@@ -4,17 +4,17 @@
4
4
 
5
5
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./transformers-ghwJuzGY.js";
6
6
  import "./compat-Bb5myD13.js";
7
- import { FetchError, fetchDocumentLoader, getDocumentLoader, getUserAgent, kvCache } from "./docloader-NmruKwBX.js";
8
- import { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, LanguageString, Leave, Like, Link, Listen, Mention, Move, Multikey, Note, Object as Object$1, Offer, OrderedCollection, OrderedCollectionPage, Organization, Page, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View, exportMultibaseKey, exportSpki, getActorClassByTypeName, getActorHandle, getActorTypeName, getTypeId, importMultibaseKey, importPem, importPkcs1, importSpki, isActor, normalizeActorHandle } from "./actor-DY_ediuQ.js";
9
- import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "./middleware-mmR5eUDI.js";
10
- import { lookupWebFinger } from "./lookup-DHlMvC3Q.js";
11
- import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk } from "./key-B4UFmNvL.js";
12
- import { signRequest, verifyRequest } from "./http-XWz7prGl.js";
13
- import { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, getKeyOwner, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "./proof-CPamyAcG.js";
14
- import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation-3B6BDKCK.js";
15
- import { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer } from "./types-Bl1hBU1t.js";
16
- import { getAuthenticatedDocumentLoader } from "./authdocloader-ColUu5fh.js";
17
- import { PUBLIC_COLLECTION, lookupObject, traverseCollection } from "./vocab-DSVoOj6P.js";
7
+ import { FetchError, fetchDocumentLoader, getDocumentLoader, getUserAgent, kvCache } from "./docloader-DOrb0fRp.js";
8
+ import { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, Flag, Follow, Group, Hashtag, Ignore, Image, IntransitiveActivity, Invite, Join, LanguageString, Leave, Like, Link, Listen, Mention, Move, Multikey, Note, Object as Object$1, Offer, OrderedCollection, OrderedCollectionPage, Organization, Page, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View, exportMultibaseKey, exportSpki, getActorClassByTypeName, getActorHandle, getActorTypeName, getTypeId, importMultibaseKey, importPem, importPkcs1, importSpki, isActor, normalizeActorHandle } from "./actor-CxnKxfwH.js";
9
+ import { Router, RouterError, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, digest, respondWithObject, respondWithObjectIfAcceptable } from "./middleware-kjrPMCqA.js";
10
+ import { lookupWebFinger } from "./lookup-DrAS097Q.js";
11
+ import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk } from "./key-Bg_PKGpe.js";
12
+ import { signRequest, verifyRequest } from "./http-LsE7i_Zq.js";
13
+ import { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, getKeyOwner, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "./proof-BTx3Maj-.js";
14
+ import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation-DyRlaC4X.js";
15
+ import { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer } from "./types-DG1qZLU9.js";
16
+ import { getAuthenticatedDocumentLoader } from "./authdocloader-DsULyH5D.js";
17
+ import { PUBLIC_COLLECTION, lookupObject, traverseCollection } from "./vocab-oKloyO0F.js";
18
18
  import "./nodeinfo-CyEbLjHs.js";
19
19
  import "./runtime-BSkOVUWM.js";
20
20
  import "./sig-BXJO--F9.js";
@@ -299,8 +299,7 @@ function decode(data) {
299
299
  "k",
300
300
  "K"
301
301
  ].includes(prefix)) data = data.toLowerCase();
302
- const enc = encoding(data[0]);
303
- return enc.decode(data.substring(1));
302
+ return encoding(data[0]).decode(data.substring(1));
304
303
  }
305
304
  /**
306
305
  * Get the encoding by name or code
@@ -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-UqcHJRjL.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-Bp-TqQI6.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-BYgIBZvh.js";
10
+ import "../url-C2xuoQD1.js";
11
+ import "../semver-BNrOOAs9.js";
12
+ import { getNodeInfo, parseInboundService, parseNodeInfo, parseOutboundService, parseProtocol, parseServices, parseSoftware, parseUsage } from "../client-BlntqhE9.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-DohFOP2C.js";
10
- import { createFederation, handleNodeInfo, handleNodeInfoJrd } from "../middleware-D_j7IO2V.js";
11
- import "../docloader-UqcHJRjL.js";
12
- import "../url-kTAI6_KP.js";
13
- import { parseSemVer } from "../semver-DWClQt_5.js";
14
- import "../client-Bp-TqQI6.js";
10
+ import { createFederation, handleNodeInfo, handleNodeInfoJrd } from "../middleware-CMTirIyg.js";
11
+ import "../docloader-BYgIBZvh.js";
12
+ import "../url-C2xuoQD1.js";
13
+ import { parseSemVer } from "../semver-BNrOOAs9.js";
14
+ import "../client-BlntqhE9.js";
15
15
  import "../router-D_aVZZUc.js";
16
- import "../types-C7C_l-jz.js";
17
- import "../multibase-DeCHcK8L.js";
18
- import "../vocab-Cs9KbJAx.js";
16
+ import "../types-CJHS5pXl.js";
17
+ import "../multibase-CnLHszip.js";
18
+ import "../vocab-lzEJg2bH.js";
19
19
  import "../langstr-DbWheeIS.js";
20
- import "../lookup-DEN8lvde.js";
21
- import "../type-D2s5lmbZ.js";
22
- import "../actor-qNVQigMJ.js";
23
- import "../key-CUEyp_yz.js";
24
- import "../http-DjFoawa6.js";
25
- import "../authdocloader-DTpSS6vq.js";
26
- import "../ld-D8WCx-VU.js";
27
- import "../owner-lYBh2f5Z.js";
28
- import "../proof-BAoGg0DQ.js";
29
- import "../lookup-DggOHyrB.js";
30
- import "../inbox-eAHML3xw.js";
31
- import "../builder-CTAic_n3.js";
20
+ import "../lookup-Cutk-FXA.js";
21
+ import "../type-CFuiGLz9.js";
22
+ import "../actor-KrOvzFz1.js";
23
+ import "../key-BTcmhZp7.js";
24
+ import "../http-Dc8RIaDE.js";
25
+ import "../authdocloader-CsnXlm3V.js";
26
+ import "../ld-n_kUCeXG.js";
27
+ import "../owner-c-Zzpacz.js";
28
+ import "../proof-CTOU2zFF.js";
29
+ import "../lookup-1pupHJbK.js";
30
+ import "../inbox-BVwejjm8.js";
31
+ import "../builder-BjJSVOvs.js";
32
32
  import "../collection-Dfb0TPno.js";
33
- import "../keycache-YqFJn7EL.js";
33
+ import "../keycache-BnCTs9sG.js";
34
34
  import "../retry-BiIhZWgD.js";
35
- import "../send-CrbpYrfD.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-SniNSIKd.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-BAx407GT.js";
43
+ import { createRequestContext } from "../context-CiyuTkCx.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-NmruKwBX.js";
6
- import { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer } from "../types-Bl1hBU1t.js";
5
+ import "../docloader-DOrb0fRp.js";
6
+ import { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer } from "../types-DG1qZLU9.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-UqcHJRjL.js";
7
- import { CryptographicKey, Object as Object$1 } from "./vocab-Cs9KbJAx.js";
8
- import { isActor } from "./actor-qNVQigMJ.js";
6
+ import { getDocumentLoader } from "./docloader-BYgIBZvh.js";
7
+ import { CryptographicKey, Object as Object$1 } from "./vocab-lzEJg2bH.js";
8
+ import { isActor } from "./actor-KrOvzFz1.js";
9
9
  import { trace } from "@opentelemetry/api";
10
10
 
11
11
  //#region sig/owner.ts
@@ -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-NmruKwBX.js";
6
- import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, getTypeId, isActor } from "./actor-DY_ediuQ.js";
7
- import { fetchKey, validateCryptoKey } from "./key-B4UFmNvL.js";
5
+ import { deno_default, getDocumentLoader } from "./docloader-DOrb0fRp.js";
6
+ import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, getTypeId, isActor } from "./actor-CxnKxfwH.js";
7
+ import { fetchKey, validateCryptoKey } from "./key-Bg_PKGpe.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,10 +3,10 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default } from "./docloader-UqcHJRjL.js";
7
- import { Activity, DataIntegrityProof, Multikey } from "./vocab-Cs9KbJAx.js";
8
- import { getTypeId } from "./type-D2s5lmbZ.js";
9
- import { fetchKey, validateCryptoKey } from "./key-CUEyp_yz.js";
6
+ import { deno_default } from "./docloader-BYgIBZvh.js";
7
+ import { Activity, DataIntegrityProof, Multikey } from "./vocab-lzEJg2bH.js";
8
+ import { getTypeId } from "./type-CFuiGLz9.js";
9
+ import { fetchKey, validateCryptoKey } from "./key-BTcmhZp7.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,
@@ -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-UqcHJRjL.js";
10
- import { UrlError } from "../url-kTAI6_KP.js";
11
- import "../multibase-DeCHcK8L.js";
12
- import "../vocab-Cs9KbJAx.js";
6
+ import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
+ import "../assert-LOEeCUK5.js";
8
+ import "../assert_instance_of-XtuFevV_.js";
9
+ import "../docloader-BYgIBZvh.js";
10
+ import { UrlError } from "../url-C2xuoQD1.js";
11
+ import "../multibase-CnLHszip.js";
12
+ import "../vocab-lzEJg2bH.js";
13
13
  import "../langstr-DbWheeIS.js";
14
- import "../lookup-DEN8lvde.js";
15
- import "../type-D2s5lmbZ.js";
16
- import "../actor-qNVQigMJ.js";
17
- import "../key-CUEyp_yz.js";
18
- import { verifyRequest } from "../http-DjFoawa6.js";
19
- import { getAuthenticatedDocumentLoader } from "../authdocloader-DTpSS6vq.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-Cutk-FXA.js";
15
+ import "../type-CFuiGLz9.js";
16
+ import "../actor-KrOvzFz1.js";
17
+ import "../key-BTcmhZp7.js";
18
+ import { verifyRequest } from "../http-Dc8RIaDE.js";
19
+ import { getAuthenticatedDocumentLoader } from "../authdocloader-CsnXlm3V.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-Dd_v3HDs.js";
28
- import { esm_default } from "../esm-Db4De7AS.js";
27
+ import { rsaPrivateKey2 } from "../keys-pbGG00jU.js";
28
+ import { esm_default } from "../esm-DO9PrujO.js";
29
29
 
30
30
  //#region runtime/authdocloader.test.ts
31
31
  test("getAuthenticatedDocumentLoader()", async (t) => {