@fedify/fedify 2.0.22-dev.1482 → 2.0.22-dev.1565

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 (47) hide show
  1. package/dist/{builder-DnU9W5Rv.mjs → builder-DiCVIEdq.mjs} +3 -3
  2. package/dist/compat/transformers.test.mjs +1 -1
  3. package/dist/{deno-DqGhPf7Z.mjs → deno-C0hao78M.mjs} +1 -1
  4. package/dist/{docloader-44obLNFf.mjs → docloader-CgohFTEx.mjs} +2 -2
  5. package/dist/federation/builder.test.mjs +1 -1
  6. package/dist/federation/handler.test.mjs +4 -4
  7. package/dist/federation/idempotency.test.mjs +2 -2
  8. package/dist/federation/inbox.test.mjs +1 -1
  9. package/dist/federation/middleware.test.mjs +6 -6
  10. package/dist/federation/mod.cjs +1 -1
  11. package/dist/federation/mod.js +1 -1
  12. package/dist/federation/send.test.mjs +3 -3
  13. package/dist/federation/temporal.test.mjs +1 -1
  14. package/dist/federation/webfinger.test.mjs +69 -7
  15. package/dist/{http-CCITZCF5.cjs → http-CpvgjWiv.cjs} +1 -1
  16. package/dist/{http-ATx5mKcD.js → http-DzEJOwGD.js} +1 -1
  17. package/dist/{http-ZP7Ryg80.mjs → http-fK66BkJj.mjs} +2 -2
  18. package/dist/{inbox-Dzxzo24a.mjs → inbox-C91k13ar.mjs} +1 -1
  19. package/dist/{key-D3fAW3e0.mjs → key-CiI2c4fV.mjs} +1 -1
  20. package/dist/{kv-cache-D64TkrEN.js → kv-cache-COhJ7YkU.js} +1 -1
  21. package/dist/{kv-cache-BSKBffCI.cjs → kv-cache-DCQ3iAoA.cjs} +1 -1
  22. package/dist/{ld-CdHtsO-f.mjs → ld-BtgF_U3o.mjs} +2 -2
  23. package/dist/{middleware-5mUl-aoV.js → middleware-BGFHmA-f.js} +38 -20
  24. package/dist/{middleware-CeeTh_Bc.mjs → middleware-Bg7Ua9YZ.mjs} +1 -1
  25. package/dist/{middleware-SoCEl9MR.cjs → middleware-BmLb_YyB.cjs} +39 -21
  26. package/dist/{middleware-nyJitxAu.cjs → middleware-CwajVapC.cjs} +1 -1
  27. package/dist/{middleware-7EKeUNaR.mjs → middleware-yNqmDL8w.mjs} +46 -28
  28. package/dist/mod.cjs +4 -4
  29. package/dist/mod.js +4 -4
  30. package/dist/nodeinfo/handler.test.mjs +1 -1
  31. package/dist/{owner-B7VDuDtw.mjs → owner-sWtcq_uW.mjs} +2 -2
  32. package/dist/{proof-DST3zBK7.mjs → proof-B9liQ9K1.mjs} +2 -2
  33. package/dist/{proof-B8IEm_2z.js → proof-p2BryEGX.js} +1 -1
  34. package/dist/{proof-BfBeDsAr.cjs → proof-p6KRdV2F.cjs} +1 -1
  35. package/dist/{send-Doxp5Dhm.mjs → send-B84OJGoX.mjs} +2 -2
  36. package/dist/sig/http.test.mjs +2 -2
  37. package/dist/sig/key.test.mjs +1 -1
  38. package/dist/sig/ld.test.mjs +2 -2
  39. package/dist/sig/mod.cjs +2 -2
  40. package/dist/sig/mod.js +2 -2
  41. package/dist/sig/owner.test.mjs +1 -1
  42. package/dist/sig/proof.test.mjs +1 -1
  43. package/dist/{temporal-CnZZkaiD.mjs → temporal-D_P8UNzl.mjs} +1 -1
  44. package/dist/utils/docloader.test.mjs +2 -2
  45. package/dist/utils/mod.cjs +1 -1
  46. package/dist/utils/mod.js +1 -1
  47. package/package.json +5 -5
@@ -2,8 +2,8 @@ import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { n as RouterError, t as Router } from "./router-CrMLXoOr.mjs";
5
- import { n as version, t as name } from "./deno-DqGhPf7Z.mjs";
6
- import { t as InboxListenerSet } from "./inbox-Dzxzo24a.mjs";
5
+ import { n as version, t as name } from "./deno-C0hao78M.mjs";
6
+ import { t as InboxListenerSet } from "./inbox-C91k13ar.mjs";
7
7
  import { getTypeId } from "@fedify/vocab";
8
8
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
9
9
  import { getLogger } from "@logtape/logtape";
@@ -42,7 +42,7 @@ var FederationBuilderImpl = class {
42
42
  this.collectionTypeIds = {};
43
43
  }
44
44
  async build(options) {
45
- const { FederationImpl } = await import("./middleware-CeeTh_Bc.mjs");
45
+ const { FederationImpl } = await import("./middleware-Bg7Ua9YZ.mjs");
46
46
  const f = new FederationImpl(options);
47
47
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
48
48
  f.router = this.router.clone();
@@ -5,7 +5,7 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
6
6
  import { t as assert } from "../assert-ddO5KLpe.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
8
- import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-7EKeUNaR.mjs";
8
+ import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-yNqmDL8w.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  import { Follow, Person } from "@fedify/vocab";
11
11
  //#region src/compat/transformers.test.ts
@@ -3,6 +3,6 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  //#region deno.json
5
5
  var name = "@fedify/fedify";
6
- var version = "2.0.22-dev.1482+e4fba16e";
6
+ var version = "2.0.22-dev.1565+b5a902fa";
7
7
  //#endregion
8
8
  export { version as n, name as t };
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { a as validateCryptoKey } from "./key-D3fAW3e0.mjs";
5
- import { n as doubleKnock } from "./http-ZP7Ryg80.mjs";
4
+ import { a as validateCryptoKey } from "./key-CiI2c4fV.mjs";
5
+ import { n as doubleKnock } from "./http-fK66BkJj.mjs";
6
6
  import { curry } from "es-toolkit";
7
7
  import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
8
8
  import { getLogger } from "@logtape/logtape";
@@ -5,7 +5,7 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { a as assertExists } from "../std__assert-Duiq_YC9.mjs";
6
6
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
8
- import { n as createFederationBuilder } from "../builder-DnU9W5Rv.mjs";
8
+ import { n as createFederationBuilder } from "../builder-DiCVIEdq.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  import { Activity, Note, Person } from "@fedify/vocab";
11
11
  //#region src/federation/builder.test.ts
@@ -6,12 +6,12 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-Duiq_YC9.mjs";
7
7
  import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
8
8
  import { t as assert } from "../assert-ddO5KLpe.mjs";
9
- import { s as signRequest } from "../http-ZP7Ryg80.mjs";
9
+ import { s as signRequest } from "../http-fK66BkJj.mjs";
10
10
  import { a as rsaPrivateKey3, c as rsaPublicKey3, s as rsaPublicKey2 } from "../keys-CtZLJq76.mjs";
11
- import { a as compactJsonLd, f as signJsonLd } from "../ld-CdHtsO-f.mjs";
11
+ import { a as compactJsonLd, f as signJsonLd } from "../ld-BtgF_U3o.mjs";
12
12
  import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
13
- import { a as createFederation, c as handleCollection, d as handleObject, f as respondWithObject, l as handleCustomCollection, p as respondWithObjectIfAcceptable, s as handleActor, u as handleInbox } from "../middleware-7EKeUNaR.mjs";
14
- import { t as InboxListenerSet } from "../inbox-Dzxzo24a.mjs";
13
+ import { a as createFederation, c as handleCollection, d as handleObject, f as respondWithObject, l as handleCustomCollection, p as respondWithObjectIfAcceptable, s as handleActor, u as handleInbox } from "../middleware-yNqmDL8w.mjs";
14
+ import { t as InboxListenerSet } from "../inbox-C91k13ar.mjs";
15
15
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
16
16
  import { Create, Note, Person } from "@fedify/vocab";
17
17
  //#region src/federation/handler.test.ts
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import "../std__assert-Duiq_YC9.mjs";
6
6
  import { n as ed25519PrivateKey, r as ed25519PublicKey, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
7
- import { n as signObject } from "../proof-DST3zBK7.mjs";
7
+ import { n as signObject } from "../proof-B9liQ9K1.mjs";
8
8
  import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
9
- import { a as createFederation } from "../middleware-7EKeUNaR.mjs";
9
+ import { a as createFederation } from "../middleware-yNqmDL8w.mjs";
10
10
  import { mockDocumentLoader, test } from "@fedify/fixture";
11
11
  import { Create, Follow, Person } from "@fedify/vocab";
12
12
  //#region src/federation/idempotency.test.ts
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
6
- import { t as InboxListenerSet } from "../inbox-Dzxzo24a.mjs";
6
+ import { t as InboxListenerSet } from "../inbox-C91k13ar.mjs";
7
7
  import { test } from "@fedify/fixture";
8
8
  import { Activity, Create, Invite, Offer, Update } from "@fedify/vocab";
9
9
  //#region src/federation/inbox.test.ts
@@ -10,14 +10,14 @@ import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
10
10
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
11
11
  import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
12
12
  import { t as assert } from "../assert-ddO5KLpe.mjs";
13
- import { l as verifyRequest, s as signRequest } from "../http-ZP7Ryg80.mjs";
13
+ import { l as verifyRequest, s as signRequest } from "../http-fK66BkJj.mjs";
14
14
  import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
15
- import { t as getAuthenticatedDocumentLoader } from "../docloader-44obLNFf.mjs";
16
- import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-CdHtsO-f.mjs";
17
- import { t as doesActorOwnKey } from "../owner-B7VDuDtw.mjs";
18
- import { n as signObject, r as verifyObject } from "../proof-DST3zBK7.mjs";
15
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-CgohFTEx.mjs";
16
+ import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-BtgF_U3o.mjs";
17
+ import { t as doesActorOwnKey } from "../owner-sWtcq_uW.mjs";
18
+ import { n as signObject, r as verifyObject } from "../proof-B9liQ9K1.mjs";
19
19
  import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
20
- import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-7EKeUNaR.mjs";
20
+ import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-yNqmDL8w.mjs";
21
21
  import { mockDocumentLoader, test } from "@fedify/fixture";
22
22
  import * as vocab from "@fedify/vocab";
23
23
  import { Create, Offer, Person, getTypeId, lookupObject } from "@fedify/vocab";
@@ -2,7 +2,7 @@ const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  require("../chunk-DDcVe30Y.cjs");
5
- const require_middleware = require("../middleware-SoCEl9MR.cjs");
5
+ const require_middleware = require("../middleware-BmLb_YyB.cjs");
6
6
  let es_toolkit = require("es-toolkit");
7
7
  //#region src/federation/kv.ts
8
8
  /**
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-5mUl-aoV.js";
3
+ import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-BGFHmA-f.js";
4
4
  import { isEqual } from "es-toolkit";
5
5
  //#region src/federation/kv.ts
6
6
  /**
@@ -8,10 +8,10 @@ import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z
8
8
  import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
9
9
  import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
10
10
  import { t as assert } from "../assert-ddO5KLpe.mjs";
11
- import { l as verifyRequest } from "../http-ZP7Ryg80.mjs";
11
+ import { l as verifyRequest } from "../http-fK66BkJj.mjs";
12
12
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
13
- import { t as doesActorOwnKey } from "../owner-B7VDuDtw.mjs";
14
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-Doxp5Dhm.mjs";
13
+ import { t as doesActorOwnKey } from "../owner-sWtcq_uW.mjs";
14
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-B84OJGoX.mjs";
15
15
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
16
16
  import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
17
17
  //#region src/federation/send.test.ts
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
4
4
  import "../std__assert-Duiq_YC9.mjs";
5
5
  import { n as assertFalse } from "../assert_rejects-B-qJtC9Z.mjs";
6
6
  import { t as assert } from "../assert-ddO5KLpe.mjs";
7
- import { t as hasMalformedKnownTemporalLiteral } from "../temporal-CnZZkaiD.mjs";
7
+ import { t as hasMalformedKnownTemporalLiteral } from "../temporal-D_P8UNzl.mjs";
8
8
  import { test } from "@fedify/fixture";
9
9
  //#region src/federation/temporal.test.ts
10
10
  test("hasMalformedKnownTemporalLiteral() detects expanded proof timestamps", async () => {
@@ -5,7 +5,7 @@ import { n as createRequestContext } from "../context-Juj6bdHC.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-Duiq_YC9.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
8
- import { a as createFederation, o as handleWebFinger } from "../middleware-7EKeUNaR.mjs";
8
+ import { a as createFederation, o as handleWebFinger } from "../middleware-yNqmDL8w.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  import { Image, Link, Person } from "@fedify/vocab";
11
11
  //#region src/federation/webfinger.test.ts
@@ -224,7 +224,7 @@ test("handleWebFinger()", async (t) => {
224
224
  });
225
225
  onNotFoundCalled = null;
226
226
  const actorHandleMapper = (_ctx, username) => {
227
- return username === "foo" ? "someone" : username === "bar" ? "someone2" : null;
227
+ return username === "foo" ? "someone" : username === "bar" ? "someone2" : username === "qux" ? "someone2" : null;
228
228
  };
229
229
  await t.step("handle mapper", async () => {
230
230
  const u = new URL(url);
@@ -347,21 +347,83 @@ test("handleWebFinger()", async (t) => {
347
347
  assertEquals(response.status, 404);
348
348
  });
349
349
  await t.step("handleHost", async () => {
350
- const u = new URL(url);
351
- u.searchParams.set("resource", "acct:someone@example.com");
350
+ let u = new URL("https://ap.example.com/.well-known/webfinger");
351
+ u.searchParams.set("resource", "acct:someone@ap.example.com");
352
352
  let context = createContext(u);
353
353
  let request = context.request;
354
354
  let response = await handleWebFinger(request, {
355
355
  context,
356
- host: "handle.example.com",
356
+ host: "example.com",
357
357
  actorDispatcher,
358
358
  onNotFound
359
359
  });
360
360
  assertEquals(response.status, 200);
361
361
  assertEquals(await response.json(), {
362
- ...expected,
363
- aliases: [...expected.aliases, "acct:someone@handle.example.com"]
362
+ subject: "acct:someone@example.com",
363
+ aliases: ["https://ap.example.com/users/someone", "acct:someone@ap.example.com"],
364
+ links: [
365
+ {
366
+ href: "https://ap.example.com/users/someone",
367
+ rel: "self",
368
+ type: "application/activity+json"
369
+ },
370
+ {
371
+ href: "https://ap.example.com/@someone",
372
+ rel: "http://webfinger.net/rel/profile-page"
373
+ },
374
+ {
375
+ href: "https://ap.example.com/@someone",
376
+ rel: "alternate",
377
+ type: "text/html"
378
+ },
379
+ {
380
+ href: "https://ap.example.com/icon.jpg",
381
+ rel: "http://webfinger.net/rel/avatar",
382
+ type: "image/jpeg"
383
+ }
384
+ ]
385
+ });
386
+ u.searchParams.set("resource", "acct:qux@ap.example.com");
387
+ context = createContext(u);
388
+ request = context.request;
389
+ response = await handleWebFinger(request, {
390
+ context,
391
+ host: "example.com",
392
+ actorDispatcher,
393
+ actorHandleMapper,
394
+ onNotFound
364
395
  });
396
+ assertEquals(response.status, 200);
397
+ assertEquals(await response.json(), {
398
+ subject: "acct:bar@example.com",
399
+ aliases: [
400
+ "https://ap.example.com/users/someone2",
401
+ "acct:qux@ap.example.com",
402
+ "acct:bar@ap.example.com"
403
+ ],
404
+ links: [
405
+ {
406
+ href: "https://ap.example.com/users/someone2",
407
+ rel: "self",
408
+ type: "application/activity+json"
409
+ },
410
+ {
411
+ href: "https://ap.example.com/@someone2",
412
+ rel: "http://webfinger.net/rel/profile-page"
413
+ },
414
+ {
415
+ href: "https://ap.example.com/@someone2",
416
+ rel: "alternate",
417
+ type: "text/html"
418
+ },
419
+ {
420
+ href: "https://ap.example.com/icon.jpg",
421
+ rel: "http://webfinger.net/rel/avatar",
422
+ type: "image/jpeg"
423
+ }
424
+ ]
425
+ });
426
+ u = new URL(url);
365
427
  u.searchParams.set("resource", "acct:someone@handle.example.com");
366
428
  context = createContext(u);
367
429
  request = context.request;
@@ -11,7 +11,7 @@ let byte_encodings_base64 = require("byte-encodings/base64");
11
11
  let structured_field_values = require("structured-field-values");
12
12
  //#region deno.json
13
13
  var name = "@fedify/fedify";
14
- var version = "2.0.22-dev.1482+e4fba16e";
14
+ var version = "2.0.22-dev.1565+b5a902fa";
15
15
  //#endregion
16
16
  //#region src/sig/key.ts
17
17
  /**
@@ -10,7 +10,7 @@ import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
10
10
  import { Item, decodeDict, encodeItem } from "structured-field-values";
11
11
  //#region deno.json
12
12
  var name = "@fedify/fedify";
13
- var version = "2.0.22-dev.1482+e4fba16e";
13
+ var version = "2.0.22-dev.1565+b5a902fa";
14
14
  //#endregion
15
15
  //#region src/sig/key.ts
16
16
  /**
@@ -1,8 +1,8 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-DqGhPf7Z.mjs";
5
- import { a as validateCryptoKey, n as fetchKey } from "./key-D3fAW3e0.mjs";
4
+ import { n as version, t as name } from "./deno-C0hao78M.mjs";
5
+ import { a as validateCryptoKey, n as fetchKey } from "./key-CiI2c4fV.mjs";
6
6
  import { CryptographicKey } from "@fedify/vocab";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { FetchError } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-DqGhPf7Z.mjs";
4
+ import { n as version, t as name } from "./deno-C0hao78M.mjs";
5
5
  import { Activity, getTypeId } from "@fedify/vocab";
6
6
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
7
7
  import { getLogger } from "@logtape/logtape";
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-DqGhPf7Z.mjs";
4
+ import { n as version, t as name } from "./deno-C0hao78M.mjs";
5
5
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
7
7
  import { getDocumentLoader } from "@fedify/vocab-runtime";
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { c as validateCryptoKey, t as doubleKnock } from "./http-ATx5mKcD.js";
3
+ import { c as validateCryptoKey, t as doubleKnock } from "./http-DzEJOwGD.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { curry } from "es-toolkit";
6
6
  import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  require("./chunk-DDcVe30Y.cjs");
4
- const require_http = require("./http-CCITZCF5.cjs");
4
+ const require_http = require("./http-CpvgjWiv.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let es_toolkit = require("es-toolkit");
7
7
  let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-DqGhPf7Z.mjs";
5
- import { a as validateCryptoKey, n as fetchKey } from "./key-D3fAW3e0.mjs";
4
+ import { n as version, t as name } from "./deno-C0hao78M.mjs";
5
+ import { a as validateCryptoKey, n as fetchKey } from "./key-CiI2c4fV.mjs";
6
6
  import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { getDocumentLoader } from "@fedify/vocab-runtime";
@@ -2,10 +2,10 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  import { t as __exportAll } from "./chunk-CRNNMoPX.js";
4
4
  import { r as getDefaultActivityTransformers } from "./transformers-BGMIq1cs.js";
5
- import { c as validateCryptoKey, i as exportJwk, l as name, r as verifyRequest, s as importJwk, t as doubleKnock, u as version } from "./http-ATx5mKcD.js";
6
- import { _ as signJsonLd, a as doesActorOwnKey, c as assertSafeJsonLd, f as detachSignature, g as isInvalidUrlTypeError, h as isClearlyMalformedContextReference, m as hasSignature, n as signObject, o as getKeyOwner, p as getNormalizationContextLoader, r as verifyObject, s as InvalidContextReferenceError, u as compactJsonLd, v as verifyCompactJsonLd, x as wrapContextLoaderForJsonLd } from "./proof-B8IEm_2z.js";
5
+ import { c as validateCryptoKey, i as exportJwk, l as name, r as verifyRequest, s as importJwk, t as doubleKnock, u as version } from "./http-DzEJOwGD.js";
6
+ import { _ as signJsonLd, a as doesActorOwnKey, c as assertSafeJsonLd, f as detachSignature, g as isInvalidUrlTypeError, h as isClearlyMalformedContextReference, m as hasSignature, n as signObject, o as getKeyOwner, p as getNormalizationContextLoader, r as verifyObject, s as InvalidContextReferenceError, u as compactJsonLd, v as verifyCompactJsonLd, x as wrapContextLoaderForJsonLd } from "./proof-p2BryEGX.js";
7
7
  import { n as getNodeInfo, t as nodeInfoToJson } from "./types-CAY3OdLq.js";
8
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-D64TkrEN.js";
8
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-COhJ7YkU.js";
9
9
  import { getLogger, withContext } from "@logtape/logtape";
10
10
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
11
11
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
@@ -2354,6 +2354,24 @@ const logger = getLogger([
2354
2354
  "webfinger",
2355
2355
  "server"
2356
2356
  ]);
2357
+ function getWebFingerSubjectAndAliases({ resourceUrl, actorUri, preferredUsername, acctUsername, host, contextHost }) {
2358
+ const aliases = [];
2359
+ let subject = resourceUrl.href;
2360
+ if (resourceUrl.protocol != "acct:" && preferredUsername != null) {
2361
+ aliases.push(`acct:${preferredUsername}@${host ?? contextHost}`);
2362
+ if (host != null && host !== contextHost) aliases.push(`acct:${preferredUsername}@${contextHost}`);
2363
+ }
2364
+ if (resourceUrl.href !== actorUri.href) aliases.push(actorUri.href);
2365
+ if (resourceUrl.protocol === "acct:" && host != null && host !== contextHost && !resourceUrl.href.endsWith(`@${host}`)) {
2366
+ subject = `acct:${preferredUsername ?? acctUsername}@${host}`;
2367
+ aliases.push(resourceUrl.href);
2368
+ if (preferredUsername != null && preferredUsername !== "" && preferredUsername !== acctUsername) aliases.push(`acct:${preferredUsername}@${contextHost}`);
2369
+ }
2370
+ return {
2371
+ subject,
2372
+ aliases
2373
+ };
2374
+ }
2357
2375
  /**
2358
2376
  * Handles a WebFinger request. You would not typically call this function
2359
2377
  * directly, but instead use {@link Federation.fetch} method.
@@ -2408,6 +2426,7 @@ async function handleWebFingerInternal(request, { context, host, actorDispatcher
2408
2426
  return identifier;
2409
2427
  }
2410
2428
  let identifier = null;
2429
+ let acctUsername = null;
2411
2430
  const uriParsed = context.parseUri(resourceUrl);
2412
2431
  if (uriParsed?.type != "actor") {
2413
2432
  const match = /^acct:([^@]+)@([^@]+)$/.exec(resource);
@@ -2421,8 +2440,9 @@ async function handleWebFingerInternal(request, { context, host, actorDispatcher
2421
2440
  const normalizedHost = portMatch == null ? domainToASCII(match[2].toLowerCase()) : domainToASCII(match[2].substring(0, portMatch.index).toLowerCase()) + portMatch[0];
2422
2441
  if (normalizedHost != context.url.host && normalizedHost != host) return await onNotFound(request);
2423
2442
  else {
2424
- identifier = await mapUsernameToIdentifier(match[1]);
2425
- resourceUrl = new URL(`acct:${match[1]}@${normalizedHost}`);
2443
+ acctUsername = match[1];
2444
+ identifier = await mapUsernameToIdentifier(acctUsername);
2445
+ resourceUrl = new URL(`acct:${acctUsername}@${normalizedHost}`);
2426
2446
  }
2427
2447
  }
2428
2448
  } else identifier = uriParsed.identifier;
@@ -2432,9 +2452,10 @@ async function handleWebFingerInternal(request, { context, host, actorDispatcher
2432
2452
  logger.error("Actor {identifier} not found.", { identifier });
2433
2453
  return await onNotFound(request);
2434
2454
  }
2455
+ const actorUri = context.getActorUri(identifier);
2435
2456
  const links = [{
2436
2457
  rel: "self",
2437
- href: context.getActorUri(identifier).href,
2458
+ href: actorUri.href,
2438
2459
  type: "application/activity+json"
2439
2460
  }];
2440
2461
  for (const url of actor.urls) if (url instanceof Link && url.href != null) links.push({
@@ -2458,22 +2479,19 @@ async function handleWebFingerInternal(request, { context, host, actorDispatcher
2458
2479
  const customLinks = await webFingerLinksDispatcher(context, resourceUrl);
2459
2480
  if (customLinks != null) for (const link of customLinks) links.push(link);
2460
2481
  }
2461
- const aliases = [];
2462
- if (resourceUrl.protocol != "acct:" && actor.preferredUsername != null) {
2463
- aliases.push(`acct:${actor.preferredUsername}@${host ?? context.url.host}`);
2464
- if (host != null && host !== context.url.host) aliases.push(`acct:${actor.preferredUsername}@${context.url.host}`);
2465
- }
2466
- if (resourceUrl.href !== context.getActorUri(identifier).href) aliases.push(context.getActorUri(identifier).href);
2467
- if (resourceUrl.protocol === "acct:" && host != null && host !== context.url.host && !resourceUrl.href.endsWith(`@${host}`)) {
2468
- const username = resourceUrl.href.replace(/^acct:/, "").replace(/@.*$/, "");
2469
- aliases.push(`acct:${username}@${host}`);
2470
- }
2471
- const jrd = {
2472
- subject: resourceUrl.href,
2482
+ const { subject, aliases } = getWebFingerSubjectAndAliases({
2483
+ resourceUrl,
2484
+ actorUri,
2485
+ preferredUsername: actor.preferredUsername,
2486
+ acctUsername,
2487
+ host,
2488
+ contextHost: context.url.host
2489
+ });
2490
+ return new Response(JSON.stringify({
2491
+ subject,
2473
2492
  aliases,
2474
2493
  links
2475
- };
2476
- return new Response(JSON.stringify(jrd), { headers: {
2494
+ }), { headers: {
2477
2495
  "Content-Type": "application/jrd+json",
2478
2496
  "Access-Control-Allow-Origin": "*"
2479
2497
  } });
@@ -1,5 +1,5 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as FederationImpl } from "./middleware-7EKeUNaR.mjs";
4
+ import { n as FederationImpl } from "./middleware-yNqmDL8w.mjs";
5
5
  export { FederationImpl };
@@ -2,10 +2,10 @@ const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  const require_chunk = require("./chunk-DDcVe30Y.cjs");
4
4
  const require_transformers = require("./transformers-NeAONrAq.cjs");
5
- const require_http = require("./http-CCITZCF5.cjs");
6
- const require_proof = require("./proof-BfBeDsAr.cjs");
5
+ const require_http = require("./http-CpvgjWiv.cjs");
6
+ const require_proof = require("./proof-p6KRdV2F.cjs");
7
7
  const require_types = require("./types-KC4QAoxe.cjs");
8
- const require_kv_cache = require("./kv-cache-BSKBffCI.cjs");
8
+ const require_kv_cache = require("./kv-cache-DCQ3iAoA.cjs");
9
9
  let _logtape_logtape = require("@logtape/logtape");
10
10
  let _fedify_vocab = require("@fedify/vocab");
11
11
  let _opentelemetry_api = require("@opentelemetry/api");
@@ -335,7 +335,7 @@ var FederationBuilderImpl = class {
335
335
  this.collectionTypeIds = {};
336
336
  }
337
337
  async build(options) {
338
- const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-nyJitxAu.cjs"));
338
+ const { FederationImpl } = await Promise.resolve().then(() => require("./middleware-CwajVapC.cjs"));
339
339
  const f = new FederationImpl(options);
340
340
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
341
341
  f.router = this.router.clone();
@@ -2355,6 +2355,24 @@ const logger = (0, _logtape_logtape.getLogger)([
2355
2355
  "webfinger",
2356
2356
  "server"
2357
2357
  ]);
2358
+ function getWebFingerSubjectAndAliases({ resourceUrl, actorUri, preferredUsername, acctUsername, host, contextHost }) {
2359
+ const aliases = [];
2360
+ let subject = resourceUrl.href;
2361
+ if (resourceUrl.protocol != "acct:" && preferredUsername != null) {
2362
+ aliases.push(`acct:${preferredUsername}@${host ?? contextHost}`);
2363
+ if (host != null && host !== contextHost) aliases.push(`acct:${preferredUsername}@${contextHost}`);
2364
+ }
2365
+ if (resourceUrl.href !== actorUri.href) aliases.push(actorUri.href);
2366
+ if (resourceUrl.protocol === "acct:" && host != null && host !== contextHost && !resourceUrl.href.endsWith(`@${host}`)) {
2367
+ subject = `acct:${preferredUsername ?? acctUsername}@${host}`;
2368
+ aliases.push(resourceUrl.href);
2369
+ if (preferredUsername != null && preferredUsername !== "" && preferredUsername !== acctUsername) aliases.push(`acct:${preferredUsername}@${contextHost}`);
2370
+ }
2371
+ return {
2372
+ subject,
2373
+ aliases
2374
+ };
2375
+ }
2358
2376
  /**
2359
2377
  * Handles a WebFinger request. You would not typically call this function
2360
2378
  * directly, but instead use {@link Federation.fetch} method.
@@ -2409,6 +2427,7 @@ async function handleWebFingerInternal(request, { context, host, actorDispatcher
2409
2427
  return identifier;
2410
2428
  }
2411
2429
  let identifier = null;
2430
+ let acctUsername = null;
2412
2431
  const uriParsed = context.parseUri(resourceUrl);
2413
2432
  if (uriParsed?.type != "actor") {
2414
2433
  const match = /^acct:([^@]+)@([^@]+)$/.exec(resource);
@@ -2422,8 +2441,9 @@ async function handleWebFingerInternal(request, { context, host, actorDispatcher
2422
2441
  const normalizedHost = portMatch == null ? (0, node_url.domainToASCII)(match[2].toLowerCase()) : (0, node_url.domainToASCII)(match[2].substring(0, portMatch.index).toLowerCase()) + portMatch[0];
2423
2442
  if (normalizedHost != context.url.host && normalizedHost != host) return await onNotFound(request);
2424
2443
  else {
2425
- identifier = await mapUsernameToIdentifier(match[1]);
2426
- resourceUrl = new URL(`acct:${match[1]}@${normalizedHost}`);
2444
+ acctUsername = match[1];
2445
+ identifier = await mapUsernameToIdentifier(acctUsername);
2446
+ resourceUrl = new URL(`acct:${acctUsername}@${normalizedHost}`);
2427
2447
  }
2428
2448
  }
2429
2449
  } else identifier = uriParsed.identifier;
@@ -2433,9 +2453,10 @@ async function handleWebFingerInternal(request, { context, host, actorDispatcher
2433
2453
  logger.error("Actor {identifier} not found.", { identifier });
2434
2454
  return await onNotFound(request);
2435
2455
  }
2456
+ const actorUri = context.getActorUri(identifier);
2436
2457
  const links = [{
2437
2458
  rel: "self",
2438
- href: context.getActorUri(identifier).href,
2459
+ href: actorUri.href,
2439
2460
  type: "application/activity+json"
2440
2461
  }];
2441
2462
  for (const url of actor.urls) if (url instanceof _fedify_vocab.Link && url.href != null) links.push({
@@ -2459,22 +2480,19 @@ async function handleWebFingerInternal(request, { context, host, actorDispatcher
2459
2480
  const customLinks = await webFingerLinksDispatcher(context, resourceUrl);
2460
2481
  if (customLinks != null) for (const link of customLinks) links.push(link);
2461
2482
  }
2462
- const aliases = [];
2463
- if (resourceUrl.protocol != "acct:" && actor.preferredUsername != null) {
2464
- aliases.push(`acct:${actor.preferredUsername}@${host ?? context.url.host}`);
2465
- if (host != null && host !== context.url.host) aliases.push(`acct:${actor.preferredUsername}@${context.url.host}`);
2466
- }
2467
- if (resourceUrl.href !== context.getActorUri(identifier).href) aliases.push(context.getActorUri(identifier).href);
2468
- if (resourceUrl.protocol === "acct:" && host != null && host !== context.url.host && !resourceUrl.href.endsWith(`@${host}`)) {
2469
- const username = resourceUrl.href.replace(/^acct:/, "").replace(/@.*$/, "");
2470
- aliases.push(`acct:${username}@${host}`);
2471
- }
2472
- const jrd = {
2473
- subject: resourceUrl.href,
2483
+ const { subject, aliases } = getWebFingerSubjectAndAliases({
2484
+ resourceUrl,
2485
+ actorUri,
2486
+ preferredUsername: actor.preferredUsername,
2487
+ acctUsername,
2488
+ host,
2489
+ contextHost: context.url.host
2490
+ });
2491
+ return new Response(JSON.stringify({
2492
+ subject,
2474
2493
  aliases,
2475
2494
  links
2476
- };
2477
- return new Response(JSON.stringify(jrd), { headers: {
2495
+ }), { headers: {
2478
2496
  "Content-Type": "application/jrd+json",
2479
2497
  "Access-Control-Allow-Origin": "*"
2480
2498
  } });
@@ -1,4 +1,4 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
- const require_middleware = require("./middleware-SoCEl9MR.cjs");
3
+ const require_middleware = require("./middleware-BmLb_YyB.cjs");
4
4
  exports.FederationImpl = require_middleware.FederationImpl;
@@ -2,24 +2,24 @@ import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { n as RouterError } from "./router-CrMLXoOr.mjs";
5
- import { n as version, t as name } from "./deno-DqGhPf7Z.mjs";
6
- import { a as validateCryptoKey, i as importJwk, t as exportJwk } from "./key-D3fAW3e0.mjs";
7
- import { l as verifyRequest } from "./http-ZP7Ryg80.mjs";
8
- import { t as getAuthenticatedDocumentLoader } from "./docloader-44obLNFf.mjs";
5
+ import { n as version, t as name } from "./deno-C0hao78M.mjs";
6
+ import { a as validateCryptoKey, i as importJwk, t as exportJwk } from "./key-CiI2c4fV.mjs";
7
+ import { l as verifyRequest } from "./http-fK66BkJj.mjs";
8
+ import { t as getAuthenticatedDocumentLoader } from "./docloader-CgohFTEx.mjs";
9
9
  import { n as kvCache } from "./kv-cache-DqEKe5E0.mjs";
10
- import { a as compactJsonLd, c as getNormalizationContextLoader, d as isInvalidUrlTypeError, f as signJsonLd, g as wrapContextLoaderForJsonLd, l as hasSignature, p as verifyCompactJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as isClearlyMalformedContextReference } from "./ld-CdHtsO-f.mjs";
11
- import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-B7VDuDtw.mjs";
12
- import { n as signObject, r as verifyObject } from "./proof-DST3zBK7.mjs";
10
+ import { a as compactJsonLd, c as getNormalizationContextLoader, d as isInvalidUrlTypeError, f as signJsonLd, g as wrapContextLoaderForJsonLd, l as hasSignature, p as verifyCompactJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as isClearlyMalformedContextReference } from "./ld-BtgF_U3o.mjs";
11
+ import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-sWtcq_uW.mjs";
12
+ import { n as signObject, r as verifyObject } from "./proof-B9liQ9K1.mjs";
13
13
  import { t as getNodeInfo } from "./client-A1UrnX6I.mjs";
14
14
  import { t as nodeInfoToJson } from "./types-C37hquWI.mjs";
15
- import { n as routeActivity } from "./inbox-Dzxzo24a.mjs";
16
- import { t as FederationBuilderImpl } from "./builder-DnU9W5Rv.mjs";
15
+ import { n as routeActivity } from "./inbox-C91k13ar.mjs";
16
+ import { t as FederationBuilderImpl } from "./builder-DiCVIEdq.mjs";
17
17
  import { t as buildCollectionSynchronizationHeader } from "./collection-ChgDTHLz.mjs";
18
18
  import { t as KvKeyCache } from "./keycache-DaQ3ndaJ.mjs";
19
19
  import { t as acceptsJsonLd } from "./negotiation-BehA2uul.mjs";
20
- import { t as hasMalformedKnownTemporalLiteral } from "./temporal-CnZZkaiD.mjs";
20
+ import { t as hasMalformedKnownTemporalLiteral } from "./temporal-D_P8UNzl.mjs";
21
21
  import { t as createExponentialBackoffPolicy } from "./retry-B_E3V_Dx.mjs";
22
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-Doxp5Dhm.mjs";
22
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-B84OJGoX.mjs";
23
23
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
24
24
  import { lookupWebFinger } from "@fedify/webfinger";
25
25
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
@@ -1202,6 +1202,24 @@ const logger = getLogger([
1202
1202
  "webfinger",
1203
1203
  "server"
1204
1204
  ]);
1205
+ function getWebFingerSubjectAndAliases({ resourceUrl, actorUri, preferredUsername, acctUsername, host, contextHost }) {
1206
+ const aliases = [];
1207
+ let subject = resourceUrl.href;
1208
+ if (resourceUrl.protocol != "acct:" && preferredUsername != null) {
1209
+ aliases.push(`acct:${preferredUsername}@${host ?? contextHost}`);
1210
+ if (host != null && host !== contextHost) aliases.push(`acct:${preferredUsername}@${contextHost}`);
1211
+ }
1212
+ if (resourceUrl.href !== actorUri.href) aliases.push(actorUri.href);
1213
+ if (resourceUrl.protocol === "acct:" && host != null && host !== contextHost && !resourceUrl.href.endsWith(`@${host}`)) {
1214
+ subject = `acct:${preferredUsername ?? acctUsername}@${host}`;
1215
+ aliases.push(resourceUrl.href);
1216
+ if (preferredUsername != null && preferredUsername !== "" && preferredUsername !== acctUsername) aliases.push(`acct:${preferredUsername}@${contextHost}`);
1217
+ }
1218
+ return {
1219
+ subject,
1220
+ aliases
1221
+ };
1222
+ }
1205
1223
  /**
1206
1224
  * Handles a WebFinger request. You would not typically call this function
1207
1225
  * directly, but instead use {@link Federation.fetch} method.
@@ -1256,6 +1274,7 @@ async function handleWebFingerInternal(request, { context, host, actorDispatcher
1256
1274
  return identifier;
1257
1275
  }
1258
1276
  let identifier = null;
1277
+ let acctUsername = null;
1259
1278
  const uriParsed = context.parseUri(resourceUrl);
1260
1279
  if (uriParsed?.type != "actor") {
1261
1280
  const match = /^acct:([^@]+)@([^@]+)$/.exec(resource);
@@ -1269,8 +1288,9 @@ async function handleWebFingerInternal(request, { context, host, actorDispatcher
1269
1288
  const normalizedHost = portMatch == null ? domainToASCII(match[2].toLowerCase()) : domainToASCII(match[2].substring(0, portMatch.index).toLowerCase()) + portMatch[0];
1270
1289
  if (normalizedHost != context.url.host && normalizedHost != host) return await onNotFound(request);
1271
1290
  else {
1272
- identifier = await mapUsernameToIdentifier(match[1]);
1273
- resourceUrl = new URL(`acct:${match[1]}@${normalizedHost}`);
1291
+ acctUsername = match[1];
1292
+ identifier = await mapUsernameToIdentifier(acctUsername);
1293
+ resourceUrl = new URL(`acct:${acctUsername}@${normalizedHost}`);
1274
1294
  }
1275
1295
  }
1276
1296
  } else identifier = uriParsed.identifier;
@@ -1280,9 +1300,10 @@ async function handleWebFingerInternal(request, { context, host, actorDispatcher
1280
1300
  logger.error("Actor {identifier} not found.", { identifier });
1281
1301
  return await onNotFound(request);
1282
1302
  }
1303
+ const actorUri = context.getActorUri(identifier);
1283
1304
  const links = [{
1284
1305
  rel: "self",
1285
- href: context.getActorUri(identifier).href,
1306
+ href: actorUri.href,
1286
1307
  type: "application/activity+json"
1287
1308
  }];
1288
1309
  for (const url of actor.urls) if (url instanceof Link && url.href != null) links.push({
@@ -1306,22 +1327,19 @@ async function handleWebFingerInternal(request, { context, host, actorDispatcher
1306
1327
  const customLinks = await webFingerLinksDispatcher(context, resourceUrl);
1307
1328
  if (customLinks != null) for (const link of customLinks) links.push(link);
1308
1329
  }
1309
- const aliases = [];
1310
- if (resourceUrl.protocol != "acct:" && actor.preferredUsername != null) {
1311
- aliases.push(`acct:${actor.preferredUsername}@${host ?? context.url.host}`);
1312
- if (host != null && host !== context.url.host) aliases.push(`acct:${actor.preferredUsername}@${context.url.host}`);
1313
- }
1314
- if (resourceUrl.href !== context.getActorUri(identifier).href) aliases.push(context.getActorUri(identifier).href);
1315
- if (resourceUrl.protocol === "acct:" && host != null && host !== context.url.host && !resourceUrl.href.endsWith(`@${host}`)) {
1316
- const username = resourceUrl.href.replace(/^acct:/, "").replace(/@.*$/, "");
1317
- aliases.push(`acct:${username}@${host}`);
1318
- }
1319
- const jrd = {
1320
- subject: resourceUrl.href,
1330
+ const { subject, aliases } = getWebFingerSubjectAndAliases({
1331
+ resourceUrl,
1332
+ actorUri,
1333
+ preferredUsername: actor.preferredUsername,
1334
+ acctUsername,
1335
+ host,
1336
+ contextHost: context.url.host
1337
+ });
1338
+ return new Response(JSON.stringify({
1339
+ subject,
1321
1340
  aliases,
1322
1341
  links
1323
- };
1324
- return new Response(JSON.stringify(jrd), { headers: {
1342
+ }), { headers: {
1325
1343
  "Content-Type": "application/jrd+json",
1326
1344
  "Access-Control-Allow-Origin": "*"
1327
1345
  } });
package/dist/mod.cjs CHANGED
@@ -4,11 +4,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
4
  require("./chunk-DDcVe30Y.cjs");
5
5
  const require_transformers = require("./transformers-NeAONrAq.cjs");
6
6
  require("./compat/mod.cjs");
7
- const require_http = require("./http-CCITZCF5.cjs");
8
- const require_middleware = require("./middleware-SoCEl9MR.cjs");
9
- const require_proof = require("./proof-BfBeDsAr.cjs");
7
+ const require_http = require("./http-CpvgjWiv.cjs");
8
+ const require_middleware = require("./middleware-BmLb_YyB.cjs");
9
+ const require_proof = require("./proof-p6KRdV2F.cjs");
10
10
  const require_types = require("./types-KC4QAoxe.cjs");
11
- const require_kv_cache = require("./kv-cache-BSKBffCI.cjs");
11
+ const require_kv_cache = require("./kv-cache-DCQ3iAoA.cjs");
12
12
  const require_federation_mod = require("./federation/mod.cjs");
13
13
  require("./nodeinfo/mod.cjs");
14
14
  require("./runtime/mod.cjs");
package/dist/mod.js CHANGED
@@ -3,11 +3,11 @@ import { URLPattern } from "urlpattern-polyfill";
3
3
  import "./chunk-CRNNMoPX.js";
4
4
  import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-BGMIq1cs.js";
5
5
  import "./compat/mod.js";
6
- import { a as fetchKey, i as exportJwk, n as signRequest, o as generateCryptoKeyPair, r as verifyRequest, s as importJwk } from "./http-ATx5mKcD.js";
7
- import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "./middleware-5mUl-aoV.js";
8
- import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "./proof-B8IEm_2z.js";
6
+ import { a as fetchKey, i as exportJwk, n as signRequest, o as generateCryptoKeyPair, r as verifyRequest, s as importJwk } from "./http-DzEJOwGD.js";
7
+ import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "./middleware-BGFHmA-f.js";
8
+ import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "./proof-p2BryEGX.js";
9
9
  import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-CAY3OdLq.js";
10
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-D64TkrEN.js";
10
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-COhJ7YkU.js";
11
11
  import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation/mod.js";
12
12
  import "./nodeinfo/mod.js";
13
13
  import "./runtime/mod.js";
@@ -5,7 +5,7 @@ import { n as createRequestContext } from "../context-Juj6bdHC.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-Duiq_YC9.mjs";
7
7
  import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
8
- import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-7EKeUNaR.mjs";
8
+ import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-yNqmDL8w.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  //#region src/nodeinfo/handler.test.ts
11
11
  test("handleNodeInfo()", async () => {
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-DqGhPf7Z.mjs";
5
- import "./key-D3fAW3e0.mjs";
4
+ import { n as version, t as name } from "./deno-C0hao78M.mjs";
5
+ import "./key-CiI2c4fV.mjs";
6
6
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
7
7
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { getDocumentLoader } from "@fedify/vocab-runtime";
@@ -1,8 +1,8 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-DqGhPf7Z.mjs";
5
- import { a as validateCryptoKey, n as fetchKey } from "./key-D3fAW3e0.mjs";
4
+ import { n as version, t as name } from "./deno-C0hao78M.mjs";
5
+ import { a as validateCryptoKey, n as fetchKey } from "./key-CiI2c4fV.mjs";
6
6
  import { Activity, DataIntegrityProof, Multikey, getTypeId } from "@fedify/vocab";
7
7
  import { SpanStatusCode, trace } from "@opentelemetry/api";
8
8
  import { getLogger } from "@logtape/logtape";
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { a as fetchKey, c as validateCryptoKey, l as name, u as version } from "./http-ATx5mKcD.js";
3
+ import { a as fetchKey, c as validateCryptoKey, l as name, u as version } from "./http-DzEJOwGD.js";
4
4
  import { getLogger } from "@logtape/logtape";
5
5
  import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, getTypeId, isActor } from "@fedify/vocab";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
@@ -1,7 +1,7 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  const require_chunk = require("./chunk-DDcVe30Y.cjs");
4
- const require_http = require("./http-CCITZCF5.cjs");
4
+ const require_http = require("./http-CpvgjWiv.cjs");
5
5
  let _logtape_logtape = require("@logtape/logtape");
6
6
  let _fedify_vocab = require("@fedify/vocab");
7
7
  let _opentelemetry_api = require("@opentelemetry/api");
@@ -1,8 +1,8 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as version, t as name } from "./deno-DqGhPf7Z.mjs";
5
- import { n as doubleKnock } from "./http-ZP7Ryg80.mjs";
4
+ import { n as version, t as name } from "./deno-C0hao78M.mjs";
5
+ import { n as doubleKnock } from "./http-fK66BkJj.mjs";
6
6
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
7
7
  import { getLogger } from "@logtape/logtape";
8
8
  //#region src/federation/send.ts
@@ -7,8 +7,8 @@ import { a as assertExists, t as assertStringIncludes } from "../std__assert-Dui
7
7
  import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
8
8
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
9
9
  import { t as assert } from "../assert-ddO5KLpe.mjs";
10
- import { t as exportJwk } from "../key-D3fAW3e0.mjs";
11
- import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase } from "../http-ZP7Ryg80.mjs";
10
+ import { t as exportJwk } from "../key-CiI2c4fV.mjs";
11
+ import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase } from "../http-fK66BkJj.mjs";
12
12
  import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-CtZLJq76.mjs";
13
13
  import { mockDocumentLoader, test } from "@fedify/fixture";
14
14
  import { FetchError, exportSpki } from "@fedify/vocab-runtime";
@@ -5,7 +5,7 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import "../std__assert-Duiq_YC9.mjs";
6
6
  import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
7
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-D3fAW3e0.mjs";
8
+ import { a as validateCryptoKey, i as importJwk, n as fetchKey, r as generateCryptoKeyPair, t as exportJwk } from "../key-CiI2c4fV.mjs";
9
9
  import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
10
10
  import { mockDocumentLoader, test } from "@fedify/fixture";
11
11
  import { CryptographicKey, Multikey } from "@fedify/vocab";
@@ -5,9 +5,9 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
5
5
  import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
6
6
  import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
7
7
  import { t as assert } from "../assert-ddO5KLpe.mjs";
8
- import { r as generateCryptoKeyPair } from "../key-D3fAW3e0.mjs";
8
+ import { r as generateCryptoKeyPair } from "../key-CiI2c4fV.mjs";
9
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 compactJsonLd, d as isInvalidUrlTypeError, f as signJsonLd, h as verifySignature, i as attachSignature, m as verifyJsonLd, n as UnsafeJsonLdError, o as createSignature, s as detachSignature } from "../ld-CdHtsO-f.mjs";
10
+ import { a as compactJsonLd, d as isInvalidUrlTypeError, f as signJsonLd, h as verifySignature, i as attachSignature, m as verifyJsonLd, n as UnsafeJsonLdError, o as createSignature, s as detachSignature } from "../ld-BtgF_U3o.mjs";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { CryptographicKey } from "@fedify/vocab";
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-CCITZCF5.cjs");
5
- const require_proof = require("../proof-BfBeDsAr.cjs");
4
+ const require_http = require("../http-CpvgjWiv.cjs");
5
+ const require_proof = require("../proof-p6KRdV2F.cjs");
6
6
  exports.attachSignature = require_proof.attachSignature;
7
7
  exports.createProof = require_proof.createProof;
8
8
  exports.createSignature = require_proof.createSignature;
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 { a as fetchKey, i as exportJwk, n as signRequest, o as generateCryptoKeyPair, r as verifyRequest, s as importJwk } from "../http-ATx5mKcD.js";
4
- import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "../proof-B8IEm_2z.js";
3
+ import { a as fetchKey, i as exportJwk, n as signRequest, o as generateCryptoKeyPair, r as verifyRequest, s as importJwk } from "../http-DzEJOwGD.js";
4
+ import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "../proof-p2BryEGX.js";
5
5
  export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getKeyOwner, importJwk, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
@@ -6,7 +6,7 @@ import "../std__assert-Duiq_YC9.mjs";
6
6
  import { n as assertFalse } from "../assert_rejects-B-qJtC9Z.mjs";
7
7
  import { t as assert } from "../assert-ddO5KLpe.mjs";
8
8
  import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-CtZLJq76.mjs";
9
- import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-B7VDuDtw.mjs";
9
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-sWtcq_uW.mjs";
10
10
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
11
11
  import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
12
12
  //#region src/sig/owner.test.ts
@@ -6,7 +6,7 @@ import "../std__assert-Duiq_YC9.mjs";
6
6
  import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
7
7
  import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
8
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-DST3zBK7.mjs";
9
+ import { i as verifyProof, n as signObject, r as verifyObject, t as createProof } from "../proof-B9liQ9K1.mjs";
10
10
  import { mockDocumentLoader, test } from "@fedify/fixture";
11
11
  import { Create, DataIntegrityProof, Multikey, Note, Place } from "@fedify/vocab";
12
12
  import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { c as getNormalizationContextLoader } from "./ld-CdHtsO-f.mjs";
4
+ import { c as getNormalizationContextLoader } from "./ld-BtgF_U3o.mjs";
5
5
  import jsonld from "@fedify/vocab-runtime/jsonld";
6
6
  //#region src/federation/temporal.ts
7
7
  function isPlainObject(value) {
@@ -5,9 +5,9 @@ import { t as esm_default } from "../esm-DVILvP5e.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
6
6
  import "../std__assert-Duiq_YC9.mjs";
7
7
  import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
8
- import { l as verifyRequest } from "../http-ZP7Ryg80.mjs";
8
+ import { l as verifyRequest } from "../http-fK66BkJj.mjs";
9
9
  import { i as rsaPrivateKey2 } from "../keys-CtZLJq76.mjs";
10
- import { t as getAuthenticatedDocumentLoader } from "../docloader-44obLNFf.mjs";
10
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-CgohFTEx.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,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-BSKBffCI.cjs");
4
+ const require_kv_cache = require("../kv-cache-DCQ3iAoA.cjs");
5
5
  exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
6
6
  exports.kvCache = require_kv_cache.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-D64TkrEN.js";
3
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-COhJ7YkU.js";
4
4
  export { getAuthenticatedDocumentLoader, kvCache };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "2.0.22-dev.1482+e4fba16e",
3
+ "version": "2.0.22-dev.1565+b5a902fa",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -144,9 +144,9 @@
144
144
  "uri-template-router": "^1.0.0",
145
145
  "url-template": "^3.1.1",
146
146
  "urlpattern-polyfill": "^10.1.0",
147
- "@fedify/vocab": "2.0.22-dev.1482+e4fba16e",
148
- "@fedify/vocab-runtime": "2.0.22-dev.1482+e4fba16e",
149
- "@fedify/webfinger": "2.0.22-dev.1482+e4fba16e"
147
+ "@fedify/vocab": "2.0.22-dev.1565+b5a902fa",
148
+ "@fedify/vocab-runtime": "2.0.22-dev.1565+b5a902fa",
149
+ "@fedify/webfinger": "2.0.22-dev.1565+b5a902fa"
150
150
  },
151
151
  "devDependencies": {
152
152
  "@std/assert": "npm:@jsr/std__assert@^0.226.0",
@@ -159,7 +159,7 @@
159
159
  "typescript": "^6.0.0",
160
160
  "wrangler": "^4.17.0",
161
161
  "@fedify/fixture": "2.0.0",
162
- "@fedify/vocab-tools": "^2.0.22-dev.1482+e4fba16e"
162
+ "@fedify/vocab-tools": "^2.0.22-dev.1565+b5a902fa"
163
163
  },
164
164
  "scripts": {
165
165
  "build:self": "tsdown",