@fedify/fedify 1.7.13 → 1.7.15

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 (138) hide show
  1. package/dist/{actor-CPpvuBKU.d.ts → actor.d.ts} +3 -3
  2. package/dist/{actor-BVilnhZ3.js → actor.js} +6 -6
  3. package/dist/{assert-LOEeCUK5.js → assert.js} +2 -2
  4. package/dist/{assert_equals-B44MxcIj.js → assert_equals.js} +16 -16
  5. package/dist/{assert_instance_of-XtuFevV_.js → assert_instance_of.js} +2 -2
  6. package/dist/{assert_is_error-BTlryvT0.js → assert_is_error.js} +2 -2
  7. package/dist/{assert_not_equals-C685gKx6.js → assert_not_equals.js} +3 -6
  8. package/dist/{assert_rejects-DWQ4jaf9.js → assert_rejects.js} +3 -3
  9. package/dist/{assert_throws-YetpVSc-.js → assert_throws.js} +3 -3
  10. package/dist/{authdocloader-DqCINL6u.js → authdocloader.js} +8 -8
  11. package/dist/{builder-CKUAOfcL.js → builder.js} +7 -7
  12. package/dist/{chunk-Cx8LTkjm.js → chunk.js} +22 -15
  13. package/dist/{client-DvtwXO7t.d.ts → client.d.ts} +2 -2
  14. package/dist/{client-C5xUY491.js → client.js} +3 -3
  15. package/dist/{collection-Dfb0TPno.js → collection.js} +2 -3
  16. package/dist/compat/mod.d.ts +79 -12
  17. package/dist/compat/mod.js +1 -2
  18. package/dist/compat/transformers.test.js +34 -38
  19. package/dist/{context-OBWjptjU.d.ts → context.d.ts} +11 -11
  20. package/dist/{context-aglzx1Ww.js → context.js} +5 -5
  21. package/dist/{docloader-Q42SMRIB.d.ts → docloader.d.ts} +2 -2
  22. package/dist/{docloader-Qfs9nPiy.js → docloader.js} +32 -152
  23. package/dist/{docloader-09nVWLAZ.js → docloader2.js} +1 -1
  24. package/dist/{esm-DO9PrujO.js → esm.js} +36 -22
  25. package/dist/federation/builder.test.js +20 -26
  26. package/dist/federation/collection.test.js +11 -16
  27. package/dist/federation/handler.test.js +41 -48
  28. package/dist/federation/inbox.test.js +11 -11
  29. package/dist/federation/keycache.test.js +12 -11
  30. package/dist/federation/kv.test.js +8 -10
  31. package/dist/federation/middleware.test.js +105 -134
  32. package/dist/federation/mod.d.ts +4 -13
  33. package/dist/federation/mod.js +206 -12
  34. package/dist/federation/mq.test.js +12 -17
  35. package/dist/federation/retry.test.js +5 -4
  36. package/dist/federation/router.test.js +9 -10
  37. package/dist/federation/send.test.js +23 -24
  38. package/dist/{http-DMTrO3Ye.d.ts → http.d.ts} +3 -3
  39. package/dist/{http-CjDwMreH.js → http.js} +25 -31
  40. package/dist/{inbox-ApPO50Ma.js → inbox.js} +5 -5
  41. package/dist/key.js +16 -0
  42. package/dist/{key-BPUM0v_S.js → key2.js} +5 -5
  43. package/dist/{keycache-B7Urghlu.js → keycache.js} +2 -2
  44. package/dist/{keys-DGJec4-R.js → keys.js} +2 -2
  45. package/dist/{kv-DRaeSXco.d.ts → kv.d.ts} +1 -1
  46. package/dist/{kv-BMY6Qf_A.js → kv.js} +1 -1
  47. package/dist/{langstr-DbWheeIS.js → langstr.js} +1 -1
  48. package/dist/{ld-DJTavNY3.js → ld.js} +9 -12
  49. package/dist/{lookup-Bf-K85bV.d.ts → lookup.d.ts} +2 -2
  50. package/dist/{lookup-CkOdKyYR.js → lookup.js} +4 -4
  51. package/dist/{lookup-CnkkF4Rf.js → lookup2.js} +6 -6
  52. package/dist/{middleware-BxHcZC4p.js → middleware.js} +35 -39
  53. package/dist/middleware2.js +32 -0
  54. package/dist/mod.d.ts +17 -17
  55. package/dist/mod.js +17 -17
  56. package/dist/{mod-CDzlVCUF.d.ts → mod2.d.ts} +3 -3
  57. package/dist/{mod-CCL2cvnI.d.ts → mod3.d.ts} +4 -4
  58. package/dist/{mq-DYKDDJmp.d.ts → mq.d.ts} +1 -1
  59. package/dist/{multibase-CnLHszip.js → multibase.js} +1 -1
  60. package/dist/nodeinfo/client.test.js +19 -28
  61. package/dist/nodeinfo/handler.test.js +37 -44
  62. package/dist/nodeinfo/mod.d.ts +2 -5
  63. package/dist/nodeinfo/mod.js +2 -3
  64. package/dist/nodeinfo/semver.test.js +13 -21
  65. package/dist/nodeinfo/types.test.js +9 -11
  66. package/dist/{owner-D0cOz8R5.d.ts → owner.d.ts} +4 -4
  67. package/dist/{owner-qKULzrkx.js → owner.js} +4 -4
  68. package/dist/{proof-d5P09-xk.js → proof.js} +11 -13
  69. package/dist/{retry-BiIhZWgD.js → retry.js} +1 -1
  70. package/dist/{router-D_aVZZUc.js → router.js} +1 -1
  71. package/dist/runtime/authdocloader.test.js +22 -26
  72. package/dist/runtime/docloader.test.js +56 -56
  73. package/dist/runtime/key.test.js +31 -53
  74. package/dist/runtime/langstr.test.js +8 -10
  75. package/dist/runtime/mod.d.ts +103 -6
  76. package/dist/runtime/mod.js +6 -7
  77. package/dist/runtime/multibase/multibase.test.js +12 -18
  78. package/dist/runtime/url.test.js +7 -6
  79. package/dist/{semver-BNrOOAs9.js → semver.js} +7 -17
  80. package/dist/{send-BnMY3Qxa.js → send.js} +4 -4
  81. package/dist/sig/http.test.js +104 -168
  82. package/dist/sig/key.test.js +17 -20
  83. package/dist/sig/ld.test.js +28 -35
  84. package/dist/sig/mod.d.ts +3 -7
  85. package/dist/sig/mod.js +6 -7
  86. package/dist/sig/owner.test.js +24 -30
  87. package/dist/sig/proof.test.js +24 -29
  88. package/dist/{std__assert-o_r9vqm1.js → std__assert.js} +7 -13
  89. package/dist/testing/docloader.test.js +9 -12
  90. package/dist/testing/mod.js +2 -1
  91. package/dist/{testing-DLyvtiiW.js → testing.js} +2 -2
  92. package/dist/{transformers-ghwJuzGY.js → transformers.js} +1 -1
  93. package/dist/{type-CFuiGLz9.js → type.js} +1 -1
  94. package/dist/{types-CJHS5pXl.js → types.js} +2 -2
  95. package/dist/{url-C2xuoQD1.js → url.js} +1 -1
  96. package/dist/vocab/actor.test.js +76 -128
  97. package/dist/vocab/lookup.test.js +19 -23
  98. package/dist/vocab/mod.d.ts +3 -5
  99. package/dist/vocab/mod.js +4 -4
  100. package/dist/vocab/type.test.js +10 -10
  101. package/dist/vocab/vocab.test.js +90 -109
  102. package/dist/{vocab-CzEfWQk2.d.ts → vocab.d.ts} +2 -2
  103. package/dist/{vocab-S7fEn6XO.js → vocab.js} +318 -454
  104. package/dist/webfinger/handler.test.js +40 -48
  105. package/dist/webfinger/lookup.test.js +12 -15
  106. package/dist/webfinger/mod.d.ts +1 -4
  107. package/dist/webfinger/mod.js +2 -3
  108. package/dist/x/cfworkers.d.ts +2 -2
  109. package/dist/x/cfworkers.test.js +7 -9
  110. package/dist/x/hono.d.ts +2 -11
  111. package/dist/x/sveltekit.d.ts +2 -11
  112. package/package.json +1 -1
  113. package/dist/actor-CsmPeeHG.js +0 -34925
  114. package/dist/authdocloader-9g6RkEcR.js +0 -53
  115. package/dist/compat-Bb5myD13.js +0 -4
  116. package/dist/docloader-CchlnLWb.js +0 -4598
  117. package/dist/federation-B0aljx0V.js +0 -203
  118. package/dist/http-CP3h1SLi.js +0 -796
  119. package/dist/key--l6NVKdl.js +0 -257
  120. package/dist/key-1Fv7reaM.js +0 -16
  121. package/dist/key-DD37RpoD.js +0 -10
  122. package/dist/lookup-CN-LpF5e.js +0 -127
  123. package/dist/middleware-BQHe0X6Y.js +0 -17
  124. package/dist/middleware-C3TZ3P-v.js +0 -33
  125. package/dist/middleware-CEpilAEY.js +0 -3524
  126. package/dist/mod-1pDWKvUL.d.ts +0 -2
  127. package/dist/mod-DFncUgcE.d.ts +0 -82
  128. package/dist/mod-GIh5OYxW.d.ts +0 -2
  129. package/dist/mod-g0xFzAP9.d.ts +0 -2
  130. package/dist/mod-qFMzZ3iF.d.ts +0 -104
  131. package/dist/nodeinfo-CyEbLjHs.js +0 -4
  132. package/dist/proof-BfeWBNrY.js +0 -582
  133. package/dist/runtime-BSkOVUWM.js +0 -4
  134. package/dist/sig-BXJO--F9.js +0 -4
  135. package/dist/types-BZUzjGS0.js +0 -455
  136. package/dist/vocab-C_pE4SvE.js +0 -168
  137. package/dist/webfinger-C3GIyXIg.js +0 -4
  138. /package/dist/{denokv-CvROlGYX.js → denokv.js} +0 -0
@@ -3,15 +3,14 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
- import { assert } from "../assert-LOEeCUK5.js";
8
- import "../assert_instance_of-XtuFevV_.js";
9
- import { test } from "../testing-DLyvtiiW.js";
10
- import { assertGreater, assertGreaterOrEqual } from "../std__assert-o_r9vqm1.js";
11
- import { assertFalse } from "../assert_rejects-DWQ4jaf9.js";
12
- import "../assert_is_error-BTlryvT0.js";
13
- import "../assert_not_equals-C685gKx6.js";
14
- import "../assert_throws-YetpVSc-.js";
6
+ import "../chunk.js";
7
+ import { t as assertEquals } from "../assert_equals.js";
8
+ import { t as assert } from "../assert.js";
9
+ import { t as test } from "../testing.js";
10
+ import { i as assertGreaterOrEqual, r as assertGreater } from "../std__assert.js";
11
+ import { n as assertFalse } from "../assert_rejects.js";
12
+ import "../assert_is_error.js";
13
+ import "../assert_throws.js";
15
14
  import { delay } from "@es-toolkit/es-toolkit";
16
15
 
17
16
  //#region federation/mq.ts
@@ -70,10 +69,7 @@ var InProcessMessageQueue = class {
70
69
  async listen(handler, options = {}) {
71
70
  const signal = options.signal;
72
71
  while (signal == null || !signal.aborted) {
73
- while (this.#messages.length > 0) {
74
- const message = this.#messages.shift();
75
- await handler(message);
76
- }
72
+ while (this.#messages.length > 0) await handler(this.#messages.shift());
77
73
  await this.#wait(this.#pollIntervalMs, signal);
78
74
  }
79
75
  }
@@ -224,7 +220,7 @@ test("InProcessMessageQueue", async (t) => {
224
220
  });
225
221
  test("MessageQueue.nativeRetrial", async (t) => {
226
222
  if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") await t.step("DenoKvMessageQueue", async () => {
227
- const { DenoKvMessageQueue } = await import("../denokv-CvROlGYX.js");
223
+ const { DenoKvMessageQueue } = await import("../denokv.js");
228
224
  const mq = new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
229
225
  assert(mq.nativeRetrial);
230
226
  if (Symbol.dispose in mq) {
@@ -257,13 +253,12 @@ test("MessageQueue.nativeRetrial", async (t) => {
257
253
  throw new TypeError("WorkersMessageQueue does not support listen()");
258
254
  }
259
255
  }
260
- const mq = new TestWorkersMessageQueue(new MockQueue());
261
- assert(mq.nativeRetrial);
256
+ assert(new TestWorkersMessageQueue(new MockQueue()).nativeRetrial);
262
257
  });
263
258
  });
264
259
  const queues = { InProcessMessageQueue: () => Promise.resolve(new InProcessMessageQueue()) };
265
260
  if ("Deno" in globalThis && "openKv" in globalThis.Deno && typeof globalThis.Deno.openKv === "function") {
266
- const { DenoKvMessageQueue } = await import("../denokv-CvROlGYX.js");
261
+ const { DenoKvMessageQueue } = await import("../denokv.js");
267
262
  queues.DenoKvMessageQueue = async () => new DenoKvMessageQueue(await globalThis.Deno.openKv(":memory:"));
268
263
  }
269
264
  for (const mqName in queues) test({
@@ -3,10 +3,11 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { AssertionError, assertEquals } from "../assert_equals-B44MxcIj.js";
7
- import { createExponentialBackoffPolicy } from "../retry-BiIhZWgD.js";
8
- import { test } from "../testing-DLyvtiiW.js";
9
- import { assertNotEquals } from "../assert_not_equals-C685gKx6.js";
6
+ import "../chunk.js";
7
+ import { t as assertEquals, u as AssertionError } from "../assert_equals.js";
8
+ import { t as createExponentialBackoffPolicy } from "../retry.js";
9
+ import { t as test } from "../testing.js";
10
+ import { t as assertNotEquals } from "../assert_not_equals.js";
10
11
 
11
12
  //#region federation/retry.test.ts
12
13
  test("createExponentialBackoffPolicy()", () => {
@@ -3,16 +3,15 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
- import { assert } from "../assert-LOEeCUK5.js";
8
- import "../assert_instance_of-XtuFevV_.js";
9
- import { Router, RouterError } from "../router-D_aVZZUc.js";
10
- import { test } from "../testing-DLyvtiiW.js";
11
- import "../std__assert-o_r9vqm1.js";
12
- import { assertFalse } from "../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";
6
+ import "../chunk.js";
7
+ import { t as assertEquals } from "../assert_equals.js";
8
+ import { t as assert } from "../assert.js";
9
+ import { n as RouterError, t as Router } from "../router.js";
10
+ import { t as test } from "../testing.js";
11
+ import "../std__assert.js";
12
+ import { n as assertFalse } from "../assert_rejects.js";
13
+ import "../assert_is_error.js";
14
+ import { t as assertThrows } from "../assert_throws.js";
16
15
 
17
16
  //#region federation/router.test.ts
18
17
  function setUp(options = {}) {
@@ -3,30 +3,29 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { assertEquals } from "../assert_equals-B44MxcIj.js";
7
- import { assert } from "../assert-LOEeCUK5.js";
8
- import "../assert_instance_of-XtuFevV_.js";
9
- import "../docloader-Qfs9nPiy.js";
10
- import "../url-C2xuoQD1.js";
11
- import "../multibase-CnLHszip.js";
12
- import { Activity, Application, Endpoints, Group, Person, Service } from "../vocab-S7fEn6XO.js";
13
- import "../langstr-DbWheeIS.js";
14
- import "../lookup-CkOdKyYR.js";
15
- import "../type-CFuiGLz9.js";
16
- import "../actor-BVilnhZ3.js";
17
- import "../key-BPUM0v_S.js";
18
- import { verifyRequest } from "../http-CP3h1SLi.js";
19
- import { doesActorOwnKey } from "../owner-qKULzrkx.js";
20
- import { extractInboxes, sendActivity } from "../send-BnMY3Qxa.js";
21
- import { test } from "../testing-DLyvtiiW.js";
22
- import "../std__assert-o_r9vqm1.js";
23
- import { assertFalse, assertRejects } from "../assert_rejects-DWQ4jaf9.js";
24
- import "../assert_is_error-BTlryvT0.js";
25
- import { assertNotEquals } from "../assert_not_equals-C685gKx6.js";
26
- import "../assert_throws-YetpVSc-.js";
27
- import { mockDocumentLoader } from "../docloader-09nVWLAZ.js";
28
- import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-DGJec4-R.js";
29
- import { esm_default } from "../esm-DO9PrujO.js";
6
+ import "../chunk.js";
7
+ import { t as assertEquals } from "../assert_equals.js";
8
+ import { t as assert } from "../assert.js";
9
+ import "../docloader.js";
10
+ import "../url.js";
11
+ import "../multibase.js";
12
+ import { S as Person, T as Service, c as Endpoints, r as Application, t as Activity, u as Group } from "../vocab.js";
13
+ import "../langstr.js";
14
+ import "../lookup.js";
15
+ import "../actor.js";
16
+ import "../key2.js";
17
+ import { l as verifyRequest } from "../http.js";
18
+ import { t as doesActorOwnKey } from "../owner.js";
19
+ import { n as sendActivity, t as extractInboxes } from "../send.js";
20
+ import { t as test } from "../testing.js";
21
+ import "../std__assert.js";
22
+ import { n as assertFalse, t as assertRejects } from "../assert_rejects.js";
23
+ import "../assert_is_error.js";
24
+ import { t as assertNotEquals } from "../assert_not_equals.js";
25
+ import "../assert_throws.js";
26
+ import { t as mockDocumentLoader } from "../docloader2.js";
27
+ import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys.js";
28
+ import { t as esm_default } from "../esm.js";
30
29
 
31
30
  //#region federation/send.test.ts
32
31
  test("extractInboxes()", () => {
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { DocumentLoader } from "./docloader-Q42SMRIB.js";
4
- import { CryptographicKey, Multikey } from "./vocab-CzEfWQk2.js";
3
+ import { n as DocumentLoader } from "./docloader.js";
4
+ import { B as Multikey, m as CryptographicKey } from "./vocab.js";
5
5
  import { TracerProvider } from "@opentelemetry/api";
6
6
 
7
7
  //#region sig/key.d.ts
@@ -252,4 +252,4 @@ interface HttpMessageSignaturesSpecDeterminer {
252
252
  * @since 1.6.0
253
253
  */
254
254
  //#endregion
255
- export { FetchKeyOptions, FetchKeyResult, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, SignRequestOptions, VerifyRequestOptions, exportJwk, fetchKey, generateCryptoKeyPair, importJwk, signRequest, verifyRequest };
255
+ export { signRequest as a, FetchKeyResult as c, fetchKey as d, generateCryptoKeyPair as f, VerifyRequestOptions as i, KeyCache as l, HttpMessageSignaturesSpecDeterminer as n, verifyRequest as o, importJwk as p, SignRequestOptions as r, FetchKeyOptions as s, HttpMessageSignaturesSpec as t, exportJwk as u };
@@ -1,15 +1,16 @@
1
1
 
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
+ globalThis.addEventListener = () => {};
4
5
 
5
- import { deno_default } from "./docloader-CchlnLWb.js";
6
- import { CryptographicKey } from "./actor-CsmPeeHG.js";
7
- import { fetchKey, validateCryptoKey } from "./key--l6NVKdl.js";
6
+ import { d as version, u as name } from "./docloader.js";
7
+ import { o as CryptographicKey } from "./vocab.js";
8
+ import { a as validateCryptoKey, n as fetchKey } from "./key2.js";
8
9
  import { getLogger } from "@logtape/logtape";
9
10
  import { SpanStatusCode, trace } from "@opentelemetry/api";
11
+ import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
10
12
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
11
13
  import { encodeHex } from "byte-encodings/hex";
12
- import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
13
14
  import { Item, decodeDict, encodeItem } from "structured-field-values";
14
15
 
15
16
  //#region sig/http.ts
@@ -24,7 +25,7 @@ import { Item, decodeDict, encodeItem } from "structured-field-values";
24
25
  */
25
26
  async function signRequest(request, privateKey, keyId, options = {}) {
26
27
  validateCryptoKey(privateKey, "private");
27
- return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("http_signatures.sign", async (span) => {
28
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.sign", async (span) => {
28
29
  try {
29
30
  const spec = options.spec ?? "draft-cavage-http-signatures-12";
30
31
  let signed;
@@ -33,7 +34,7 @@ async function signRequest(request, privateKey, keyId, options = {}) {
33
34
  if (span.isRecording()) {
34
35
  span.setAttribute(ATTR_HTTP_REQUEST_METHOD, signed.method);
35
36
  span.setAttribute(ATTR_URL_FULL, signed.url);
36
- for (const [name, value] of signed.headers) span.setAttribute(ATTR_HTTP_REQUEST_HEADER(name), value);
37
+ for (const [name$1, value] of signed.headers) span.setAttribute(ATTR_HTTP_REQUEST_HEADER(name$1), value);
37
38
  span.setAttribute("http_signatures.key_id", keyId.href);
38
39
  }
39
40
  return signed;
@@ -61,8 +62,8 @@ async function signRequestDraft(request, privateKey, keyId, span, currentTime, b
61
62
  }
62
63
  if (!headers.has("Date")) headers.set("Date", currentTime == null ? (/* @__PURE__ */ new Date()).toUTCString() : new Date(currentTime.toString()).toUTCString());
63
64
  const serialized = [["(request-target)", `${request.method.toLowerCase()} ${url.pathname}`], ...headers];
64
- const headerNames = serialized.map(([name]) => name);
65
- const message = serialized.map(([name, value]) => `${name}: ${value.trim()}`).join("\n");
65
+ const headerNames = serialized.map(([name$1]) => name$1);
66
+ const message = serialized.map(([name$1, value]) => `${name$1}: ${value.trim()}`).join("\n");
66
67
  const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, new TextEncoder().encode(message));
67
68
  const sigHeader = `keyId="${keyId.href}",algorithm="rsa-sha256",headers="${headerNames.join(" ")}",signature="${encodeBase64(signature)}"`;
68
69
  headers.set("Signature", sigHeader);
@@ -119,9 +120,7 @@ function createRfc9421SignatureBase(request, components, parameters) {
119
120
  * @returns The formatted signature string.
120
121
  */
121
122
  function formatRfc9421Signature(signature, components, parameters) {
122
- const signatureInputValue = `sig1=("${components.join("\" \"")}");${parameters}`;
123
- const signatureValue = `sig1=:${encodeBase64(signature)}:`;
124
- return [signatureInputValue, signatureValue];
123
+ return [`sig1=("${components.join("\" \"")}");${parameters}`, `sig1=:${encodeBase64(signature)}:`];
125
124
  }
126
125
  /**
127
126
  * Parse RFC 9421 Signature-Input header.
@@ -251,11 +250,11 @@ const supportedHashAlgorithms = {
251
250
  * could not be verified.
252
251
  */
253
252
  async function verifyRequest(request, options = {}) {
254
- return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("http_signatures.verify", async (span) => {
253
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("http_signatures.verify", async (span) => {
255
254
  if (span.isRecording()) {
256
255
  span.setAttribute(ATTR_HTTP_REQUEST_METHOD, request.method);
257
256
  span.setAttribute(ATTR_URL_FULL, request.url);
258
- for (const [name, value] of request.headers) span.setAttribute(ATTR_HTTP_REQUEST_HEADER(name), value);
257
+ for (const [name$1, value] of request.headers) span.setAttribute(ATTR_HTTP_REQUEST_HEADER(name$1), value);
259
258
  }
260
259
  try {
261
260
  let spec = options.spec;
@@ -438,7 +437,7 @@ async function verifyRequestDraft(request, span, { documentLoader, contextLoader
438
437
  logger.debug("Failed to verify; required headers missing in the Signature header: {headers}.", { headers });
439
438
  return null;
440
439
  }
441
- const message = headerNames.map((name) => `${name}: ` + (name === "(request-target)" ? `${request.method.toLowerCase()} ${new URL(request.url).pathname}` : name === "(created)" ? sigValues.created ?? "" : name === "(expires)" ? sigValues.expires ?? "" : name === "host" ? request.headers.get("host") ?? new URL(request.url).host : request.headers.get(name))).join("\n");
440
+ const message = headerNames.map((name$1) => `${name$1}: ` + (name$1 === "(request-target)" ? `${request.method.toLowerCase()} ${new URL(request.url).pathname}` : name$1 === "(created)" ? sigValues.created ?? "" : name$1 === "(expires)" ? sigValues.expires ?? "" : name$1 === "host" ? request.headers.get("host") ?? new URL(request.url).host : request.headers.get(name$1))).join("\n");
442
441
  const sig = decodeBase64(signature);
443
442
  span?.setAttribute("http_signatures.signature", encodeHex(sig));
444
443
  if (!await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, sig, new TextEncoder().encode(message))) {
@@ -605,8 +604,7 @@ async function verifyRequestRfc9421(request, span, { documentLoader, contextLoad
605
604
  logger.debug("Failed to verify; Content-Digest header required but not found.", { components: sigInput.components });
606
605
  continue;
607
606
  }
608
- const body = await request.arrayBuffer();
609
- if (!await verifyRfc9421ContentDigest(contentDigestHeader, body)) {
607
+ if (!await verifyRfc9421ContentDigest(contentDigestHeader, await request.arrayBuffer())) {
610
608
  logger.debug("Failed to verify; Content-Digest verification failed.", { contentDigest: contentDigestHeader });
611
609
  continue;
612
610
  }
@@ -728,13 +726,11 @@ async function doubleKnock(request, identity, options = {}) {
728
726
  });
729
727
  log?.(signedRequest);
730
728
  let response = await fetch(signedRequest, { redirect: "manual" });
731
- if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
732
- const location = response.headers.get("Location");
733
- return doubleKnock(createRedirectRequest(request, location, body), identity, {
734
- ...options,
735
- body
736
- });
737
- } else if (response.status === 400 || response.status === 401 || response.status > 401) {
729
+ if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) return doubleKnock(createRedirectRequest(request, response.headers.get("Location"), body), identity, {
730
+ ...options,
731
+ body
732
+ });
733
+ else if (response.status === 400 || response.status === 401 || response.status > 401) {
738
734
  const spec = firstTrySpec === "draft-cavage-http-signatures-12" ? "rfc9421" : "draft-cavage-http-signatures-12";
739
735
  getLogger([
740
736
  "fedify",
@@ -753,13 +749,11 @@ async function doubleKnock(request, identity, options = {}) {
753
749
  });
754
750
  log?.(signedRequest);
755
751
  response = await fetch(signedRequest, { redirect: "manual" });
756
- if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
757
- const location = response.headers.get("Location");
758
- return doubleKnock(createRedirectRequest(request, location, body), identity, {
759
- ...options,
760
- body
761
- });
762
- } else if (response.status !== 400 && response.status !== 401) await specDeterminer?.rememberSpec(origin, spec);
752
+ if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) return doubleKnock(createRedirectRequest(request, response.headers.get("Location"), body), identity, {
753
+ ...options,
754
+ body
755
+ });
756
+ else if (response.status !== 400 && response.status !== 401) await specDeterminer?.rememberSpec(origin, spec);
763
757
  } else await specDeterminer?.rememberSpec(origin, firstTrySpec);
764
758
  return response;
765
759
  }
@@ -792,4 +786,4 @@ function timingSafeEqual(a, b) {
792
786
  }
793
787
 
794
788
  //#endregion
795
- export { doubleKnock, signRequest, verifyRequest };
789
+ export { parseRfc9421Signature as a, timingSafeEqual as c, formatRfc9421SignatureParameters as i, verifyRequest as l, doubleKnock as n, parseRfc9421SignatureInput as o, formatRfc9421Signature as r, signRequest as s, createRfc9421SignatureBase as t };
@@ -3,9 +3,9 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default } from "./docloader-Qfs9nPiy.js";
7
- import { Activity } from "./vocab-S7fEn6XO.js";
8
- import { getTypeId } from "./type-CFuiGLz9.js";
6
+ import { d as version, u as name } from "./docloader.js";
7
+ import { t as Activity } from "./vocab.js";
8
+ import { t as getTypeId } from "./type.js";
9
9
  import { getLogger } from "@logtape/logtape";
10
10
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
11
11
 
@@ -112,7 +112,7 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
112
112
  return "enqueued";
113
113
  }
114
114
  tracerProvider = tracerProvider ?? trace.getTracerProvider();
115
- return await tracerProvider.getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.dispatch_inbox_listener", { kind: SpanKind.INTERNAL }, async (span$1) => {
115
+ return await tracerProvider.getTracer(name, version).startActiveSpan("activitypub.dispatch_inbox_listener", { kind: SpanKind.INTERNAL }, async (span$1) => {
116
116
  const dispatched = inboxListeners?.dispatchWithClass(activity);
117
117
  if (dispatched == null) {
118
118
  logger.error("Unsupported activity type:\n{activity}", {
@@ -166,4 +166,4 @@ async function routeActivity({ context: ctx, json, activity, recipient, inboxLis
166
166
  }
167
167
 
168
168
  //#endregion
169
- export { InboxListenerSet, routeActivity };
169
+ export { routeActivity as n, InboxListenerSet as t };
package/dist/key.js ADDED
@@ -0,0 +1,16 @@
1
+
2
+ import { Temporal } from "@js-temporal/polyfill";
3
+ import { URLPattern } from "urlpattern-polyfill";
4
+ globalThis.addEventListener = () => {};
5
+
6
+ import "./chunk.js";
7
+ import "./docloader.js";
8
+ import "./url.js";
9
+ import "./multibase.js";
10
+ import "./vocab.js";
11
+ import "./langstr.js";
12
+ import "./lookup.js";
13
+ import "./actor.js";
14
+ import { a as validateCryptoKey, i as importJwk, n as fetchKey, r as generateCryptoKeyPair, t as exportJwk } from "./key2.js";
15
+
16
+ export { validateCryptoKey };
@@ -3,9 +3,9 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default, getDocumentLoader } from "./docloader-Qfs9nPiy.js";
7
- import { CryptographicKey, Object as Object$1 } from "./vocab-S7fEn6XO.js";
8
- import { isActor } from "./actor-BVilnhZ3.js";
6
+ import { d as version, i as getDocumentLoader, u as name } from "./docloader.js";
7
+ import { _ as Object$1, o as CryptographicKey } from "./vocab.js";
8
+ import { i as isActor } from "./actor.js";
9
9
  import { getLogger } from "@logtape/logtape";
10
10
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
11
11
 
@@ -102,7 +102,7 @@ async function importJwk(jwk, type) {
102
102
  * @since 1.3.0
103
103
  */
104
104
  function fetchKey(keyId, cls, options = {}) {
105
- const tracer = (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version);
105
+ const tracer = (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version);
106
106
  keyId = typeof keyId === "string" ? new URL(keyId) : keyId;
107
107
  return tracer.startActiveSpan("activitypub.fetch_key", {
108
108
  kind: SpanKind.CLIENT,
@@ -256,4 +256,4 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
256
256
  }
257
257
 
258
258
  //#endregion
259
- export { exportJwk, fetchKey, generateCryptoKeyPair, importJwk, validateCryptoKey };
259
+ export { validateCryptoKey as a, importJwk as i, fetchKey as n, generateCryptoKeyPair as r, exportJwk as t };
@@ -3,7 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { CryptographicKey, Multikey } from "./vocab-S7fEn6XO.js";
6
+ import { h as Multikey, o as CryptographicKey } from "./vocab.js";
7
7
 
8
8
  //#region federation/keycache.ts
9
9
  var KvKeyCache = class {
@@ -45,4 +45,4 @@ var KvKeyCache = class {
45
45
  };
46
46
 
47
47
  //#endregion
48
- export { KvKeyCache };
48
+ export { KvKeyCache as t };
@@ -3,7 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { CryptographicKey, Multikey, importSpki } from "./vocab-S7fEn6XO.js";
6
+ import { P as importSpki, h as Multikey, o as CryptographicKey } from "./vocab.js";
7
7
 
8
8
  //#region testing/keys.ts
9
9
  const rsaPublicKey1 = new CryptographicKey({
@@ -120,4 +120,4 @@ const ed25519Multikey = new Multikey({
120
120
  });
121
121
 
122
122
  //#endregion
123
- export { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey1, rsaPublicKey2, rsaPublicKey3, rsaPublicKey5 };
123
+ export { rsaPrivateKey3 as a, rsaPublicKey3 as c, rsaPrivateKey2 as i, rsaPublicKey5 as l, ed25519PrivateKey as n, rsaPublicKey1 as o, ed25519PublicKey as r, rsaPublicKey2 as s, ed25519Multikey as t };
@@ -67,4 +67,4 @@ declare class MemoryKvStore implements KvStore {
67
67
  delete(key: KvKey): Promise<void>;
68
68
  }
69
69
  //#endregion
70
- export { KvKey, KvStore, KvStoreSetOptions, MemoryKvStore };
70
+ export { MemoryKvStore as i, KvStore as n, KvStoreSetOptions as r, KvKey as t };
@@ -49,4 +49,4 @@ var MemoryKvStore = class {
49
49
  };
50
50
 
51
51
  //#endregion
52
- export { MemoryKvStore };
52
+ export { MemoryKvStore as t };
@@ -30,4 +30,4 @@ var LanguageString = class extends String {
30
30
  };
31
31
 
32
32
  //#endregion
33
- export { LanguageString };
33
+ export { LanguageString as t };
@@ -3,10 +3,10 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default, getDocumentLoader } from "./docloader-Qfs9nPiy.js";
7
- import { Activity, CryptographicKey, Object as Object$1 } from "./vocab-S7fEn6XO.js";
8
- import { getTypeId } from "./type-CFuiGLz9.js";
9
- import { fetchKey, validateCryptoKey } from "./key-BPUM0v_S.js";
6
+ import { d as version, i as getDocumentLoader, u as name } from "./docloader.js";
7
+ import { _ as Object$1, o as CryptographicKey, t as Activity } from "./vocab.js";
8
+ import { t as getTypeId } from "./type.js";
9
+ import { a as validateCryptoKey, n as fetchKey } from "./key2.js";
10
10
  import { getLogger } from "@logtape/logtape";
11
11
  import { SpanStatusCode, trace } from "@opentelemetry/api";
12
12
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
@@ -54,9 +54,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
54
54
  creator: keyId.href,
55
55
  created: created?.toString() ?? (/* @__PURE__ */ new Date()).toISOString()
56
56
  };
57
- const optionsHash = await hashJsonLd(options, contextLoader);
58
- const docHash = await hashJsonLd(jsonLd, contextLoader);
59
- const message = optionsHash + docHash;
57
+ const message = await hashJsonLd(options, contextLoader) + await hashJsonLd(jsonLd, contextLoader);
60
58
  const messageBytes = new TextEncoder().encode(message);
61
59
  const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, messageBytes);
62
60
  return {
@@ -79,7 +77,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
79
77
  * @since 1.0.0
80
78
  */
81
79
  async function signJsonLd(jsonLd, privateKey, keyId, options) {
82
- return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("ld_signatures.sign", { attributes: { "ld_signatures.key_id": keyId.href } }, async (span) => {
80
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("ld_signatures.sign", { attributes: { "ld_signatures.key_id": keyId.href } }, async (span) => {
83
81
  try {
84
82
  const signature = await createSignature(jsonLd, privateKey, keyId, options);
85
83
  if (span.isRecording()) {
@@ -214,7 +212,7 @@ async function verifySignature(jsonLd, options = {}) {
214
212
  * @returns `true` if the document is authentic; `false` otherwise.
215
213
  */
216
214
  async function verifyJsonLd(jsonLd, options = {}) {
217
- return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("ld_signatures.verify", async (span) => {
215
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("ld_signatures.verify", async (span) => {
218
216
  try {
219
217
  const object = await Object$1.fromJsonLd(jsonLd, options);
220
218
  if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
@@ -255,9 +253,8 @@ async function hashJsonLd(jsonLd, contextLoader) {
255
253
  documentLoader: contextLoader ?? getDocumentLoader()
256
254
  });
257
255
  const encoder = new TextEncoder();
258
- const hash = await crypto.subtle.digest("SHA-256", encoder.encode(canon));
259
- return encodeHex(hash);
256
+ return encodeHex(await crypto.subtle.digest("SHA-256", encoder.encode(canon)));
260
257
  }
261
258
 
262
259
  //#endregion
263
- export { attachSignature, createSignature, detachSignature, hasSignature, signJsonLd, verifyJsonLd, verifySignature };
260
+ export { signJsonLd as a, hasSignature as i, createSignature as n, verifyJsonLd as o, detachSignature as r, verifySignature as s, attachSignature as t };
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { GetUserAgentOptions } from "./docloader-Q42SMRIB.js";
3
+ import { s as GetUserAgentOptions } from "./docloader.js";
4
4
  import { TracerProvider } from "@opentelemetry/api";
5
5
 
6
6
  //#region webfinger/jrd.d.ts
@@ -93,4 +93,4 @@ interface LookupWebFingerOptions {
93
93
  */
94
94
  declare function lookupWebFinger(resource: URL | string, options?: LookupWebFingerOptions): Promise<ResourceDescriptor | null>;
95
95
  //#endregion
96
- export { Link, LookupWebFingerOptions, ResourceDescriptor, lookupWebFinger };
96
+ export { ResourceDescriptor as i, lookupWebFinger as n, Link as r, LookupWebFingerOptions as t };
@@ -3,8 +3,8 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default, getUserAgent } from "./docloader-Qfs9nPiy.js";
7
- import { UrlError, validatePublicUrl } from "./url-C2xuoQD1.js";
6
+ import { d as version, o as getUserAgent, u as name } from "./docloader.js";
7
+ import { a as validatePublicUrl, t as UrlError } from "./url.js";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
10
10
 
@@ -23,7 +23,7 @@ const MAX_REDIRECTION = 5;
23
23
  * @since 0.2.0
24
24
  */
25
25
  async function lookupWebFinger(resource, options = {}) {
26
- return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("webfinger.lookup", {
26
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("webfinger.lookup", {
27
27
  kind: SpanKind.CLIENT,
28
28
  attributes: {
29
29
  "webfinger.resource": resource.toString(),
@@ -126,4 +126,4 @@ async function lookupWebFingerInternal(resource, options = {}) {
126
126
  }
127
127
 
128
128
  //#endregion
129
- export { lookupWebFinger };
129
+ export { lookupWebFinger as t };
@@ -3,10 +3,10 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default, getDocumentLoader } from "./docloader-Qfs9nPiy.js";
7
- import { Object as Object$1 } from "./vocab-S7fEn6XO.js";
8
- import { lookupWebFinger } from "./lookup-CkOdKyYR.js";
9
- import { getTypeId } from "./type-CFuiGLz9.js";
6
+ import { d as version, i as getDocumentLoader, u as name } from "./docloader.js";
7
+ import { _ as Object$1 } from "./vocab.js";
8
+ import { t as lookupWebFinger } from "./lookup.js";
9
+ import { t as getTypeId } from "./type.js";
10
10
  import { getLogger } from "@logtape/logtape";
11
11
  import { SpanStatusCode, trace } from "@opentelemetry/api";
12
12
  import { delay } from "@es-toolkit/es-toolkit";
@@ -51,7 +51,7 @@ const handleRegexp = /^@?((?:[-A-Za-z0-9._~!$&'()*+,;=]|%[A-Fa-f0-9]{2})+)@([^@]
51
51
  * @since 0.2.0
52
52
  */
53
53
  async function lookupObject(identifier, options = {}) {
54
- return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(deno_default.name, deno_default.version).startActiveSpan("activitypub.lookup_object", async (span) => {
54
+ return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("activitypub.lookup_object", async (span) => {
55
55
  try {
56
56
  const result = await lookupObjectInternal(identifier, options);
57
57
  if (result == null) span.setStatus({ code: SpanStatusCode.ERROR });
@@ -155,4 +155,4 @@ async function* traverseCollection(collection, options = {}) {
155
155
  }
156
156
 
157
157
  //#endregion
158
- export { lookupObject, traverseCollection };
158
+ export { traverseCollection as n, lookupObject as t };