@fedify/fedify 2.0.8 → 2.0.9

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 (203) hide show
  1. package/dist/{assert-MZs1qjMx.js → assert-ddO5KLpe.mjs} +5 -9
  2. package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Ew3jOFa3.mjs} +55 -69
  3. package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-C4Ri6VuN.mjs} +5 -9
  4. package/dist/{assert_not_equals-C80BG-_5.js → assert_not_equals--wG9hV7u.mjs} +6 -13
  5. package/dist/{assert_rejects-Ce45JcFg.js → assert_rejects-B-qJtC9Z.mjs} +6 -11
  6. package/dist/{assert_throws-BNXdRGWP.js → assert_throws-4NwKEy2q.mjs} +5 -10
  7. package/dist/{builder-B5cKln9v.js → builder-DDoQaGOu.mjs} +32 -41
  8. package/dist/{chunk-CGaQZ11T.cjs → chunk-DDcVe30Y.cjs} +23 -24
  9. package/dist/{chunk-DJNbSFdH.js → chunk-nlSIicah.js} +8 -8
  10. package/dist/{client-CoCIaTNO.js → client-A1UrnX6I.mjs} +9 -13
  11. package/dist/{client-BxMZiQaD.d.ts → client-AtlibPOU.d.ts} +1 -1
  12. package/dist/{client-C97KOq3x.d.cts → client-z-8dc-e1.d.cts} +1 -1
  13. package/dist/{collection-CcnIw1qY.js → collection-ChgDTHLz.mjs} +7 -12
  14. package/dist/compat/mod.cjs +5 -8
  15. package/dist/compat/mod.d.cts +78 -6
  16. package/dist/compat/mod.d.ts +78 -6
  17. package/dist/compat/mod.js +4 -8
  18. package/dist/compat/transformers.test.mjs +62 -0
  19. package/dist/{context-D3QkEtZd.d.cts → context-CNIt-Qn7.d.cts} +9 -18
  20. package/dist/{context-DZJhUmzF.d.ts → context-Dyg7P1qW.d.ts} +9 -18
  21. package/dist/{context-pa9aIrwp.js → context-Juj6bdHC.mjs} +7 -11
  22. package/dist/deno-CuVDEdyj.mjs +8 -0
  23. package/dist/{docloader-CBHh0rC5.js → docloader-BPq9yzC_.mjs} +8 -14
  24. package/dist/{esm-nLm00z9V.js → esm-DVILvP5e.mjs} +50 -89
  25. package/dist/federation/builder.test.d.mts +2 -0
  26. package/dist/federation/{builder.test.js → builder.test.mjs} +19 -38
  27. package/dist/federation/collection.test.d.mts +2 -0
  28. package/dist/federation/collection.test.mjs +21 -0
  29. package/dist/federation/handler.test.d.mts +2 -0
  30. package/dist/federation/{handler.test.js → handler.test.mjs} +26 -56
  31. package/dist/federation/idempotency.test.d.mts +2 -0
  32. package/dist/federation/{idempotency.test.js → idempotency.test.mjs} +31 -62
  33. package/dist/federation/inbox.test.d.mts +2 -0
  34. package/dist/federation/{inbox.test.js → inbox.test.mjs} +8 -12
  35. package/dist/federation/keycache.test.d.mts +2 -0
  36. package/dist/federation/{keycache.test.js → keycache.test.mjs} +11 -15
  37. package/dist/federation/kv.test.d.mts +2 -0
  38. package/dist/federation/{kv.test.js → kv.test.mjs} +11 -22
  39. package/dist/federation/middleware.test.d.mts +2 -0
  40. package/dist/federation/{middleware.test.js → middleware.test.mjs} +146 -225
  41. package/dist/federation/mod.cjs +327 -16
  42. package/dist/federation/mod.d.cts +3 -6
  43. package/dist/federation/mod.d.ts +3 -6
  44. package/dist/federation/mod.js +322 -13
  45. package/dist/federation/mq.test.d.mts +2 -0
  46. package/dist/federation/{mq.test.js → mq.test.mjs} +21 -35
  47. package/dist/federation/negotiation.test.d.mts +2 -0
  48. package/dist/federation/{negotiation.test.js → negotiation.test.mjs} +9 -16
  49. package/dist/federation/retry.test.d.mts +2 -0
  50. package/dist/federation/{retry.test.js → retry.test.mjs} +8 -11
  51. package/dist/federation/router.test.d.mts +2 -0
  52. package/dist/federation/{router.test.js → router.test.mjs} +11 -16
  53. package/dist/federation/send.test.d.mts +2 -0
  54. package/dist/federation/{send.test.js → send.test.mjs} +22 -29
  55. package/dist/federation/webfinger.test.d.mts +2 -0
  56. package/dist/federation/{webfinger.test.js → webfinger.test.mjs} +22 -55
  57. package/dist/{http-DkHdFfrc.d.ts → http-B2wiNmSo.d.ts} +1 -6
  58. package/dist/{http-C_RwU_oN.js → http-Bz7avX57.js} +25 -156
  59. package/dist/{http-Cz3MlXAZ.d.cts → http-C_tEAiZj.d.cts} +1 -6
  60. package/dist/{http-Br3-1dRf.js → http-DI213UHg.mjs} +17 -33
  61. package/dist/{http-DGs_78tx.cjs → http-DKBDoudA.cjs} +110 -235
  62. package/dist/{inbox-3bZUqDLE.js → inbox-Bdn-CSRd.mjs} +18 -26
  63. package/dist/{key-D7Y_J9kt.js → key-DzJf84o7.mjs} +12 -19
  64. package/dist/{keycache-BASM0rrX.js → keycache-DaQ3ndaJ.mjs} +5 -9
  65. package/dist/{keys-ZbcByPg9.js → keys-CtZLJq76.mjs} +5 -9
  66. package/dist/{kv-QzKcOQgP.js → kv-BrZHNugx.mjs} +6 -10
  67. package/dist/{kv-BL4nlICN.d.cts → kv-CbLNp3zQ.d.cts} +1 -1
  68. package/dist/{kv-DXEUEP6z.d.ts → kv-GFYnFoOl.d.ts} +1 -1
  69. package/dist/{kv-cache-CMM5VJsc.js → kv-cache-DBd7BezJ.js} +6 -13
  70. package/dist/{kv-cache-9PANi4tA.cjs → kv-cache-Dj1Q7TiW.cjs} +27 -34
  71. package/dist/{kv-cache-El7We5sy.js → kv-cache-OWmRLHir.mjs} +4 -8
  72. package/dist/{ld-Bjq9Z4St.js → ld-DczS1fLK.mjs} +17 -31
  73. package/dist/middleware-B5CiOImA.mjs +5 -0
  74. package/dist/{middleware-Bj30TZll.js → middleware-BKNu57ZI.js} +320 -363
  75. package/dist/middleware-C36TOX-2.cjs +4 -0
  76. package/dist/{middleware-CQeA5yF7.cjs → middleware-CyjmpK70.cjs} +513 -564
  77. package/dist/{middleware-DozhKfB6.js → middleware-DoHz9oIo.mjs} +260 -292
  78. package/dist/{mod-DPkRU3EK.d.cts → mod-1xhgsHef.d.cts} +2 -2
  79. package/dist/{mod-DUWcVv49.d.ts → mod-BGtYJZKu.d.ts} +2 -2
  80. package/dist/{mod-DXsQakeS.d.cts → mod-Bld7oeqf.d.cts} +3 -3
  81. package/dist/{mod-DnSsduJF.d.ts → mod-BnAKGh2w.d.ts} +2 -2
  82. package/dist/{mod-CwZXZJ9d.d.ts → mod-DTOUyCce.d.ts} +3 -3
  83. package/dist/{mod-Di3W5OdP.d.cts → mod-DWoQffTD.d.cts} +2 -2
  84. package/dist/mod.cjs +29 -68
  85. package/dist/mod.d.cts +11 -14
  86. package/dist/mod.d.ts +11 -15
  87. package/dist/mod.js +17 -65
  88. package/dist/{negotiation-5NPJL6zp.js → negotiation-BehA2uul.mjs} +7 -11
  89. package/dist/nodeinfo/client.test.d.mts +2 -0
  90. package/dist/nodeinfo/{client.test.js → client.test.mjs} +22 -40
  91. package/dist/nodeinfo/handler.test.d.mts +2 -0
  92. package/dist/nodeinfo/{handler.test.js → handler.test.mjs} +13 -42
  93. package/dist/nodeinfo/mod.cjs +5 -8
  94. package/dist/nodeinfo/mod.d.cts +2 -3
  95. package/dist/nodeinfo/mod.d.ts +2 -3
  96. package/dist/nodeinfo/mod.js +4 -8
  97. package/dist/nodeinfo/types.test.d.mts +2 -0
  98. package/dist/nodeinfo/{types.test.js → types.test.mjs} +9 -16
  99. package/dist/otel/exporter.test.d.mts +2 -0
  100. package/dist/otel/{exporter.test.js → exporter.test.mjs} +117 -169
  101. package/dist/otel/mod.cjs +15 -20
  102. package/dist/otel/mod.d.cts +2 -2
  103. package/dist/otel/mod.d.ts +2 -2
  104. package/dist/otel/mod.js +8 -14
  105. package/dist/{owner-gd0Q9FuU.d.ts → owner-74ARJ5TL.d.ts} +1 -1
  106. package/dist/{owner-1AbPBOOZ.d.cts → owner-CptqhsOy.d.cts} +1 -1
  107. package/dist/{owner-CImU2dKz.js → owner-DXMGUEOr.mjs} +11 -16
  108. package/dist/{proof-BygvN4r5.js → proof-C-7NljBU.js} +32 -58
  109. package/dist/{proof-DLL0MLmV.js → proof-CEOujj0L.mjs} +21 -33
  110. package/dist/{proof-UhA5do8k.cjs → proof-DMu-6A_w.cjs} +133 -157
  111. package/dist/{retry-D4GJ670a.js → retry-Ddbq3AcK.mjs} +4 -7
  112. package/dist/{router-D9eI0s4b.js → router-CrMLXoOr.mjs} +4 -8
  113. package/dist/runtime/mod.cjs +11 -13
  114. package/dist/runtime/mod.d.cts +6 -2
  115. package/dist/runtime/mod.d.ts +0 -1
  116. package/dist/runtime/mod.js +4 -7
  117. package/dist/{send-DbW03azY.js → send-DIfrLTB_.mjs} +8 -13
  118. package/dist/sig/http.test.d.mts +2 -0
  119. package/dist/sig/{http.test.js → http.test.mjs} +117 -199
  120. package/dist/sig/key.test.d.mts +2 -0
  121. package/dist/sig/{key.test.js → key.test.mjs} +11 -18
  122. package/dist/sig/ld.test.d.mts +2 -0
  123. package/dist/sig/{ld.test.js → ld.test.mjs} +22 -35
  124. package/dist/sig/mod.cjs +6 -9
  125. package/dist/sig/mod.d.cts +3 -3
  126. package/dist/sig/mod.d.ts +3 -3
  127. package/dist/sig/mod.js +5 -9
  128. package/dist/sig/owner.test.d.mts +2 -0
  129. package/dist/sig/{owner.test.js → owner.test.mjs} +19 -34
  130. package/dist/sig/proof.test.d.mts +2 -0
  131. package/dist/sig/{proof.test.js → proof.test.mjs} +16 -27
  132. package/dist/{std__assert-DWivtrGR.js → std__assert-Duiq_YC9.mjs} +12 -24
  133. package/dist/testing/{mod.d.ts → mod.d.mts} +26 -78
  134. package/dist/testing/mod.mjs +6 -0
  135. package/dist/{transformers-3g8GZwkZ.cjs → transformers-NeAONrAq.cjs} +20 -25
  136. package/dist/{transformers-C3FLHUd6.js → transformers-ve6e2xcg.js} +3 -7
  137. package/dist/{types-CPz01LGH.js → types-C37hquWI.mjs} +4 -7
  138. package/dist/{types-Cd_hszr_.cjs → types-KC4QAoxe.cjs} +29 -34
  139. package/dist/{types-C93Ob9cU.js → types-hvL8ElAs.js} +8 -13
  140. package/dist/utils/docloader.test.d.mts +2 -0
  141. package/dist/utils/{docloader.test.js → docloader.test.mjs} +14 -24
  142. package/dist/utils/kv-cache.test.d.mts +2 -0
  143. package/dist/utils/{kv-cache.test.js → kv-cache.test.mjs} +25 -40
  144. package/dist/utils/mod.cjs +5 -9
  145. package/dist/utils/mod.d.cts +1 -3
  146. package/dist/utils/mod.d.ts +1 -3
  147. package/dist/utils/mod.js +4 -9
  148. package/dist/vocab/cjs.test.d.mts +2 -0
  149. package/dist/vocab/cjs.test.mjs +14 -0
  150. package/dist/vocab/mod.cjs +10 -12
  151. package/dist/vocab/mod.js +3 -5
  152. package/package.json +7 -7
  153. package/dist/compat/transformers.test.d.ts +0 -3
  154. package/dist/compat/transformers.test.js +0 -87
  155. package/dist/compat-Bb4NuTUO.js +0 -4
  156. package/dist/compat-DmDDELst.cjs +0 -4
  157. package/dist/deno-4w047OFk.js +0 -121
  158. package/dist/federation/builder.test.d.ts +0 -3
  159. package/dist/federation/collection.test.d.ts +0 -3
  160. package/dist/federation/collection.test.js +0 -32
  161. package/dist/federation/handler.test.d.ts +0 -3
  162. package/dist/federation/idempotency.test.d.ts +0 -3
  163. package/dist/federation/inbox.test.d.ts +0 -3
  164. package/dist/federation/keycache.test.d.ts +0 -3
  165. package/dist/federation/kv.test.d.ts +0 -3
  166. package/dist/federation/middleware.test.d.ts +0 -3
  167. package/dist/federation/mq.test.d.ts +0 -3
  168. package/dist/federation/negotiation.test.d.ts +0 -3
  169. package/dist/federation/retry.test.d.ts +0 -3
  170. package/dist/federation/router.test.d.ts +0 -3
  171. package/dist/federation/send.test.d.ts +0 -3
  172. package/dist/federation/webfinger.test.d.ts +0 -3
  173. package/dist/federation-Bp3HI26G.cjs +0 -350
  174. package/dist/federation-DaMfqRm4.js +0 -332
  175. package/dist/middleware-B73ZyDmk.js +0 -12
  176. package/dist/middleware-Dr61i4Jo.cjs +0 -12
  177. package/dist/middleware-_1PYruC5.js +0 -26
  178. package/dist/mod-Bh8mqlYw.d.cts +0 -9
  179. package/dist/mod-D6HodEq7.d.ts +0 -7
  180. package/dist/mod-DVwHUI_x.d.cts +0 -80
  181. package/dist/mod-DosD6NsG.d.ts +0 -82
  182. package/dist/mod-gq_Xfdz8.d.cts +0 -1
  183. package/dist/nodeinfo/client.test.d.ts +0 -3
  184. package/dist/nodeinfo/handler.test.d.ts +0 -3
  185. package/dist/nodeinfo/types.test.d.ts +0 -3
  186. package/dist/nodeinfo-DoESQxq5.js +0 -4
  187. package/dist/nodeinfo-DuMYTpbZ.cjs +0 -4
  188. package/dist/otel/exporter.test.d.ts +0 -3
  189. package/dist/runtime-c2Njxsry.cjs +0 -17
  190. package/dist/runtime-poamPCMb.js +0 -13
  191. package/dist/sig/http.test.d.ts +0 -3
  192. package/dist/sig/key.test.d.ts +0 -3
  193. package/dist/sig/ld.test.d.ts +0 -3
  194. package/dist/sig/owner.test.d.ts +0 -3
  195. package/dist/sig/proof.test.d.ts +0 -3
  196. package/dist/sig-BNhspNOf.js +0 -4
  197. package/dist/sig-vX39WyWI.cjs +0 -4
  198. package/dist/testing/mod.js +0 -10
  199. package/dist/utils/docloader.test.d.ts +0 -3
  200. package/dist/utils/kv-cache.test.d.ts +0 -3
  201. package/dist/utils-BQ9KqEK9.cjs +0 -4
  202. package/dist/utils-Dn5OPdSW.js +0 -4
  203. /package/dist/{mod-AGjRfPjT.d.ts → compat/transformers.test.d.mts} +0 -0
@@ -0,0 +1,2 @@
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";
@@ -1,21 +1,14 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- import { assertEquals } from "../assert_equals-DSbWqCm3.js";
7
- import "../assert-MZs1qjMx.js";
8
- import "../assert_instance_of-DHz7EHNU.js";
9
- import "../deno-4w047OFk.js";
10
- import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk, validateCryptoKey } from "../key-D7Y_J9kt.js";
11
- import "../std__assert-DWivtrGR.js";
12
- import { assertRejects } from "../assert_rejects-Ce45JcFg.js";
13
- import { assertThrows } from "../assert_throws-BNXdRGWP.js";
14
- import "../assert_not_equals-C80BG-_5.js";
15
- import { ed25519Multikey, rsaPrivateKey2, rsaPublicKey1, rsaPublicKey2, rsaPublicKey3 } from "../keys-ZbcByPg9.js";
1
+ import "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
+ import "../std__assert-Duiq_YC9.mjs";
6
+ import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
7
+ import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
8
+ import { a as validateCryptoKey, i as importJwk, n as fetchKey, r as generateCryptoKeyPair, t as exportJwk } from "../key-DzJf84o7.mjs";
9
+ import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
16
10
  import { mockDocumentLoader, test } from "@fedify/fixture";
17
11
  import { CryptographicKey, Multikey } from "@fedify/vocab";
18
-
19
12
  //#region src/sig/key.test.ts
20
13
  test("validateCryptoKey()", async () => {
21
14
  const pkcs1v15 = await crypto.subtle.generateKey({
@@ -243,5 +236,5 @@ test("fetchKey()", async () => {
243
236
  cached: false
244
237
  });
245
238
  });
246
-
247
- //#endregion
239
+ //#endregion
240
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";
@@ -1,20 +1,16 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- import { assertEquals } from "../assert_equals-DSbWqCm3.js";
7
- import { assert } from "../assert-MZs1qjMx.js";
8
- import "../deno-4w047OFk.js";
9
- import { generateCryptoKeyPair } from "../key-D7Y_J9kt.js";
10
- import { attachSignature, createSignature, detachSignature, signJsonLd, verifyJsonLd, verifySignature } from "../ld-Bjq9Z4St.js";
11
- import { assertFalse, assertRejects } from "../assert_rejects-Ce45JcFg.js";
12
- import { assertThrows } from "../assert_throws-BNXdRGWP.js";
13
- import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-ZbcByPg9.js";
1
+ import "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
+ import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
6
+ import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
7
+ import { t as assert } from "../assert-ddO5KLpe.mjs";
8
+ import { r as generateCryptoKeyPair } from "../key-DzJf84o7.mjs";
9
+ import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
10
+ import { a as signJsonLd, n as createSignature, o as verifyJsonLd, r as detachSignature, s as verifySignature, t as attachSignature } from "../ld-DczS1fLK.mjs";
14
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
15
12
  import { CryptographicKey } from "@fedify/vocab";
16
13
  import { encodeBase64 } from "byte-encodings/base64";
17
-
18
14
  //#region src/sig/ld.test.ts
19
15
  test("attachSignature()", () => {
20
16
  const sig = {
@@ -41,28 +37,23 @@ test("createSignature()", async () => {
41
37
  id: "https://example.com/1",
42
38
  type: "Create"
43
39
  };
44
- const sig = await createSignature(doc, rsaPrivateKey2, rsaPublicKey2.id, { contextLoader: mockDocumentLoader });
45
- const key = await verifySignature(attachSignature(doc, sig), {
40
+ assertEquals(await verifySignature(attachSignature(doc, await createSignature(doc, rsaPrivateKey2, rsaPublicKey2.id, { contextLoader: mockDocumentLoader })), {
46
41
  documentLoader: mockDocumentLoader,
47
42
  contextLoader: mockDocumentLoader
48
- });
49
- assertEquals(key, rsaPublicKey2);
43
+ }), rsaPublicKey2);
50
44
  assertRejects(() => createSignature(doc, rsaPublicKey2.publicKey, rsaPublicKey2.id, { contextLoader: mockDocumentLoader }), TypeError);
51
45
  assertRejects(() => createSignature(doc, ed25519PrivateKey, ed25519Multikey.id, { contextLoader: mockDocumentLoader }), TypeError);
52
46
  });
53
47
  test("signJsonLd()", async () => {
54
- const doc = {
48
+ assert(await verifyJsonLd(await signJsonLd({
55
49
  "@context": "https://www.w3.org/ns/activitystreams",
56
50
  id: "https://example.com/1",
57
51
  type: "Create",
58
52
  actor: "https://example.com/person2"
59
- };
60
- const signed = await signJsonLd(doc, rsaPrivateKey3, rsaPublicKey3.id, { contextLoader: mockDocumentLoader });
61
- const verified = await verifyJsonLd(signed, {
53
+ }, rsaPrivateKey3, rsaPublicKey3.id, { contextLoader: mockDocumentLoader }), {
62
54
  documentLoader: mockDocumentLoader,
63
55
  contextLoader: mockDocumentLoader
64
- });
65
- assert(verified);
56
+ }));
66
57
  });
67
58
  const document = {
68
59
  "@context": ["https://www.w3.org/ns/activitystreams", {
@@ -202,23 +193,19 @@ test("verifySignature()", async () => {
202
193
  assertEquals(key4, key);
203
194
  });
204
195
  test("verifyJsonLd()", async () => {
205
- const verified = await verifyJsonLd(testVector, {
196
+ assert(await verifyJsonLd(testVector, {
206
197
  documentLoader: mockDocumentLoader,
207
198
  contextLoader: mockDocumentLoader
208
- });
209
- assert(verified);
210
- const doc = {
199
+ }));
200
+ assertFalse(await verifyJsonLd(await signJsonLd({
211
201
  "@context": "https://www.w3.org/ns/activitystreams",
212
202
  id: "https://example.com/1",
213
203
  type: "Create",
214
204
  actor: "https://example.com/person2"
215
- };
216
- const signed = await signJsonLd(doc, rsaPrivateKey2, rsaPublicKey2.id, { contextLoader: mockDocumentLoader });
217
- const verified2 = await verifyJsonLd(signed, {
205
+ }, rsaPrivateKey2, rsaPublicKey2.id, { contextLoader: mockDocumentLoader }), {
218
206
  documentLoader: mockDocumentLoader,
219
207
  contextLoader: mockDocumentLoader
220
- });
221
- assertFalse(verified2);
208
+ }));
222
209
  });
223
-
224
- //#endregion
210
+ //#endregion
211
+ export {};
package/dist/sig/mod.cjs CHANGED
@@ -1,11 +1,8 @@
1
-
2
- const { Temporal } = require("@js-temporal/polyfill");
3
- const { URLPattern } = require("urlpattern-polyfill");
4
-
5
- const require_http = require('../http-DGs_78tx.cjs');
6
- const require_proof = require('../proof-UhA5do8k.cjs');
7
- require('../sig-vX39WyWI.cjs');
8
-
1
+ const { Temporal } = require("@js-temporal/polyfill");
2
+ const { URLPattern } = require("urlpattern-polyfill");
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const require_http = require("../http-DKBDoudA.cjs");
5
+ const require_proof = require("../proof-DMu-6A_w.cjs");
9
6
  exports.attachSignature = require_proof.attachSignature;
10
7
  exports.createProof = require_proof.createProof;
11
8
  exports.createSignature = require_proof.createSignature;
@@ -23,4 +20,4 @@ exports.verifyJsonLd = require_proof.verifyJsonLd;
23
20
  exports.verifyObject = require_proof.verifyObject;
24
21
  exports.verifyProof = require_proof.verifyProof;
25
22
  exports.verifyRequest = require_http.verifyRequest;
26
- exports.verifySignature = require_proof.verifySignature;
23
+ exports.verifySignature = require_proof.verifySignature;
@@ -1,4 +1,4 @@
1
- import { FetchKeyOptions, FetchKeyResult, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, SignRequestOptions, VerifyRequestOptions, exportJwk, fetchKey, generateCryptoKeyPair, importJwk, signRequest, verifyRequest } from "../http-Cz3MlXAZ.cjs";
2
- import { DoesActorOwnKeyOptions, GetKeyOwnerOptions, doesActorOwnKey, getKeyOwner } from "../owner-1AbPBOOZ.cjs";
3
- import { CreateProofOptions, CreateSignatureOptions, SignJsonLdOptions, SignObjectOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "../mod-DPkRU3EK.cjs";
1
+ import { a as signRequest, c as FetchKeyResult, d as fetchKey, f as generateCryptoKeyPair, i as VerifyRequestOptions, l as KeyCache, n as HttpMessageSignaturesSpecDeterminer, o as verifyRequest, p as importJwk, r as SignRequestOptions, s as FetchKeyOptions, t as HttpMessageSignaturesSpec, u as exportJwk } from "../http-C_tEAiZj.cjs";
2
+ import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-CptqhsOy.cjs";
3
+ import { _ as verifyJsonLd, a as createProof, c as verifyProof, d as VerifyJsonLdOptions, f as VerifySignatureOptions, g as signJsonLd, h as detachSignature, i as VerifyProofOptions, l as CreateSignatureOptions, m as createSignature, n as SignObjectOptions, o as signObject, p as attachSignature, r as VerifyObjectOptions, s as verifyObject, t as CreateProofOptions, u as SignJsonLdOptions, v as verifySignature } from "../mod-1xhgsHef.cjs";
4
4
  export { CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyOptions, FetchKeyResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getKeyOwner, importJwk, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
package/dist/sig/mod.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { FetchKeyOptions, FetchKeyResult, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, SignRequestOptions, VerifyRequestOptions, exportJwk, fetchKey, generateCryptoKeyPair, importJwk, signRequest, verifyRequest } from "../http-DkHdFfrc.js";
4
- import { DoesActorOwnKeyOptions, GetKeyOwnerOptions, doesActorOwnKey, getKeyOwner } from "../owner-gd0Q9FuU.js";
5
- import { CreateProofOptions, CreateSignatureOptions, SignJsonLdOptions, SignObjectOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "../mod-DUWcVv49.js";
3
+ import { a as signRequest, c as FetchKeyResult, d as fetchKey, f as generateCryptoKeyPair, i as VerifyRequestOptions, l as KeyCache, n as HttpMessageSignaturesSpecDeterminer, o as verifyRequest, p as importJwk, r as SignRequestOptions, s as FetchKeyOptions, t as HttpMessageSignaturesSpec, u as exportJwk } from "../http-B2wiNmSo.js";
4
+ import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-74ARJ5TL.js";
5
+ import { _ as verifyJsonLd, a as createProof, c as verifyProof, d as VerifyJsonLdOptions, f as VerifySignatureOptions, g as signJsonLd, h as detachSignature, i as VerifyProofOptions, l as CreateSignatureOptions, m as createSignature, n as SignObjectOptions, o as signObject, p as attachSignature, r as VerifyObjectOptions, s as verifyObject, t as CreateProofOptions, u as SignJsonLdOptions, v as verifySignature } from "../mod-BGtYJZKu.js";
6
6
  export { CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyOptions, FetchKeyResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getKeyOwner, importJwk, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
package/dist/sig/mod.js CHANGED
@@ -1,9 +1,5 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
-
5
- import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk, signRequest, verifyRequest } from "../http-C_RwU_oN.js";
6
- import { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, getKeyOwner, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "../proof-BygvN4r5.js";
7
- import "../sig-BNhspNOf.js";
8
-
9
- export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getKeyOwner, importJwk, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
1
+ import "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ import { a as fetchKey, i as exportJwk, n as signRequest, o as generateCryptoKeyPair, r as verifyRequest, s as importJwk } from "../http-Bz7avX57.js";
4
+ import { a as doesActorOwnKey, c as createSignature, d as signJsonLd, f as verifyJsonLd, i as verifyProof, l as detachSignature, n as signObject, o as getKeyOwner, p as verifySignature, r as verifyObject, s as attachSignature, t as createProof } from "../proof-C-7NljBU.js";
5
+ export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getKeyOwner, importJwk, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
@@ -0,0 +1,2 @@
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";
@@ -1,22 +1,14 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- import { assertEquals } from "../assert_equals-DSbWqCm3.js";
7
- import { assert } from "../assert-MZs1qjMx.js";
8
- import "../assert_instance_of-DHz7EHNU.js";
9
- import "../deno-4w047OFk.js";
10
- import "../key-D7Y_J9kt.js";
11
- import { doesActorOwnKey, getKeyOwner } from "../owner-CImU2dKz.js";
12
- import "../std__assert-DWivtrGR.js";
13
- import { assertFalse } from "../assert_rejects-Ce45JcFg.js";
14
- import "../assert_throws-BNXdRGWP.js";
15
- import "../assert_not_equals-C80BG-_5.js";
16
- import { rsaPublicKey1, rsaPublicKey2 } from "../keys-ZbcByPg9.js";
1
+ import "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
+ import "../std__assert-Duiq_YC9.mjs";
6
+ import { n as assertFalse } from "../assert_rejects-B-qJtC9Z.mjs";
7
+ import { t as assert } from "../assert-ddO5KLpe.mjs";
8
+ import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-CtZLJq76.mjs";
9
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-DXMGUEOr.mjs";
17
10
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
18
11
  import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
19
-
20
12
  //#region src/sig/owner.test.ts
21
13
  test("doesActorOwnKey()", async () => {
22
14
  const options = {
@@ -35,32 +27,25 @@ test("getKeyOwner()", async () => {
35
27
  documentLoader: mockDocumentLoader,
36
28
  contextLoader: mockDocumentLoader
37
29
  };
38
- const owner = await getKeyOwner(new URL("https://example.com/users/handle#main-key"), options);
39
- assertEquals(owner, await lookupObject("https://example.com/users/handle", options));
30
+ assertEquals(await getKeyOwner(new URL("https://example.com/users/handle#main-key"), options), await lookupObject("https://example.com/users/handle", options));
40
31
  const owner2 = await getKeyOwner(new URL("https://example.com/key"), options);
41
32
  assertEquals(owner2, await lookupObject("https://example.com/person", options));
42
- const owner3 = await getKeyOwner(rsaPublicKey1, options);
43
- assertEquals(owner3, owner2);
44
- const noOwner = await getKeyOwner(new URL("https://example.com/key2"), options);
45
- assertEquals(noOwner, null);
46
- const noOwner2 = await getKeyOwner(new URL("https://example.com/object"), options);
47
- assertEquals(noOwner2, null);
33
+ assertEquals(await getKeyOwner(rsaPublicKey1, options), owner2);
34
+ assertEquals(await getKeyOwner(new URL("https://example.com/key2"), options), null);
35
+ assertEquals(await getKeyOwner(new URL("https://example.com/object"), options), null);
48
36
  });
49
37
  test("doesActorOwnKey() records OpenTelemetry span", async () => {
50
38
  const [tracerProvider, exporter] = createTestTracerProvider();
51
- const activity = new Create({
39
+ assert(await doesActorOwnKey(new Create({
52
40
  id: new URL("https://example.com/activity"),
53
41
  actor: new URL("https://example.com/person")
54
- });
55
- const key = new CryptographicKey({
42
+ }), new CryptographicKey({
56
43
  id: new URL("https://example.com/person#key"),
57
44
  owner: new URL("https://example.com/person")
58
- });
59
- const result = await doesActorOwnKey(activity, key, {
45
+ }), {
60
46
  documentLoader: mockDocumentLoader,
61
47
  tracerProvider
62
- });
63
- assert(result);
48
+ }));
64
49
  const spans = exporter.getSpans("activitypub.verify_key_ownership");
65
50
  assertEquals(spans.length, 1);
66
51
  const span = spans[0];
@@ -69,5 +54,5 @@ test("doesActorOwnKey() records OpenTelemetry span", async () => {
69
54
  assertEquals(span.attributes["activitypub.key_ownership.verified"], true);
70
55
  assertEquals(span.attributes["activitypub.key_ownership.method"], "owner_id");
71
56
  });
72
-
73
- //#endregion
57
+ //#endregion
58
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";
@@ -1,24 +1,16 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- import { assertEquals } from "../assert_equals-DSbWqCm3.js";
7
- import "../assert-MZs1qjMx.js";
8
- import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
9
- import "../deno-4w047OFk.js";
10
- import "../key-D7Y_J9kt.js";
11
- import { createProof, signObject, verifyObject, verifyProof } from "../proof-DLL0MLmV.js";
12
- import "../std__assert-DWivtrGR.js";
13
- import { assertRejects } from "../assert_rejects-Ce45JcFg.js";
14
- import "../assert_throws-BNXdRGWP.js";
15
- import "../assert_not_equals-C80BG-_5.js";
16
- import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-ZbcByPg9.js";
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
+ import "../std__assert-Duiq_YC9.mjs";
6
+ import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
7
+ import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
8
+ import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
9
+ import { i as verifyProof, n as signObject, r as verifyObject, t as createProof } from "../proof-CEOujj0L.mjs";
17
10
  import { mockDocumentLoader, test } from "@fedify/fixture";
18
11
  import { Create, DataIntegrityProof, Multikey, Note, Place } from "@fedify/vocab";
19
12
  import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
20
13
  import { decodeHex, encodeHex } from "byte-encodings/hex";
21
-
22
14
  //#region src/sig/proof.test.ts
23
15
  const fep8b32TestVectorPrivateKey = await crypto.subtle.importKey("jwk", {
24
16
  "kty": "OKP",
@@ -118,11 +110,10 @@ test("signObject()", async () => {
118
110
  created: "2023-02-24T23:36:38Z"
119
111
  }
120
112
  });
121
- const signedObject2 = await signObject(signedObject, ed25519PrivateKey, ed25519Multikey.id, {
113
+ assertEquals(await (await signObject(signedObject, ed25519PrivateKey, ed25519Multikey.id, {
122
114
  ...options,
123
115
  created
124
- });
125
- assertEquals(await signedObject2.toJsonLd(options), {
116
+ })).toJsonLd(options), {
126
117
  "@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"],
127
118
  id: "https://server.example/activities/1",
128
119
  type: "Create",
@@ -210,16 +201,14 @@ test("verifyProof()", async () => {
210
201
  cache["https://server.example/users/alice#ed25519-key"] = ed25519Multikey;
211
202
  assertEquals(await verifyProof(jsonLd, proof, options), expectedKey);
212
203
  assertEquals(cache["https://server.example/users/alice#ed25519-key"], expectedKey);
213
- const jsonLd2 = {
204
+ assertEquals(await verifyProof({
214
205
  ...jsonLd,
215
206
  object: {
216
207
  ...jsonLd.object,
217
208
  content: "bye"
218
209
  }
219
- };
220
- assertEquals(await verifyProof(jsonLd2, proof, options), null);
221
- const wrongProof = proof.clone({ created: Temporal.Now.instant() });
222
- assertEquals(await verifyProof(jsonLd, wrongProof, options), null);
210
+ }, proof, options), null);
211
+ assertEquals(await verifyProof(jsonLd, proof.clone({ created: Temporal.Now.instant() }), options), null);
223
212
  });
224
213
  test("verifyObject()", async () => {
225
214
  const options = {
@@ -264,5 +253,5 @@ test("verifyObject()", async () => {
264
253
  assertInstanceOf(note, Note);
265
254
  assertEquals(note.content, "Hello world");
266
255
  });
267
-
268
- //#endregion
256
+ //#endregion
257
+ export {};
@@ -1,10 +1,9 @@
1
-
2
- import { Temporal } from "@js-temporal/polyfill";
3
- import { URLPattern } from "urlpattern-polyfill";
4
- globalThis.addEventListener = () => {};
5
-
6
- import { AssertionError, buildMessage, diff, diffStr, format, red } from "./assert_equals-DSbWqCm3.js";
7
-
1
+ import "@js-temporal/polyfill";
2
+ import "urlpattern-polyfill";
3
+ globalThis.addEventListener = () => {};
4
+ import { a as red, i as buildMessage, l as AssertionError, n as diffStr, r as diff, s as format } from "./assert_equals-Ew3jOFa3.mjs";
5
+ import "./assert_rejects-B-qJtC9Z.mjs";
6
+ import "./assert_throws-4NwKEy2q.mjs";
8
7
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_exists.js
9
8
  /**
10
9
  * Make an assertion that actual is not null or undefined.
@@ -23,12 +22,10 @@ import { AssertionError, buildMessage, diff, diffStr, format, red } from "./asse
23
22
  * @param msg The optional message to include in the error if the assertion fails.
24
23
  */ function assertExists(actual, msg) {
25
24
  if (actual === void 0 || actual === null) {
26
- const msgSuffix = msg ? `: ${msg}` : ".";
27
- msg = `Expected actual: "${actual}" to not be null or undefined${msgSuffix}`;
25
+ msg = `Expected actual: "${actual}" to not be null or undefined${msg ? `: ${msg}` : "."}`;
28
26
  throw new AssertionError(msg);
29
27
  }
30
28
  }
31
-
32
29
  //#endregion
33
30
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_greater_or_equal.js
34
31
  /**
@@ -54,7 +51,6 @@ import { AssertionError, buildMessage, diff, diffStr, format, red } from "./asse
54
51
  const expectedString = format(expected);
55
52
  throw new AssertionError(msg ?? `Expect ${actualString} >= ${expectedString}`);
56
53
  }
57
-
58
54
  //#endregion
59
55
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_greater.js
60
56
  /**
@@ -80,7 +76,6 @@ import { AssertionError, buildMessage, diff, diffStr, format, red } from "./asse
80
76
  const expectedString = format(expected);
81
77
  throw new AssertionError(msg ?? `Expect ${actualString} > ${expectedString}`);
82
78
  }
83
-
84
79
  //#endregion
85
80
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_strict_equals.js
86
81
  /**
@@ -110,18 +105,13 @@ import { AssertionError, buildMessage, diff, diffStr, format, red } from "./asse
110
105
  let message;
111
106
  const actualString = format(actual);
112
107
  const expectedString = format(expected);
113
- if (actualString === expectedString) {
114
- const withOffset = actualString.split("\n").map((l) => ` ${l}`).join("\n");
115
- message = `Values have the same structure but are not reference-equal${msgSuffix}\n\n${red(withOffset)}\n`;
116
- } else {
108
+ if (actualString === expectedString) message = `Values have the same structure but are not reference-equal${msgSuffix}\n\n${red(actualString.split("\n").map((l) => ` ${l}`).join("\n"))}\n`;
109
+ else {
117
110
  const stringDiff = typeof actual === "string" && typeof expected === "string";
118
- const diffResult = stringDiff ? diffStr(actual, expected) : diff(actualString.split("\n"), expectedString.split("\n"));
119
- const diffMsg = buildMessage(diffResult, { stringDiff }).join("\n");
120
- message = `Values are not strictly equal${msgSuffix}\n${diffMsg}`;
111
+ message = `Values are not strictly equal${msgSuffix}\n${buildMessage(stringDiff ? diffStr(actual, expected) : diff(actualString.split("\n"), expectedString.split("\n")), { stringDiff }).join("\n")}`;
121
112
  }
122
113
  throw new AssertionError(message);
123
114
  }
124
-
125
115
  //#endregion
126
116
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_string_includes.js
127
117
  /**
@@ -141,11 +131,9 @@ import { AssertionError, buildMessage, diff, diffStr, format, red } from "./asse
141
131
  * @param msg The optional message to display if the assertion fails.
142
132
  */ function assertStringIncludes(actual, expected, msg) {
143
133
  if (!actual.includes(expected)) {
144
- const msgSuffix = msg ? `: ${msg}` : ".";
145
- msg = `Expected actual: "${actual}" to contain: "${expected}"${msgSuffix}`;
134
+ msg = `Expected actual: "${actual}" to contain: "${expected}"${msg ? `: ${msg}` : "."}`;
146
135
  throw new AssertionError(msg);
147
136
  }
148
137
  }
149
-
150
138
  //#endregion
151
- export { assertExists, assertGreater, assertGreaterOrEqual, assertStrictEquals, assertStringIncludes };
139
+ export { assertExists as a, assertGreaterOrEqual as i, assertStrictEquals as n, assertGreater as r, assertStringIncludes as t };