@fedify/fedify 2.3.0-dev.1119 → 2.3.0-dev.1137

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 (116) hide show
  1. package/README.md +3 -0
  2. package/dist/{assert-DikXweDx.mjs → assert-OguE97r2.mjs} +1 -1
  3. package/dist/{assert_instance_of-C4Ri6VuN.mjs → assert_instance_of-DBC5X09g.mjs} +1 -1
  4. package/dist/{assert_not_equals--wG9hV7u.mjs → assert_not_equals-DkVK8oqV.mjs} +1 -1
  5. package/dist/{assert_rejects-DQP-q39h.mjs → assert_rejects-DN60FHPX.mjs} +2 -2
  6. package/dist/{assert_strict_equals-Dmjbg-bA.mjs → assert_strict_equals-XEgZAlrj.mjs} +1 -1
  7. package/dist/{assert_throws-4NwKEy2q.mjs → assert_throws-BOkhLGYc.mjs} +1 -1
  8. package/dist/{builder-Ond_h57y.mjs → builder-BCkBXxky.mjs} +60 -41
  9. package/dist/compat/mod.d.cts +1 -1
  10. package/dist/compat/mod.d.ts +1 -1
  11. package/dist/compat/outgoing-jsonld.test.mjs +3 -3
  12. package/dist/compat/public-audience.test.mjs +3 -3
  13. package/dist/compat/transformers.test.mjs +5 -5
  14. package/dist/{context-cSUMk2da.d.ts → context-DCtsSHDv.d.ts} +4 -293
  15. package/dist/{context-Ch-ZLyTQ.d.cts → context-DI2gRbyN.d.cts} +3 -294
  16. package/dist/{context-BAE7AKLA.mjs → context-DVoTs_wM.mjs} +1 -1
  17. package/dist/{deno-DVsHS7rA.mjs → deno-B_9yJW3w.mjs} +1 -1
  18. package/dist/{docloader-WsWfKaE5.mjs → docloader-BT89tyFr.mjs} +3 -3
  19. package/dist/federation/builder.test.mjs +138 -10
  20. package/dist/federation/collection.test.mjs +3 -3
  21. package/dist/federation/handler.test.mjs +12 -12
  22. package/dist/federation/idempotency.test.mjs +6 -6
  23. package/dist/federation/inbox.test.mjs +3 -3
  24. package/dist/federation/keycache.test.mjs +5 -5
  25. package/dist/federation/kv.test.mjs +3 -3
  26. package/dist/federation/metrics.test.mjs +231 -3
  27. package/dist/federation/middleware.test.mjs +88 -18
  28. package/dist/federation/mod.cjs +155 -3
  29. package/dist/federation/mod.d.cts +3 -2
  30. package/dist/federation/mod.d.ts +3 -2
  31. package/dist/federation/mod.js +153 -1
  32. package/dist/federation/mq.test.mjs +5 -5
  33. package/dist/federation/negotiation.test.mjs +4 -4
  34. package/dist/federation/retry.test.mjs +3 -3
  35. package/dist/federation/router.test.mjs +190 -9
  36. package/dist/federation/send.test.mjs +16 -16
  37. package/dist/federation/webfinger.test.mjs +5 -5
  38. package/dist/{getMachineId-bsd-BY01PL1n.mjs → getMachineId-bsd-etIyxDet.mjs} +1 -1
  39. package/dist/{getMachineId-darwin-Dr1gkBkp.mjs → getMachineId-darwin-D23zTf4g.mjs} +1 -1
  40. package/dist/{getMachineId-win-QEYwcJiy.mjs → getMachineId-win-Dpap6v5i.mjs} +1 -1
  41. package/dist/{http-CouJSFVK.js → http-CToqG5ap.js} +252 -20
  42. package/dist/{http-CubOB9wq.cjs → http-CWoeyogl.cjs} +263 -19
  43. package/dist/{http-DUV8ysti.mjs → http-Cyx5SNuu.mjs} +8 -6
  44. package/dist/{http-D6LP89UO.d.ts → http-VyDTd4G3.d.cts} +8 -1
  45. package/dist/{http-D6aw3j2U.d.cts → http-lf8Hsd91.d.ts} +8 -1
  46. package/dist/{key-BoWaYRHm.mjs → key-CkkMJBjF.mjs} +42 -17
  47. package/dist/{kv-cache-DBNpsneh.js → kv-cache-CuCn2xvM.js} +19 -2
  48. package/dist/{kv-cache-Dz31ATUT.cjs → kv-cache-DuEwFYcN.cjs} +19 -2
  49. package/dist/{kv-cache-DihufyAQ.mjs → kv-cache-VHFP42vY.mjs} +19 -1
  50. package/dist/{ld-B5K1mSuG.mjs → ld-k8yqD2a-.mjs} +3 -3
  51. package/dist/{metrics-C4attqv0.mjs → metrics-iRBg8jTk.mjs} +209 -2
  52. package/dist/{middleware-CmsDtIHI.cjs → middleware-BWLUrbS9.cjs} +137 -210
  53. package/dist/{middleware-BDKFRjue.mjs → middleware-CztxpARM.mjs} +1 -1
  54. package/dist/{middleware-Dtjz-hSk.js → middleware-D7FrhN9q.js} +101 -162
  55. package/dist/{middleware-t0jC8I99.mjs → middleware-DQEgdr83.mjs} +64 -36
  56. package/dist/{mod-BDhgfjP7.d.cts → mod-B0hW12_O.d.cts} +1 -1
  57. package/dist/mod-C504qevA.d.cts +173 -0
  58. package/dist/{mod-B-Lin9Sy.d.ts → mod-COIAjwRS.d.ts} +1 -1
  59. package/dist/{mod-DLrRb0dx.d.ts → mod-DFvNJcNb.d.ts} +54 -3
  60. package/dist/mod-wYfuXeDE.d.ts +173 -0
  61. package/dist/{mod-BR_BB0bh.d.cts → mod-yvIXFAEi.d.cts} +54 -3
  62. package/dist/mod.cjs +6 -6
  63. package/dist/mod.d.cts +6 -5
  64. package/dist/mod.d.ts +6 -5
  65. package/dist/mod.js +5 -5
  66. package/dist/mq-D-nlpY04.d.ts +208 -0
  67. package/dist/mq-D8uSFzxe.d.cts +208 -0
  68. package/dist/nodeinfo/client.test.mjs +4 -4
  69. package/dist/nodeinfo/handler.test.mjs +5 -5
  70. package/dist/nodeinfo/types.test.mjs +4 -4
  71. package/dist/otel/exporter.test.mjs +3 -3
  72. package/dist/{outgoing-jsonld-BNL8AC14.mjs → outgoing-jsonld-BgFLCJQ_.mjs} +1 -1
  73. package/dist/{owner-hDxI0ufu.mjs → owner-nmXdvXpc.mjs} +2 -2
  74. package/dist/{proof-BUWfVr6Q.cjs → proof-CcsIJLTn.cjs} +1 -1
  75. package/dist/{proof-DhVuz4bc.mjs → proof-DpwO1T4S.mjs} +5 -5
  76. package/dist/{proof-n60t8o9P.js → proof-NRmtrTDu.js} +1 -1
  77. package/dist/{send-BPhyR5Oo.mjs → send-DvX2tYyZ.mjs} +3 -3
  78. package/dist/sig/accept.test.mjs +1 -1
  79. package/dist/sig/http.test.mjs +13 -9
  80. package/dist/sig/key.test.mjs +104 -7
  81. package/dist/sig/ld.test.mjs +7 -7
  82. package/dist/sig/mod.cjs +2 -2
  83. package/dist/sig/mod.d.cts +2 -2
  84. package/dist/sig/mod.d.ts +2 -2
  85. package/dist/sig/mod.js +2 -2
  86. package/dist/sig/owner.test.mjs +6 -6
  87. package/dist/sig/proof.test.mjs +8 -8
  88. package/dist/{std__assert-BTEgfoJo.mjs → std__assert-BBjXFNOb.mjs} +4 -4
  89. package/dist/testing/mod.d.mts +1 -0
  90. package/dist/testing/mod.mjs +1 -1
  91. package/dist/utils/docloader.test.mjs +7 -7
  92. package/dist/utils/kv-cache.test.mjs +67 -2
  93. package/dist/utils/mod.cjs +1 -1
  94. package/dist/utils/mod.d.cts +1 -1
  95. package/dist/utils/mod.d.ts +1 -1
  96. package/dist/utils/mod.js +1 -1
  97. package/package.json +6 -7
  98. package/dist/mod-C6E8rkcz.d.ts +0 -63
  99. package/dist/mod-P9tE2WmM.d.cts +0 -63
  100. package/dist/router-BT_F5748.mjs +0 -114
  101. /package/dist/{accept-CgDcxvjV.mjs → accept-CceiKpCy.mjs} +0 -0
  102. /package/dist/{activity-listener-BeTGV3wc.mjs → activity-listener-tztVvlNb.mjs} +0 -0
  103. /package/dist/{assert_equals-Ew3jOFa3.mjs → assert_equals-C-ZRDbaf.mjs} +0 -0
  104. /package/dist/{client-Bneh_DYR.mjs → client-B_A6mfn3.mjs} +0 -0
  105. /package/dist/{collection-Cc3DVAhE.mjs → collection-CA3V5zyK.mjs} +0 -0
  106. /package/dist/{esm-sdtqOUPu.mjs → esm-BQRw925N.mjs} +0 -0
  107. /package/dist/{execAsync-Dxb7rNf3.mjs → execAsync-DCBrgFiV.mjs} +0 -0
  108. /package/dist/{getMachineId-linux-Bbhofx-s.mjs → getMachineId-linux-ObI47Hql.mjs} +0 -0
  109. /package/dist/{getMachineId-unsupported-dIOte2Ct.mjs → getMachineId-unsupported-Ddu-PFeh.mjs} +0 -0
  110. /package/dist/{keycache-BeU0LCII.mjs → keycache-BYMd8q7F.mjs} +0 -0
  111. /package/dist/{keys-CSYsOMFG.mjs → keys-C3kae-6B.mjs} +0 -0
  112. /package/dist/{kv-QHE0oeM3.mjs → kv-x2IvBUyq.mjs} +0 -0
  113. /package/dist/{negotiation-DDstyBvc.mjs → negotiation-CDW-_gUU.mjs} +0 -0
  114. /package/dist/{public-audience-c9zmYKgA.mjs → public-audience-N3pyOx2p.mjs} +0 -0
  115. /package/dist/{retry-_VvV0h9f.mjs → retry-v_sGLH1d.mjs} +0 -0
  116. /package/dist/{types-D09GN0uZ.mjs → types-BFowWFTT.mjs} +0 -0
@@ -1,14 +1,14 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import "../std__assert-BTEgfoJo.mjs";
6
- import { t as assertRejects } from "../assert_rejects-DQP-q39h.mjs";
7
- import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
8
- import { a as importJwk, i as generateCryptoKeyPair, n as fetchKey, o as validateCryptoKey, r as fetchKeyDetailed, t as exportJwk } from "../key-BoWaYRHm.mjs";
9
- import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CSYsOMFG.mjs";
4
+ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
+ import "../std__assert-BBjXFNOb.mjs";
6
+ import { t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
7
+ import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
8
+ import { a as importJwk, i as generateCryptoKeyPair, n as fetchKey, o as validateCryptoKey, r as fetchKeyDetailed, t as exportJwk } from "../key-CkkMJBjF.mjs";
9
+ import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-C3kae-6B.mjs";
10
10
  import { CryptographicKey, Multikey } from "@fedify/vocab";
11
- import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
11
+ import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { FetchError } from "@fedify/vocab-runtime";
13
13
  //#region src/sig/key.test.ts
14
14
  test("validateCryptoKey()", async () => {
@@ -303,5 +303,102 @@ test("fetchKeyDetailed() returns detailed fetch errors", async () => {
303
303
  if (detailedError == null || !("error" in detailedError)) throw new Error("Expected non-HTTP fetch error details.");
304
304
  assertEquals(detailedError.error, failure);
305
305
  });
306
+ test("fetchKey() records activitypub.key.lookup with hit on cached key", async () => {
307
+ const [meterProvider, recorder] = createTestMeterProvider();
308
+ const cache = {};
309
+ const options = {
310
+ documentLoader: mockDocumentLoader,
311
+ contextLoader: mockDocumentLoader,
312
+ keyCache: {
313
+ get(keyId) {
314
+ return Promise.resolve(cache[keyId.href]);
315
+ },
316
+ set(keyId, key) {
317
+ cache[keyId.href] = key;
318
+ return Promise.resolve();
319
+ }
320
+ },
321
+ meterProvider
322
+ };
323
+ await fetchKey("https://example.com/key", CryptographicKey, options);
324
+ recorder.clear();
325
+ assertEquals((await fetchKey("https://example.com/key", CryptographicKey, options)).cached, true);
326
+ const counters = recorder.getMeasurements("activitypub.key.lookup");
327
+ assertEquals(counters.length, 1);
328
+ assertEquals(counters[0].attributes["activitypub.lookup.kind"], "public_key");
329
+ assertEquals(counters[0].attributes["activitypub.lookup.result"], "hit");
330
+ assertEquals(counters[0].attributes["activitypub.cache.enabled"], true);
331
+ assertEquals(counters[0].attributes["activitypub.remote.host"], "example.com");
332
+ const duration = recorder.getMeasurement("activitypub.key.lookup.duration");
333
+ assertEquals(duration?.type, "histogram");
334
+ assertEquals(duration?.attributes["activitypub.lookup.result"], "hit");
335
+ });
336
+ test("fetchKey() records activitypub.key.lookup with fetched on cache miss", async () => {
337
+ const [meterProvider, recorder] = createTestMeterProvider();
338
+ assertEquals((await fetchKey("https://example.com/key", CryptographicKey, {
339
+ documentLoader: mockDocumentLoader,
340
+ contextLoader: mockDocumentLoader,
341
+ meterProvider
342
+ })).cached, false);
343
+ const counter = recorder.getMeasurement("activitypub.key.lookup");
344
+ assertEquals(counter?.attributes["activitypub.lookup.result"], "fetched");
345
+ assertEquals(counter?.attributes["activitypub.cache.enabled"], false);
346
+ assertEquals(counter?.attributes["activitypub.remote.host"], "example.com");
347
+ assertEquals(recorder.getMeasurement("activitypub.key.lookup.duration")?.attributes["activitypub.lookup.result"], "fetched");
348
+ });
349
+ test("fetchKey() records not_found and status code on HTTP 404", async () => {
350
+ const [meterProvider, recorder] = createTestMeterProvider();
351
+ const missingKeyId = new URL("https://example.com/missing-key");
352
+ const documentLoader = (url) => {
353
+ if (url === missingKeyId.href) throw new FetchError(missingKeyId, `HTTP 404: ${missingKeyId.href}`, new Response(null, { status: 404 }));
354
+ return mockDocumentLoader(url);
355
+ };
356
+ assertEquals((await fetchKey(missingKeyId, CryptographicKey, {
357
+ documentLoader,
358
+ contextLoader: mockDocumentLoader,
359
+ meterProvider
360
+ })).key, null);
361
+ const counter = recorder.getMeasurement("activitypub.key.lookup");
362
+ assertEquals(counter?.attributes["activitypub.lookup.result"], "not_found");
363
+ assertEquals(counter?.attributes["http.response.status_code"], 404);
364
+ assertEquals(counter?.attributes["activitypub.cache.enabled"], false);
365
+ assertEquals(counter?.attributes["activitypub.remote.host"], "example.com");
366
+ });
367
+ test("fetchKey() records network_error on TypeError from the document loader", async () => {
368
+ const [meterProvider, recorder] = createTestMeterProvider();
369
+ const documentLoader = () => {
370
+ throw new TypeError("connect failed");
371
+ };
372
+ await fetchKey("https://example.com/key", CryptographicKey, {
373
+ documentLoader,
374
+ contextLoader: mockDocumentLoader,
375
+ meterProvider
376
+ });
377
+ const counter = recorder.getMeasurement("activitypub.key.lookup");
378
+ assertEquals(counter?.attributes["activitypub.lookup.result"], "network_error");
379
+ assertEquals("http.response.status_code" in counter.attributes, false);
380
+ });
381
+ test("fetchKeyDetailed() records activitypub.key.lookup with the same taxonomy", async () => {
382
+ const [meterProvider, recorder] = createTestMeterProvider();
383
+ const goneKeyId = new URL("https://example.com/gone-key");
384
+ const documentLoader = (url) => {
385
+ if (url === goneKeyId.href) throw new FetchError(goneKeyId, `HTTP 410: ${goneKeyId.href}`, new Response(null, { status: 410 }));
386
+ return mockDocumentLoader(url);
387
+ };
388
+ await fetchKeyDetailed(goneKeyId, CryptographicKey, {
389
+ documentLoader,
390
+ contextLoader: mockDocumentLoader,
391
+ meterProvider
392
+ });
393
+ const counter = recorder.getMeasurement("activitypub.key.lookup");
394
+ assertEquals(counter?.attributes["activitypub.lookup.result"], "not_found");
395
+ assertEquals(counter?.attributes["http.response.status_code"], 410);
396
+ });
397
+ test("fetchKey() works when meterProvider is omitted", async () => {
398
+ assertEquals((await fetchKey("https://example.com/key", CryptographicKey, {
399
+ documentLoader: mockDocumentLoader,
400
+ contextLoader: mockDocumentLoader
401
+ })).cached, false);
402
+ });
306
403
  //#endregion
307
404
  export {};
@@ -1,13 +1,13 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DQP-q39h.mjs";
6
- import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
7
- import { t as assert } from "../assert-DikXweDx.mjs";
8
- import { i as generateCryptoKeyPair } from "../key-BoWaYRHm.mjs";
9
- import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CSYsOMFG.mjs";
10
- import { a as signJsonLd, i as hasSignatureLike, n as createSignature, o as verifyJsonLd, r as detachSignature, s as verifySignature, t as attachSignature } from "../ld-B5K1mSuG.mjs";
4
+ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
+ import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
6
+ import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
7
+ import { t as assert } from "../assert-OguE97r2.mjs";
8
+ import { i as generateCryptoKeyPair } from "../key-CkkMJBjF.mjs";
9
+ import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-C3kae-6B.mjs";
10
+ import { a as signJsonLd, i as hasSignatureLike, n as createSignature, o as verifyJsonLd, r as detachSignature, s as verifySignature, t as attachSignature } from "../ld-k8yqD2a-.mjs";
11
11
  import { CryptographicKey } from "@fedify/vocab";
12
12
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
13
13
  import { encodeBase64 } from "byte-encodings/base64";
package/dist/sig/mod.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_http = require("../http-CubOB9wq.cjs");
5
- const require_proof = require("../proof-BUWfVr6Q.cjs");
4
+ const require_http = require("../http-CWoeyogl.cjs");
5
+ const require_proof = require("../proof-CcsIJLTn.cjs");
6
6
  exports.attachSignature = require_proof.attachSignature;
7
7
  exports.createProof = require_proof.createProof;
8
8
  exports.createSignature = require_proof.createSignature;
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-D6aw3j2U.cjs";
2
+ import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-VyDTd4G3.cjs";
3
3
  import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-DEvZuyOE.cjs";
4
- import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-BDhgfjP7.cjs";
4
+ import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-B0hW12_O.cjs";
5
5
  export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
package/dist/sig/mod.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-D6LP89UO.js";
2
+ import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-lf8Hsd91.js";
3
3
  import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-CnngXDNJ.js";
4
- import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-B-Lin9Sy.js";
4
+ import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-COIAjwRS.js";
5
5
  export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
package/dist/sig/mod.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { C as parseAcceptSignature, S as fulfillAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk, w as validateAcceptSignature, x as formatAcceptSignature } from "../http-CouJSFVK.js";
4
- import { a as verifyProof, c as getKeyOwner, d as detachSignature, f as hasSignatureLike, h as verifySignature, i as verifyObject, l as attachSignature, m as verifyJsonLd, n as hasProofLike, p as signJsonLd, r as signObject, s as doesActorOwnKey, t as createProof, u as createSignature } from "../proof-n60t8o9P.js";
3
+ import { C as formatAcceptSignature, E as validateAcceptSignature, T as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk, w as fulfillAcceptSignature } from "../http-CToqG5ap.js";
4
+ import { a as verifyProof, c as getKeyOwner, d as detachSignature, f as hasSignatureLike, h as verifySignature, i as verifyObject, l as attachSignature, m as verifyJsonLd, n as hasProofLike, p as signJsonLd, r as signObject, s as doesActorOwnKey, t as createProof, u as createSignature } from "../proof-NRmtrTDu.js";
5
5
  export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
@@ -1,12 +1,12 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import "../std__assert-BTEgfoJo.mjs";
6
- import { r as assertFalse } from "../assert_rejects-DQP-q39h.mjs";
7
- import { t as assert } from "../assert-DikXweDx.mjs";
8
- import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-CSYsOMFG.mjs";
9
- import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-hDxI0ufu.mjs";
4
+ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
+ import "../std__assert-BBjXFNOb.mjs";
6
+ import { r as assertFalse } from "../assert_rejects-DN60FHPX.mjs";
7
+ import { t as assert } from "../assert-OguE97r2.mjs";
8
+ import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-C3kae-6B.mjs";
9
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-nmXdvXpc.mjs";
10
10
  import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
11
11
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
12
12
  //#region src/sig/owner.test.ts
@@ -1,14 +1,14 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import "../std__assert-BTEgfoJo.mjs";
6
- import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DQP-q39h.mjs";
7
- import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
8
- import { t as assert } from "../assert-DikXweDx.mjs";
9
- import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CSYsOMFG.mjs";
10
- import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-BNL8AC14.mjs";
11
- import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-DhVuz4bc.mjs";
4
+ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
+ import "../std__assert-BBjXFNOb.mjs";
6
+ import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
7
+ import { t as assertInstanceOf } from "../assert_instance_of-DBC5X09g.mjs";
8
+ import { t as assert } from "../assert-OguE97r2.mjs";
9
+ import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-C3kae-6B.mjs";
10
+ import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-BgFLCJQ_.mjs";
11
+ import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-DpwO1T4S.mjs";
12
12
  import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place } from "@fedify/vocab";
13
13
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
14
14
  import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
@@ -1,10 +1,10 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { l as AssertionError, s as format } from "./assert_equals-Ew3jOFa3.mjs";
5
- import "./assert_rejects-DQP-q39h.mjs";
6
- import "./assert_throws-4NwKEy2q.mjs";
7
- import "./assert_strict_equals-Dmjbg-bA.mjs";
4
+ import { l as AssertionError, s as format } from "./assert_equals-C-ZRDbaf.mjs";
5
+ import "./assert_rejects-DN60FHPX.mjs";
6
+ import "./assert_throws-BOkhLGYc.mjs";
7
+ import "./assert_strict_equals-XEgZAlrj.mjs";
8
8
  //#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_exists.js
9
9
  /**
10
10
  * Make an assertion that actual is not null or undefined.
@@ -1,6 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import { ExportResultCode } from "@opentelemetry/core";
4
+ import { Router } from "@fedify/uri-template";
4
5
  import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, Tombstone, TraverseCollectionOptions } from "@fedify/vocab";
5
6
  import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
6
7
  import { MeterProvider, TracerProvider } from "@opentelemetry/api";
@@ -1,5 +1,5 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { i as testDefinitions, n as createOutboxContext, r as createRequestContext, t as createInboxContext } from "../context-BAE7AKLA.mjs";
4
+ import { i as testDefinitions, n as createOutboxContext, r as createRequestContext, t as createInboxContext } from "../context-DVoTs_wM.mjs";
5
5
  export { createInboxContext, createOutboxContext, createRequestContext, testDefinitions };
@@ -1,13 +1,13 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
- import "../std__assert-BTEgfoJo.mjs";
6
- import { t as assertRejects } from "../assert_rejects-DQP-q39h.mjs";
7
- import { t as esm_default } from "../esm-sdtqOUPu.mjs";
8
- import { l as verifyRequest } from "../http-DUV8ysti.mjs";
9
- import { i as rsaPrivateKey2 } from "../keys-CSYsOMFG.mjs";
10
- import { t as getAuthenticatedDocumentLoader } from "../docloader-WsWfKaE5.mjs";
4
+ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
+ import "../std__assert-BBjXFNOb.mjs";
6
+ import { t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
7
+ import { t as esm_default } from "../esm-BQRw925N.mjs";
8
+ import { l as verifyRequest } from "../http-Cyx5SNuu.mjs";
9
+ import { i as rsaPrivateKey2 } from "../keys-C3kae-6B.mjs";
10
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-BT89tyFr.mjs";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { UrlError } from "@fedify/vocab-runtime";
13
13
  //#region src/utils/docloader.test.ts
@@ -1,9 +1,9 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as kvCache, t as MockKvStore } from "../kv-cache-DihufyAQ.mjs";
4
+ import { n as kvCache, t as MockKvStore } from "../kv-cache-VHFP42vY.mjs";
5
5
  import { deepStrictEqual, throws } from "node:assert";
6
- import { mockDocumentLoader, test } from "@fedify/fixture";
6
+ import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
7
7
  import { preloadedContexts } from "@fedify/vocab-runtime";
8
8
  //#region src/utils/kv-cache.test.ts
9
9
  test("kvCache()", async (t) => {
@@ -139,6 +139,71 @@ test("kvCache()", async (t) => {
139
139
  }
140
140
  });
141
141
  });
142
+ await t.step("records activitypub.document.cache with miss then hit", async () => {
143
+ const kv = new MockKvStore();
144
+ const [meterProvider, recorder] = createTestMeterProvider();
145
+ const loader = kvCache({
146
+ kv,
147
+ loader: mockDocumentLoader,
148
+ rules: [["https://example.com/object", { days: 1 }]],
149
+ prefix: ["_test", "doc-cache"],
150
+ meterProvider,
151
+ kind: "object"
152
+ });
153
+ await loader("https://example.com/object");
154
+ const afterMiss = recorder.getMeasurements("activitypub.document.cache");
155
+ deepStrictEqual(afterMiss.length, 1);
156
+ deepStrictEqual(afterMiss[0].type, "counter");
157
+ deepStrictEqual(afterMiss[0].value, 1);
158
+ deepStrictEqual(afterMiss[0].attributes["activitypub.lookup.kind"], "object");
159
+ deepStrictEqual(afterMiss[0].attributes["activitypub.lookup.result"], "miss");
160
+ deepStrictEqual(afterMiss[0].attributes["activitypub.remote.host"], "example.com");
161
+ await loader("https://example.com/object");
162
+ const all = recorder.getMeasurements("activitypub.document.cache");
163
+ deepStrictEqual(all.length, 2);
164
+ deepStrictEqual(all[1].attributes["activitypub.lookup.result"], "hit");
165
+ deepStrictEqual(all[1].attributes["activitypub.lookup.kind"], "object");
166
+ deepStrictEqual(all[1].attributes["activitypub.remote.host"], "example.com");
167
+ });
168
+ await t.step("preloaded contexts emit no activitypub.document.cache", async () => {
169
+ const kv = new MockKvStore();
170
+ const [meterProvider, recorder] = createTestMeterProvider();
171
+ await kvCache({
172
+ kv,
173
+ loader: mockDocumentLoader,
174
+ prefix: ["_test", "doc-cache-preloaded"],
175
+ meterProvider,
176
+ kind: "context"
177
+ })("https://www.w3.org/ns/activitystreams");
178
+ deepStrictEqual(recorder.getMeasurements("activitypub.document.cache").length, 0, "preloaded contexts must bypass the KV cache and the cache metric");
179
+ });
180
+ await t.step("no cache rule match emits no activitypub.document.cache", async () => {
181
+ const kv = new MockKvStore();
182
+ const [meterProvider, recorder] = createTestMeterProvider();
183
+ await kvCache({
184
+ kv,
185
+ loader: mockDocumentLoader,
186
+ rules: [],
187
+ prefix: ["_test", "doc-cache-no-rule"],
188
+ meterProvider,
189
+ kind: "object"
190
+ })("https://example.com/object");
191
+ deepStrictEqual(recorder.getMeasurements("activitypub.document.cache").length, 0);
192
+ });
193
+ await t.step("omitting meterProvider records no cache measurements", async () => {
194
+ const kv = new MockKvStore();
195
+ const [meterProvider, recorder] = createTestMeterProvider();
196
+ const loader = kvCache({
197
+ kv,
198
+ loader: mockDocumentLoader,
199
+ rules: [["https://example.com/object", { days: 1 }]],
200
+ prefix: ["_test", "doc-cache-no-mp"]
201
+ });
202
+ await loader("https://example.com/object");
203
+ await loader("https://example.com/object");
204
+ deepStrictEqual(recorder.getMeasurements("activitypub.document.cache").length, 0);
205
+ deepStrictEqual(typeof meterProvider.getMeter, "function");
206
+ });
142
207
  await t.step("preloaded contexts bypass cache", async () => {
143
208
  const kv = new MockKvStore();
144
209
  let loaderCalled = false;
@@ -1,6 +1,6 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_kv_cache = require("../kv-cache-Dz31ATUT.cjs");
4
+ const require_kv_cache = require("../kv-cache-DuEwFYcN.cjs");
5
5
  exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
6
6
  exports.kvCache = require_kv_cache.kvCache;
@@ -1,3 +1,3 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../mod-BR_BB0bh.cjs";
2
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../mod-yvIXFAEi.cjs";
3
3
  export { getAuthenticatedDocumentLoader, kvCache };
@@ -1,3 +1,3 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../mod-DLrRb0dx.js";
2
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../mod-DFvNJcNb.js";
3
3
  export { getAuthenticatedDocumentLoader, kvCache };
package/dist/utils/mod.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-DBNpsneh.js";
3
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-CuCn2xvM.js";
4
4
  export { getAuthenticatedDocumentLoader, kvCache };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "2.3.0-dev.1119+6cc02662",
3
+ "version": "2.3.0-dev.1137+53a1f26d",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -150,12 +150,11 @@
150
150
  "json-canon": "^1.0.1",
151
151
  "jsonld": "^9.0.0",
152
152
  "structured-field-values": "^2.0.4",
153
- "uri-template-router": "^1.0.0",
154
- "url-template": "^3.1.1",
155
153
  "urlpattern-polyfill": "^10.1.0",
156
- "@fedify/vocab": "2.3.0-dev.1119+6cc02662",
157
- "@fedify/vocab-runtime": "2.3.0-dev.1119+6cc02662",
158
- "@fedify/webfinger": "2.3.0-dev.1119+6cc02662"
154
+ "@fedify/vocab-runtime": "2.3.0-dev.1137+53a1f26d",
155
+ "@fedify/webfinger": "2.3.0-dev.1137+53a1f26d",
156
+ "@fedify/vocab": "2.3.0-dev.1137+53a1f26d",
157
+ "@fedify/uri-template": "2.3.0-dev.1137+53a1f26d"
159
158
  },
160
159
  "devDependencies": {
161
160
  "@opentelemetry/sdk-metrics": "2.7.1",
@@ -169,7 +168,7 @@
169
168
  "typescript": "^6.0.0",
170
169
  "wrangler": "^4.17.0",
171
170
  "@fedify/fixture": "2.0.0",
172
- "@fedify/vocab-tools": "^2.3.0-dev.1119+6cc02662"
171
+ "@fedify/vocab-tools": "^2.3.0-dev.1137+53a1f26d"
173
172
  },
174
173
  "scripts": {
175
174
  "build:self": "tsdown",
@@ -1,63 +0,0 @@
1
- /// <reference lib="esnext.temporal" />
2
- import { Ct as WebFingerLinksDispatcher, et as ActorAliasMapper, l as RequestContext, nt as ActorHandleMapper, tt as ActorDispatcher } from "./context-cSUMk2da.js";
3
- import { Span, Tracer } from "@opentelemetry/api";
4
-
5
- //#region src/federation/webfinger.d.ts
6
- /**
7
- * Parameters for {@link handleWebFinger}.
8
- */
9
- interface WebFingerHandlerParameters<TContextData> {
10
- /**
11
- * The request context.
12
- */
13
- context: RequestContext<TContextData>;
14
- /**
15
- * The canonical hostname of the server, if it's explicitly configured.
16
- * @since 1.5.0
17
- */
18
- host?: string;
19
- /**
20
- * The callback for dispatching the actor.
21
- */
22
- actorDispatcher?: ActorDispatcher<TContextData>;
23
- /**
24
- * The callback for mapping a WebFinger username to the corresponding actor's
25
- * internal identifier, or `null` if the username is not found.
26
- * @since 0.15.0
27
- */
28
- actorHandleMapper?: ActorHandleMapper<TContextData>;
29
- /**
30
- * The callback for mapping a WebFinger query to the corresponding actor's
31
- * internal identifier or username, or `null` if the query is not found.
32
- * @since 1.4.0
33
- */
34
- actorAliasMapper?: ActorAliasMapper<TContextData>;
35
- /**
36
- * The callback for dispatching the Links of webFinger.
37
- */
38
- webFingerLinksDispatcher?: WebFingerLinksDispatcher<TContextData>;
39
- /**
40
- * The function to call when the actor is not found.
41
- */
42
- onNotFound(request: Request): Response | Promise<Response>;
43
- /**
44
- * The OpenTelemetry tracer.
45
- * @since 1.3.0
46
- */
47
- tracer?: Tracer;
48
- /**
49
- * The span for the request.
50
- * @since 1.3.0
51
- */
52
- span?: Span;
53
- }
54
- /**
55
- * Handles a WebFinger request. You would not typically call this function
56
- * directly, but instead use {@link Federation.fetch} method.
57
- * @param request The WebFinger request to handle.
58
- * @param parameters The parameters for handling the request.
59
- * @returns The response to the request.
60
- */
61
- declare function handleWebFinger<TContextData>(request: Request, options: WebFingerHandlerParameters<TContextData>): Promise<Response>;
62
- //#endregion
63
- export { handleWebFinger as n, WebFingerHandlerParameters as t };
@@ -1,63 +0,0 @@
1
- /// <reference lib="esnext.temporal" />
2
- import { Ct as WebFingerLinksDispatcher, et as ActorAliasMapper, l as RequestContext, nt as ActorHandleMapper, tt as ActorDispatcher } from "./context-Ch-ZLyTQ.cjs";
3
- import { Span, Tracer } from "@opentelemetry/api";
4
-
5
- //#region src/federation/webfinger.d.ts
6
- /**
7
- * Parameters for {@link handleWebFinger}.
8
- */
9
- interface WebFingerHandlerParameters<TContextData> {
10
- /**
11
- * The request context.
12
- */
13
- context: RequestContext<TContextData>;
14
- /**
15
- * The canonical hostname of the server, if it's explicitly configured.
16
- * @since 1.5.0
17
- */
18
- host?: string;
19
- /**
20
- * The callback for dispatching the actor.
21
- */
22
- actorDispatcher?: ActorDispatcher<TContextData>;
23
- /**
24
- * The callback for mapping a WebFinger username to the corresponding actor's
25
- * internal identifier, or `null` if the username is not found.
26
- * @since 0.15.0
27
- */
28
- actorHandleMapper?: ActorHandleMapper<TContextData>;
29
- /**
30
- * The callback for mapping a WebFinger query to the corresponding actor's
31
- * internal identifier or username, or `null` if the query is not found.
32
- * @since 1.4.0
33
- */
34
- actorAliasMapper?: ActorAliasMapper<TContextData>;
35
- /**
36
- * The callback for dispatching the Links of webFinger.
37
- */
38
- webFingerLinksDispatcher?: WebFingerLinksDispatcher<TContextData>;
39
- /**
40
- * The function to call when the actor is not found.
41
- */
42
- onNotFound(request: Request): Response | Promise<Response>;
43
- /**
44
- * The OpenTelemetry tracer.
45
- * @since 1.3.0
46
- */
47
- tracer?: Tracer;
48
- /**
49
- * The span for the request.
50
- * @since 1.3.0
51
- */
52
- span?: Span;
53
- }
54
- /**
55
- * Handles a WebFinger request. You would not typically call this function
56
- * directly, but instead use {@link Federation.fetch} method.
57
- * @param request The WebFinger request to handle.
58
- * @param parameters The parameters for handling the request.
59
- * @returns The response to the request.
60
- */
61
- declare function handleWebFinger<TContextData>(request: Request, options: WebFingerHandlerParameters<TContextData>): Promise<Response>;
62
- //#endregion
63
- export { handleWebFinger as n, WebFingerHandlerParameters as t };