@fedify/fedify 2.1.17 → 2.1.19

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 (54) hide show
  1. package/README.md +5 -4
  2. package/dist/{builder-DUQXHENg.mjs → builder-DCXx9nNs.mjs} +5 -3
  3. package/dist/{client-DEpOVgY1.mjs → client-CZWLyLmp.mjs} +63 -5
  4. package/dist/compat/transformers.test.mjs +1 -1
  5. package/dist/{deno-SeF9Kbof.mjs → deno-Duj5q741.mjs} +1 -1
  6. package/dist/{docloader-20Uxx-BW.mjs → docloader-CARF375t.mjs} +2 -2
  7. package/dist/federation/builder.test.mjs +13 -1
  8. package/dist/federation/handler.test.mjs +4 -4
  9. package/dist/federation/idempotency.test.mjs +2 -2
  10. package/dist/federation/inbox.test.mjs +1 -1
  11. package/dist/federation/middleware.test.mjs +6 -6
  12. package/dist/federation/mod.cjs +1 -1
  13. package/dist/federation/mod.js +1 -1
  14. package/dist/federation/send.test.mjs +3 -3
  15. package/dist/federation/temporal.test.mjs +1 -1
  16. package/dist/federation/webfinger.test.mjs +69 -7
  17. package/dist/{http-vr3aQ7jg.mjs → http-BpDVph0H.mjs} +2 -2
  18. package/dist/{http-D11iWbgC.js → http-DJVliVm5.js} +1 -1
  19. package/dist/{http-BVFDfPaf.cjs → http-DV9BSPH6.cjs} +1 -1
  20. package/dist/{inbox-Bgd66bvQ.mjs → inbox-B6MZcCLE.mjs} +1 -1
  21. package/dist/{key-DELVYrDs.mjs → key-D-UlhG0h.mjs} +1 -1
  22. package/dist/{kv-cache-BPr4KawB.js → kv-cache-Byc1cbqT.js} +1 -1
  23. package/dist/{kv-cache-BsvJXj0K.cjs → kv-cache-CktLjvI-.cjs} +1 -1
  24. package/dist/{ld-C30fjlVq.mjs → ld-DI-vkRtz.mjs} +2 -2
  25. package/dist/{middleware-X3Wj8cQj.mjs → middleware-6xCmJ0Cg.mjs} +47 -29
  26. package/dist/{middleware-DTBJWxr0.cjs → middleware-CfV7L21b.cjs} +1 -1
  27. package/dist/{middleware-CLHlFIpA.js → middleware-DlLhm6b5.js} +41 -21
  28. package/dist/{middleware-CfvlmuBy.cjs → middleware-FKcaUo12.cjs} +42 -22
  29. package/dist/{middleware-BsZCAdN-.mjs → middleware-OARqMTLy.mjs} +1 -1
  30. package/dist/mod.cjs +5 -5
  31. package/dist/mod.js +5 -5
  32. package/dist/nodeinfo/client.test.mjs +61 -1
  33. package/dist/nodeinfo/handler.test.mjs +1 -1
  34. package/dist/nodeinfo/mod.cjs +1 -1
  35. package/dist/nodeinfo/mod.js +1 -1
  36. package/dist/{owner-Vcjlj9bu.mjs → owner-L-WR8x4T.mjs} +2 -2
  37. package/dist/{proof-ZrhGR6j9.cjs → proof-BxcoCp99.cjs} +1 -1
  38. package/dist/{proof-BjCuYLSJ.js → proof-C6AzSnQ-.js} +1 -1
  39. package/dist/{proof-BGKiZBbr.mjs → proof-D8CQqyYl.mjs} +2 -2
  40. package/dist/{send-D8h5fYFB.mjs → send-D4OpM7t7.mjs} +2 -2
  41. package/dist/sig/http.test.mjs +2 -2
  42. package/dist/sig/key.test.mjs +1 -1
  43. package/dist/sig/ld.test.mjs +2 -2
  44. package/dist/sig/mod.cjs +2 -2
  45. package/dist/sig/mod.js +2 -2
  46. package/dist/sig/owner.test.mjs +1 -1
  47. package/dist/sig/proof.test.mjs +1 -1
  48. package/dist/{temporal-CGP_GCdL.mjs → temporal-CduMXjXl.mjs} +1 -1
  49. package/dist/{types-CAY3OdLq.js → types-DTONwNqL.js} +63 -5
  50. package/dist/{types-KC4QAoxe.cjs → types-m8u9L86X.cjs} +62 -4
  51. package/dist/utils/docloader.test.mjs +2 -2
  52. package/dist/utils/mod.cjs +1 -1
  53. package/dist/utils/mod.js +1 -1
  54. package/package.json +5 -5
package/README.md CHANGED
@@ -188,7 +188,7 @@ This project exists thanks to all the people who contribute, donate, and sponsor
188
188
  it. We are grateful for their support. We would like to thank the following
189
189
  financial contributors:[^2]
190
190
 
191
- [^2]: Those lists are automatically updated every hour.
191
+ [^2]: Those lists are automatically updated twice a day.
192
192
 
193
193
  <!-- hongdown-disable -->
194
194
 
@@ -199,21 +199,22 @@ financial contributors:[^2]
199
199
  ### Corporate sponsors
200
200
 
201
201
  - [<img src="https://images.opencollective.com/ghost/avatar/128.png" width="64" height="64"> Ghost](https://ghost.org)
202
+ - [<img src="https://images.opencollective.com/altstore/avatar/128.png" width="64" height="64"> AltStore](https://altstore.io)
202
203
 
203
204
  ### Supporters
204
205
 
205
- - [Daniel Supernault](https://pixelfed.org/)
206
206
  - [tkgka](https://opencollective.com/tkgka)
207
207
  - [Blaine](https://opencollective.com/blaine)
208
208
  - [Erick González Aguilar](https://opencollective.com/erick-gonzalez-aguilar)
209
+ - [Daniel Supernault](https://pixelfed.org/)
209
210
 
210
211
  ### Backers
211
212
 
212
- Robin Riley, yamanoku, Encyclia, taye, okin, Andy Piper, box464, Evan Prodromou, Rafael Goulart, malte
213
+ Robin Riley, Encyclia, taye, box464, Evan Prodromou, okin, yamanoku, malte, Rafael Goulart, Andy Piper
213
214
 
214
215
  ### One-time donations
215
216
 
216
- Robin Riley, Markus P, Nils Bergmann, Rameez
217
+ Robin Riley, malte, Nils Bergmann, Markus P, Rameez
217
218
 
218
219
  <!-- /DO NOT EDIT -->
219
220
 
@@ -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-SeF9Kbof.mjs";
6
- import { t as InboxListenerSet } from "./inbox-Bgd66bvQ.mjs";
5
+ import { n as version, t as name } from "./deno-Duj5q741.mjs";
6
+ import { t as InboxListenerSet } from "./inbox-B6MZcCLE.mjs";
7
7
  import { getTypeId } from "@fedify/vocab";
8
8
  import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
9
9
  import { getLogger } from "@logtape/logtape";
@@ -43,7 +43,7 @@ var FederationBuilderImpl = class {
43
43
  this.collectionTypeIds = {};
44
44
  }
45
45
  async build(options) {
46
- const { FederationImpl } = await import("./middleware-BsZCAdN-.mjs");
46
+ const { FederationImpl } = await import("./middleware-OARqMTLy.mjs");
47
47
  const f = new FederationImpl(options);
48
48
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
49
49
  f.router = this.router.clone();
@@ -54,6 +54,8 @@ var FederationBuilderImpl = class {
54
54
  f.webFingerLinksDispatcher = this.webFingerLinksDispatcher;
55
55
  f.objectCallbacks = { ...this.objectCallbacks };
56
56
  f.objectTypeIds = { ...this.objectTypeIds };
57
+ f.collectionCallbacks = { ...this.collectionCallbacks };
58
+ f.collectionTypeIds = { ...this.collectionTypeIds };
57
59
  f.inboxPath = this.inboxPath;
58
60
  f.inboxCallbacks = this.inboxCallbacks == null ? void 0 : { ...this.inboxCallbacks };
59
61
  f.outboxCallbacks = this.outboxCallbacks == null ? void 0 : { ...this.outboxCallbacks };
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { getUserAgent } from "@fedify/vocab-runtime";
4
+ import { UrlError, getUserAgent, validatePublicUrl } from "@fedify/vocab-runtime";
5
5
  import { getLogger } from "@logtape/logtape";
6
6
  //#region src/nodeinfo/client.ts
7
7
  const logger = getLogger([
@@ -9,15 +9,72 @@ const logger = getLogger([
9
9
  "nodeinfo",
10
10
  "client"
11
11
  ]);
12
+ const DEFAULT_MAX_REDIRECTION = 5;
13
+ /**
14
+ * Fetches a URL while guarding against SSRF. Before every request—including
15
+ * each redirect hop—the destination is validated with
16
+ * {@link validatePublicUrl}, so that loopback, link-local, and private
17
+ * addresses, as well as non-HTTP(S) schemes such as `data:`, are rejected.
18
+ * Redirects are followed manually with a cap, so that a public URL cannot
19
+ * bounce the request to an internal address.
20
+ * @param url The URL to fetch.
21
+ * @param headers The request headers.
22
+ * @returns The final response, or `null` if the URL is disallowed or there
23
+ * are too many redirects.
24
+ */
25
+ async function fetchPublicUrl(url, headers) {
26
+ let current = url instanceof URL ? url : new URL(url);
27
+ let redirected = 0;
28
+ while (true) {
29
+ try {
30
+ await validatePublicUrl(current.href);
31
+ } catch (e) {
32
+ if (e instanceof UrlError) {
33
+ logger.error("Refused to fetch a private or invalid URL {url}: {error}", {
34
+ url: current.href,
35
+ error: e
36
+ });
37
+ return null;
38
+ }
39
+ throw e;
40
+ }
41
+ const response = await fetch(current, {
42
+ headers,
43
+ redirect: "manual"
44
+ });
45
+ if (response.status >= 300 && response.status < 400 && response.headers.has("Location")) {
46
+ redirected++;
47
+ if (redirected >= DEFAULT_MAX_REDIRECTION) {
48
+ logger.error("Too many redirections ({redirections}) while fetching {url}.", {
49
+ redirections: redirected,
50
+ url: current.href
51
+ });
52
+ return null;
53
+ }
54
+ const next = new URL(response.headers.get("Location"), response.url == null || response.url === "" ? current : response.url);
55
+ if (next.protocol !== current.protocol) {
56
+ logger.error("Refused a redirect to a different protocol ({protocol} to {redirectedProtocol}) while fetching NodeInfo.", {
57
+ protocol: current.protocol,
58
+ redirectedProtocol: next.protocol
59
+ });
60
+ return null;
61
+ }
62
+ current = next;
63
+ continue;
64
+ }
65
+ return response;
66
+ }
67
+ }
12
68
  async function getNodeInfo(url, options = {}) {
13
69
  try {
14
70
  let nodeInfoUrl = url;
15
71
  if (!options.direct) {
16
72
  const wellKnownUrl = new URL("/.well-known/nodeinfo", url);
17
- const wellKnownResponse = await fetch(wellKnownUrl, { headers: {
73
+ const wellKnownResponse = await fetchPublicUrl(wellKnownUrl, {
18
74
  Accept: "application/json",
19
75
  "User-Agent": typeof options.userAgent === "string" ? options.userAgent : getUserAgent(options.userAgent)
20
- } });
76
+ });
77
+ if (wellKnownResponse == null) return void 0;
21
78
  if (!wellKnownResponse.ok) {
22
79
  logger.error("Failed to fetch {url}: {status} {statusText}", {
23
80
  url: wellKnownUrl.href,
@@ -37,10 +94,11 @@ async function getNodeInfo(url, options = {}) {
37
94
  }
38
95
  nodeInfoUrl = link.href;
39
96
  }
40
- const response = await fetch(nodeInfoUrl, { headers: {
97
+ const response = await fetchPublicUrl(nodeInfoUrl, {
41
98
  Accept: "application/json",
42
99
  "User-Agent": typeof options.userAgent === "string" ? options.userAgent : getUserAgent(options.userAgent)
43
- } });
100
+ });
101
+ if (response == null) return void 0;
44
102
  if (!response.ok) {
45
103
  logger.error("Failed to fetch NodeInfo document from {url}: {status} {statusText}", {
46
104
  url: nodeInfoUrl.toString(),
@@ -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-tL2TOE9X.mjs";
8
- import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-X3Wj8cQj.mjs";
8
+ import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-6xCmJ0Cg.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.1.17";
6
+ var version = "2.1.19";
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 { o as validateCryptoKey } from "./key-DELVYrDs.mjs";
5
- import { n as doubleKnock } from "./http-vr3aQ7jg.mjs";
4
+ import { o as validateCryptoKey } from "./key-D-UlhG0h.mjs";
5
+ import { n as doubleKnock } from "./http-BpDVph0H.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-tL2TOE9X.mjs";
8
- import { n as createFederationBuilder } from "../builder-DUQXHENg.mjs";
8
+ import { n as createFederationBuilder } from "../builder-DCXx9nNs.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
@@ -156,6 +156,18 @@ test("FederationBuilder", async (t) => {
156
156
  });
157
157
  builder.setCollectionDispatcher(strId, Note, "/string-id/{id}", dispatcher);
158
158
  });
159
+ await t.step("propagates custom collection dispatchers to the built federation", async () => {
160
+ const kv = new MemoryKvStore();
161
+ const builder = createFederationBuilder();
162
+ builder.setCollectionDispatcher("test", Note, "/c/{id}", () => ({ items: [] }));
163
+ const impl = await builder.build({
164
+ kv,
165
+ origin: "https://example.com"
166
+ });
167
+ assertExists(impl.collectionCallbacks["test"]);
168
+ assertEquals(impl.collectionTypeIds["test"], Note);
169
+ assertEquals((await impl.fetch(new Request("https://example.com/c/x", { headers: { accept: "application/activity+json" } }), { contextData: void 0 })).status, 200);
170
+ });
159
171
  });
160
172
  //#endregion
161
173
  export {};
@@ -7,12 +7,12 @@ 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
9
  import { r as parseAcceptSignature } from "../accept-Dd__NiUL.mjs";
10
- import { s as signRequest } from "../http-vr3aQ7jg.mjs";
10
+ import { s as signRequest } from "../http-BpDVph0H.mjs";
11
11
  import { a as rsaPrivateKey3, c as rsaPublicKey3, s as rsaPublicKey2 } from "../keys-BAK-tUlf.mjs";
12
- import { a as compactJsonLd, f as signJsonLd } from "../ld-C30fjlVq.mjs";
12
+ import { a as compactJsonLd, f as signJsonLd } from "../ld-DI-vkRtz.mjs";
13
13
  import { t as MemoryKvStore } from "../kv-tL2TOE9X.mjs";
14
- 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-X3Wj8cQj.mjs";
15
- import { t as InboxListenerSet } from "../inbox-Bgd66bvQ.mjs";
14
+ 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-6xCmJ0Cg.mjs";
15
+ import { t as InboxListenerSet } from "../inbox-B6MZcCLE.mjs";
16
16
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
17
17
  import { Create, Note, Person } from "@fedify/vocab";
18
18
  import { FetchError } from "@fedify/vocab-runtime";
@@ -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-BAK-tUlf.mjs";
7
- import { n as signObject } from "../proof-BGKiZBbr.mjs";
7
+ import { n as signObject } from "../proof-D8CQqyYl.mjs";
8
8
  import { t as MemoryKvStore } from "../kv-tL2TOE9X.mjs";
9
- import { a as createFederation } from "../middleware-X3Wj8cQj.mjs";
9
+ import { a as createFederation } from "../middleware-6xCmJ0Cg.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-Bgd66bvQ.mjs";
6
+ import { t as InboxListenerSet } from "../inbox-B6MZcCLE.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-vr3aQ7jg.mjs";
13
+ import { l as verifyRequest, s as signRequest } from "../http-BpDVph0H.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-BAK-tUlf.mjs";
15
- import { t as getAuthenticatedDocumentLoader } from "../docloader-20Uxx-BW.mjs";
16
- import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-C30fjlVq.mjs";
17
- import { t as doesActorOwnKey } from "../owner-Vcjlj9bu.mjs";
18
- import { n as signObject, r as verifyObject } from "../proof-BGKiZBbr.mjs";
15
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-CARF375t.mjs";
16
+ import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-DI-vkRtz.mjs";
17
+ import { t as doesActorOwnKey } from "../owner-L-WR8x4T.mjs";
18
+ import { n as signObject, r as verifyObject } from "../proof-D8CQqyYl.mjs";
19
19
  import { t as MemoryKvStore } from "../kv-tL2TOE9X.mjs";
20
- import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-X3Wj8cQj.mjs";
20
+ import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-6xCmJ0Cg.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-CfvlmuBy.cjs");
5
+ const require_middleware = require("../middleware-FKcaUo12.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-CLHlFIpA.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-DlLhm6b5.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-vr3aQ7jg.mjs";
11
+ import { l as verifyRequest } from "../http-BpDVph0H.mjs";
12
12
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
13
- import { t as doesActorOwnKey } from "../owner-Vcjlj9bu.mjs";
14
- import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-D8h5fYFB.mjs";
13
+ import { t as doesActorOwnKey } from "../owner-L-WR8x4T.mjs";
14
+ import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-D4OpM7t7.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-CGP_GCdL.mjs";
7
+ import { t as hasMalformedKnownTemporalLiteral } from "../temporal-CduMXjXl.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-tL2TOE9X.mjs";
8
- import { a as createFederation, o as handleWebFinger } from "../middleware-X3Wj8cQj.mjs";
8
+ import { a as createFederation, o as handleWebFinger } from "../middleware-6xCmJ0Cg.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;
@@ -1,9 +1,9 @@
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-SeF9Kbof.mjs";
4
+ import { n as version, t as name } from "./deno-Duj5q741.mjs";
5
5
  import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-Dd__NiUL.mjs";
6
- import { o as validateCryptoKey, r as fetchKeyDetailed } from "./key-DELVYrDs.mjs";
6
+ import { o as validateCryptoKey, r as fetchKeyDetailed } from "./key-D-UlhG0h.mjs";
7
7
  import { CryptographicKey } from "@fedify/vocab";
8
8
  import { SpanStatusCode, trace } from "@opentelemetry/api";
9
9
  import { FetchError } from "@fedify/vocab-runtime";
@@ -10,7 +10,7 @@ import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } fro
10
10
  import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
11
11
  //#region deno.json
12
12
  var name = "@fedify/fedify";
13
- var version = "2.1.17";
13
+ var version = "2.1.19";
14
14
  //#endregion
15
15
  //#region src/sig/accept.ts
16
16
  /**
@@ -11,7 +11,7 @@ let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conve
11
11
  let byte_encodings_base64 = require("byte-encodings/base64");
12
12
  //#region deno.json
13
13
  var name = "@fedify/fedify";
14
- var version = "2.1.17";
14
+ var version = "2.1.19";
15
15
  //#endregion
16
16
  //#region src/sig/accept.ts
17
17
  /**
@@ -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-SeF9Kbof.mjs";
4
+ import { n as version, t as name } from "./deno-Duj5q741.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-SeF9Kbof.mjs";
4
+ import { n as version, t as name } from "./deno-Duj5q741.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 { FetchError, 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 { d as validateCryptoKey, t as doubleKnock } from "./http-D11iWbgC.js";
3
+ import { d as validateCryptoKey, t as doubleKnock } from "./http-DJVliVm5.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-BVFDfPaf.cjs");
4
+ const require_http = require("./http-DV9BSPH6.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-SeF9Kbof.mjs";
5
- import { n as fetchKey, o as validateCryptoKey } from "./key-DELVYrDs.mjs";
4
+ import { n as version, t as name } from "./deno-Duj5q741.mjs";
5
+ import { n as fetchKey, o as validateCryptoKey } from "./key-D-UlhG0h.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";