@fedify/fedify 2.3.0-dev.1145 → 2.3.0-dev.1150
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.
- package/dist/{builder-ShiR1K6b.mjs → builder-Bjm1Jq9n.mjs} +2 -2
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{context-DI2gRbyN.d.cts → context-CRXCkTM6.d.cts} +48 -6
- package/dist/{context-DCtsSHDv.d.ts → context-MgCh7YGu.d.ts} +48 -6
- package/dist/{deno-h0TWFuEz.mjs → deno-CKFE6Uya.mjs} +1 -1
- package/dist/{docloader-BdDN0Aqx.mjs → docloader-B-ZE1cZf.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +1363 -44
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +1667 -163
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +2 -2
- package/dist/federation/mod.d.ts +2 -2
- package/dist/federation/mod.js +1 -1
- package/dist/federation/retry.test.mjs +1 -1
- package/dist/federation/send.test.mjs +8 -8
- package/dist/federation/temporal.test.d.mts +2 -0
- package/dist/federation/temporal.test.mjs +71 -0
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{getMachineId-bsd-etIyxDet.mjs → getMachineId-bsd-BY01PL1n.mjs} +1 -1
- package/dist/{getMachineId-darwin-D23zTf4g.mjs → getMachineId-darwin-Dr1gkBkp.mjs} +1 -1
- package/dist/{getMachineId-win-Dpap6v5i.mjs → getMachineId-win-QEYwcJiy.mjs} +1 -1
- package/dist/{http-7kAB7PVx.cjs → http-DQYEA7AZ.cjs} +1 -1
- package/dist/{http-B2hxA7dO.js → http-WbS1gKzr.js} +1 -1
- package/dist/{http-QzW9IWfs.mjs → http-vHCgbhTg.mjs} +3 -3
- package/dist/{key-Dh2OK1XQ.mjs → key-N0zP_oJA.mjs} +2 -2
- package/dist/{kv-cache-b22dNkjt.js → kv-cache-DM2O-Yjy.js} +1 -1
- package/dist/{kv-cache-DCPp-MT0.cjs → kv-cache-Dsg_bi4N.cjs} +1 -1
- package/dist/{kv-cache-EZRIPZXD.mjs → kv-cache-GXXZEemD.mjs} +1 -1
- package/dist/{ld-eZbar1rr.mjs → ld-BwKhquPx.mjs} +302 -6
- package/dist/{metrics-E0hAHtLZ.mjs → metrics-7Vy9FvEw.mjs} +1 -1
- package/dist/{middleware-BrGIM_Ra.js → middleware-BscgvU-m.js} +428 -99
- package/dist/{middleware-BUl1BH4x.cjs → middleware-D_iXrYHJ.cjs} +429 -99
- package/dist/{middleware-mToCR2tG.mjs → middleware-Db1_qAFG.mjs} +1 -1
- package/dist/{middleware-CyJDCmNg.mjs → middleware-ZuUcO0t1.mjs} +348 -108
- package/dist/{mod-CI9fduEi.d.cts → mod-C7HOzGqH.d.cts} +1 -1
- package/dist/{mod-CkRiJHGA.d.ts → mod-CpQHB3Ys.d.ts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +2 -2
- package/dist/mod.d.ts +2 -2
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-ByO_Fw6U.mjs → owner-FD0H_vpj.mjs} +2 -2
- package/dist/{proof-jVqClF49.cjs → proof-CYK8T8IS.cjs} +353 -3
- package/dist/{proof-BkRyFchv.js → proof-I3EokKN-.js} +300 -4
- package/dist/{proof-CSo0S8OK.mjs → proof-V_lafPmA.mjs} +3 -3
- package/dist/{send-jzrTV1FU.mjs → send-Cc2_10tF.mjs} +3 -3
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +558 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +1 -1
- package/dist/temporal-BkmBfs__.mjs +95 -0
- package/dist/testing/mod.d.mts +48 -6
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +7 -7
- /package/dist/{execAsync-DCBrgFiV.mjs → execAsync-Dxb7rNf3.mjs} +0 -0
- /package/dist/{getMachineId-linux-ObI47Hql.mjs → getMachineId-linux-Bbhofx-s.mjs} +0 -0
- /package/dist/{getMachineId-unsupported-Ddu-PFeh.mjs → getMachineId-unsupported-dIOte2Ct.mjs} +0 -0
- /package/dist/{retry-v_sGLH1d.mjs → retry-_VvV0h9f.mjs} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { G as ActorHandleMapper, U as ActorAliasMapper, W as ActorDispatcher, ft as WebFingerLinksDispatcher, l as RequestContext } from "./context-
|
|
2
|
+
import { G as ActorHandleMapper, U as ActorAliasMapper, W as ActorDispatcher, ft as WebFingerLinksDispatcher, l as RequestContext } from "./context-CRXCkTM6.cjs";
|
|
3
3
|
import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
|
|
4
4
|
import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
|
|
5
5
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { G as ActorHandleMapper, U as ActorAliasMapper, W as ActorDispatcher, ft as WebFingerLinksDispatcher, l as RequestContext } from "./context-
|
|
2
|
+
import { G as ActorHandleMapper, U as ActorAliasMapper, W as ActorDispatcher, ft as WebFingerLinksDispatcher, l as RequestContext } from "./context-MgCh7YGu.js";
|
|
3
3
|
import { RouterError, RouterOptions, RouterRouteResult } from "@fedify/uri-template";
|
|
4
4
|
import { MeterProvider, Span, Tracer } from "@opentelemetry/api";
|
|
5
5
|
|
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-
|
|
8
|
-
const require_middleware = require("./middleware-
|
|
9
|
-
const require_proof = require("./proof-
|
|
7
|
+
const require_http = require("./http-DQYEA7AZ.cjs");
|
|
8
|
+
const require_middleware = require("./middleware-D_iXrYHJ.cjs");
|
|
9
|
+
const require_proof = require("./proof-CYK8T8IS.cjs");
|
|
10
10
|
const require_types = require("./types-KC4QAoxe.cjs");
|
|
11
|
-
const require_kv_cache = require("./kv-cache-
|
|
11
|
+
const require_kv_cache = require("./kv-cache-Dsg_bi4N.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
|
@@ -2,11 +2,11 @@
|
|
|
2
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
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-VyDTd4G3.cjs";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-DEvZuyOE.cjs";
|
|
5
|
-
import { $ as CustomCollectionDispatcher, A as FederationKvPrefixes, B as RespondWithObjectOptions, C as IdempotencyKeyCallback, D as ObjectCallbackSetters, E as InboxListenerSetters, F as RetryContext, G as ActorHandleMapper, H as respondWithObjectIfAcceptable, I as RetryPolicy, J as CollectionCounter, K as ActorKeyPairsDispatcher, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, P as CreateExponentialBackoffPolicyOptions, Q as CustomCollectionCursor, R as Message, S as FederationStartQueueOptions, T as InboxChallengePolicy, U as ActorAliasMapper, V as respondWithObject, W as ActorDispatcher, X as CollectionDispatcher, Y as CollectionCursor, Z as CustomCollectionCounter, _ as Federatable, _t as digest, a as GetSignedKeyOptions, at as OutboxErrorHandler, b as FederationFetchOptions, c as ParseUriResult, ct as OutboxPermanentFailureHandler, d as SendActivityOptions, dt as UnverifiedActivityReason, et as InboxErrorHandler, f as SendActivityOptionsForCollection, ft as WebFingerLinksDispatcher, g as CustomCollectionCallbackSetters, gt as buildCollectionSynchronizationHeader, h as ConstructorWithTypeId, ht as PageItems, i as GetActorOptions, it as ObjectDispatcher, j as FederationOrigin, k as Rfc6570Expression, l as RequestContext, lt as SharedInboxKeyDispatcher, m as CollectionCallbackSetters, mt as SenderKeyPair, n as Context, nt as NodeInfoDispatcher, o as InboxContext, ot as OutboxListener, p as ActorCallbackSetters, pt as SendActivityError, q as AuthorizePredicate, r as ForwardActivityOptions, rt as ObjectAuthorizePredicate, s as OutboxContext, st as OutboxListenerErrorHandler, t as ActorKeyPair, tt as InboxListener, u as RouteActivityOptions, ut as UnverifiedActivityHandler, v as Federation, vt as ActivityTransformer, w as IdempotencyStrategy, x as FederationOptions, y as FederationBuilder, z as createFederationBuilder } from "./context-
|
|
5
|
+
import { $ as CustomCollectionDispatcher, A as FederationKvPrefixes, B as RespondWithObjectOptions, C as IdempotencyKeyCallback, D as ObjectCallbackSetters, E as InboxListenerSetters, F as RetryContext, G as ActorHandleMapper, H as respondWithObjectIfAcceptable, I as RetryPolicy, J as CollectionCounter, K as ActorKeyPairsDispatcher, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, P as CreateExponentialBackoffPolicyOptions, Q as CustomCollectionCursor, R as Message, S as FederationStartQueueOptions, T as InboxChallengePolicy, U as ActorAliasMapper, V as respondWithObject, W as ActorDispatcher, X as CollectionDispatcher, Y as CollectionCursor, Z as CustomCollectionCounter, _ as Federatable, _t as digest, a as GetSignedKeyOptions, at as OutboxErrorHandler, b as FederationFetchOptions, c as ParseUriResult, ct as OutboxPermanentFailureHandler, d as SendActivityOptions, dt as UnverifiedActivityReason, et as InboxErrorHandler, f as SendActivityOptionsForCollection, ft as WebFingerLinksDispatcher, g as CustomCollectionCallbackSetters, gt as buildCollectionSynchronizationHeader, h as ConstructorWithTypeId, ht as PageItems, i as GetActorOptions, it as ObjectDispatcher, j as FederationOrigin, k as Rfc6570Expression, l as RequestContext, lt as SharedInboxKeyDispatcher, m as CollectionCallbackSetters, mt as SenderKeyPair, n as Context, nt as NodeInfoDispatcher, o as InboxContext, ot as OutboxListener, p as ActorCallbackSetters, pt as SendActivityError, q as AuthorizePredicate, r as ForwardActivityOptions, rt as ObjectAuthorizePredicate, s as OutboxContext, st as OutboxListenerErrorHandler, t as ActorKeyPair, tt as InboxListener, u as RouteActivityOptions, ut as UnverifiedActivityHandler, v as Federation, vt as ActivityTransformer, w as IdempotencyStrategy, x as FederationOptions, y as FederationBuilder, z as createFederationBuilder } from "./context-CRXCkTM6.cjs";
|
|
6
6
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-gJ8LYbxX.cjs";
|
|
7
7
|
import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcessMessageQueueOptions, o as MessageQueueListenOptions, r as MessageQueue, s as ParallelMessageQueue, t as InProcessMessageQueue } from "./mq-D8uSFzxe.cjs";
|
|
8
8
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
|
|
9
|
-
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-
|
|
9
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-C7HOzGqH.cjs";
|
|
10
10
|
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-B0hW12_O.cjs";
|
|
11
11
|
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-yvIXFAEi.cjs";
|
|
12
12
|
export * from "@fedify/vocab-runtime";
|
package/dist/mod.d.ts
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
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
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-lf8Hsd91.js";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-CnngXDNJ.js";
|
|
5
|
-
import { $ as CustomCollectionDispatcher, A as FederationKvPrefixes, B as RespondWithObjectOptions, C as IdempotencyKeyCallback, D as ObjectCallbackSetters, E as InboxListenerSetters, F as RetryContext, G as ActorHandleMapper, H as respondWithObjectIfAcceptable, I as RetryPolicy, J as CollectionCounter, K as ActorKeyPairsDispatcher, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, P as CreateExponentialBackoffPolicyOptions, Q as CustomCollectionCursor, R as Message, S as FederationStartQueueOptions, T as InboxChallengePolicy, U as ActorAliasMapper, V as respondWithObject, W as ActorDispatcher, X as CollectionDispatcher, Y as CollectionCursor, Z as CustomCollectionCounter, _ as Federatable, _t as digest, a as GetSignedKeyOptions, at as OutboxErrorHandler, b as FederationFetchOptions, c as ParseUriResult, ct as OutboxPermanentFailureHandler, d as SendActivityOptions, dt as UnverifiedActivityReason, et as InboxErrorHandler, f as SendActivityOptionsForCollection, ft as WebFingerLinksDispatcher, g as CustomCollectionCallbackSetters, gt as buildCollectionSynchronizationHeader, h as ConstructorWithTypeId, ht as PageItems, i as GetActorOptions, it as ObjectDispatcher, j as FederationOrigin, k as Rfc6570Expression, l as RequestContext, lt as SharedInboxKeyDispatcher, m as CollectionCallbackSetters, mt as SenderKeyPair, n as Context, nt as NodeInfoDispatcher, o as InboxContext, ot as OutboxListener, p as ActorCallbackSetters, pt as SendActivityError, q as AuthorizePredicate, r as ForwardActivityOptions, rt as ObjectAuthorizePredicate, s as OutboxContext, st as OutboxListenerErrorHandler, t as ActorKeyPair, tt as InboxListener, u as RouteActivityOptions, ut as UnverifiedActivityHandler, v as Federation, vt as ActivityTransformer, w as IdempotencyStrategy, x as FederationOptions, y as FederationBuilder, z as createFederationBuilder } from "./context-
|
|
5
|
+
import { $ as CustomCollectionDispatcher, A as FederationKvPrefixes, B as RespondWithObjectOptions, C as IdempotencyKeyCallback, D as ObjectCallbackSetters, E as InboxListenerSetters, F as RetryContext, G as ActorHandleMapper, H as respondWithObjectIfAcceptable, I as RetryPolicy, J as CollectionCounter, K as ActorKeyPairsDispatcher, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, P as CreateExponentialBackoffPolicyOptions, Q as CustomCollectionCursor, R as Message, S as FederationStartQueueOptions, T as InboxChallengePolicy, U as ActorAliasMapper, V as respondWithObject, W as ActorDispatcher, X as CollectionDispatcher, Y as CollectionCursor, Z as CustomCollectionCounter, _ as Federatable, _t as digest, a as GetSignedKeyOptions, at as OutboxErrorHandler, b as FederationFetchOptions, c as ParseUriResult, ct as OutboxPermanentFailureHandler, d as SendActivityOptions, dt as UnverifiedActivityReason, et as InboxErrorHandler, f as SendActivityOptionsForCollection, ft as WebFingerLinksDispatcher, g as CustomCollectionCallbackSetters, gt as buildCollectionSynchronizationHeader, h as ConstructorWithTypeId, ht as PageItems, i as GetActorOptions, it as ObjectDispatcher, j as FederationOrigin, k as Rfc6570Expression, l as RequestContext, lt as SharedInboxKeyDispatcher, m as CollectionCallbackSetters, mt as SenderKeyPair, n as Context, nt as NodeInfoDispatcher, o as InboxContext, ot as OutboxListener, p as ActorCallbackSetters, pt as SendActivityError, q as AuthorizePredicate, r as ForwardActivityOptions, rt as ObjectAuthorizePredicate, s as OutboxContext, st as OutboxListenerErrorHandler, t as ActorKeyPair, tt as InboxListener, u as RouteActivityOptions, ut as UnverifiedActivityHandler, v as Federation, vt as ActivityTransformer, w as IdempotencyStrategy, x as FederationOptions, y as FederationBuilder, z as createFederationBuilder } from "./context-MgCh7YGu.js";
|
|
6
6
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-D6hNiMTK.js";
|
|
7
7
|
import { a as MessageQueueEnqueueOptions, i as MessageQueueDepth, n as InProcessMessageQueueOptions, o as MessageQueueListenOptions, r as MessageQueue, s as ParallelMessageQueue, t as InProcessMessageQueue } from "./mq-D-nlpY04.js";
|
|
8
8
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
|
|
9
|
-
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-
|
|
9
|
+
import { a as RouterOptions, i as RouterError, n as handleWebFinger, o as RouterRouteResult, r as Router, t as WebFingerHandlerParameters } from "./mod-CpQHB3Ys.js";
|
|
10
10
|
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "./mod-COIAjwRS.js";
|
|
11
11
|
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-DFvNJcNb.js";
|
|
12
12
|
export * from "@fedify/vocab-runtime";
|
package/dist/mod.js
CHANGED
|
@@ -3,11 +3,11 @@ import { URLPattern } from "urlpattern-polyfill";
|
|
|
3
3
|
import "./chunk-CRNNMoPX.js";
|
|
4
4
|
import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-BGMIq1cs.js";
|
|
5
5
|
import "./compat/mod.js";
|
|
6
|
-
import { D as validateAcceptSignature, E as parseAcceptSignature, T as fulfillAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk, w as formatAcceptSignature } from "./http-
|
|
7
|
-
import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "./middleware-
|
|
8
|
-
import {
|
|
6
|
+
import { D as validateAcceptSignature, E as parseAcceptSignature, T as fulfillAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk, w as formatAcceptSignature } from "./http-WbS1gKzr.js";
|
|
7
|
+
import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "./middleware-BscgvU-m.js";
|
|
8
|
+
import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "./proof-I3EokKN-.js";
|
|
9
9
|
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-CAY3OdLq.js";
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-DM2O-Yjy.js";
|
|
11
11
|
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError } from "./federation/mod.js";
|
|
12
12
|
import "./nodeinfo/mod.js";
|
|
13
13
|
import "./runtime/mod.js";
|
|
@@ -5,7 +5,7 @@ import { r as createRequestContext } from "../context-DVoTs_wM.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
6
6
|
import "../std__assert-BBjXFNOb.mjs";
|
|
7
7
|
import { t as MemoryKvStore } from "../kv-x2IvBUyq.mjs";
|
|
8
|
-
import { _ as handleNodeInfoJrd, g as handleNodeInfo, o as createFederation } from "../middleware-
|
|
8
|
+
import { _ as handleNodeInfoJrd, g as handleNodeInfo, o as createFederation } from "../middleware-ZuUcO0t1.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
//#region src/nodeinfo/handler.test.ts
|
|
11
11
|
test("handleNodeInfo()", async () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-CKFE6Uya.mjs";
|
|
5
|
+
import "./key-N0zP_oJA.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,7 +1,7 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
const require_chunk = require("./chunk-DDcVe30Y.cjs");
|
|
4
|
-
const require_http = require("./http-
|
|
4
|
+
const require_http = require("./http-DQYEA7AZ.cjs");
|
|
5
5
|
let _logtape_logtape = require("@logtape/logtape");
|
|
6
6
|
let _fedify_vocab = require("@fedify/vocab");
|
|
7
7
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
@@ -18,6 +18,290 @@ const logger$3 = (0, _logtape_logtape.getLogger)([
|
|
|
18
18
|
"sig",
|
|
19
19
|
"ld"
|
|
20
20
|
]);
|
|
21
|
+
const localContext = [
|
|
22
|
+
"https://w3id.org/identity/v1",
|
|
23
|
+
"https://www.w3.org/ns/activitystreams",
|
|
24
|
+
"https://w3id.org/security/v1",
|
|
25
|
+
"https://w3id.org/security/data-integrity/v1"
|
|
26
|
+
];
|
|
27
|
+
const localContextUrls = new Set(localContext);
|
|
28
|
+
const builtInContextLoader = (0, _fedify_vocab_runtime.getDocumentLoader)();
|
|
29
|
+
const disallowedJsonLdKeywords = new Set([
|
|
30
|
+
"@graph",
|
|
31
|
+
"@included",
|
|
32
|
+
"@reverse"
|
|
33
|
+
]);
|
|
34
|
+
/** @internal */
|
|
35
|
+
var UnsafeJsonLdError = class extends TypeError {
|
|
36
|
+
keyword;
|
|
37
|
+
constructor(keyword) {
|
|
38
|
+
super(`Unsupported JSON-LD keyword: ${keyword}.`);
|
|
39
|
+
this.keyword = keyword;
|
|
40
|
+
this.name = "UnsafeJsonLdError";
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
/** @internal */
|
|
44
|
+
var InvalidContextReferenceError = class extends TypeError {
|
|
45
|
+
reference;
|
|
46
|
+
constructor(reference) {
|
|
47
|
+
super(`Invalid JSON-LD context reference: ${reference}.`);
|
|
48
|
+
this.reference = reference;
|
|
49
|
+
this.name = "InvalidContextReferenceError";
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
function createLoadingRemoteContextFailedError(reference, cause) {
|
|
53
|
+
const message = cause instanceof Error ? cause.message : String(cause);
|
|
54
|
+
const error = /* @__PURE__ */ new Error(`Dereferencing a URL did not result in a valid JSON-LD context: ${reference}. ${message}`);
|
|
55
|
+
error.name = "jsonld.InvalidUrl";
|
|
56
|
+
error.details = {
|
|
57
|
+
code: "loading remote context failed",
|
|
58
|
+
url: reference
|
|
59
|
+
};
|
|
60
|
+
error.cause = cause;
|
|
61
|
+
return error;
|
|
62
|
+
}
|
|
63
|
+
/** @internal */
|
|
64
|
+
function isClearlyMalformedContextReference(reference) {
|
|
65
|
+
for (const char of reference) {
|
|
66
|
+
const code = char.charCodeAt(0);
|
|
67
|
+
if (code <= 32 || code === 127) return true;
|
|
68
|
+
}
|
|
69
|
+
if (/^[A-Za-z][A-Za-z0-9+.-]*:/.test(reference) && !URL.canParse(reference)) return true;
|
|
70
|
+
for (let i = 0; i < reference.length; i++) {
|
|
71
|
+
if (reference[i] !== "%") continue;
|
|
72
|
+
if (i + 2 >= reference.length || !/[0-9A-Fa-f]/.test(reference[i + 1]) || !/[0-9A-Fa-f]/.test(reference[i + 2])) return true;
|
|
73
|
+
i += 2;
|
|
74
|
+
}
|
|
75
|
+
if (reference.startsWith("./") || reference.startsWith("../") || reference.startsWith("/") || reference.startsWith("//")) {
|
|
76
|
+
for (const char of reference) if ("[]<>\"\\^`{|}".includes(char)) return true;
|
|
77
|
+
}
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
function cloneRemoteDocument(remoteDocument) {
|
|
81
|
+
return structuredClone(remoteDocument);
|
|
82
|
+
}
|
|
83
|
+
function createMemoizedDocumentLoader(documentLoader) {
|
|
84
|
+
const cache = /* @__PURE__ */ new Map();
|
|
85
|
+
return async (url, options) => {
|
|
86
|
+
const cacheKey = URL.canParse(url) ? new URL(url).href : url;
|
|
87
|
+
let remoteDocument = cache.get(cacheKey);
|
|
88
|
+
if (remoteDocument == null) {
|
|
89
|
+
remoteDocument = Promise.resolve(documentLoader(url, options)).then(cloneRemoteDocument);
|
|
90
|
+
remoteDocument.catch(() => {
|
|
91
|
+
if (cache.get(cacheKey) === remoteDocument) cache.delete(cacheKey);
|
|
92
|
+
});
|
|
93
|
+
cache.set(cacheKey, remoteDocument);
|
|
94
|
+
}
|
|
95
|
+
return cloneRemoteDocument(await remoteDocument);
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/** @internal */
|
|
99
|
+
function wrapContextLoaderForJsonLd(contextLoader) {
|
|
100
|
+
const loader = contextLoader ?? builtInContextLoader;
|
|
101
|
+
return async (url, options) => {
|
|
102
|
+
try {
|
|
103
|
+
return await loader(url, options);
|
|
104
|
+
} catch (error) {
|
|
105
|
+
if (!isInvalidUrlTypeError(error)) throw error;
|
|
106
|
+
if (isClearlyMalformedContextReference(url)) throw new InvalidContextReferenceError(url);
|
|
107
|
+
throw createLoadingRemoteContextFailedError(url, error);
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/** @internal */
|
|
112
|
+
function getNormalizationContextLoader(contextLoader) {
|
|
113
|
+
const loader = wrapContextLoaderForJsonLd(contextLoader);
|
|
114
|
+
return createMemoizedDocumentLoader(async (url, options) => {
|
|
115
|
+
if (URL.canParse(url)) {
|
|
116
|
+
const normalizedUrl = new URL(url).href;
|
|
117
|
+
if (localContextUrls.has(normalizedUrl)) return await builtInContextLoader(normalizedUrl, options);
|
|
118
|
+
}
|
|
119
|
+
return await loader(url, options);
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/** @internal */
|
|
123
|
+
async function compactJsonLd(jsonLd, contextLoader) {
|
|
124
|
+
const hasLds = typeof jsonLd === "object" && jsonLd != null && "signature" in jsonLd;
|
|
125
|
+
const signature = hasLds ? jsonLd.signature : void 0;
|
|
126
|
+
const normalizationContextLoader = getNormalizationContextLoader(contextLoader);
|
|
127
|
+
const document = hasLds ? detachSignature(jsonLd) : jsonLd;
|
|
128
|
+
await assertNoGraphBeforeCompaction(document, normalizationContextLoader);
|
|
129
|
+
const compacted = await _fedify_vocab_runtime_jsonld.default.compact(document, localContext, { documentLoader: normalizationContextLoader });
|
|
130
|
+
if (hasLds && typeof compacted === "object" && compacted != null) compacted.signature = signature;
|
|
131
|
+
assertSafeJsonLd(compacted);
|
|
132
|
+
return compacted;
|
|
133
|
+
}
|
|
134
|
+
function createInvalidRemoteContextError(reference) {
|
|
135
|
+
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}".`);
|
|
136
|
+
error.name = "jsonld.InvalidUrl";
|
|
137
|
+
error.details = {
|
|
138
|
+
code: "invalid remote context",
|
|
139
|
+
url: reference
|
|
140
|
+
};
|
|
141
|
+
return error;
|
|
142
|
+
}
|
|
143
|
+
function getRemoteContext(remoteDocument, reference) {
|
|
144
|
+
const { contextUrl, documentUrl } = remoteDocument;
|
|
145
|
+
let { document } = remoteDocument;
|
|
146
|
+
if (typeof document === "string") document = JSON.parse(document);
|
|
147
|
+
if (typeof document !== "object" || document == null || Array.isArray(document)) throw createInvalidRemoteContextError(reference);
|
|
148
|
+
let context = "@context" in document ? document["@context"] : {};
|
|
149
|
+
if (contextUrl != null) context = Array.isArray(context) ? [...context, contextUrl] : [context, contextUrl];
|
|
150
|
+
return {
|
|
151
|
+
context,
|
|
152
|
+
baseUrl: documentUrl ?? reference
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
function createGraphAliasContextState() {
|
|
156
|
+
return {
|
|
157
|
+
graphTerms: /* @__PURE__ */ new Set(),
|
|
158
|
+
jsonTerms: /* @__PURE__ */ new Set(),
|
|
159
|
+
propertyContexts: /* @__PURE__ */ new Map(),
|
|
160
|
+
termTargets: /* @__PURE__ */ new Map()
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
function cloneGraphAliasContextState(state) {
|
|
164
|
+
return {
|
|
165
|
+
graphTerms: new Set(state.graphTerms),
|
|
166
|
+
jsonTerms: new Set(state.jsonTerms),
|
|
167
|
+
propertyContexts: new Map(state.propertyContexts),
|
|
168
|
+
termTargets: new Map(state.termTargets)
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function resolveContextTarget(target, state) {
|
|
172
|
+
if (target === "@graph") return target;
|
|
173
|
+
const mapped = state.termTargets.get(target);
|
|
174
|
+
if (mapped == null) return target;
|
|
175
|
+
return mapped;
|
|
176
|
+
}
|
|
177
|
+
function getDirectContextTarget(definition) {
|
|
178
|
+
if (definition === null) return null;
|
|
179
|
+
if (typeof definition === "string") return definition;
|
|
180
|
+
if (typeof definition === "object" && definition != null && "@id" in definition) {
|
|
181
|
+
const id = definition["@id"];
|
|
182
|
+
if (id === null) return null;
|
|
183
|
+
if (typeof id === "string") return id;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function isJsonTypedDefinition(definition) {
|
|
187
|
+
return typeof definition === "object" && definition != null && "@type" in definition && definition["@type"] === "@json";
|
|
188
|
+
}
|
|
189
|
+
function resolveLocalContextTarget(target, state, localTargets, seen = /* @__PURE__ */ new Set()) {
|
|
190
|
+
if (target === "@graph") return target;
|
|
191
|
+
if (seen.has(target)) return target;
|
|
192
|
+
seen.add(target);
|
|
193
|
+
if (localTargets.has(target)) {
|
|
194
|
+
const localTarget = localTargets.get(target);
|
|
195
|
+
return localTarget == null ? target : resolveLocalContextTarget(localTarget, state, localTargets, seen);
|
|
196
|
+
}
|
|
197
|
+
return resolveContextTarget(target, state);
|
|
198
|
+
}
|
|
199
|
+
function refreshGraphAliases(state) {
|
|
200
|
+
state.graphTerms.clear();
|
|
201
|
+
for (const [term, target] of state.termTargets) if (target === "@graph") state.graphTerms.add(term);
|
|
202
|
+
}
|
|
203
|
+
function normalizeContextReference(reference, baseUrl) {
|
|
204
|
+
if (baseUrl != null) return new URL(reference, baseUrl).href;
|
|
205
|
+
return URL.canParse(reference) ? new URL(reference).href : reference;
|
|
206
|
+
}
|
|
207
|
+
/** @internal */
|
|
208
|
+
function isInvalidUrlTypeError(error) {
|
|
209
|
+
const code = error.code;
|
|
210
|
+
return error instanceof TypeError && (code === "ERR_INVALID_URL" || /^Invalid URL(?::|$)/.test(error.message) || / cannot be parsed as a URL\.?$/.test(error.message));
|
|
211
|
+
}
|
|
212
|
+
async function applyGraphAliasContext(state, context, documentLoader, remoteContextCache, baseUrl = null, processingContexts = /* @__PURE__ */ new Set()) {
|
|
213
|
+
if (context === null) return createGraphAliasContextState();
|
|
214
|
+
let nextState = cloneGraphAliasContextState(state);
|
|
215
|
+
if (Array.isArray(context)) {
|
|
216
|
+
for (const item of context) nextState = await applyGraphAliasContext(nextState, item, documentLoader, remoteContextCache, baseUrl, processingContexts);
|
|
217
|
+
return nextState;
|
|
218
|
+
}
|
|
219
|
+
if (typeof context === "string") {
|
|
220
|
+
const reference = normalizeContextReference(context, baseUrl);
|
|
221
|
+
const cacheKey = `${baseUrl ?? ""}\n${reference}`;
|
|
222
|
+
if (processingContexts.has(cacheKey)) return nextState;
|
|
223
|
+
processingContexts.add(cacheKey);
|
|
224
|
+
try {
|
|
225
|
+
let remoteContext = remoteContextCache.get(cacheKey);
|
|
226
|
+
if (remoteContext == null) {
|
|
227
|
+
remoteContext = (async () => {
|
|
228
|
+
try {
|
|
229
|
+
return getRemoteContext(await documentLoader(reference), reference);
|
|
230
|
+
} catch (error) {
|
|
231
|
+
if (reference === context && isInvalidUrlTypeError(error) && isClearlyMalformedContextReference(context)) throw new InvalidContextReferenceError(context);
|
|
232
|
+
throw error;
|
|
233
|
+
}
|
|
234
|
+
})();
|
|
235
|
+
remoteContextCache.set(cacheKey, remoteContext);
|
|
236
|
+
}
|
|
237
|
+
const loadedRemoteContext = await remoteContext;
|
|
238
|
+
return await applyGraphAliasContext(nextState, loadedRemoteContext.context, documentLoader, remoteContextCache, loadedRemoteContext.baseUrl, processingContexts);
|
|
239
|
+
} finally {
|
|
240
|
+
processingContexts.delete(cacheKey);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
if (typeof context === "object" && context != null) {
|
|
244
|
+
if ("@import" in context && typeof context["@import"] === "string") nextState = await applyGraphAliasContext(nextState, context["@import"], documentLoader, remoteContextCache, baseUrl, processingContexts);
|
|
245
|
+
const localTargets = /* @__PURE__ */ new Map();
|
|
246
|
+
for (const [term, definition] of globalThis.Object.entries(context)) {
|
|
247
|
+
if (term.startsWith("@")) continue;
|
|
248
|
+
const target = getDirectContextTarget(definition);
|
|
249
|
+
if (target == null) localTargets.set(term, null);
|
|
250
|
+
else if (typeof target === "string") localTargets.set(term, target);
|
|
251
|
+
else localTargets.delete(term);
|
|
252
|
+
}
|
|
253
|
+
for (const [term, definition] of globalThis.Object.entries(context)) {
|
|
254
|
+
if (term.startsWith("@")) continue;
|
|
255
|
+
if (localTargets.has(term)) {
|
|
256
|
+
const directTarget = localTargets.get(term);
|
|
257
|
+
if (directTarget == null) nextState.termTargets.set(term, null);
|
|
258
|
+
else nextState.termTargets.set(term, resolveLocalContextTarget(directTarget, nextState, localTargets));
|
|
259
|
+
} else nextState.termTargets.delete(term);
|
|
260
|
+
if (typeof definition === "object" && definition != null && "@context" in definition) nextState.propertyContexts.set(term, {
|
|
261
|
+
context: definition["@context"],
|
|
262
|
+
baseUrl
|
|
263
|
+
});
|
|
264
|
+
else nextState.propertyContexts.delete(term);
|
|
265
|
+
if (isJsonTypedDefinition(definition)) nextState.jsonTerms.add(term);
|
|
266
|
+
else nextState.jsonTerms.delete(term);
|
|
267
|
+
}
|
|
268
|
+
refreshGraphAliases(nextState);
|
|
269
|
+
}
|
|
270
|
+
return nextState;
|
|
271
|
+
}
|
|
272
|
+
async function assertNoGraphBeforeCompaction(jsonLd, documentLoader, inheritedState = createGraphAliasContextState(), propertyContext, remoteContextCache = /* @__PURE__ */ new Map()) {
|
|
273
|
+
if (Array.isArray(jsonLd)) {
|
|
274
|
+
for (const item of jsonLd) await assertNoGraphBeforeCompaction(item, documentLoader, inheritedState, propertyContext, remoteContextCache);
|
|
275
|
+
return;
|
|
276
|
+
}
|
|
277
|
+
if (typeof jsonLd !== "object" || jsonLd == null) return;
|
|
278
|
+
const jsonLiteralWrapper = isJsonLiteralWrapper(jsonLd);
|
|
279
|
+
let state = inheritedState;
|
|
280
|
+
if (propertyContext !== void 0) state = await applyGraphAliasContext(state, propertyContext.context, documentLoader, remoteContextCache, propertyContext.baseUrl);
|
|
281
|
+
if ("@context" in jsonLd) state = await applyGraphAliasContext(state, jsonLd["@context"], documentLoader, remoteContextCache);
|
|
282
|
+
for (const [key, value] of globalThis.Object.entries(jsonLd)) {
|
|
283
|
+
if (key === "@context") continue;
|
|
284
|
+
if (jsonLiteralWrapper && key === "@value") continue;
|
|
285
|
+
if (key === "@graph" || state.graphTerms.has(key)) throw new UnsafeJsonLdError("@graph");
|
|
286
|
+
if (state.jsonTerms.has(key)) continue;
|
|
287
|
+
await assertNoGraphBeforeCompaction(value, documentLoader, state, state.propertyContexts.get(key), remoteContextCache);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
function isJsonLiteralWrapper(value) {
|
|
291
|
+
return "@value" in value && (value["@type"] === "@json" || value.type === "@json");
|
|
292
|
+
}
|
|
293
|
+
/** @internal */
|
|
294
|
+
function assertSafeJsonLd(jsonLd) {
|
|
295
|
+
if (Array.isArray(jsonLd)) for (const item of jsonLd) assertSafeJsonLd(item);
|
|
296
|
+
else if (typeof jsonLd === "object" && jsonLd != null) {
|
|
297
|
+
const jsonLiteralWrapper = isJsonLiteralWrapper(jsonLd);
|
|
298
|
+
for (const [key, value] of globalThis.Object.entries(jsonLd)) {
|
|
299
|
+
if (disallowedJsonLdKeywords.has(key)) throw new UnsafeJsonLdError(key);
|
|
300
|
+
if (jsonLiteralWrapper && key === "@value") continue;
|
|
301
|
+
assertSafeJsonLd(value);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
}
|
|
21
305
|
/**
|
|
22
306
|
* Attaches a LD signature to the given JSON-LD document.
|
|
23
307
|
* @param jsonLd The JSON-LD document to attach the signature to. It is not
|
|
@@ -272,13 +556,25 @@ function getLdSignatureObject(jsonLd) {
|
|
|
272
556
|
* @returns `true` if the document is authentic; `false` otherwise.
|
|
273
557
|
*/
|
|
274
558
|
async function verifyJsonLd(jsonLd, options = {}) {
|
|
559
|
+
return await verifyJsonLdInternal(jsonLd, options, true);
|
|
560
|
+
}
|
|
561
|
+
/** @internal */
|
|
562
|
+
async function verifyCompactJsonLd(jsonLd, options = {}) {
|
|
563
|
+
return await verifyJsonLdInternal(jsonLd, options, false);
|
|
564
|
+
}
|
|
565
|
+
async function verifyJsonLdInternal(jsonLd, options, compact) {
|
|
275
566
|
return await (options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()).getTracer(require_http.name, require_http.version).startActiveSpan("ld_signatures.verify", async (span) => {
|
|
276
567
|
const start = performance.now();
|
|
277
568
|
let verified = false;
|
|
278
569
|
let threw = false;
|
|
279
570
|
let signatureType;
|
|
280
571
|
try {
|
|
281
|
-
const
|
|
572
|
+
const verificationOptions = hasSignature(jsonLd) ? {
|
|
573
|
+
...options,
|
|
574
|
+
contextLoader: getNormalizationContextLoader(options.contextLoader)
|
|
575
|
+
} : options;
|
|
576
|
+
const compacted = compact ? hasSignature(jsonLd) ? await compactJsonLd(jsonLd, options.contextLoader) : jsonLd : jsonLd;
|
|
577
|
+
const object = await _fedify_vocab.Object.fromJsonLd(compacted, verificationOptions);
|
|
282
578
|
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
283
579
|
span.setAttribute("activitypub.object.type", (0, _fedify_vocab.getTypeId)(object).href);
|
|
284
580
|
const sig = getLdSignatureObject(jsonLd);
|
|
@@ -292,7 +588,7 @@ async function verifyJsonLd(jsonLd, options = {}) {
|
|
|
292
588
|
}
|
|
293
589
|
const attributions = new Set(object.attributionIds.map((uri) => uri.href));
|
|
294
590
|
if (object instanceof _fedify_vocab.Activity) for (const uri of object.actorIds) attributions.add(uri.href);
|
|
295
|
-
const key = await verifySignature(
|
|
591
|
+
const key = await verifySignature(compacted, verificationOptions);
|
|
296
592
|
if (key == null) return false;
|
|
297
593
|
if (key.ownerId == null) {
|
|
298
594
|
logger$3.debug("Key {keyId} has no owner.", { keyId: key.id?.href });
|
|
@@ -1108,12 +1404,30 @@ async function verifyObject(cls, jsonLd, options = {}) {
|
|
|
1108
1404
|
return object;
|
|
1109
1405
|
}
|
|
1110
1406
|
//#endregion
|
|
1407
|
+
Object.defineProperty(exports, "InvalidContextReferenceError", {
|
|
1408
|
+
enumerable: true,
|
|
1409
|
+
get: function() {
|
|
1410
|
+
return InvalidContextReferenceError;
|
|
1411
|
+
}
|
|
1412
|
+
});
|
|
1413
|
+
Object.defineProperty(exports, "assertSafeJsonLd", {
|
|
1414
|
+
enumerable: true,
|
|
1415
|
+
get: function() {
|
|
1416
|
+
return assertSafeJsonLd;
|
|
1417
|
+
}
|
|
1418
|
+
});
|
|
1111
1419
|
Object.defineProperty(exports, "attachSignature", {
|
|
1112
1420
|
enumerable: true,
|
|
1113
1421
|
get: function() {
|
|
1114
1422
|
return attachSignature;
|
|
1115
1423
|
}
|
|
1116
1424
|
});
|
|
1425
|
+
Object.defineProperty(exports, "compactJsonLd", {
|
|
1426
|
+
enumerable: true,
|
|
1427
|
+
get: function() {
|
|
1428
|
+
return compactJsonLd;
|
|
1429
|
+
}
|
|
1430
|
+
});
|
|
1117
1431
|
Object.defineProperty(exports, "createProof", {
|
|
1118
1432
|
enumerable: true,
|
|
1119
1433
|
get: function() {
|
|
@@ -1144,18 +1458,42 @@ Object.defineProperty(exports, "getKeyOwner", {
|
|
|
1144
1458
|
return getKeyOwner;
|
|
1145
1459
|
}
|
|
1146
1460
|
});
|
|
1461
|
+
Object.defineProperty(exports, "getNormalizationContextLoader", {
|
|
1462
|
+
enumerable: true,
|
|
1463
|
+
get: function() {
|
|
1464
|
+
return getNormalizationContextLoader;
|
|
1465
|
+
}
|
|
1466
|
+
});
|
|
1147
1467
|
Object.defineProperty(exports, "hasProofLike", {
|
|
1148
1468
|
enumerable: true,
|
|
1149
1469
|
get: function() {
|
|
1150
1470
|
return hasProofLike;
|
|
1151
1471
|
}
|
|
1152
1472
|
});
|
|
1473
|
+
Object.defineProperty(exports, "hasSignature", {
|
|
1474
|
+
enumerable: true,
|
|
1475
|
+
get: function() {
|
|
1476
|
+
return hasSignature;
|
|
1477
|
+
}
|
|
1478
|
+
});
|
|
1153
1479
|
Object.defineProperty(exports, "hasSignatureLike", {
|
|
1154
1480
|
enumerable: true,
|
|
1155
1481
|
get: function() {
|
|
1156
1482
|
return hasSignatureLike;
|
|
1157
1483
|
}
|
|
1158
1484
|
});
|
|
1485
|
+
Object.defineProperty(exports, "isClearlyMalformedContextReference", {
|
|
1486
|
+
enumerable: true,
|
|
1487
|
+
get: function() {
|
|
1488
|
+
return isClearlyMalformedContextReference;
|
|
1489
|
+
}
|
|
1490
|
+
});
|
|
1491
|
+
Object.defineProperty(exports, "isInvalidUrlTypeError", {
|
|
1492
|
+
enumerable: true,
|
|
1493
|
+
get: function() {
|
|
1494
|
+
return isInvalidUrlTypeError;
|
|
1495
|
+
}
|
|
1496
|
+
});
|
|
1159
1497
|
Object.defineProperty(exports, "normalizeOutgoingActivityJsonLd", {
|
|
1160
1498
|
enumerable: true,
|
|
1161
1499
|
get: function() {
|
|
@@ -1174,6 +1512,12 @@ Object.defineProperty(exports, "signObject", {
|
|
|
1174
1512
|
return signObject;
|
|
1175
1513
|
}
|
|
1176
1514
|
});
|
|
1515
|
+
Object.defineProperty(exports, "verifyCompactJsonLd", {
|
|
1516
|
+
enumerable: true,
|
|
1517
|
+
get: function() {
|
|
1518
|
+
return verifyCompactJsonLd;
|
|
1519
|
+
}
|
|
1520
|
+
});
|
|
1177
1521
|
Object.defineProperty(exports, "verifyJsonLd", {
|
|
1178
1522
|
enumerable: true,
|
|
1179
1523
|
get: function() {
|
|
@@ -1198,3 +1542,9 @@ Object.defineProperty(exports, "verifySignature", {
|
|
|
1198
1542
|
return verifySignature;
|
|
1199
1543
|
}
|
|
1200
1544
|
});
|
|
1545
|
+
Object.defineProperty(exports, "wrapContextLoaderForJsonLd", {
|
|
1546
|
+
enumerable: true,
|
|
1547
|
+
get: function() {
|
|
1548
|
+
return wrapContextLoaderForJsonLd;
|
|
1549
|
+
}
|
|
1550
|
+
});
|