@fedify/fedify 2.1.12 → 2.1.14

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 (96) hide show
  1. package/dist/{builder-D9hlyCx5.mjs → builder-BBifZZ5G.mjs} +3 -3
  2. package/dist/{chunk-nlSIicah.js → chunk-CRNNMoPX.js} +2 -2
  3. package/dist/{client-z-8dc-e1.d.cts → client-CAM_bQXx.d.cts} +1 -0
  4. package/dist/{client-AtlibPOU.d.ts → client-CSddvgWN.d.ts} +1 -2
  5. package/dist/compat/mod.d.cts +2 -1
  6. package/dist/compat/mod.d.ts +2 -3
  7. package/dist/compat/mod.js +3 -3
  8. package/dist/compat/transformers.test.mjs +1 -1
  9. package/dist/{context-C0fssarc.d.ts → context-_l9t359k.d.ts} +53 -12
  10. package/dist/{context-LmrZPwti.d.cts → context-o22vjzS2.d.cts} +53 -10
  11. package/dist/{deno-Ddb3P7G7.mjs → deno-bqnW1QlD.mjs} +1 -1
  12. package/dist/{docloader-CK8tewt1.mjs → docloader-D-Fu0kBF.mjs} +2 -2
  13. package/dist/federation/builder.test.mjs +1 -1
  14. package/dist/federation/handler.test.mjs +1361 -41
  15. package/dist/federation/idempotency.test.mjs +2 -2
  16. package/dist/federation/inbox.test.mjs +1 -1
  17. package/dist/federation/middleware.test.mjs +1588 -84
  18. package/dist/federation/mod.cjs +1 -1
  19. package/dist/federation/mod.d.cts +4 -3
  20. package/dist/federation/mod.d.ts +4 -5
  21. package/dist/federation/mod.js +2 -2
  22. package/dist/federation/retry.test.mjs +1 -1
  23. package/dist/federation/send.test.mjs +3 -3
  24. package/dist/federation/temporal.test.d.mts +2 -0
  25. package/dist/federation/temporal.test.mjs +71 -0
  26. package/dist/federation/webfinger.test.mjs +1 -1
  27. package/dist/{http-CrGuipxe.d.cts → http-BDZeS5om.d.ts} +2 -1
  28. package/dist/{http-aQzN9Ayi.d.ts → http-C87EWkO0.d.cts} +2 -3
  29. package/dist/{http-CmDErAnD.cjs → http-CEXtUHix.cjs} +57 -9
  30. package/dist/{http-qKyJKSnF.js → http-Cw1EorUA.js} +58 -10
  31. package/dist/{http-DRDpStn2.mjs → http-DvhFwy2E.mjs} +58 -10
  32. package/dist/{inbox-DTuPJEma.mjs → inbox-7b3VYnec.mjs} +7 -4
  33. package/dist/{key-WSedbAA-.mjs → key-B3OBz6A_.mjs} +1 -1
  34. package/dist/{kv-CbLNp3zQ.d.cts → kv-D6hNiMTK.d.ts} +1 -0
  35. package/dist/{kv-cache-9cdQDeT0.cjs → kv-cache-BIapFiSV.cjs} +2 -2
  36. package/dist/{kv-cache-DNNRFY8u.js → kv-cache-C6nynGhh.js} +2 -2
  37. package/dist/{kv-cache-B01V7s3h.mjs → kv-cache-FsT1ljhs.mjs} +1 -1
  38. package/dist/{kv-GFYnFoOl.d.ts → kv-gJ8LYbxX.d.cts} +1 -3
  39. package/dist/ld-DTxYKZTT.mjs +550 -0
  40. package/dist/{middleware-UThUK30x.js → middleware-0vceVN10.js} +407 -82
  41. package/dist/{middleware-DFcgN1cH.cjs → middleware-BcbU5lKS.cjs} +406 -80
  42. package/dist/{middleware-8P6Z15Wq.cjs → middleware-DUT--Qen.cjs} +1 -1
  43. package/dist/{middleware-DDsnRvFC.mjs → middleware-DmT9t0BJ.mjs} +317 -84
  44. package/dist/{middleware-C2c1rlmE.mjs → middleware-Li_g_vqz.mjs} +1 -1
  45. package/dist/{mod-CnwZoDzx.d.ts → mod-0dF0OeGw.d.cts} +2 -3
  46. package/dist/{mod-B505FZBC.d.cts → mod-BTWFtZwa.d.ts} +4 -3
  47. package/dist/{mod-Cgpc49fA.d.cts → mod-Bv1elC-b.d.ts} +2 -1
  48. package/dist/{mod-DoJBjjnO.d.cts → mod-CjiK2zrW.d.ts} +3 -2
  49. package/dist/{mod-DvxszxXC.d.ts → mod-D5YlzzP3.d.cts} +3 -4
  50. package/dist/{mod-D7PAuO6k.d.ts → mod-dxOnKp2Y.d.cts} +4 -5
  51. package/dist/mod.cjs +4 -4
  52. package/dist/mod.d.cts +9 -8
  53. package/dist/mod.d.ts +9 -10
  54. package/dist/mod.js +9 -9
  55. package/dist/nodeinfo/handler.test.mjs +1 -1
  56. package/dist/nodeinfo/mod.d.cts +2 -1
  57. package/dist/nodeinfo/mod.d.ts +2 -3
  58. package/dist/nodeinfo/mod.js +3 -3
  59. package/dist/otel/mod.d.cts +2 -1
  60. package/dist/otel/mod.d.ts +2 -3
  61. package/dist/otel/mod.js +2 -2
  62. package/dist/{owner-CptqhsOy.d.cts → owner-CnngXDNJ.d.ts} +2 -1
  63. package/dist/{owner-74ARJ5TL.d.ts → owner-DEvZuyOE.d.cts} +2 -3
  64. package/dist/{owner-BceqCVOs.mjs → owner-DzcnuWYo.mjs} +2 -2
  65. package/dist/{proof-4NUQlbQV.js → proof-CtTT8A7y.js} +299 -5
  66. package/dist/{proof-BojC8L94.mjs → proof-DmVGi7mI.mjs} +2 -2
  67. package/dist/{proof-kuTIVfyZ.cjs → proof-JEoW3ODq.cjs} +345 -3
  68. package/dist/runtime/mod.d.cts +1 -0
  69. package/dist/runtime/mod.d.ts +1 -2
  70. package/dist/runtime/mod.js +3 -3
  71. package/dist/{send-Buz5Gy8x.mjs → send-5ulOKVCW.mjs} +2 -2
  72. package/dist/sig/http.test.mjs +120 -2
  73. package/dist/sig/key.test.mjs +1 -1
  74. package/dist/sig/ld.test.mjs +558 -2
  75. package/dist/sig/mod.cjs +2 -2
  76. package/dist/sig/mod.d.cts +4 -3
  77. package/dist/sig/mod.d.ts +4 -5
  78. package/dist/sig/mod.js +4 -4
  79. package/dist/sig/owner.test.mjs +1 -1
  80. package/dist/sig/proof.test.mjs +1 -1
  81. package/dist/temporal-CmJkd-25.mjs +95 -0
  82. package/dist/testing/mod.d.mts +48 -6
  83. package/dist/{transformers-ve6e2xcg.js → transformers-BGMIq1cs.js} +2 -2
  84. package/dist/{types-hvL8ElAs.js → types-CAY3OdLq.js} +2 -2
  85. package/dist/utils/docloader.test.mjs +2 -2
  86. package/dist/utils/kv-cache.test.mjs +1 -1
  87. package/dist/utils/mod.cjs +1 -1
  88. package/dist/utils/mod.d.cts +2 -1
  89. package/dist/utils/mod.d.ts +2 -3
  90. package/dist/utils/mod.js +3 -3
  91. package/dist/vocab/mod.d.cts +1 -0
  92. package/dist/vocab/mod.d.ts +1 -2
  93. package/dist/vocab/mod.js +2 -2
  94. package/package.json +7 -7
  95. package/dist/ld-OBpaLfHR.mjs +0 -256
  96. /package/dist/{retry-B_E3V_Dx.mjs → retry-CJL0poaU.mjs} +0 -0
@@ -1,9 +1,8 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
3
- import { S as KeyCache } from "./http-aQzN9Ayi.js";
1
+ /// <reference lib="esnext.temporal" />
2
+ import { S as KeyCache } from "./http-C87EWkO0.cjs";
4
3
  import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "@fedify/vocab";
5
- import { TracerProvider } from "@opentelemetry/api";
6
4
  import { DocumentLoader } from "@fedify/vocab-runtime";
5
+ import { TracerProvider } from "@opentelemetry/api";
7
6
 
8
7
  //#region src/sig/ld.d.ts
9
8
  /**
@@ -1,9 +1,8 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
3
- import { n as HttpMessageSignaturesSpecDeterminer } from "./http-aQzN9Ayi.js";
4
- import { n as KvStore, t as KvKey } from "./kv-GFYnFoOl.js";
5
- import { TracerProvider } from "@opentelemetry/api";
1
+ /// <reference lib="esnext.temporal" />
2
+ import { n as HttpMessageSignaturesSpecDeterminer } from "./http-C87EWkO0.cjs";
3
+ import { n as KvStore, t as KvKey } from "./kv-gJ8LYbxX.cjs";
6
4
  import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
5
+ import { TracerProvider } from "@opentelemetry/api";
7
6
 
8
7
  //#region src/utils/docloader.d.ts
9
8
  /**
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-CmDErAnD.cjs");
8
- const require_middleware = require("./middleware-DFcgN1cH.cjs");
9
- const require_proof = require("./proof-kuTIVfyZ.cjs");
7
+ const require_http = require("./http-CEXtUHix.cjs");
8
+ const require_middleware = require("./middleware-BcbU5lKS.cjs");
9
+ const require_proof = require("./proof-JEoW3ODq.cjs");
10
10
  const require_types = require("./types-KC4QAoxe.cjs");
11
- const require_kv_cache = require("./kv-cache-9cdQDeT0.cjs");
11
+ const require_kv_cache = require("./kv-cache-BIapFiSV.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.d.cts CHANGED
@@ -1,12 +1,13 @@
1
- import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-z-8dc-e1.cjs";
2
- import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-CrGuipxe.cjs";
3
- import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-CptqhsOy.cjs";
4
- import { $ as ActorKeyPairsDispatcher, A as createFederation, B as RouterRouteResult, C as InboxChallengePolicy, Ct as ActivityTransformer, D as FederationKvPrefixes, E as Rfc6570Expression, F as Message, G as InProcessMessageQueueOptions, H as respondWithObject, I as createFederationBuilder, J as MessageQueueListenOptions, K as MessageQueue, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as ActorHandleMapper, R as RouterError, S as IdempotencyStrategy, St as digest, T as ObjectCallbackSetters, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as InProcessMessageQueue, X as ActorAliasMapper, Y as ParallelMessageQueue, Z as ActorDispatcher, _ as FederationBuilder, _t as WebFingerLinksDispatcher, a as InboxContext, at as CustomCollectionCursor, b as FederationStartQueueOptions, bt as PageItems, c as RouteActivityOptions, ct as InboxListener, d as ActorCallbackSetters, dt as ObjectDispatcher, et as AuthorizePredicate, f as CollectionCallbackSetters, ft as OutboxErrorHandler, g as Federation, gt as UnverifiedActivityReason, h as Federatable, ht as UnverifiedActivityHandler, i as GetSignedKeyOptions, it as CustomCollectionCounter, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as NodeInfoDispatcher, m as CustomCollectionCallbackSetters, mt as SharedInboxKeyDispatcher, n as Context, nt as CollectionCursor, o as ParseUriResult, ot as CustomCollectionDispatcher, p as ConstructorWithTypeId, pt as OutboxPermanentFailureHandler, q as MessageQueueEnqueueOptions, r as ForwardActivityOptions, rt as CollectionDispatcher, s as RequestContext, st as InboxErrorHandler, t as ActorKeyPair, tt as CollectionCounter, u as SendActivityOptionsForCollection, ut as ObjectAuthorizePredicate, v as FederationFetchOptions, vt as SendActivityError, w as InboxListenerSetters, x as IdempotencyKeyCallback, xt as buildCollectionSynchronizationHeader, y as FederationOptions, yt as SenderKeyPair, z as RouterOptions } from "./context-LmrZPwti.cjs";
5
- import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-CbLNp3zQ.cjs";
1
+ /// <reference lib="esnext.temporal" />
2
+ import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-CAM_bQXx.cjs";
3
+ import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-C87EWkO0.cjs";
4
+ import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-DEvZuyOE.cjs";
5
+ import { $ as ActorKeyPairsDispatcher, A as createFederation, B as RouterRouteResult, C as InboxChallengePolicy, Ct as ActivityTransformer, D as FederationKvPrefixes, E as Rfc6570Expression, F as Message, G as InProcessMessageQueueOptions, H as respondWithObject, I as createFederationBuilder, J as MessageQueueListenOptions, K as MessageQueue, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as ActorHandleMapper, R as RouterError, S as IdempotencyStrategy, St as digest, T as ObjectCallbackSetters, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as InProcessMessageQueue, X as ActorAliasMapper, Y as ParallelMessageQueue, Z as ActorDispatcher, _ as FederationBuilder, _t as WebFingerLinksDispatcher, a as InboxContext, at as CustomCollectionCursor, b as FederationStartQueueOptions, bt as PageItems, c as RouteActivityOptions, ct as InboxListener, d as ActorCallbackSetters, dt as ObjectDispatcher, et as AuthorizePredicate, f as CollectionCallbackSetters, ft as OutboxErrorHandler, g as Federation, gt as UnverifiedActivityReason, h as Federatable, ht as UnverifiedActivityHandler, i as GetSignedKeyOptions, it as CustomCollectionCounter, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as NodeInfoDispatcher, m as CustomCollectionCallbackSetters, mt as SharedInboxKeyDispatcher, n as Context, nt as CollectionCursor, o as ParseUriResult, ot as CustomCollectionDispatcher, p as ConstructorWithTypeId, pt as OutboxPermanentFailureHandler, q as MessageQueueEnqueueOptions, r as ForwardActivityOptions, rt as CollectionDispatcher, s as RequestContext, st as InboxErrorHandler, t as ActorKeyPair, tt as CollectionCounter, u as SendActivityOptionsForCollection, ut as ObjectAuthorizePredicate, v as FederationFetchOptions, vt as SendActivityError, w as InboxListenerSetters, x as IdempotencyKeyCallback, xt as buildCollectionSynchronizationHeader, y as FederationOptions, yt as SenderKeyPair, z as RouterOptions } from "./context-o22vjzS2.cjs";
6
+ import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-gJ8LYbxX.cjs";
6
7
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
7
- import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-Cgpc49fA.cjs";
8
- import { _ as verifyJsonLd, a as createProof, c as verifyProof, d as VerifyJsonLdOptions, f as VerifySignatureOptions, g as signJsonLd, h as detachSignature, i as VerifyProofOptions, l as CreateSignatureOptions, m as createSignature, n as SignObjectOptions, o as signObject, p as attachSignature, r as VerifyObjectOptions, s as verifyObject, t as CreateProofOptions, u as SignJsonLdOptions, v as verifySignature } from "./mod-DoJBjjnO.cjs";
9
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-B505FZBC.cjs";
8
+ import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-0dF0OeGw.cjs";
9
+ import { _ as verifyJsonLd, a as createProof, c as verifyProof, d as VerifyJsonLdOptions, f as VerifySignatureOptions, g as signJsonLd, h as detachSignature, i as VerifyProofOptions, l as CreateSignatureOptions, m as createSignature, n as SignObjectOptions, o as signObject, p as attachSignature, r as VerifyObjectOptions, s as verifyObject, t as CreateProofOptions, u as SignJsonLdOptions, v as verifySignature } from "./mod-D5YlzzP3.cjs";
10
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-dxOnKp2Y.cjs";
10
11
  export * from "@fedify/vocab-runtime";
11
12
 
12
13
  //#region src/mod.d.ts
package/dist/mod.d.ts CHANGED
@@ -1,14 +1,13 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
3
- import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-AtlibPOU.js";
4
- import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-aQzN9Ayi.js";
5
- import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-74ARJ5TL.js";
6
- import { $ as ActorKeyPairsDispatcher, A as createFederation, B as RouterRouteResult, C as InboxChallengePolicy, Ct as ActivityTransformer, D as FederationKvPrefixes, E as Rfc6570Expression, F as Message, G as InProcessMessageQueueOptions, H as respondWithObject, I as createFederationBuilder, J as MessageQueueListenOptions, K as MessageQueue, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as ActorHandleMapper, R as RouterError, S as IdempotencyStrategy, St as digest, T as ObjectCallbackSetters, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as InProcessMessageQueue, X as ActorAliasMapper, Y as ParallelMessageQueue, Z as ActorDispatcher, _ as FederationBuilder, _t as WebFingerLinksDispatcher, a as InboxContext, at as CustomCollectionCursor, b as FederationStartQueueOptions, bt as PageItems, c as RouteActivityOptions, ct as InboxListener, d as ActorCallbackSetters, dt as ObjectDispatcher, et as AuthorizePredicate, f as CollectionCallbackSetters, ft as OutboxErrorHandler, g as Federation, gt as UnverifiedActivityReason, h as Federatable, ht as UnverifiedActivityHandler, i as GetSignedKeyOptions, it as CustomCollectionCounter, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as NodeInfoDispatcher, m as CustomCollectionCallbackSetters, mt as SharedInboxKeyDispatcher, n as Context, nt as CollectionCursor, o as ParseUriResult, ot as CustomCollectionDispatcher, p as ConstructorWithTypeId, pt as OutboxPermanentFailureHandler, q as MessageQueueEnqueueOptions, r as ForwardActivityOptions, rt as CollectionDispatcher, s as RequestContext, st as InboxErrorHandler, t as ActorKeyPair, tt as CollectionCounter, u as SendActivityOptionsForCollection, ut as ObjectAuthorizePredicate, v as FederationFetchOptions, vt as SendActivityError, w as InboxListenerSetters, x as IdempotencyKeyCallback, xt as buildCollectionSynchronizationHeader, y as FederationOptions, yt as SenderKeyPair, z as RouterOptions } from "./context-C0fssarc.js";
7
- import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-GFYnFoOl.js";
1
+ /// <reference lib="esnext.temporal" />
2
+ import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "./client-CSddvgWN.js";
3
+ import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "./http-BDZeS5om.js";
4
+ import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-CnngXDNJ.js";
5
+ import { $ as ActorKeyPairsDispatcher, A as createFederation, B as RouterRouteResult, C as InboxChallengePolicy, Ct as ActivityTransformer, D as FederationKvPrefixes, E as Rfc6570Expression, F as Message, G as InProcessMessageQueueOptions, H as respondWithObject, I as createFederationBuilder, J as MessageQueueListenOptions, K as MessageQueue, L as Router, M as RetryContext, N as RetryPolicy, O as FederationOrigin, P as createExponentialBackoffPolicy, Q as ActorHandleMapper, R as RouterError, S as IdempotencyStrategy, St as digest, T as ObjectCallbackSetters, U as respondWithObjectIfAcceptable, V as RespondWithObjectOptions, W as InProcessMessageQueue, X as ActorAliasMapper, Y as ParallelMessageQueue, Z as ActorDispatcher, _ as FederationBuilder, _t as WebFingerLinksDispatcher, a as InboxContext, at as CustomCollectionCursor, b as FederationStartQueueOptions, bt as PageItems, c as RouteActivityOptions, ct as InboxListener, d as ActorCallbackSetters, dt as ObjectDispatcher, et as AuthorizePredicate, f as CollectionCallbackSetters, ft as OutboxErrorHandler, g as Federation, gt as UnverifiedActivityReason, h as Federatable, ht as UnverifiedActivityHandler, i as GetSignedKeyOptions, it as CustomCollectionCounter, j as CreateExponentialBackoffPolicyOptions, k as FederationQueueOptions, l as SendActivityOptions, lt as NodeInfoDispatcher, m as CustomCollectionCallbackSetters, mt as SharedInboxKeyDispatcher, n as Context, nt as CollectionCursor, o as ParseUriResult, ot as CustomCollectionDispatcher, p as ConstructorWithTypeId, pt as OutboxPermanentFailureHandler, q as MessageQueueEnqueueOptions, r as ForwardActivityOptions, rt as CollectionDispatcher, s as RequestContext, st as InboxErrorHandler, t as ActorKeyPair, tt as CollectionCounter, u as SendActivityOptionsForCollection, ut as ObjectAuthorizePredicate, v as FederationFetchOptions, vt as SendActivityError, w as InboxListenerSetters, x as IdempotencyKeyCallback, xt as buildCollectionSynchronizationHeader, y as FederationOptions, yt as SenderKeyPair, z as RouterOptions } from "./context-_l9t359k.js";
6
+ import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-D6hNiMTK.js";
8
7
  import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
9
- import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-CnwZoDzx.js";
10
- import { _ as verifyJsonLd, a as createProof, c as verifyProof, d as VerifyJsonLdOptions, f as VerifySignatureOptions, g as signJsonLd, h as detachSignature, i as VerifyProofOptions, l as CreateSignatureOptions, m as createSignature, n as SignObjectOptions, o as signObject, p as attachSignature, r as VerifyObjectOptions, s as verifyObject, t as CreateProofOptions, u as SignJsonLdOptions, v as verifySignature } from "./mod-DvxszxXC.js";
11
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-D7PAuO6k.js";
8
+ import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-Bv1elC-b.js";
9
+ import { _ as verifyJsonLd, a as createProof, c as verifyProof, d as VerifyJsonLdOptions, f as VerifySignatureOptions, g as signJsonLd, h as detachSignature, i as VerifyProofOptions, l as CreateSignatureOptions, m as createSignature, n as SignObjectOptions, o as signObject, p as attachSignature, r as VerifyObjectOptions, s as verifyObject, t as CreateProofOptions, u as SignJsonLdOptions, v as verifySignature } from "./mod-CjiK2zrW.js";
10
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-BTWFtZwa.js";
12
11
  export * from "@fedify/vocab-runtime";
13
12
 
14
13
  //#region src/mod.d.ts
package/dist/mod.js CHANGED
@@ -1,13 +1,13 @@
1
- import "@js-temporal/polyfill";
2
- import "urlpattern-polyfill";
3
- import "./chunk-nlSIicah.js";
4
- import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-ve6e2xcg.js";
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";
3
+ import "./chunk-CRNNMoPX.js";
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 verifyRequestDetailed, c as fetchKeyDetailed, f as formatAcceptSignature, h as validateAcceptSignature, i as verifyRequest, l as generateCryptoKeyPair, m as parseAcceptSignature, o as exportJwk, p as fulfillAcceptSignature, r as signRequest, s as fetchKey, u as importJwk } from "./http-qKyJKSnF.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-UThUK30x.js";
8
- import { a as doesActorOwnKey, c as createSignature, d as signJsonLd, f as verifyJsonLd, i as verifyProof, l as detachSignature, n as signObject, o as getKeyOwner, p as verifySignature, r as verifyObject, s as attachSignature, t as createProof } from "./proof-4NUQlbQV.js";
9
- import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-hvL8ElAs.js";
10
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-DNNRFY8u.js";
6
+ import { a as verifyRequestDetailed, c as fetchKeyDetailed, f as formatAcceptSignature, h as validateAcceptSignature, i as verifyRequest, l as generateCryptoKeyPair, m as parseAcceptSignature, o as exportJwk, p as fulfillAcceptSignature, r as signRequest, s as fetchKey, u as importJwk } from "./http-Cw1EorUA.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-0vceVN10.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-CtTT8A7y.js";
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-C6nynGhh.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-tL2TOE9X.mjs";
8
- import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-DDsnRvFC.mjs";
8
+ import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-DmT9t0BJ.mjs";
9
9
  import { test } from "@fedify/fixture";
10
10
  //#region src/nodeinfo/handler.test.ts
11
11
  test("handleNodeInfo()", async () => {
@@ -1,2 +1,3 @@
1
- import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "../client-z-8dc-e1.cjs";
1
+ /// <reference lib="esnext.temporal" />
2
+ import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "../client-CAM_bQXx.cjs";
2
3
  export { type GetNodeInfoOptions, InboundService, JsonValue, NodeInfo, OutboundService, type ParseNodeInfoOptions, Protocol, Services, Software, Usage, getNodeInfo, nodeInfoToJson, parseNodeInfo };
@@ -1,4 +1,3 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
3
- import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "../client-AtlibPOU.js";
1
+ /// <reference lib="esnext.temporal" />
2
+ import { a as InboundService, c as OutboundService, d as Software, f as Usage, i as parseNodeInfo, l as Protocol, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "../client-CSddvgWN.js";
4
3
  export { type GetNodeInfoOptions, InboundService, JsonValue, NodeInfo, OutboundService, type ParseNodeInfoOptions, Protocol, Services, Software, Usage, getNodeInfo, nodeInfoToJson, parseNodeInfo };
@@ -1,4 +1,4 @@
1
- import "@js-temporal/polyfill";
2
- import "urlpattern-polyfill";
3
- import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "../types-hvL8ElAs.js";
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";
3
+ import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "../types-CAY3OdLq.js";
4
4
  export { getNodeInfo, nodeInfoToJson, parseNodeInfo };
@@ -1,4 +1,5 @@
1
- import { n as KvStore, t as KvKey } from "../kv-CbLNp3zQ.cjs";
1
+ /// <reference lib="esnext.temporal" />
2
+ import { n as KvStore, t as KvKey } from "../kv-gJ8LYbxX.cjs";
2
3
  import { ReadableSpan, SpanExporter } from "@opentelemetry/sdk-trace-base";
3
4
  import { ExportResultCode } from "@opentelemetry/core";
4
5
 
@@ -1,6 +1,5 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
3
- import { n as KvStore, t as KvKey } from "../kv-GFYnFoOl.js";
1
+ /// <reference lib="esnext.temporal" />
2
+ import { n as KvStore, t as KvKey } from "../kv-D6hNiMTK.js";
4
3
  import { ExportResultCode } from "@opentelemetry/core";
5
4
  import { ReadableSpan, SpanExporter } from "@opentelemetry/sdk-trace-base";
6
5
 
package/dist/otel/mod.js CHANGED
@@ -1,5 +1,5 @@
1
- import "@js-temporal/polyfill";
2
- import "urlpattern-polyfill";
1
+ import { Temporal } from "@js-temporal/polyfill";
2
+ import { URLPattern } from "urlpattern-polyfill";
3
3
  import { getLogger } from "@logtape/logtape";
4
4
  import { ExportResultCode } from "@opentelemetry/core";
5
5
  //#region src/otel/exporter.ts
@@ -1,6 +1,7 @@
1
+ /// <reference lib="esnext.temporal" />
1
2
  import { Activity, Actor, CryptographicKey } from "@fedify/vocab";
2
- import { DocumentLoader } from "@fedify/vocab-runtime";
3
3
  import { TracerProvider } from "@opentelemetry/api";
4
+ import { DocumentLoader } from "@fedify/vocab-runtime";
4
5
 
5
6
  //#region src/sig/owner.d.ts
6
7
  /**
@@ -1,8 +1,7 @@
1
- import { Temporal } from "@js-temporal/polyfill";
2
- import { URLPattern } from "urlpattern-polyfill";
1
+ /// <reference lib="esnext.temporal" />
3
2
  import { Activity, Actor, CryptographicKey } from "@fedify/vocab";
4
- import { TracerProvider } from "@opentelemetry/api";
5
3
  import { DocumentLoader } from "@fedify/vocab-runtime";
4
+ import { TracerProvider } from "@opentelemetry/api";
6
5
 
7
6
  //#region src/sig/owner.d.ts
8
7
  /**
@@ -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-Ddb3P7G7.mjs";
5
- import "./key-WSedbAA-.mjs";
4
+ import { n as version, t as name } from "./deno-bqnW1QlD.mjs";
5
+ import "./key-B3OBz6A_.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,6 +1,6 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
- import "urlpattern-polyfill";
3
- import { _ as version, d as validateCryptoKey, g as name, s as fetchKey } from "./http-qKyJKSnF.js";
2
+ import { URLPattern } from "urlpattern-polyfill";
3
+ import { _ as version, d as validateCryptoKey, g as name, s as fetchKey } from "./http-Cw1EorUA.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";
@@ -15,6 +15,288 @@ const logger$1 = getLogger([
15
15
  "sig",
16
16
  "ld"
17
17
  ]);
18
+ const localContext = [
19
+ "https://w3id.org/identity/v1",
20
+ "https://www.w3.org/ns/activitystreams",
21
+ "https://w3id.org/security/v1",
22
+ "https://w3id.org/security/data-integrity/v1"
23
+ ];
24
+ const localContextUrls = new Set(localContext);
25
+ const builtInContextLoader = getDocumentLoader();
26
+ const disallowedJsonLdKeywords = new Set([
27
+ "@graph",
28
+ "@included",
29
+ "@reverse"
30
+ ]);
31
+ /** @internal */
32
+ var UnsafeJsonLdError = class extends TypeError {
33
+ constructor(keyword) {
34
+ super(`Unsupported JSON-LD keyword: ${keyword}.`);
35
+ this.keyword = keyword;
36
+ this.name = "UnsafeJsonLdError";
37
+ }
38
+ };
39
+ /** @internal */
40
+ var InvalidContextReferenceError = class extends TypeError {
41
+ constructor(reference) {
42
+ super(`Invalid JSON-LD context reference: ${reference}.`);
43
+ this.reference = reference;
44
+ this.name = "InvalidContextReferenceError";
45
+ }
46
+ };
47
+ function createLoadingRemoteContextFailedError(reference, cause) {
48
+ const message = cause instanceof Error ? cause.message : String(cause);
49
+ const error = /* @__PURE__ */ new Error(`Dereferencing a URL did not result in a valid JSON-LD context: ${reference}. ${message}`);
50
+ error.name = "jsonld.InvalidUrl";
51
+ error.details = {
52
+ code: "loading remote context failed",
53
+ url: reference
54
+ };
55
+ error.cause = cause;
56
+ return error;
57
+ }
58
+ /** @internal */
59
+ function isClearlyMalformedContextReference(reference) {
60
+ for (const char of reference) {
61
+ const code = char.charCodeAt(0);
62
+ if (code <= 32 || code === 127) return true;
63
+ }
64
+ if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(reference) && !URL.canParse(reference)) return true;
65
+ for (let i = 0; i < reference.length; i++) {
66
+ if (reference[i] !== "%") continue;
67
+ if (i + 2 >= reference.length || !/[0-9A-Fa-f]/.test(reference[i + 1]) || !/[0-9A-Fa-f]/.test(reference[i + 2])) return true;
68
+ i += 2;
69
+ }
70
+ if (reference.startsWith("./") || reference.startsWith("../") || reference.startsWith("/") || reference.startsWith("//")) {
71
+ for (const char of reference) if ("[]<>\"\\^`{|}".includes(char)) return true;
72
+ }
73
+ return false;
74
+ }
75
+ function cloneRemoteDocument(remoteDocument) {
76
+ return structuredClone(remoteDocument);
77
+ }
78
+ function createMemoizedDocumentLoader(documentLoader) {
79
+ const cache = /* @__PURE__ */ new Map();
80
+ return async (url, options) => {
81
+ const cacheKey = URL.canParse(url) ? new URL(url).href : url;
82
+ let remoteDocument = cache.get(cacheKey);
83
+ if (remoteDocument == null) {
84
+ remoteDocument = Promise.resolve(documentLoader(url, options)).then(cloneRemoteDocument);
85
+ remoteDocument.catch(() => {
86
+ if (cache.get(cacheKey) === remoteDocument) cache.delete(cacheKey);
87
+ });
88
+ cache.set(cacheKey, remoteDocument);
89
+ }
90
+ return cloneRemoteDocument(await remoteDocument);
91
+ };
92
+ }
93
+ /** @internal */
94
+ function wrapContextLoaderForJsonLd(contextLoader) {
95
+ const loader = contextLoader ?? builtInContextLoader;
96
+ return async (url, options) => {
97
+ try {
98
+ return await loader(url, options);
99
+ } catch (error) {
100
+ if (!isInvalidUrlTypeError(error)) throw error;
101
+ if (isClearlyMalformedContextReference(url)) throw new InvalidContextReferenceError(url);
102
+ throw createLoadingRemoteContextFailedError(url, error);
103
+ }
104
+ };
105
+ }
106
+ /** @internal */
107
+ function getNormalizationContextLoader(contextLoader) {
108
+ const loader = wrapContextLoaderForJsonLd(contextLoader);
109
+ return createMemoizedDocumentLoader(async (url, options) => {
110
+ if (URL.canParse(url)) {
111
+ const normalizedUrl = new URL(url).href;
112
+ if (localContextUrls.has(normalizedUrl)) return await builtInContextLoader(normalizedUrl, options);
113
+ }
114
+ return await loader(url, options);
115
+ });
116
+ }
117
+ /** @internal */
118
+ async function compactJsonLd(jsonLd, contextLoader) {
119
+ const hasLds = typeof jsonLd === "object" && jsonLd != null && "signature" in jsonLd;
120
+ const signature = hasLds ? jsonLd.signature : void 0;
121
+ const normalizationContextLoader = getNormalizationContextLoader(contextLoader);
122
+ const document = hasLds ? detachSignature(jsonLd) : jsonLd;
123
+ await assertNoGraphBeforeCompaction(document, normalizationContextLoader);
124
+ const compacted = await jsonld.compact(document, localContext, { documentLoader: normalizationContextLoader });
125
+ if (hasLds && typeof compacted === "object" && compacted != null) compacted.signature = signature;
126
+ assertSafeJsonLd(compacted);
127
+ return compacted;
128
+ }
129
+ function createInvalidRemoteContextError(reference) {
130
+ const error = /* @__PURE__ */ new Error(`Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object. URL: "${reference}".`);
131
+ error.name = "jsonld.InvalidUrl";
132
+ error.details = {
133
+ code: "invalid remote context",
134
+ url: reference
135
+ };
136
+ return error;
137
+ }
138
+ function getRemoteContext(remoteDocument, reference) {
139
+ const { contextUrl, documentUrl } = remoteDocument;
140
+ let { document } = remoteDocument;
141
+ if (typeof document === "string") document = JSON.parse(document);
142
+ if (typeof document !== "object" || document == null || Array.isArray(document)) throw createInvalidRemoteContextError(reference);
143
+ let context = "@context" in document ? document["@context"] : {};
144
+ if (contextUrl != null) context = Array.isArray(context) ? [...context, contextUrl] : [context, contextUrl];
145
+ return {
146
+ context,
147
+ baseUrl: documentUrl ?? reference
148
+ };
149
+ }
150
+ function createGraphAliasContextState() {
151
+ return {
152
+ graphTerms: /* @__PURE__ */ new Set(),
153
+ jsonTerms: /* @__PURE__ */ new Set(),
154
+ propertyContexts: /* @__PURE__ */ new Map(),
155
+ termTargets: /* @__PURE__ */ new Map()
156
+ };
157
+ }
158
+ function cloneGraphAliasContextState(state) {
159
+ return {
160
+ graphTerms: new Set(state.graphTerms),
161
+ jsonTerms: new Set(state.jsonTerms),
162
+ propertyContexts: new Map(state.propertyContexts),
163
+ termTargets: new Map(state.termTargets)
164
+ };
165
+ }
166
+ function resolveContextTarget(target, state) {
167
+ if (target === "@graph") return target;
168
+ const mapped = state.termTargets.get(target);
169
+ if (mapped == null) return target;
170
+ return mapped;
171
+ }
172
+ function getDirectContextTarget(definition) {
173
+ if (definition === null) return null;
174
+ if (typeof definition === "string") return definition;
175
+ if (typeof definition === "object" && definition != null && "@id" in definition) {
176
+ const id = definition["@id"];
177
+ if (id === null) return null;
178
+ if (typeof id === "string") return id;
179
+ }
180
+ }
181
+ function isJsonTypedDefinition(definition) {
182
+ return typeof definition === "object" && definition != null && "@type" in definition && definition["@type"] === "@json";
183
+ }
184
+ function resolveLocalContextTarget(target, state, localTargets, seen = /* @__PURE__ */ new Set()) {
185
+ if (target === "@graph") return target;
186
+ if (seen.has(target)) return target;
187
+ seen.add(target);
188
+ if (localTargets.has(target)) {
189
+ const localTarget = localTargets.get(target);
190
+ return localTarget == null ? target : resolveLocalContextTarget(localTarget, state, localTargets, seen);
191
+ }
192
+ return resolveContextTarget(target, state);
193
+ }
194
+ function refreshGraphAliases(state) {
195
+ state.graphTerms.clear();
196
+ for (const [term, target] of state.termTargets) if (target === "@graph") state.graphTerms.add(term);
197
+ }
198
+ function normalizeContextReference(reference, baseUrl) {
199
+ if (baseUrl != null) return new URL(reference, baseUrl).href;
200
+ return URL.canParse(reference) ? new URL(reference).href : reference;
201
+ }
202
+ /** @internal */
203
+ function isInvalidUrlTypeError(error) {
204
+ const code = error.code;
205
+ return error instanceof TypeError && (code === "ERR_INVALID_URL" || /^Invalid URL(?::|$)/.test(error.message) || / cannot be parsed as a URL\.?$/.test(error.message));
206
+ }
207
+ async function applyGraphAliasContext(state, context, documentLoader, remoteContextCache, baseUrl = null, processingContexts = /* @__PURE__ */ new Set()) {
208
+ if (context === null) return createGraphAliasContextState();
209
+ let nextState = cloneGraphAliasContextState(state);
210
+ if (Array.isArray(context)) {
211
+ for (const item of context) nextState = await applyGraphAliasContext(nextState, item, documentLoader, remoteContextCache, baseUrl, processingContexts);
212
+ return nextState;
213
+ }
214
+ if (typeof context === "string") {
215
+ const reference = normalizeContextReference(context, baseUrl);
216
+ const cacheKey = `${baseUrl ?? ""}\n${reference}`;
217
+ if (processingContexts.has(cacheKey)) return nextState;
218
+ processingContexts.add(cacheKey);
219
+ try {
220
+ let remoteContext = remoteContextCache.get(cacheKey);
221
+ if (remoteContext == null) {
222
+ remoteContext = (async () => {
223
+ try {
224
+ return getRemoteContext(await documentLoader(reference), reference);
225
+ } catch (error) {
226
+ if (reference === context && isInvalidUrlTypeError(error) && isClearlyMalformedContextReference(context)) throw new InvalidContextReferenceError(context);
227
+ throw error;
228
+ }
229
+ })();
230
+ remoteContextCache.set(cacheKey, remoteContext);
231
+ }
232
+ const loadedRemoteContext = await remoteContext;
233
+ return await applyGraphAliasContext(nextState, loadedRemoteContext.context, documentLoader, remoteContextCache, loadedRemoteContext.baseUrl, processingContexts);
234
+ } finally {
235
+ processingContexts.delete(cacheKey);
236
+ }
237
+ }
238
+ if (typeof context === "object" && context != null) {
239
+ if ("@import" in context && typeof context["@import"] === "string") nextState = await applyGraphAliasContext(nextState, context["@import"], documentLoader, remoteContextCache, baseUrl, processingContexts);
240
+ const localTargets = /* @__PURE__ */ new Map();
241
+ for (const [term, definition] of globalThis.Object.entries(context)) {
242
+ if (term.startsWith("@")) continue;
243
+ const target = getDirectContextTarget(definition);
244
+ if (target == null) localTargets.set(term, null);
245
+ else if (typeof target === "string") localTargets.set(term, target);
246
+ else localTargets.delete(term);
247
+ }
248
+ for (const [term, definition] of globalThis.Object.entries(context)) {
249
+ if (term.startsWith("@")) continue;
250
+ if (localTargets.has(term)) {
251
+ const directTarget = localTargets.get(term);
252
+ if (directTarget == null) nextState.termTargets.set(term, null);
253
+ else nextState.termTargets.set(term, resolveLocalContextTarget(directTarget, nextState, localTargets));
254
+ } else nextState.termTargets.delete(term);
255
+ if (typeof definition === "object" && definition != null && "@context" in definition) nextState.propertyContexts.set(term, {
256
+ context: definition["@context"],
257
+ baseUrl
258
+ });
259
+ else nextState.propertyContexts.delete(term);
260
+ if (isJsonTypedDefinition(definition)) nextState.jsonTerms.add(term);
261
+ else nextState.jsonTerms.delete(term);
262
+ }
263
+ refreshGraphAliases(nextState);
264
+ }
265
+ return nextState;
266
+ }
267
+ async function assertNoGraphBeforeCompaction(jsonLd, documentLoader, inheritedState = createGraphAliasContextState(), propertyContext, remoteContextCache = /* @__PURE__ */ new Map()) {
268
+ if (Array.isArray(jsonLd)) {
269
+ for (const item of jsonLd) await assertNoGraphBeforeCompaction(item, documentLoader, inheritedState, propertyContext, remoteContextCache);
270
+ return;
271
+ }
272
+ if (typeof jsonLd !== "object" || jsonLd == null) return;
273
+ const jsonLiteralWrapper = isJsonLiteralWrapper(jsonLd);
274
+ let state = inheritedState;
275
+ if (propertyContext !== void 0) state = await applyGraphAliasContext(state, propertyContext.context, documentLoader, remoteContextCache, propertyContext.baseUrl);
276
+ if ("@context" in jsonLd) state = await applyGraphAliasContext(state, jsonLd["@context"], documentLoader, remoteContextCache);
277
+ for (const [key, value] of globalThis.Object.entries(jsonLd)) {
278
+ if (key === "@context") continue;
279
+ if (jsonLiteralWrapper && key === "@value") continue;
280
+ if (key === "@graph" || state.graphTerms.has(key)) throw new UnsafeJsonLdError("@graph");
281
+ if (state.jsonTerms.has(key)) continue;
282
+ await assertNoGraphBeforeCompaction(value, documentLoader, state, state.propertyContexts.get(key), remoteContextCache);
283
+ }
284
+ }
285
+ function isJsonLiteralWrapper(value) {
286
+ return "@value" in value && (value["@type"] === "@json" || value.type === "@json");
287
+ }
288
+ /** @internal */
289
+ function assertSafeJsonLd(jsonLd) {
290
+ if (Array.isArray(jsonLd)) for (const item of jsonLd) assertSafeJsonLd(item);
291
+ else if (typeof jsonLd === "object" && jsonLd != null) {
292
+ const jsonLiteralWrapper = isJsonLiteralWrapper(jsonLd);
293
+ for (const [key, value] of globalThis.Object.entries(jsonLd)) {
294
+ if (disallowedJsonLdKeywords.has(key)) throw new UnsafeJsonLdError(key);
295
+ if (jsonLiteralWrapper && key === "@value") continue;
296
+ assertSafeJsonLd(value);
297
+ }
298
+ }
299
+ }
18
300
  /**
19
301
  * Attaches a LD signature to the given JSON-LD document.
20
302
  * @param jsonLd The JSON-LD document to attach the signature to. It is not
@@ -208,9 +490,21 @@ async function verifySignature(jsonLd, options = {}) {
208
490
  * @returns `true` if the document is authentic; `false` otherwise.
209
491
  */
210
492
  async function verifyJsonLd(jsonLd, options = {}) {
493
+ return await verifyJsonLdInternal(jsonLd, options, true);
494
+ }
495
+ /** @internal */
496
+ async function verifyCompactJsonLd(jsonLd, options = {}) {
497
+ return await verifyJsonLdInternal(jsonLd, options, false);
498
+ }
499
+ async function verifyJsonLdInternal(jsonLd, options, compact) {
211
500
  return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("ld_signatures.verify", async (span) => {
212
501
  try {
213
- const object = await Object$1.fromJsonLd(jsonLd, options);
502
+ const verificationOptions = hasSignature(jsonLd) ? {
503
+ ...options,
504
+ contextLoader: getNormalizationContextLoader(options.contextLoader)
505
+ } : options;
506
+ const compacted = compact ? hasSignature(jsonLd) ? await compactJsonLd(jsonLd, options.contextLoader) : jsonLd : jsonLd;
507
+ const object = await Object$1.fromJsonLd(compacted, verificationOptions);
214
508
  if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
215
509
  span.setAttribute("activitypub.object.type", getTypeId(object).href);
216
510
  if (typeof jsonLd === "object" && jsonLd != null && "signature" in jsonLd && typeof jsonLd.signature === "object" && jsonLd.signature != null) {
@@ -220,7 +514,7 @@ async function verifyJsonLd(jsonLd, options = {}) {
220
514
  }
221
515
  const attributions = new Set(object.attributionIds.map((uri) => uri.href));
222
516
  if (object instanceof Activity) for (const uri of object.actorIds) attributions.add(uri.href);
223
- const key = await verifySignature(jsonLd, options);
517
+ const key = await verifySignature(compacted, verificationOptions);
224
518
  if (key == null) return false;
225
519
  if (key.ownerId == null) {
226
520
  logger$1.debug("Key {keyId} has no owner.", { keyId: key.id?.href });
@@ -602,4 +896,4 @@ async function verifyObject(cls, jsonLd, options = {}) {
602
896
  return object;
603
897
  }
604
898
  //#endregion
605
- export { doesActorOwnKey as a, createSignature as c, signJsonLd as d, verifyJsonLd as f, verifyProof as i, detachSignature as l, signObject as n, getKeyOwner as o, verifySignature as p, verifyObject as r, attachSignature as s, createProof as t, hasSignature as u };
899
+ export { signJsonLd as _, doesActorOwnKey as a, verifySignature as b, assertSafeJsonLd as c, createSignature as d, detachSignature as f, isInvalidUrlTypeError as g, isClearlyMalformedContextReference as h, verifyProof as i, attachSignature as l, hasSignature as m, signObject as n, getKeyOwner as o, getNormalizationContextLoader as p, verifyObject as r, InvalidContextReferenceError as s, createProof as t, compactJsonLd as u, verifyCompactJsonLd as v, wrapContextLoaderForJsonLd as x, verifyJsonLd as y };
@@ -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-Ddb3P7G7.mjs";
5
- import { n as fetchKey, o as validateCryptoKey } from "./key-WSedbAA-.mjs";
4
+ import { n as version, t as name } from "./deno-bqnW1QlD.mjs";
5
+ import { n as fetchKey, o as validateCryptoKey } from "./key-B3OBz6A_.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";