@fedify/fedify 2.1.0-dev.408 → 2.1.0-dev.418

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 (60) hide show
  1. package/dist/{builder-DqJQtxW4.js → builder-Dr8wJfzL.js} +3 -3
  2. package/dist/compat/mod.d.cts +2 -2
  3. package/dist/compat/mod.d.ts +2 -2
  4. package/dist/compat/transformers.test.js +11 -11
  5. package/dist/{context-o4OhjMHe.d.cts → context-D3QkEtZd.d.cts} +4 -23
  6. package/dist/{context-Dy5ro7zD.d.ts → context-DZJhUmzF.d.ts} +4 -23
  7. package/dist/{deno-D_VnPW-Y.js → deno-RllegzSG.js} +1 -1
  8. package/dist/{docloader-D7xSU1xb.js → docloader-Bue7Ij3R.js} +2 -2
  9. package/dist/federation/builder.test.js +3 -3
  10. package/dist/federation/handler.test.js +19 -19
  11. package/dist/federation/idempotency.test.js +11 -11
  12. package/dist/federation/inbox.test.js +2 -2
  13. package/dist/federation/middleware.test.js +27 -12
  14. package/dist/federation/mod.cjs +4 -4
  15. package/dist/federation/mod.d.cts +2 -2
  16. package/dist/federation/mod.d.ts +2 -2
  17. package/dist/federation/mod.js +4 -4
  18. package/dist/federation/send.test.js +5 -5
  19. package/dist/federation/webfinger.test.js +11 -11
  20. package/dist/{http-C3oMHumD.js → http-BNiAwNU-.js} +1 -1
  21. package/dist/{http-CFILUWFj.js → http-Cvsk5Skd.js} +2 -2
  22. package/dist/{http-B-epypwc.cjs → http-Due1pojF.cjs} +1 -1
  23. package/dist/{inbox-FsU-ifET.js → inbox-CYce8kRg.js} +1 -1
  24. package/dist/{key-Cw2GXzkv.js → key-BqMOdwtv.js} +1 -1
  25. package/dist/{kv-cache-K6GW8-uS.js → kv-cache-DjYerrCe.js} +1 -1
  26. package/dist/{kv-cache-YG3yAJRb.cjs → kv-cache-zyDjqzjm.cjs} +1 -1
  27. package/dist/{ld-D4-RbyP8.js → ld-BMgYSVTZ.js} +2 -2
  28. package/dist/{middleware-CVGms5AS.js → middleware-B2L4AM_o.js} +11 -11
  29. package/dist/middleware-BFRIkXyv.cjs +12 -0
  30. package/dist/{middleware-ByN4qQt0.js → middleware-BQ3c3mRY.js} +30 -89
  31. package/dist/{middleware-CzNcdhiV.cjs → middleware-CfgAMF_j.cjs} +29 -88
  32. package/dist/{middleware-D_wNj9p6.js → middleware-CgEEF8s6.js} +4 -4
  33. package/dist/{middleware-Co3x1vLV.js → middleware-CpOJCVxU.js} +36 -95
  34. package/dist/{mod-Bm_GwNTL.d.cts → mod-DVwHUI_x.d.cts} +1 -1
  35. package/dist/{mod-DwqZ5l67.d.cts → mod-Di3W5OdP.d.cts} +1 -1
  36. package/dist/{mod-CIR7gJW8.d.ts → mod-DnSsduJF.d.ts} +1 -1
  37. package/dist/{mod-DQWhp0xs.d.ts → mod-DosD6NsG.d.ts} +1 -1
  38. package/dist/mod.cjs +4 -4
  39. package/dist/mod.d.cts +3 -3
  40. package/dist/mod.d.ts +3 -3
  41. package/dist/mod.js +4 -4
  42. package/dist/nodeinfo/handler.test.js +11 -11
  43. package/dist/{owner-BJOuHY_S.js → owner-rwfm7c6o.js} +1 -1
  44. package/dist/{proof-BNcJ_Sa_.js → proof-BSXD3gxs.js} +1 -1
  45. package/dist/{proof-VvmjtuyP.js → proof-CV9ObID1.js} +2 -2
  46. package/dist/{proof-BmYdRz_f.cjs → proof-CVHxb_s9.cjs} +1 -1
  47. package/dist/{send-DYC2LvJZ.js → send-BUsEdmU0.js} +2 -2
  48. package/dist/sig/http.test.js +3 -3
  49. package/dist/sig/key.test.js +2 -2
  50. package/dist/sig/ld.test.js +3 -3
  51. package/dist/sig/mod.cjs +2 -2
  52. package/dist/sig/mod.js +2 -2
  53. package/dist/sig/owner.test.js +3 -3
  54. package/dist/sig/proof.test.js +3 -3
  55. package/dist/testing/mod.d.ts +4 -23
  56. package/dist/utils/docloader.test.js +4 -4
  57. package/dist/utils/mod.cjs +2 -2
  58. package/dist/utils/mod.js +2 -2
  59. package/package.json +5 -5
  60. package/dist/middleware-DWhDjC7Z.cjs +0 -12
@@ -3,7 +3,7 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default } from "./deno-D_VnPW-Y.js";
6
+ import { deno_default } from "./deno-RllegzSG.js";
7
7
  import { getLogger } from "@logtape/logtape";
8
8
  import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
9
9
  import { getDocumentLoader } from "@fedify/vocab-runtime";
@@ -2,7 +2,7 @@
2
2
  import { Temporal } from "@js-temporal/polyfill";
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
- import { doubleKnock, validateCryptoKey } from "./http-C3oMHumD.js";
5
+ import { doubleKnock, validateCryptoKey } from "./http-BNiAwNU-.js";
6
6
  import { getLogger } from "@logtape/logtape";
7
7
  import { curry } from "es-toolkit";
8
8
  import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, validatePublicUrl } from "@fedify/vocab-runtime";
@@ -3,7 +3,7 @@
3
3
  const { URLPattern } = require("urlpattern-polyfill");
4
4
 
5
5
  const require_chunk = require('./chunk-CGaQZ11T.cjs');
6
- const require_http = require('./http-B-epypwc.cjs');
6
+ const require_http = require('./http-Due1pojF.cjs');
7
7
  const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
8
8
  const es_toolkit = require_chunk.__toESM(require("es-toolkit"));
9
9
  const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
@@ -3,8 +3,8 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default } from "./deno-D_VnPW-Y.js";
7
- import { fetchKey, validateCryptoKey } from "./key-Cw2GXzkv.js";
6
+ import { deno_default } from "./deno-RllegzSG.js";
7
+ import { fetchKey, validateCryptoKey } from "./key-BqMOdwtv.js";
8
8
  import { getLogger } from "@logtape/logtape";
9
9
  import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
10
10
  import { getDocumentLoader } from "@fedify/vocab-runtime";
@@ -3,24 +3,24 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import "./deno-D_VnPW-Y.js";
7
- import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-Co3x1vLV.js";
6
+ import "./deno-RllegzSG.js";
7
+ import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-CpOJCVxU.js";
8
8
  import "./client-Dg7OfUDA.js";
9
9
  import "./router-D9eI0s4b.js";
10
10
  import "./types-CPz01LGH.js";
11
- import "./key-Cw2GXzkv.js";
12
- import "./http-CFILUWFj.js";
13
- import "./ld-D4-RbyP8.js";
14
- import "./owner-BJOuHY_S.js";
15
- import "./proof-VvmjtuyP.js";
16
- import "./docloader-D7xSU1xb.js";
11
+ import "./key-BqMOdwtv.js";
12
+ import "./http-Cvsk5Skd.js";
13
+ import "./ld-BMgYSVTZ.js";
14
+ import "./owner-rwfm7c6o.js";
15
+ import "./proof-CV9ObID1.js";
16
+ import "./docloader-Bue7Ij3R.js";
17
17
  import "./kv-cache-B__dHl7g.js";
18
- import "./inbox-FsU-ifET.js";
19
- import "./builder-DqJQtxW4.js";
18
+ import "./inbox-CYce8kRg.js";
19
+ import "./builder-Dr8wJfzL.js";
20
20
  import "./collection-CcnIw1qY.js";
21
21
  import "./keycache-DRxpZ5r9.js";
22
22
  import "./negotiation-5NPJL6zp.js";
23
23
  import "./retry-D4GJ670a.js";
24
- import "./send-DYC2LvJZ.js";
24
+ import "./send-BUsEdmU0.js";
25
25
 
26
26
  export { FederationImpl };
@@ -0,0 +1,12 @@
1
+
2
+ const { Temporal } = require("@js-temporal/polyfill");
3
+ const { URLPattern } = require("urlpattern-polyfill");
4
+
5
+ require('./transformers-3g8GZwkZ.cjs');
6
+ require('./http-Due1pojF.cjs');
7
+ const require_middleware = require('./middleware-CfgAMF_j.cjs');
8
+ require('./proof-CVHxb_s9.cjs');
9
+ require('./types-Cd_hszr_.cjs');
10
+ require('./kv-cache-zyDjqzjm.cjs');
11
+
12
+ exports.FederationImpl = require_middleware.FederationImpl;
@@ -3,10 +3,10 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
5
  import { getDefaultActivityTransformers } from "./transformers-C3FLHUd6.js";
6
- import { deno_default, doubleKnock, exportJwk, importJwk, validateCryptoKey, verifyRequest } from "./http-C3oMHumD.js";
7
- import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-BNcJ_Sa_.js";
6
+ import { deno_default, doubleKnock, exportJwk, importJwk, validateCryptoKey, verifyRequest } from "./http-BNiAwNU-.js";
7
+ import { detachSignature, doesActorOwnKey, getKeyOwner, hasSignature, signJsonLd, signObject, verifyJsonLd, verifyObject } from "./proof-BSXD3gxs.js";
8
8
  import { getNodeInfo, nodeInfoToJson } from "./types-C93Ob9cU.js";
9
- import { getAuthenticatedDocumentLoader, kvCache } from "./kv-cache-K6GW8-uS.js";
9
+ import { getAuthenticatedDocumentLoader, kvCache } from "./kv-cache-DjYerrCe.js";
10
10
  import { getLogger, withContext } from "@logtape/logtape";
11
11
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
12
12
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
@@ -15,7 +15,7 @@ import { Router } from "uri-template-router";
15
15
  import { parseTemplate } from "url-template";
16
16
  import { encodeHex } from "byte-encodings/hex";
17
17
  import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
18
- import { getDocumentLoader } from "@fedify/vocab-runtime";
18
+ import { FetchError, getDocumentLoader } from "@fedify/vocab-runtime";
19
19
  import { lookupWebFinger } from "@fedify/webfinger";
20
20
  import { domainToASCII } from "node:url";
21
21
 
@@ -338,7 +338,7 @@ var FederationBuilderImpl = class {
338
338
  this.collectionTypeIds = {};
339
339
  }
340
340
  async build(options) {
341
- const { FederationImpl: FederationImpl$1 } = await import("./middleware-D_wNj9p6.js");
341
+ const { FederationImpl: FederationImpl$1 } = await import("./middleware-CgEEF8s6.js");
342
342
  const f = new FederationImpl$1(options);
343
343
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
344
344
  f.router = this.router.clone();
@@ -993,25 +993,7 @@ async function handleActor(request, { identifier, context: context$1, actorDispa
993
993
  return await onNotFound(request);
994
994
  }
995
995
  if (authorizePredicate != null) {
996
- let key = await context$1.getSignedKey();
997
- key = key?.clone({}, { $warning: {
998
- category: [
999
- "fedify",
1000
- "federation",
1001
- "actor"
1002
- ],
1003
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
1004
- } }) ?? null;
1005
- let keyOwner = await context$1.getSignedKeyOwner();
1006
- keyOwner = keyOwner?.clone({}, { $warning: {
1007
- category: [
1008
- "fedify",
1009
- "federation",
1010
- "actor"
1011
- ],
1012
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
1013
- } }) ?? null;
1014
- if (!await authorizePredicate(context$1, identifier, key, keyOwner)) return await onUnauthorized(request);
996
+ if (!await authorizePredicate(context$1, identifier)) return await onUnauthorized(request);
1015
997
  }
1016
998
  const jsonLd = await actor.toJsonLd(context$1);
1017
999
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -1031,25 +1013,7 @@ async function handleObject(request, { values, context: context$1, objectDispatc
1031
1013
  const object = await objectDispatcher(context$1, values);
1032
1014
  if (object == null) return await onNotFound(request);
1033
1015
  if (authorizePredicate != null) {
1034
- let key = await context$1.getSignedKey();
1035
- key = key?.clone({}, { $warning: {
1036
- category: [
1037
- "fedify",
1038
- "federation",
1039
- "object"
1040
- ],
1041
- message: "The third parameter of ObjectAuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
1042
- } }) ?? null;
1043
- let keyOwner = await context$1.getSignedKeyOwner();
1044
- keyOwner = keyOwner?.clone({}, { $warning: {
1045
- category: [
1046
- "fedify",
1047
- "federation",
1048
- "object"
1049
- ],
1050
- message: "The fourth parameter of ObjectAuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
1051
- } }) ?? null;
1052
- if (!await authorizePredicate(context$1, values, key, keyOwner)) return await onUnauthorized(request);
1016
+ if (!await authorizePredicate(context$1, values)) return await onUnauthorized(request);
1053
1017
  }
1054
1018
  const jsonLd = await object.toJsonLd(context$1);
1055
1019
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -1181,25 +1145,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
1181
1145
  });
1182
1146
  }
1183
1147
  if (collectionCallbacks.authorizePredicate != null) {
1184
- let key = await context$1.getSignedKey();
1185
- key = key?.clone({}, { $warning: {
1186
- category: [
1187
- "fedify",
1188
- "federation",
1189
- "collection"
1190
- ],
1191
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
1192
- } }) ?? null;
1193
- let keyOwner = await context$1.getSignedKeyOwner();
1194
- keyOwner = keyOwner?.clone({}, { $warning: {
1195
- category: [
1196
- "fedify",
1197
- "federation",
1198
- "collection"
1199
- ],
1200
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
1201
- } }) ?? null;
1202
- if (!await collectionCallbacks.authorizePredicate(context$1, identifier, key, keyOwner)) return await onUnauthorized(request);
1148
+ if (!await collectionCallbacks.authorizePredicate(context$1, identifier)) return await onUnauthorized(request);
1203
1149
  }
1204
1150
  const jsonLd = await collection.toJsonLd(context$1);
1205
1151
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -1850,28 +1796,7 @@ const verifyDefined = (callbacks) => {
1850
1796
  */
1851
1797
  const authIfNeeded = async (context$1, values, { authorizePredicate: authorize = void 0 }) => {
1852
1798
  if (authorize === void 0) return;
1853
- const key = (await context$1.getSignedKey())?.clone({}, warning.key) ?? null;
1854
- const keyOwner = (await context$1.getSignedKeyOwner())?.clone({}, warning.keyOwner) ?? null;
1855
- if (!await authorize(context$1, values, key, keyOwner)) throw new UnauthorizedError();
1856
- };
1857
- /** Warning messages for `authIfNeeded`. */
1858
- const warning = {
1859
- key: { $warning: {
1860
- category: [
1861
- "fedify",
1862
- "federation",
1863
- "collection"
1864
- ],
1865
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
1866
- } },
1867
- keyOwner: { $warning: {
1868
- category: [
1869
- "fedify",
1870
- "federation",
1871
- "collection"
1872
- ],
1873
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
1874
- } }
1799
+ if (!await authorize(context$1, values)) throw new UnauthorizedError();
1875
1800
  };
1876
1801
  /**
1877
1802
  * Appends a cursor parameter to a URL if the cursor exists.
@@ -3955,11 +3880,27 @@ var RequestContextImpl = class RequestContextImpl extends ContextImpl {
3955
3880
  if (this.#signedKeyOwner != null) return this.#signedKeyOwner;
3956
3881
  const key = await this.getSignedKey(options);
3957
3882
  if (key == null) return this.#signedKeyOwner = null;
3958
- return this.#signedKeyOwner = await getKeyOwner(key, {
3959
- contextLoader: options.contextLoader ?? this.contextLoader,
3960
- documentLoader: options.documentLoader ?? this.documentLoader,
3961
- tracerProvider: options.tracerProvider ?? this.tracerProvider
3962
- });
3883
+ try {
3884
+ return this.#signedKeyOwner = await getKeyOwner(key, {
3885
+ contextLoader: options.contextLoader ?? this.contextLoader,
3886
+ documentLoader: options.documentLoader ?? this.documentLoader,
3887
+ tracerProvider: options.tracerProvider ?? this.tracerProvider
3888
+ });
3889
+ } catch (error) {
3890
+ if (error instanceof FetchError) {
3891
+ getLogger([
3892
+ "fedify",
3893
+ "federation",
3894
+ "actor"
3895
+ ]).warn("Failed to fetch the key owner {keyOwner} of {keyId} while verifying the request signature; treating the request as unauthenticated: {error}", {
3896
+ keyId: key.id?.href,
3897
+ keyOwner: error.url.href,
3898
+ error
3899
+ });
3900
+ return this.#signedKeyOwner = null;
3901
+ }
3902
+ throw error;
3903
+ }
3963
3904
  }
3964
3905
  };
3965
3906
  var InboxContextImpl = class InboxContextImpl extends ContextImpl {
@@ -4,10 +4,10 @@
4
4
 
5
5
  const require_chunk = require('./chunk-CGaQZ11T.cjs');
6
6
  const require_transformers = require('./transformers-3g8GZwkZ.cjs');
7
- const require_http = require('./http-B-epypwc.cjs');
8
- const require_proof = require('./proof-BmYdRz_f.cjs');
7
+ const require_http = require('./http-Due1pojF.cjs');
8
+ const require_proof = require('./proof-CVHxb_s9.cjs');
9
9
  const require_types = require('./types-Cd_hszr_.cjs');
10
- const require_kv_cache = require('./kv-cache-YG3yAJRb.cjs');
10
+ const require_kv_cache = require('./kv-cache-zyDjqzjm.cjs');
11
11
  const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
12
12
  const __fedify_vocab = require_chunk.__toESM(require("@fedify/vocab"));
13
13
  const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
@@ -339,7 +339,7 @@ var FederationBuilderImpl = class {
339
339
  this.collectionTypeIds = {};
340
340
  }
341
341
  async build(options) {
342
- const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-DWhDjC7Z.cjs"));
342
+ const { FederationImpl: FederationImpl$1 } = await Promise.resolve().then(() => require("./middleware-BFRIkXyv.cjs"));
343
343
  const f = new FederationImpl$1(options);
344
344
  const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
345
345
  f.router = this.router.clone();
@@ -994,25 +994,7 @@ async function handleActor(request, { identifier, context: context$2, actorDispa
994
994
  return await onNotFound(request);
995
995
  }
996
996
  if (authorizePredicate != null) {
997
- let key = await context$2.getSignedKey();
998
- key = key?.clone({}, { $warning: {
999
- category: [
1000
- "fedify",
1001
- "federation",
1002
- "actor"
1003
- ],
1004
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
1005
- } }) ?? null;
1006
- let keyOwner = await context$2.getSignedKeyOwner();
1007
- keyOwner = keyOwner?.clone({}, { $warning: {
1008
- category: [
1009
- "fedify",
1010
- "federation",
1011
- "actor"
1012
- ],
1013
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
1014
- } }) ?? null;
1015
- if (!await authorizePredicate(context$2, identifier, key, keyOwner)) return await onUnauthorized(request);
997
+ if (!await authorizePredicate(context$2, identifier)) return await onUnauthorized(request);
1016
998
  }
1017
999
  const jsonLd = await actor.toJsonLd(context$2);
1018
1000
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -1032,25 +1014,7 @@ async function handleObject(request, { values, context: context$2, objectDispatc
1032
1014
  const object = await objectDispatcher(context$2, values);
1033
1015
  if (object == null) return await onNotFound(request);
1034
1016
  if (authorizePredicate != null) {
1035
- let key = await context$2.getSignedKey();
1036
- key = key?.clone({}, { $warning: {
1037
- category: [
1038
- "fedify",
1039
- "federation",
1040
- "object"
1041
- ],
1042
- message: "The third parameter of ObjectAuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
1043
- } }) ?? null;
1044
- let keyOwner = await context$2.getSignedKeyOwner();
1045
- keyOwner = keyOwner?.clone({}, { $warning: {
1046
- category: [
1047
- "fedify",
1048
- "federation",
1049
- "object"
1050
- ],
1051
- message: "The fourth parameter of ObjectAuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
1052
- } }) ?? null;
1053
- if (!await authorizePredicate(context$2, values, key, keyOwner)) return await onUnauthorized(request);
1017
+ if (!await authorizePredicate(context$2, values)) return await onUnauthorized(request);
1054
1018
  }
1055
1019
  const jsonLd = await object.toJsonLd(context$2);
1056
1020
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -1182,25 +1146,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
1182
1146
  });
1183
1147
  }
1184
1148
  if (collectionCallbacks.authorizePredicate != null) {
1185
- let key = await context$2.getSignedKey();
1186
- key = key?.clone({}, { $warning: {
1187
- category: [
1188
- "fedify",
1189
- "federation",
1190
- "collection"
1191
- ],
1192
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
1193
- } }) ?? null;
1194
- let keyOwner = await context$2.getSignedKeyOwner();
1195
- keyOwner = keyOwner?.clone({}, { $warning: {
1196
- category: [
1197
- "fedify",
1198
- "federation",
1199
- "collection"
1200
- ],
1201
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
1202
- } }) ?? null;
1203
- if (!await collectionCallbacks.authorizePredicate(context$2, identifier, key, keyOwner)) return await onUnauthorized(request);
1149
+ if (!await collectionCallbacks.authorizePredicate(context$2, identifier)) return await onUnauthorized(request);
1204
1150
  }
1205
1151
  const jsonLd = await collection.toJsonLd(context$2);
1206
1152
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -1851,28 +1797,7 @@ const verifyDefined = (callbacks) => {
1851
1797
  */
1852
1798
  const authIfNeeded = async (context$2, values, { authorizePredicate: authorize = void 0 }) => {
1853
1799
  if (authorize === void 0) return;
1854
- const key = (await context$2.getSignedKey())?.clone({}, warning.key) ?? null;
1855
- const keyOwner = (await context$2.getSignedKeyOwner())?.clone({}, warning.keyOwner) ?? null;
1856
- if (!await authorize(context$2, values, key, keyOwner)) throw new UnauthorizedError();
1857
- };
1858
- /** Warning messages for `authIfNeeded`. */
1859
- const warning = {
1860
- key: { $warning: {
1861
- category: [
1862
- "fedify",
1863
- "federation",
1864
- "collection"
1865
- ],
1866
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
1867
- } },
1868
- keyOwner: { $warning: {
1869
- category: [
1870
- "fedify",
1871
- "federation",
1872
- "collection"
1873
- ],
1874
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
1875
- } }
1800
+ if (!await authorize(context$2, values)) throw new UnauthorizedError();
1876
1801
  };
1877
1802
  /**
1878
1803
  * Appends a cursor parameter to a URL if the cursor exists.
@@ -3956,11 +3881,27 @@ var RequestContextImpl = class RequestContextImpl extends ContextImpl {
3956
3881
  if (this.#signedKeyOwner != null) return this.#signedKeyOwner;
3957
3882
  const key = await this.getSignedKey(options);
3958
3883
  if (key == null) return this.#signedKeyOwner = null;
3959
- return this.#signedKeyOwner = await require_proof.getKeyOwner(key, {
3960
- contextLoader: options.contextLoader ?? this.contextLoader,
3961
- documentLoader: options.documentLoader ?? this.documentLoader,
3962
- tracerProvider: options.tracerProvider ?? this.tracerProvider
3963
- });
3884
+ try {
3885
+ return this.#signedKeyOwner = await require_proof.getKeyOwner(key, {
3886
+ contextLoader: options.contextLoader ?? this.contextLoader,
3887
+ documentLoader: options.documentLoader ?? this.documentLoader,
3888
+ tracerProvider: options.tracerProvider ?? this.tracerProvider
3889
+ });
3890
+ } catch (error) {
3891
+ if (error instanceof __fedify_vocab_runtime.FetchError) {
3892
+ (0, __logtape_logtape.getLogger)([
3893
+ "fedify",
3894
+ "federation",
3895
+ "actor"
3896
+ ]).warn("Failed to fetch the key owner {keyOwner} of {keyId} while verifying the request signature; treating the request as unauthenticated: {error}", {
3897
+ keyId: key.id?.href,
3898
+ keyOwner: error.url.href,
3899
+ error
3900
+ });
3901
+ return this.#signedKeyOwner = null;
3902
+ }
3903
+ throw error;
3904
+ }
3964
3905
  }
3965
3906
  };
3966
3907
  var InboxContextImpl = class InboxContextImpl extends ContextImpl {
@@ -3,10 +3,10 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
 
5
5
  import "./transformers-C3FLHUd6.js";
6
- import "./http-C3oMHumD.js";
7
- import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-ByN4qQt0.js";
8
- import "./proof-BNcJ_Sa_.js";
6
+ import "./http-BNiAwNU-.js";
7
+ import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "./middleware-BQ3c3mRY.js";
8
+ import "./proof-BSXD3gxs.js";
9
9
  import "./types-C93Ob9cU.js";
10
- import "./kv-cache-K6GW8-uS.js";
10
+ import "./kv-cache-DjYerrCe.js";
11
11
 
12
12
  export { FederationImpl };
@@ -3,27 +3,27 @@
3
3
  import { URLPattern } from "urlpattern-polyfill";
4
4
  globalThis.addEventListener = () => {};
5
5
 
6
- import { deno_default } from "./deno-D_VnPW-Y.js";
6
+ import { deno_default } from "./deno-RllegzSG.js";
7
7
  import { getNodeInfo } from "./client-Dg7OfUDA.js";
8
8
  import { RouterError } from "./router-D9eI0s4b.js";
9
9
  import { nodeInfoToJson } from "./types-CPz01LGH.js";
10
- import { exportJwk, importJwk, validateCryptoKey } from "./key-Cw2GXzkv.js";
11
- import { verifyRequest } from "./http-CFILUWFj.js";
12
- import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-D4-RbyP8.js";
13
- import { doesActorOwnKey, getKeyOwner } from "./owner-BJOuHY_S.js";
14
- import { signObject, verifyObject } from "./proof-VvmjtuyP.js";
15
- import { getAuthenticatedDocumentLoader } from "./docloader-D7xSU1xb.js";
10
+ import { exportJwk, importJwk, validateCryptoKey } from "./key-BqMOdwtv.js";
11
+ import { verifyRequest } from "./http-Cvsk5Skd.js";
12
+ import { detachSignature, hasSignature, signJsonLd, verifyJsonLd } from "./ld-BMgYSVTZ.js";
13
+ import { doesActorOwnKey, getKeyOwner } from "./owner-rwfm7c6o.js";
14
+ import { signObject, verifyObject } from "./proof-CV9ObID1.js";
15
+ import { getAuthenticatedDocumentLoader } from "./docloader-Bue7Ij3R.js";
16
16
  import { kvCache } from "./kv-cache-B__dHl7g.js";
17
- import { routeActivity } from "./inbox-FsU-ifET.js";
18
- import { FederationBuilderImpl } from "./builder-DqJQtxW4.js";
17
+ import { routeActivity } from "./inbox-CYce8kRg.js";
18
+ import { FederationBuilderImpl } from "./builder-Dr8wJfzL.js";
19
19
  import { buildCollectionSynchronizationHeader } from "./collection-CcnIw1qY.js";
20
20
  import { KvKeyCache } from "./keycache-DRxpZ5r9.js";
21
21
  import { acceptsJsonLd } from "./negotiation-5NPJL6zp.js";
22
22
  import { createExponentialBackoffPolicy } from "./retry-D4GJ670a.js";
23
- import { SendActivityError, extractInboxes, sendActivity } from "./send-DYC2LvJZ.js";
23
+ import { SendActivityError, extractInboxes, sendActivity } from "./send-BUsEdmU0.js";
24
24
  import { getLogger, withContext } from "@logtape/logtape";
25
25
  import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
26
- import { getDocumentLoader } from "@fedify/vocab-runtime";
26
+ import { FetchError, getDocumentLoader } from "@fedify/vocab-runtime";
27
27
  import { lookupWebFinger } from "@fedify/webfinger";
28
28
  import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
29
29
  import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
@@ -182,25 +182,7 @@ async function handleActor(request, { identifier, context: context$1, actorDispa
182
182
  return await onNotFound(request);
183
183
  }
184
184
  if (authorizePredicate != null) {
185
- let key = await context$1.getSignedKey();
186
- key = key?.clone({}, { $warning: {
187
- category: [
188
- "fedify",
189
- "federation",
190
- "actor"
191
- ],
192
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
193
- } }) ?? null;
194
- let keyOwner = await context$1.getSignedKeyOwner();
195
- keyOwner = keyOwner?.clone({}, { $warning: {
196
- category: [
197
- "fedify",
198
- "federation",
199
- "actor"
200
- ],
201
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
202
- } }) ?? null;
203
- if (!await authorizePredicate(context$1, identifier, key, keyOwner)) return await onUnauthorized(request);
185
+ if (!await authorizePredicate(context$1, identifier)) return await onUnauthorized(request);
204
186
  }
205
187
  const jsonLd = await actor.toJsonLd(context$1);
206
188
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -220,25 +202,7 @@ async function handleObject(request, { values, context: context$1, objectDispatc
220
202
  const object = await objectDispatcher(context$1, values);
221
203
  if (object == null) return await onNotFound(request);
222
204
  if (authorizePredicate != null) {
223
- let key = await context$1.getSignedKey();
224
- key = key?.clone({}, { $warning: {
225
- category: [
226
- "fedify",
227
- "federation",
228
- "object"
229
- ],
230
- message: "The third parameter of ObjectAuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
231
- } }) ?? null;
232
- let keyOwner = await context$1.getSignedKeyOwner();
233
- keyOwner = keyOwner?.clone({}, { $warning: {
234
- category: [
235
- "fedify",
236
- "federation",
237
- "object"
238
- ],
239
- message: "The fourth parameter of ObjectAuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
240
- } }) ?? null;
241
- if (!await authorizePredicate(context$1, values, key, keyOwner)) return await onUnauthorized(request);
205
+ if (!await authorizePredicate(context$1, values)) return await onUnauthorized(request);
242
206
  }
243
207
  const jsonLd = await object.toJsonLd(context$1);
244
208
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -370,25 +334,7 @@ async function handleCollection(request, { name, identifier, uriGetter, filter,
370
334
  });
371
335
  }
372
336
  if (collectionCallbacks.authorizePredicate != null) {
373
- let key = await context$1.getSignedKey();
374
- key = key?.clone({}, { $warning: {
375
- category: [
376
- "fedify",
377
- "federation",
378
- "collection"
379
- ],
380
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
381
- } }) ?? null;
382
- let keyOwner = await context$1.getSignedKeyOwner();
383
- keyOwner = keyOwner?.clone({}, { $warning: {
384
- category: [
385
- "fedify",
386
- "federation",
387
- "collection"
388
- ],
389
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
390
- } }) ?? null;
391
- if (!await collectionCallbacks.authorizePredicate(context$1, identifier, key, keyOwner)) return await onUnauthorized(request);
337
+ if (!await collectionCallbacks.authorizePredicate(context$1, identifier)) return await onUnauthorized(request);
392
338
  }
393
339
  const jsonLd = await collection.toJsonLd(context$1);
394
340
  return new Response(JSON.stringify(jsonLd), { headers: {
@@ -1039,28 +985,7 @@ const verifyDefined = (callbacks) => {
1039
985
  */
1040
986
  const authIfNeeded = async (context$1, values, { authorizePredicate: authorize = void 0 }) => {
1041
987
  if (authorize === void 0) return;
1042
- const key = (await context$1.getSignedKey())?.clone({}, warning.key) ?? null;
1043
- const keyOwner = (await context$1.getSignedKeyOwner())?.clone({}, warning.keyOwner) ?? null;
1044
- if (!await authorize(context$1, values, key, keyOwner)) throw new UnauthorizedError();
1045
- };
1046
- /** Warning messages for `authIfNeeded`. */
1047
- const warning = {
1048
- key: { $warning: {
1049
- category: [
1050
- "fedify",
1051
- "federation",
1052
- "collection"
1053
- ],
1054
- message: "The third parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKey() method. The third parameter will be removed in a future release."
1055
- } },
1056
- keyOwner: { $warning: {
1057
- category: [
1058
- "fedify",
1059
- "federation",
1060
- "collection"
1061
- ],
1062
- message: "The fourth parameter of AuthorizePredicate is deprecated in favor of RequestContext.getSignedKeyOwner() method. The fourth parameter will be removed in a future release."
1063
- } }
988
+ if (!await authorize(context$1, values)) throw new UnauthorizedError();
1064
989
  };
1065
990
  /**
1066
991
  * Appends a cursor parameter to a URL if the cursor exists.
@@ -2888,11 +2813,27 @@ var RequestContextImpl = class RequestContextImpl extends ContextImpl {
2888
2813
  if (this.#signedKeyOwner != null) return this.#signedKeyOwner;
2889
2814
  const key = await this.getSignedKey(options);
2890
2815
  if (key == null) return this.#signedKeyOwner = null;
2891
- return this.#signedKeyOwner = await getKeyOwner(key, {
2892
- contextLoader: options.contextLoader ?? this.contextLoader,
2893
- documentLoader: options.documentLoader ?? this.documentLoader,
2894
- tracerProvider: options.tracerProvider ?? this.tracerProvider
2895
- });
2816
+ try {
2817
+ return this.#signedKeyOwner = await getKeyOwner(key, {
2818
+ contextLoader: options.contextLoader ?? this.contextLoader,
2819
+ documentLoader: options.documentLoader ?? this.documentLoader,
2820
+ tracerProvider: options.tracerProvider ?? this.tracerProvider
2821
+ });
2822
+ } catch (error) {
2823
+ if (error instanceof FetchError) {
2824
+ getLogger([
2825
+ "fedify",
2826
+ "federation",
2827
+ "actor"
2828
+ ]).warn("Failed to fetch the key owner {keyOwner} of {keyId} while verifying the request signature; treating the request as unauthenticated: {error}", {
2829
+ keyId: key.id?.href,
2830
+ keyOwner: error.url.href,
2831
+ error
2832
+ });
2833
+ return this.#signedKeyOwner = null;
2834
+ }
2835
+ throw error;
2836
+ }
2896
2837
  }
2897
2838
  };
2898
2839
  var InboxContextImpl = class InboxContextImpl extends ContextImpl {
@@ -1,4 +1,4 @@
1
- import { ActivityTransformer, Context } from "./context-o4OhjMHe.cjs";
1
+ import { ActivityTransformer, Context } from "./context-D3QkEtZd.cjs";
2
2
  import { Activity } from "@fedify/vocab";
3
3
 
4
4
  //#region src/compat/transformers.d.ts
@@ -1,4 +1,4 @@
1
- import { ActorAliasMapper, ActorDispatcher, ActorHandleMapper, RequestContext, WebFingerLinksDispatcher } from "./context-o4OhjMHe.cjs";
1
+ import { ActorAliasMapper, ActorDispatcher, ActorHandleMapper, RequestContext, WebFingerLinksDispatcher } from "./context-D3QkEtZd.cjs";
2
2
  import { Span, Tracer } from "@opentelemetry/api";
3
3
 
4
4
  //#region src/federation/webfinger.d.ts
@@ -1,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { ActorAliasMapper, ActorDispatcher, ActorHandleMapper, RequestContext, WebFingerLinksDispatcher } from "./context-Dy5ro7zD.js";
3
+ import { ActorAliasMapper, ActorDispatcher, ActorHandleMapper, RequestContext, WebFingerLinksDispatcher } from "./context-DZJhUmzF.js";
4
4
  import { Span, Tracer } from "@opentelemetry/api";
5
5
 
6
6
  //#region src/federation/webfinger.d.ts