@fedify/fedify 2.3.0-dev.1099 → 2.3.0-dev.1114
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/{assert_rejects-B-qJtC9Z.mjs → assert_rejects-DQP-q39h.mjs} +27 -2
- package/dist/{builder-BkRRjxzb.mjs → builder-YlEusQth.mjs} +3 -3
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/outgoing-jsonld.test.mjs +1 -1
- package/dist/compat/public-audience.test.mjs +1 -1
- package/dist/compat/transformers.test.mjs +2 -2
- package/dist/{context-C0C_sRha.d.cts → context-Ch-ZLyTQ.d.cts} +1 -1
- package/dist/{context-Dqgt8saU.d.ts → context-cSUMk2da.d.ts} +1 -1
- package/dist/{deno-DBabeupC.mjs → deno-CF3jMgip.mjs} +1 -1
- package/dist/{docloader-DA5FzJOR.mjs → docloader-BENj6vQ4.mjs} +2 -2
- package/dist/federation/builder.test.mjs +3 -3
- package/dist/federation/collection.test.mjs +2 -2
- package/dist/federation/handler.test.mjs +8 -7
- package/dist/federation/idempotency.test.mjs +5 -5
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/keycache.test.mjs +1 -1
- package/dist/federation/kv.test.mjs +2 -2
- package/dist/federation/middleware.test.mjs +10 -10
- 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/mq.test.mjs +2 -2
- package/dist/federation/negotiation.test.mjs +2 -2
- package/dist/federation/router.test.mjs +2 -2
- package/dist/federation/send.test.mjs +11 -11
- package/dist/federation/webfinger.test.mjs +3 -3
- 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-5G18W3NP.mjs → http-BmOZYc-8.mjs} +86 -37
- package/dist/{http-W2u_KBoQ.cjs → http-CKCgOPkX.cjs} +427 -35
- package/dist/{http-Dzy5c472.js → http-CpzZ9zsb.js} +393 -37
- package/dist/{http-BDZeS5om.d.ts → http-D6LP89UO.d.ts} +7 -1
- package/dist/{http-C87EWkO0.d.cts → http-D6aw3j2U.d.cts} +7 -1
- package/dist/{key-D9dUsyow.mjs → key-B4I8H5Lc.mjs} +1 -1
- package/dist/{kv-cache-BygrlQ1c.cjs → kv-cache-DY-XWOqM.cjs} +1 -1
- package/dist/{kv-cache-CBSgxEsZ.js → kv-cache-Wc5ezcVW.js} +1 -1
- package/dist/{ld-hbxDLO1k.mjs → ld-B5D5THhl.mjs} +60 -9
- package/dist/{send-BOwz4Hw5.mjs → metrics-ek3ilf6c.mjs} +53 -221
- package/dist/{middleware-vCF_cKAq.js → middleware-CuZbBw-N.js} +16 -269
- package/dist/{middleware-BXnhAGF9.mjs → middleware-DlcecZMq.mjs} +29 -23
- package/dist/{middleware-DZQsPMZb.mjs → middleware-EI7OU6BR.mjs} +1 -1
- package/dist/{middleware-Caj827xW.cjs → middleware-EqTYPG4F.cjs} +45 -298
- package/dist/{mod-DXY9JF28.d.cts → mod-B-Lin9Sy.d.ts} +25 -2
- package/dist/{mod-DHO9lk3D.d.ts → mod-BDhgfjP7.d.cts} +25 -2
- package/dist/{mod-B0rWmfW5.d.cts → mod-BR_BB0bh.d.cts} +1 -1
- package/dist/{mod-Dx3-hqyo.d.ts → mod-C6E8rkcz.d.ts} +1 -1
- package/dist/{mod-BhU_H1I_.d.ts → mod-DLrRb0dx.d.ts} +1 -1
- package/dist/{mod-CLPnQPsv.d.cts → mod-P9tE2WmM.d.cts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +5 -5
- package/dist/mod.d.ts +5 -5
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/client.test.mjs +2 -2
- package/dist/nodeinfo/handler.test.mjs +3 -3
- package/dist/nodeinfo/types.test.mjs +2 -2
- package/dist/otel/exporter.test.mjs +2 -2
- package/dist/{outgoing-jsonld-BgFLCJQ_.mjs → outgoing-jsonld-BNL8AC14.mjs} +1 -1
- package/dist/{owner-DwJe0BH9.mjs → owner-DO810N24.mjs} +2 -2
- package/dist/{proof-erpV_J_n.mjs → proof-BgfyWv7b.mjs} +25 -7
- package/dist/{proof-CZCaAURh.cjs → proof-DIoqrKnX.cjs} +78 -11
- package/dist/{proof-DMJJZnKd.js → proof-Vd8-1EWh.js} +78 -11
- package/dist/send-CAYXdUTk.mjs +225 -0
- package/dist/sig/accept.test.mjs +1 -1
- package/dist/sig/http.test.mjs +212 -6
- package/dist/sig/key.test.mjs +4 -4
- package/dist/sig/ld.test.mjs +138 -5
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +4 -4
- package/dist/sig/proof.test.mjs +167 -6
- package/dist/{std__assert-CRDpx_HF.mjs → std__assert-BTEgfoJo.mjs} +2 -27
- package/dist/utils/docloader.test.mjs +5 -5
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +6 -6
- /package/dist/{accept-CceiKpCy.mjs → accept-CgDcxvjV.mjs} +0 -0
- /package/dist/{activity-listener-tztVvlNb.mjs → activity-listener-BeTGV3wc.mjs} +0 -0
- /package/dist/{client-B_A6mfn3.mjs → client-Bneh_DYR.mjs} +0 -0
- /package/dist/{collection-CA3V5zyK.mjs → collection-Cc3DVAhE.mjs} +0 -0
- /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/{keys-C3kae-6B.mjs → keys-CSYsOMFG.mjs} +0 -0
- /package/dist/{kv-x2IvBUyq.mjs → kv-QHE0oeM3.mjs} +0 -0
- /package/dist/{kv-cache-CiiNwT6W.mjs → kv-cache-DihufyAQ.mjs} +0 -0
- /package/dist/{public-audience-N3pyOx2p.mjs → public-audience-c9zmYKgA.mjs} +0 -0
- /package/dist/{types-BFowWFTT.mjs → types-D09GN0uZ.mjs} +0 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { S as KeyCache } from "./http-
|
|
2
|
+
import { S as KeyCache } from "./http-D6aw3j2U.cjs";
|
|
3
3
|
import { CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "@fedify/vocab";
|
|
4
|
-
import { TracerProvider } from "@opentelemetry/api";
|
|
5
4
|
import { DocumentLoader } from "@fedify/vocab-runtime";
|
|
5
|
+
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
6
6
|
|
|
7
7
|
//#region src/sig/ld.d.ts
|
|
8
8
|
/**
|
|
@@ -127,9 +127,26 @@ interface VerifySignatureOptions {
|
|
|
127
127
|
* @since 1.3.0
|
|
128
128
|
*/
|
|
129
129
|
tracerProvider?: TracerProvider;
|
|
130
|
+
/**
|
|
131
|
+
* The OpenTelemetry meter provider. If omitted, the global meter provider
|
|
132
|
+
* is used.
|
|
133
|
+
* @since 2.3.0
|
|
134
|
+
*/
|
|
135
|
+
meterProvider?: MeterProvider;
|
|
130
136
|
}
|
|
131
137
|
/**
|
|
132
138
|
* Verifies Linked Data Signatures of the given JSON-LD document.
|
|
139
|
+
*
|
|
140
|
+
* This is a low-level utility that only checks the cryptographic signature
|
|
141
|
+
* and (optionally) the cached key. It does not run the JSON-LD parsing,
|
|
142
|
+
* attribution, and owner checks that a complete inbound LD verification
|
|
143
|
+
* needs. For incoming activities, prefer {@link verifyJsonLd}, which is
|
|
144
|
+
* the public verification entry point and the one that emits the
|
|
145
|
+
* `activitypub.signature.verification.duration` metric for the LD path.
|
|
146
|
+
* `verifySignature` itself only emits
|
|
147
|
+
* `activitypub.signature.key_fetch.duration`, since the rest of the work
|
|
148
|
+
* that the verification-duration metric is meant to cover happens in
|
|
149
|
+
* `verifyJsonLd`.
|
|
133
150
|
* @param jsonLd The JSON-LD document to verify.
|
|
134
151
|
* @param options Options for verifying the signature.
|
|
135
152
|
* @returns The public key that signed the document or `null` if the signature
|
|
@@ -246,6 +263,12 @@ interface VerifyProofOptions {
|
|
|
246
263
|
* @since 1.3.0
|
|
247
264
|
*/
|
|
248
265
|
tracerProvider?: TracerProvider;
|
|
266
|
+
/**
|
|
267
|
+
* The OpenTelemetry meter provider. If omitted, the global meter provider
|
|
268
|
+
* is used.
|
|
269
|
+
* @since 2.3.0
|
|
270
|
+
*/
|
|
271
|
+
meterProvider?: MeterProvider;
|
|
249
272
|
}
|
|
250
273
|
/**
|
|
251
274
|
* Verifies the given proof for the object.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { n as HttpMessageSignaturesSpecDeterminer } from "./http-
|
|
2
|
+
import { n as HttpMessageSignaturesSpecDeterminer } from "./http-D6aw3j2U.cjs";
|
|
3
3
|
import { n as KvStore, t as KvKey } from "./kv-gJ8LYbxX.cjs";
|
|
4
4
|
import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
|
|
5
5
|
import { TracerProvider } from "@opentelemetry/api";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { Ct as WebFingerLinksDispatcher, et as ActorAliasMapper, l as RequestContext, nt as ActorHandleMapper, tt as ActorDispatcher } from "./context-
|
|
2
|
+
import { Ct as WebFingerLinksDispatcher, et as ActorAliasMapper, l as RequestContext, nt as ActorHandleMapper, tt as ActorDispatcher } from "./context-cSUMk2da.js";
|
|
3
3
|
import { Span, Tracer } from "@opentelemetry/api";
|
|
4
4
|
|
|
5
5
|
//#region src/federation/webfinger.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { n as HttpMessageSignaturesSpecDeterminer } from "./http-
|
|
2
|
+
import { n as HttpMessageSignaturesSpecDeterminer } from "./http-D6LP89UO.js";
|
|
3
3
|
import { n as KvStore, t as KvKey } from "./kv-D6hNiMTK.js";
|
|
4
4
|
import { TracerProvider } from "@opentelemetry/api";
|
|
5
5
|
import { DocumentLoader, DocumentLoaderFactoryOptions } from "@fedify/vocab-runtime";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { Ct as WebFingerLinksDispatcher, et as ActorAliasMapper, l as RequestContext, nt as ActorHandleMapper, tt as ActorDispatcher } from "./context-
|
|
2
|
+
import { Ct as WebFingerLinksDispatcher, et as ActorAliasMapper, l as RequestContext, nt as ActorHandleMapper, tt as ActorDispatcher } from "./context-Ch-ZLyTQ.cjs";
|
|
3
3
|
import { Span, Tracer } from "@opentelemetry/api";
|
|
4
4
|
|
|
5
5
|
//#region src/federation/webfinger.d.ts
|
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-CKCgOPkX.cjs");
|
|
8
|
+
const require_middleware = require("./middleware-EqTYPG4F.cjs");
|
|
9
|
+
const require_proof = require("./proof-DIoqrKnX.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-DY-XWOqM.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,13 +1,13 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
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
|
-
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-
|
|
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-D6aw3j2U.cjs";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-DEvZuyOE.cjs";
|
|
5
|
-
import { $ as ParallelMessageQueue, A as FederationKvPrefixes, B as Router, C as IdempotencyKeyCallback, Ct as WebFingerLinksDispatcher, D as ObjectCallbackSetters, Dt as buildCollectionSynchronizationHeader, E as InboxListenerSetters, Et as PageItems, F as RetryContext, G as respondWithObject, H as RouterOptions, I as RetryPolicy, J as InProcessMessageQueueOptions, K as respondWithObjectIfAcceptable, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, Ot as digest, P as CreateExponentialBackoffPolicyOptions, Q as MessageQueueListenOptions, R as Message, S as FederationStartQueueOptions, St as UnverifiedActivityReason, T as InboxChallengePolicy, Tt as SenderKeyPair, U as RouterRouteResult, V as RouterError, W as RespondWithObjectOptions, X as MessageQueueDepth, Y as MessageQueue, Z as MessageQueueEnqueueOptions, _ as Federatable, _t as OutboxListener, a as GetSignedKeyOptions, at as CollectionCounter, b as FederationFetchOptions, bt as SharedInboxKeyDispatcher, c as ParseUriResult, ct as CustomCollectionCounter, d as SendActivityOptions, dt as InboxErrorHandler, et as ActorAliasMapper, f as SendActivityOptionsForCollection, ft as InboxListener, g as CustomCollectionCallbackSetters, gt as OutboxErrorHandler, h as ConstructorWithTypeId, ht as ObjectDispatcher, i as GetActorOptions, it as AuthorizePredicate, j as FederationOrigin, k as Rfc6570Expression, kt as ActivityTransformer, l as RequestContext, lt as CustomCollectionCursor, m as CollectionCallbackSetters, mt as ObjectAuthorizePredicate, n as Context, nt as ActorHandleMapper, o as InboxContext, ot as CollectionCursor, p as ActorCallbackSetters, pt as NodeInfoDispatcher, q as InProcessMessageQueue, r as ForwardActivityOptions, rt as ActorKeyPairsDispatcher, s as OutboxContext, st as CollectionDispatcher, t as ActorKeyPair, tt as ActorDispatcher, u as RouteActivityOptions, ut as CustomCollectionDispatcher, v as Federation, vt as OutboxListenerErrorHandler, w as IdempotencyStrategy, wt as SendActivityError, x as FederationOptions, xt as UnverifiedActivityHandler, y as FederationBuilder, yt as OutboxPermanentFailureHandler, z as createFederationBuilder } from "./context-
|
|
5
|
+
import { $ as ParallelMessageQueue, A as FederationKvPrefixes, B as Router, C as IdempotencyKeyCallback, Ct as WebFingerLinksDispatcher, D as ObjectCallbackSetters, Dt as buildCollectionSynchronizationHeader, E as InboxListenerSetters, Et as PageItems, F as RetryContext, G as respondWithObject, H as RouterOptions, I as RetryPolicy, J as InProcessMessageQueueOptions, K as respondWithObjectIfAcceptable, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, Ot as digest, P as CreateExponentialBackoffPolicyOptions, Q as MessageQueueListenOptions, R as Message, S as FederationStartQueueOptions, St as UnverifiedActivityReason, T as InboxChallengePolicy, Tt as SenderKeyPair, U as RouterRouteResult, V as RouterError, W as RespondWithObjectOptions, X as MessageQueueDepth, Y as MessageQueue, Z as MessageQueueEnqueueOptions, _ as Federatable, _t as OutboxListener, a as GetSignedKeyOptions, at as CollectionCounter, b as FederationFetchOptions, bt as SharedInboxKeyDispatcher, c as ParseUriResult, ct as CustomCollectionCounter, d as SendActivityOptions, dt as InboxErrorHandler, et as ActorAliasMapper, f as SendActivityOptionsForCollection, ft as InboxListener, g as CustomCollectionCallbackSetters, gt as OutboxErrorHandler, h as ConstructorWithTypeId, ht as ObjectDispatcher, i as GetActorOptions, it as AuthorizePredicate, j as FederationOrigin, k as Rfc6570Expression, kt as ActivityTransformer, l as RequestContext, lt as CustomCollectionCursor, m as CollectionCallbackSetters, mt as ObjectAuthorizePredicate, n as Context, nt as ActorHandleMapper, o as InboxContext, ot as CollectionCursor, p as ActorCallbackSetters, pt as NodeInfoDispatcher, q as InProcessMessageQueue, r as ForwardActivityOptions, rt as ActorKeyPairsDispatcher, s as OutboxContext, st as CollectionDispatcher, t as ActorKeyPair, tt as ActorDispatcher, u as RouteActivityOptions, ut as CustomCollectionDispatcher, v as Federation, vt as OutboxListenerErrorHandler, w as IdempotencyStrategy, wt as SendActivityError, x as FederationOptions, xt as UnverifiedActivityHandler, y as FederationBuilder, yt as OutboxPermanentFailureHandler, z as createFederationBuilder } from "./context-Ch-ZLyTQ.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 { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.cjs";
|
|
8
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-
|
|
9
|
-
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-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-
|
|
8
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-P9tE2WmM.cjs";
|
|
9
|
+
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-BDhgfjP7.cjs";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-BR_BB0bh.cjs";
|
|
11
11
|
export * from "@fedify/vocab-runtime";
|
|
12
12
|
|
|
13
13
|
//#region src/mod.d.ts
|
package/dist/mod.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
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
|
-
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-
|
|
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-D6LP89UO.js";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-CnngXDNJ.js";
|
|
5
|
-
import { $ as ParallelMessageQueue, A as FederationKvPrefixes, B as Router, C as IdempotencyKeyCallback, Ct as WebFingerLinksDispatcher, D as ObjectCallbackSetters, Dt as buildCollectionSynchronizationHeader, E as InboxListenerSetters, Et as PageItems, F as RetryContext, G as respondWithObject, H as RouterOptions, I as RetryPolicy, J as InProcessMessageQueueOptions, K as respondWithObjectIfAcceptable, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, Ot as digest, P as CreateExponentialBackoffPolicyOptions, Q as MessageQueueListenOptions, R as Message, S as FederationStartQueueOptions, St as UnverifiedActivityReason, T as InboxChallengePolicy, Tt as SenderKeyPair, U as RouterRouteResult, V as RouterError, W as RespondWithObjectOptions, X as MessageQueueDepth, Y as MessageQueue, Z as MessageQueueEnqueueOptions, _ as Federatable, _t as OutboxListener, a as GetSignedKeyOptions, at as CollectionCounter, b as FederationFetchOptions, bt as SharedInboxKeyDispatcher, c as ParseUriResult, ct as CustomCollectionCounter, d as SendActivityOptions, dt as InboxErrorHandler, et as ActorAliasMapper, f as SendActivityOptionsForCollection, ft as InboxListener, g as CustomCollectionCallbackSetters, gt as OutboxErrorHandler, h as ConstructorWithTypeId, ht as ObjectDispatcher, i as GetActorOptions, it as AuthorizePredicate, j as FederationOrigin, k as Rfc6570Expression, kt as ActivityTransformer, l as RequestContext, lt as CustomCollectionCursor, m as CollectionCallbackSetters, mt as ObjectAuthorizePredicate, n as Context, nt as ActorHandleMapper, o as InboxContext, ot as CollectionCursor, p as ActorCallbackSetters, pt as NodeInfoDispatcher, q as InProcessMessageQueue, r as ForwardActivityOptions, rt as ActorKeyPairsDispatcher, s as OutboxContext, st as CollectionDispatcher, t as ActorKeyPair, tt as ActorDispatcher, u as RouteActivityOptions, ut as CustomCollectionDispatcher, v as Federation, vt as OutboxListenerErrorHandler, w as IdempotencyStrategy, wt as SendActivityError, x as FederationOptions, xt as UnverifiedActivityHandler, y as FederationBuilder, yt as OutboxPermanentFailureHandler, z as createFederationBuilder } from "./context-
|
|
5
|
+
import { $ as ParallelMessageQueue, A as FederationKvPrefixes, B as Router, C as IdempotencyKeyCallback, Ct as WebFingerLinksDispatcher, D as ObjectCallbackSetters, Dt as buildCollectionSynchronizationHeader, E as InboxListenerSetters, Et as PageItems, F as RetryContext, G as respondWithObject, H as RouterOptions, I as RetryPolicy, J as InProcessMessageQueueOptions, K as respondWithObjectIfAcceptable, L as createExponentialBackoffPolicy, M as FederationQueueOptions, N as createFederation, O as OutboxListenerSetters, Ot as digest, P as CreateExponentialBackoffPolicyOptions, Q as MessageQueueListenOptions, R as Message, S as FederationStartQueueOptions, St as UnverifiedActivityReason, T as InboxChallengePolicy, Tt as SenderKeyPair, U as RouterRouteResult, V as RouterError, W as RespondWithObjectOptions, X as MessageQueueDepth, Y as MessageQueue, Z as MessageQueueEnqueueOptions, _ as Federatable, _t as OutboxListener, a as GetSignedKeyOptions, at as CollectionCounter, b as FederationFetchOptions, bt as SharedInboxKeyDispatcher, c as ParseUriResult, ct as CustomCollectionCounter, d as SendActivityOptions, dt as InboxErrorHandler, et as ActorAliasMapper, f as SendActivityOptionsForCollection, ft as InboxListener, g as CustomCollectionCallbackSetters, gt as OutboxErrorHandler, h as ConstructorWithTypeId, ht as ObjectDispatcher, i as GetActorOptions, it as AuthorizePredicate, j as FederationOrigin, k as Rfc6570Expression, kt as ActivityTransformer, l as RequestContext, lt as CustomCollectionCursor, m as CollectionCallbackSetters, mt as ObjectAuthorizePredicate, n as Context, nt as ActorHandleMapper, o as InboxContext, ot as CollectionCursor, p as ActorCallbackSetters, pt as NodeInfoDispatcher, q as InProcessMessageQueue, r as ForwardActivityOptions, rt as ActorKeyPairsDispatcher, s as OutboxContext, st as CollectionDispatcher, t as ActorKeyPair, tt as ActorDispatcher, u as RouteActivityOptions, ut as CustomCollectionDispatcher, v as Federation, vt as OutboxListenerErrorHandler, w as IdempotencyStrategy, wt as SendActivityError, x as FederationOptions, xt as UnverifiedActivityHandler, y as FederationBuilder, yt as OutboxPermanentFailureHandler, z as createFederationBuilder } from "./context-cSUMk2da.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 { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
|
|
8
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-
|
|
9
|
-
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-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-
|
|
8
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-C6E8rkcz.js";
|
|
9
|
+
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-B-Lin9Sy.js";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-DLrRb0dx.js";
|
|
11
11
|
export * from "@fedify/vocab-runtime";
|
|
12
12
|
|
|
13
13
|
//#region src/mod.d.ts
|
package/dist/mod.js
CHANGED
|
@@ -3,11 +3,11 @@ import { URLPattern } from "urlpattern-polyfill";
|
|
|
3
3
|
import "./chunk-CRNNMoPX.js";
|
|
4
4
|
import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-BGMIq1cs.js";
|
|
5
5
|
import "./compat/mod.js";
|
|
6
|
-
import { a as verifyRequestDetailed,
|
|
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-
|
|
8
|
-
import { a as verifyProof, c as getKeyOwner, d as detachSignature, f as hasSignatureLike, h as verifySignature, i as verifyObject, l as attachSignature, m as verifyJsonLd, n as hasProofLike, p as signJsonLd, r as signObject, s as doesActorOwnKey, t as createProof, u as createSignature } from "./proof-
|
|
6
|
+
import { a as verifyRequestDetailed, b as parseAcceptSignature, c as fetchKeyDetailed, i as verifyRequest, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk, v as formatAcceptSignature, x as validateAcceptSignature, y as fulfillAcceptSignature } from "./http-CpzZ9zsb.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-CuZbBw-N.js";
|
|
8
|
+
import { a as verifyProof, c as getKeyOwner, d as detachSignature, f as hasSignatureLike, h as verifySignature, i as verifyObject, l as attachSignature, m as verifyJsonLd, n as hasProofLike, p as signJsonLd, r as signObject, s as doesActorOwnKey, t as createProof, u as createSignature } from "./proof-Vd8-1EWh.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-Wc5ezcVW.js";
|
|
11
11
|
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation/mod.js";
|
|
12
12
|
import "./nodeinfo/mod.js";
|
|
13
13
|
import "./runtime/mod.js";
|
|
@@ -2,9 +2,9 @@ import "@js-temporal/polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
-
import "../std__assert-
|
|
5
|
+
import "../std__assert-BTEgfoJo.mjs";
|
|
6
6
|
import { t as esm_default } from "../esm-sdtqOUPu.mjs";
|
|
7
|
-
import { a as parseProtocol, c as parseUsage, i as parseOutboundService, n as parseInboundService, o as parseServices, r as parseNodeInfo, s as parseSoftware, t as getNodeInfo } from "../client-
|
|
7
|
+
import { a as parseProtocol, c as parseUsage, i as parseOutboundService, n as parseInboundService, o as parseServices, r as parseNodeInfo, s as parseSoftware, t as getNodeInfo } from "../client-Bneh_DYR.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/nodeinfo/client.test.ts
|
|
10
10
|
test("getNodeInfo()", async (t) => {
|
|
@@ -3,9 +3,9 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { r as createRequestContext } from "../context-BAE7AKLA.mjs";
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
|
-
import "../std__assert-
|
|
7
|
-
import { t as MemoryKvStore } from "../kv-
|
|
8
|
-
import { _ as handleNodeInfoJrd, g as handleNodeInfo, o as createFederation } from "../middleware-
|
|
6
|
+
import "../std__assert-BTEgfoJo.mjs";
|
|
7
|
+
import { t as MemoryKvStore } from "../kv-QHE0oeM3.mjs";
|
|
8
|
+
import { _ as handleNodeInfoJrd, g as handleNodeInfo, o as createFederation } from "../middleware-DlcecZMq.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
//#region src/nodeinfo/handler.test.ts
|
|
11
11
|
test("handleNodeInfo()", async () => {
|
|
@@ -2,9 +2,9 @@ import "@js-temporal/polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
-
import "../std__assert-
|
|
5
|
+
import "../std__assert-BTEgfoJo.mjs";
|
|
6
6
|
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
7
|
-
import { t as nodeInfoToJson } from "../types-
|
|
7
|
+
import { t as nodeInfoToJson } from "../types-D09GN0uZ.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/nodeinfo/types.test.ts
|
|
10
10
|
test("nodeInfoToJson()", () => {
|
|
@@ -2,8 +2,8 @@ import { Temporal } from "@js-temporal/polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
-
import "../std__assert-
|
|
6
|
-
import { t as MemoryKvStore } from "../kv-
|
|
5
|
+
import "../std__assert-BTEgfoJo.mjs";
|
|
6
|
+
import { t as MemoryKvStore } from "../kv-QHE0oeM3.mjs";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { ExportResultCode } from "@opentelemetry/core";
|
|
9
9
|
import { SpanKind, SpanStatusCode, TraceFlags } from "@opentelemetry/api";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as preloadedOnlyDocumentLoader, t as normalizePublicAudience } from "./public-audience-
|
|
4
|
+
import { n as preloadedOnlyDocumentLoader, t as normalizePublicAudience } from "./public-audience-c9zmYKgA.mjs";
|
|
5
5
|
import { getLogger } from "@logtape/logtape";
|
|
6
6
|
import { preloadedContexts } from "@fedify/vocab-runtime";
|
|
7
7
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
@@ -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-CF3jMgip.mjs";
|
|
5
|
+
import "./key-B4I8H5Lc.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,16 +1,26 @@
|
|
|
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-
|
|
5
|
-
import { n as
|
|
6
|
-
import { n as
|
|
7
|
-
import {
|
|
4
|
+
import { n as version, t as name } from "./deno-CF3jMgip.mjs";
|
|
5
|
+
import { a as measureSignatureKeyFetch, n as getFederationMetrics, t as getDurationMs } from "./metrics-ek3ilf6c.mjs";
|
|
6
|
+
import { n as fetchKey, o as validateCryptoKey } from "./key-B4I8H5Lc.mjs";
|
|
7
|
+
import { n as preloadedOnlyDocumentLoader } from "./public-audience-c9zmYKgA.mjs";
|
|
8
|
+
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-BNL8AC14.mjs";
|
|
8
9
|
import { getLogger } from "@logtape/logtape";
|
|
9
10
|
import { Activity, DataIntegrityProof, Multikey, getTypeId } from "@fedify/vocab";
|
|
10
11
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
11
12
|
import { encodeHex } from "byte-encodings/hex";
|
|
12
13
|
import serialize from "json-canon";
|
|
13
14
|
//#region src/sig/proof.ts
|
|
15
|
+
/**
|
|
16
|
+
* Known Object Integrity Proof `cryptosuite` values, used to keep
|
|
17
|
+
* `object_integrity_proofs.cryptosuite` on a bounded set of spec-defined
|
|
18
|
+
* string values. Fedify currently signs and verifies only
|
|
19
|
+
* `eddsa-jcs-2022`; other values come in only from external proofs and are
|
|
20
|
+
* dropped from the metric attribute to avoid attacker-controlled
|
|
21
|
+
* cardinality.
|
|
22
|
+
*/
|
|
23
|
+
const OIP_KNOWN_CRYPTOSUITES = new Set(["eddsa-jcs-2022"]);
|
|
14
24
|
const logger = getLogger([
|
|
15
25
|
"fedify",
|
|
16
26
|
"sig",
|
|
@@ -137,6 +147,10 @@ async function signObject(object, privateKey, keyId, options = {}) {
|
|
|
137
147
|
*/
|
|
138
148
|
async function verifyProof(jsonLd, proof, options = {}) {
|
|
139
149
|
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("object_integrity_proofs.verify", async (span) => {
|
|
150
|
+
const start = performance.now();
|
|
151
|
+
let verified = false;
|
|
152
|
+
let threw = false;
|
|
153
|
+
const cryptosuite = proof.cryptosuite != null && OIP_KNOWN_CRYPTOSUITES.has(proof.cryptosuite) ? proof.cryptosuite : void 0;
|
|
140
154
|
if (span.isRecording()) {
|
|
141
155
|
if (proof.cryptosuite != null) span.setAttribute("object_integrity_proofs.cryptosuite", proof.cryptosuite);
|
|
142
156
|
if (proof.verificationMethodId != null) span.setAttribute("object_integrity_proofs.key_id", proof.verificationMethodId.href);
|
|
@@ -145,21 +159,25 @@ async function verifyProof(jsonLd, proof, options = {}) {
|
|
|
145
159
|
try {
|
|
146
160
|
const key = await verifyProofInternal(jsonLd, proof, options);
|
|
147
161
|
if (key == null) span.setStatus({ code: SpanStatusCode.ERROR });
|
|
162
|
+
else verified = true;
|
|
148
163
|
return key;
|
|
149
164
|
} catch (error) {
|
|
165
|
+
threw = true;
|
|
150
166
|
span.setStatus({
|
|
151
167
|
code: SpanStatusCode.ERROR,
|
|
152
168
|
message: String(error)
|
|
153
169
|
});
|
|
154
170
|
throw error;
|
|
155
171
|
} finally {
|
|
172
|
+
const classified = threw ? "error" : verified ? "verified" : "rejected";
|
|
173
|
+
getFederationMetrics(options.meterProvider).recordSignatureVerificationDuration(getDurationMs(start), "object_integrity", classified, { cryptosuite });
|
|
156
174
|
span.end();
|
|
157
175
|
}
|
|
158
176
|
});
|
|
159
177
|
}
|
|
160
178
|
async function verifyProofInternal(jsonLd, proof, options) {
|
|
161
179
|
if (typeof jsonLd !== "object" || jsonLd == null || Array.isArray(jsonLd) || proof.cryptosuite !== "eddsa-jcs-2022" || proof.verificationMethodId == null || proof.proofPurpose !== "assertionMethod" || proof.proofValue == null || proof.created == null) return null;
|
|
162
|
-
const publicKeyPromise = fetchKey(proof.verificationMethodId, Multikey, options);
|
|
180
|
+
const publicKeyPromise = measureSignatureKeyFetch(options.meterProvider, "object_integrity", () => fetchKey(proof.verificationMethodId, Multikey, options));
|
|
163
181
|
const proofConfig = {
|
|
164
182
|
"@context": jsonLd["@context"],
|
|
165
183
|
type: "DataIntegrityProof",
|
|
@@ -199,7 +217,7 @@ async function verifyProofInternal(jsonLd, proof, options) {
|
|
|
199
217
|
proof,
|
|
200
218
|
keyId: proof.verificationMethodId.href
|
|
201
219
|
});
|
|
202
|
-
return await
|
|
220
|
+
return await verifyProofInternal(jsonLd, proof, {
|
|
203
221
|
...options,
|
|
204
222
|
keyCache: {
|
|
205
223
|
get: () => Promise.resolve(void 0),
|
|
@@ -230,7 +248,7 @@ async function verifyProofInternal(jsonLd, proof, options) {
|
|
|
230
248
|
keyId: proof.verificationMethodId.href,
|
|
231
249
|
proof
|
|
232
250
|
});
|
|
233
|
-
return await
|
|
251
|
+
return await verifyProofInternal(jsonLd, proof, {
|
|
234
252
|
...options,
|
|
235
253
|
keyCache: {
|
|
236
254
|
get: () => Promise.resolve(void 0),
|
|
@@ -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-CKCgOPkX.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");
|
|
@@ -148,6 +148,17 @@ function detachSignature(jsonLd) {
|
|
|
148
148
|
}
|
|
149
149
|
/**
|
|
150
150
|
* Verifies Linked Data Signatures of the given JSON-LD document.
|
|
151
|
+
*
|
|
152
|
+
* This is a low-level utility that only checks the cryptographic signature
|
|
153
|
+
* and (optionally) the cached key. It does not run the JSON-LD parsing,
|
|
154
|
+
* attribution, and owner checks that a complete inbound LD verification
|
|
155
|
+
* needs. For incoming activities, prefer {@link verifyJsonLd}, which is
|
|
156
|
+
* the public verification entry point and the one that emits the
|
|
157
|
+
* `activitypub.signature.verification.duration` metric for the LD path.
|
|
158
|
+
* `verifySignature` itself only emits
|
|
159
|
+
* `activitypub.signature.key_fetch.duration`, since the rest of the work
|
|
160
|
+
* that the verification-duration metric is meant to cover happens in
|
|
161
|
+
* `verifyJsonLd`.
|
|
151
162
|
* @param jsonLd The JSON-LD document to verify.
|
|
152
163
|
* @param options Options for verifying the signature.
|
|
153
164
|
* @returns The public key that signed the document or `null` if the signature
|
|
@@ -167,7 +178,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
167
178
|
});
|
|
168
179
|
return null;
|
|
169
180
|
}
|
|
170
|
-
const { key, cached } = await require_http.fetchKey(new URL(sig.creator), _fedify_vocab.CryptographicKey, options);
|
|
181
|
+
const { key, cached } = await require_http.measureSignatureKeyFetch(options.meterProvider, "linked_data", () => require_http.fetchKey(new URL(sig.creator), _fedify_vocab.CryptographicKey, options));
|
|
171
182
|
if (key == null) return null;
|
|
172
183
|
const sigOpts = {
|
|
173
184
|
...sig,
|
|
@@ -207,13 +218,13 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
207
218
|
keyId: sig.creator,
|
|
208
219
|
...sig
|
|
209
220
|
});
|
|
210
|
-
const { key } = await require_http.fetchKey(new URL(sig.creator), _fedify_vocab.CryptographicKey, {
|
|
221
|
+
const { key } = await require_http.measureSignatureKeyFetch(options.meterProvider, "linked_data", () => require_http.fetchKey(new URL(sig.creator), _fedify_vocab.CryptographicKey, {
|
|
211
222
|
...options,
|
|
212
223
|
keyCache: {
|
|
213
224
|
get: () => Promise.resolve(void 0),
|
|
214
225
|
set: async (keyId, key) => await options.keyCache?.set(keyId, key)
|
|
215
226
|
}
|
|
216
|
-
});
|
|
227
|
+
}));
|
|
217
228
|
if (key == null) return null;
|
|
218
229
|
return await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, signature.slice(), messageBytes) ? key : null;
|
|
219
230
|
}
|
|
@@ -225,6 +236,33 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
225
236
|
return null;
|
|
226
237
|
}
|
|
227
238
|
/**
|
|
239
|
+
* Known Linked Data Signature `type` values, used to keep
|
|
240
|
+
* `ld_signatures.type` on a bounded set of spec-defined string values.
|
|
241
|
+
* Fedify only signs and verifies `RsaSignature2017`; other values come in
|
|
242
|
+
* only from external documents and are dropped from the metric attribute to
|
|
243
|
+
* avoid attacker-controlled cardinality.
|
|
244
|
+
*/
|
|
245
|
+
const LD_KNOWN_SIGNATURE_TYPES = new Set(["RsaSignature2017"]);
|
|
246
|
+
/**
|
|
247
|
+
* Reports only whether a `signature` key is present on the document, with
|
|
248
|
+
* no shape check on its value. This is intentionally looser than
|
|
249
|
+
* {@link hasSignature} (which validates a full `RsaSignature2017` shape)
|
|
250
|
+
* and {@link hasSignatureLike} (which structurally accepts several known
|
|
251
|
+
* suites): `verifyJsonLd` needs to tell a document with a malformed or
|
|
252
|
+
* unsupported signature payload (classified as `rejected`) apart from a
|
|
253
|
+
* truly unsigned document (classified as `missing`), and only this
|
|
254
|
+
* presence-only check captures both cases.
|
|
255
|
+
*/
|
|
256
|
+
function hasLdSignatureProperty(jsonLd) {
|
|
257
|
+
return typeof jsonLd === "object" && jsonLd != null && "signature" in jsonLd;
|
|
258
|
+
}
|
|
259
|
+
function getLdSignatureObject(jsonLd) {
|
|
260
|
+
if (!hasLdSignatureProperty(jsonLd)) return void 0;
|
|
261
|
+
const { signature } = jsonLd;
|
|
262
|
+
if (typeof signature !== "object" || signature == null || Array.isArray(signature)) return;
|
|
263
|
+
return signature;
|
|
264
|
+
}
|
|
265
|
+
/**
|
|
228
266
|
* Verify the authenticity of the given JSON-LD document using Linked Data
|
|
229
267
|
* Signatures. If the document is signed, this function verifies the signature
|
|
230
268
|
* and checks if the document is attributed to the owner of the public key.
|
|
@@ -235,14 +273,22 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
235
273
|
*/
|
|
236
274
|
async function verifyJsonLd(jsonLd, options = {}) {
|
|
237
275
|
return await (options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()).getTracer(require_http.name, require_http.version).startActiveSpan("ld_signatures.verify", async (span) => {
|
|
276
|
+
const start = performance.now();
|
|
277
|
+
let verified = false;
|
|
278
|
+
let threw = false;
|
|
279
|
+
let signatureType;
|
|
238
280
|
try {
|
|
239
281
|
const object = await _fedify_vocab.Object.fromJsonLd(jsonLd, options);
|
|
240
282
|
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
241
283
|
span.setAttribute("activitypub.object.type", (0, _fedify_vocab.getTypeId)(object).href);
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
if (
|
|
245
|
-
if (
|
|
284
|
+
const sig = getLdSignatureObject(jsonLd);
|
|
285
|
+
if (sig != null) {
|
|
286
|
+
if (typeof sig.creator === "string") span.setAttribute("ld_signatures.key_id", sig.creator);
|
|
287
|
+
if (typeof sig.signatureValue === "string") span.setAttribute("ld_signatures.signature", sig.signatureValue);
|
|
288
|
+
if (typeof sig.type === "string") {
|
|
289
|
+
span.setAttribute("ld_signatures.type", sig.type);
|
|
290
|
+
if (LD_KNOWN_SIGNATURE_TYPES.has(sig.type)) signatureType = sig.type;
|
|
291
|
+
}
|
|
246
292
|
}
|
|
247
293
|
const attributions = new Set(object.attributionIds.map((uri) => uri.href));
|
|
248
294
|
if (object instanceof _fedify_vocab.Activity) for (const uri of object.actorIds) attributions.add(uri.href);
|
|
@@ -257,14 +303,18 @@ async function verifyJsonLd(jsonLd, options = {}) {
|
|
|
257
303
|
logger$3.debug("Some attributions are not authenticated by the Linked Data Signatures: {attributions}.", { attributions: [...attributions] });
|
|
258
304
|
return false;
|
|
259
305
|
}
|
|
306
|
+
verified = true;
|
|
260
307
|
return true;
|
|
261
308
|
} catch (error) {
|
|
309
|
+
threw = true;
|
|
262
310
|
span.setStatus({
|
|
263
311
|
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
264
312
|
message: String(error)
|
|
265
313
|
});
|
|
266
314
|
throw error;
|
|
267
315
|
} finally {
|
|
316
|
+
const classified = threw ? "error" : verified ? "verified" : hasLdSignatureProperty(jsonLd) ? "rejected" : "missing";
|
|
317
|
+
require_http.getFederationMetrics(options.meterProvider).recordSignatureVerificationDuration(require_http.getDurationMs(start), "linked_data", classified, { ldType: signatureType });
|
|
268
318
|
span.end();
|
|
269
319
|
}
|
|
270
320
|
});
|
|
@@ -769,6 +819,15 @@ async function normalizeOutgoingActivityJsonLd(jsonLd, contextLoader) {
|
|
|
769
819
|
}
|
|
770
820
|
//#endregion
|
|
771
821
|
//#region src/sig/proof.ts
|
|
822
|
+
/**
|
|
823
|
+
* Known Object Integrity Proof `cryptosuite` values, used to keep
|
|
824
|
+
* `object_integrity_proofs.cryptosuite` on a bounded set of spec-defined
|
|
825
|
+
* string values. Fedify currently signs and verifies only
|
|
826
|
+
* `eddsa-jcs-2022`; other values come in only from external proofs and are
|
|
827
|
+
* dropped from the metric attribute to avoid attacker-controlled
|
|
828
|
+
* cardinality.
|
|
829
|
+
*/
|
|
830
|
+
const OIP_KNOWN_CRYPTOSUITES = new Set(["eddsa-jcs-2022"]);
|
|
772
831
|
const logger = (0, _logtape_logtape.getLogger)([
|
|
773
832
|
"fedify",
|
|
774
833
|
"sig",
|
|
@@ -895,6 +954,10 @@ async function signObject(object, privateKey, keyId, options = {}) {
|
|
|
895
954
|
*/
|
|
896
955
|
async function verifyProof(jsonLd, proof, options = {}) {
|
|
897
956
|
return await (options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()).getTracer(require_http.name, require_http.version).startActiveSpan("object_integrity_proofs.verify", async (span) => {
|
|
957
|
+
const start = performance.now();
|
|
958
|
+
let verified = false;
|
|
959
|
+
let threw = false;
|
|
960
|
+
const cryptosuite = proof.cryptosuite != null && OIP_KNOWN_CRYPTOSUITES.has(proof.cryptosuite) ? proof.cryptosuite : void 0;
|
|
898
961
|
if (span.isRecording()) {
|
|
899
962
|
if (proof.cryptosuite != null) span.setAttribute("object_integrity_proofs.cryptosuite", proof.cryptosuite);
|
|
900
963
|
if (proof.verificationMethodId != null) span.setAttribute("object_integrity_proofs.key_id", proof.verificationMethodId.href);
|
|
@@ -903,21 +966,25 @@ async function verifyProof(jsonLd, proof, options = {}) {
|
|
|
903
966
|
try {
|
|
904
967
|
const key = await verifyProofInternal(jsonLd, proof, options);
|
|
905
968
|
if (key == null) span.setStatus({ code: _opentelemetry_api.SpanStatusCode.ERROR });
|
|
969
|
+
else verified = true;
|
|
906
970
|
return key;
|
|
907
971
|
} catch (error) {
|
|
972
|
+
threw = true;
|
|
908
973
|
span.setStatus({
|
|
909
974
|
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
910
975
|
message: String(error)
|
|
911
976
|
});
|
|
912
977
|
throw error;
|
|
913
978
|
} finally {
|
|
979
|
+
const classified = threw ? "error" : verified ? "verified" : "rejected";
|
|
980
|
+
require_http.getFederationMetrics(options.meterProvider).recordSignatureVerificationDuration(require_http.getDurationMs(start), "object_integrity", classified, { cryptosuite });
|
|
914
981
|
span.end();
|
|
915
982
|
}
|
|
916
983
|
});
|
|
917
984
|
}
|
|
918
985
|
async function verifyProofInternal(jsonLd, proof, options) {
|
|
919
986
|
if (typeof jsonLd !== "object" || jsonLd == null || Array.isArray(jsonLd) || proof.cryptosuite !== "eddsa-jcs-2022" || proof.verificationMethodId == null || proof.proofPurpose !== "assertionMethod" || proof.proofValue == null || proof.created == null) return null;
|
|
920
|
-
const publicKeyPromise = require_http.fetchKey(proof.verificationMethodId, _fedify_vocab.Multikey, options);
|
|
987
|
+
const publicKeyPromise = require_http.measureSignatureKeyFetch(options.meterProvider, "object_integrity", () => require_http.fetchKey(proof.verificationMethodId, _fedify_vocab.Multikey, options));
|
|
921
988
|
const proofConfig = {
|
|
922
989
|
"@context": jsonLd["@context"],
|
|
923
990
|
type: "DataIntegrityProof",
|
|
@@ -957,7 +1024,7 @@ async function verifyProofInternal(jsonLd, proof, options) {
|
|
|
957
1024
|
proof,
|
|
958
1025
|
keyId: proof.verificationMethodId.href
|
|
959
1026
|
});
|
|
960
|
-
return await
|
|
1027
|
+
return await verifyProofInternal(jsonLd, proof, {
|
|
961
1028
|
...options,
|
|
962
1029
|
keyCache: {
|
|
963
1030
|
get: () => Promise.resolve(void 0),
|
|
@@ -988,7 +1055,7 @@ async function verifyProofInternal(jsonLd, proof, options) {
|
|
|
988
1055
|
keyId: proof.verificationMethodId.href,
|
|
989
1056
|
proof
|
|
990
1057
|
});
|
|
991
|
-
return await
|
|
1058
|
+
return await verifyProofInternal(jsonLd, proof, {
|
|
992
1059
|
...options,
|
|
993
1060
|
keyCache: {
|
|
994
1061
|
get: () => Promise.resolve(void 0),
|