@fedify/fedify 2.0.36-dev.2653 → 2.0.36-dev.2729
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-D6LGNjSj.mjs → builder-DifMW7os.mjs} +3 -3
- package/dist/callback-CJd-aCRE.d.mts +2223 -0
- 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-C00pWP8x.d.ts → context-CgpkmUFq.d.ts} +23 -12
- package/dist/{context-ao-qb3eP.d.cts → context-DGC1C_UU.d.cts} +23 -12
- package/dist/{deno-DnlTCwP9.mjs → deno-CZYDJcbZ.mjs} +1 -1
- package/dist/{docloader-ClA1cBXp.mjs → docloader-DXZDJeg3.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +6 -6
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +7 -7
- 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/send.test.mjs +3 -3
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{http-Cqbz1vSQ.js → http-6beU7KiN.js} +6 -4
- package/dist/{http-Cd8UD1ym.d.ts → http-B57wVmZ3.d.cts} +3 -3
- package/dist/{http-pcUSzQJO.mjs → http-BEyjd3P7.mjs} +6 -4
- package/dist/{http-CUyMHX68.cjs → http-CU9dab8F.cjs} +6 -4
- package/dist/{http-DFqAb11b.d.cts → http-CURWmZlP.d.ts} +3 -3
- package/dist/{inbox-Dvd92fR4.mjs → inbox-DO4a9FKE.mjs} +1 -1
- package/dist/{key-WbbcbEg2.mjs → key-DjCiTRyO.mjs} +3 -2
- package/dist/{kv-cache-C2CZ0wo0.cjs → kv-cache-DFybNxHG.cjs} +1 -1
- package/dist/{kv-cache-CFnt0ze9.js → kv-cache-DPBGlPnW.js} +1 -1
- package/dist/{ld-CQIFcE4D.mjs → ld-B5pG0yhd.mjs} +20 -7
- package/dist/{middleware-CNSvd_Yd.cjs → middleware-Bdvdue5B.cjs} +1 -1
- package/dist/{middleware-C1wIK-Eo.js → middleware-BqQbaTiu.js} +14 -6
- package/dist/{middleware-BW7yDR0N.cjs → middleware-ClxSuYs7.cjs} +15 -7
- package/dist/{middleware-pG3fni-8.mjs → middleware-DnnYzTPv.mjs} +22 -13
- package/dist/{middleware-DdgQlj3K.mjs → middleware-Dsw0i5sQ.mjs} +1 -1
- package/dist/{mod-DtRh015i.d.ts → mod-BqnolIm8.d.ts} +1 -1
- package/dist/{mod-6uJWdCc0.d.cts → mod-BzKteaAe.d.cts} +1 -1
- package/dist/{mod-DGP89q0u.d.ts → mod-CIjZ1RmH.d.ts} +3 -3
- package/dist/{mod-BPDfu4Ey.d.cts → mod-DaQ6pIH3.d.cts} +3 -3
- package/dist/{mod-CL9Ep0uo.d.ts → mod-DmmcsbU8.d.cts} +12 -7
- package/dist/{mod-BA6vqC2S.d.cts → mod-fnE_D0lV.d.ts} +12 -7
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +7 -7
- package/dist/mod.d.ts +7 -7
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-U2uzi8vw.mjs → owner-Dmlm2oR_.mjs} +2 -2
- package/dist/{proof-Czu16ywv.cjs → proof-BGPhmUJL.cjs} +20 -7
- package/dist/{proof-DlcTuXU1.js → proof-iPBfQoMT.js} +20 -7
- package/dist/{proof-DuGHbMbs.mjs → proof-v76wU5Lv.mjs} +4 -3
- package/dist/{send-JCtYxtYm.mjs → send-C830qz95.mjs} +2 -2
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key-types.test.d.mts +218 -0
- package/dist/sig/key-types.test.mjs +8 -0
- package/dist/sig/key.test.mjs +2 -2
- package/dist/sig/ld.test.mjs +156 -4
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +3 -3
- package/dist/sig/mod.d.ts +3 -3
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +2 -2
- package/dist/{temporal-B7Rg3f1o.mjs → temporal-Bm5DL5mq.mjs} +1 -1
- package/dist/testing/mod.d.mts +2 -2123
- package/dist/utils/docloader.test.mjs +2 -2
- 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 +5 -5
package/dist/mod.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
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-jE7oGvRh.js";
|
|
3
|
-
import { a as signRequest, c as FetchKeyResult, d as fetchKey, f as generateCryptoKeyPair, i as VerifyRequestOptions, l as KeyCache, n as HttpMessageSignaturesSpecDeterminer, o as verifyRequest, p as importJwk, r as SignRequestOptions, s as FetchKeyOptions, t as HttpMessageSignaturesSpec, u as exportJwk } from "./http-
|
|
3
|
+
import { a as signRequest, c as FetchKeyResult, d as fetchKey, f as generateCryptoKeyPair, i as VerifyRequestOptions, l as KeyCache, n as HttpMessageSignaturesSpecDeterminer, o as verifyRequest, p as importJwk, r as SignRequestOptions, s as FetchKeyOptions, t as HttpMessageSignaturesSpec, u as exportJwk } from "./http-CURWmZlP.js";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "./owner-CiBPcC6F.js";
|
|
5
|
-
import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, bt as ActivityTransformer, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "./context-
|
|
5
|
+
import { $ as AuthorizePredicate, A as CreateExponentialBackoffPolicyOptions, B as RespondWithObjectOptions, C as InboxListenerSetters, D as FederationOrigin, E as FederationKvPrefixes, F as createFederationBuilder, G as MessageQueue, H as respondWithObjectIfAcceptable, I as Router, J as ParallelMessageQueue, K as MessageQueueEnqueueOptions, L as RouterError, M as RetryPolicy, N as createExponentialBackoffPolicy, O as FederationQueueOptions, P as Message, Q as ActorKeyPairsDispatcher, R as RouterOptions, S as IdempotencyStrategy, T as Rfc6570Expression, U as InProcessMessageQueue, V as respondWithObject, W as InProcessMessageQueueOptions, X as ActorDispatcher, Y as ActorAliasMapper, Z as ActorHandleMapper, _ as FederationBuilder, _t as PageItems, a as InboxContext, at as CustomCollectionDispatcher, b as FederationStartQueueOptions, bt as ActivityTransformer, c as RouteActivityOptions, ct as NodeInfoDispatcher, d as ActorCallbackSetters, dt as OutboxErrorHandler, et as CollectionCounter, f as CollectionCallbackSetters, ft as OutboxPermanentFailureHandler, g as Federation, gt as SenderKeyPair, h as Federatable, ht as SendActivityError, i as GetSignedKeyOptions, it as CustomCollectionCursor, j as RetryContext, k as createFederation, l as SendActivityOptions, lt as ObjectAuthorizePredicate, m as CustomCollectionCallbackSetters, mt as WebFingerLinksDispatcher, n as Context, nt as CollectionDispatcher, o as ParseUriResult, ot as InboxErrorHandler, p as ConstructorWithTypeId, pt as SharedInboxKeyDispatcher, q as MessageQueueListenOptions, r as ForwardActivityOptions, rt as CustomCollectionCounter, s as RequestContext, st as InboxListener, t as ActorKeyPair, tt as CollectionCursor, u as SendActivityOptionsForCollection, ut as ObjectDispatcher, v as FederationFetchOptions, vt as buildCollectionSynchronizationHeader, w as ObjectCallbackSetters, x as IdempotencyKeyCallback, y as FederationOptions, yt as digest, z as RouterRouteResult } from "./context-CgpkmUFq.js";
|
|
6
6
|
import { a as MemoryKvStore, i as KvStoreSetOptions, n as KvStore, r as KvStoreListEntry, t as KvKey } from "./kv-CxaI4eGo.js";
|
|
7
7
|
import { actorDehydrator, autoIdAssigner, getDefaultActivityTransformers } from "./compat/mod.js";
|
|
8
|
-
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-
|
|
9
|
-
import { _ as
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-
|
|
8
|
+
import { n as handleWebFinger, t as WebFingerHandlerParameters } from "./mod-BqnolIm8.js";
|
|
9
|
+
import { _ as detachSignature, a as VerifyObjectOptions, b as verifySignature, c as signObject, d as CreateSignatureOptions, f as SignJsonLdOptions, g as createSignature, h as attachSignature, i as SignObjectOptions, l as verifyObject, m as VerifySignatureOptions, n as CryptoKeyPairLike, o as VerifyProofOptions, p as VerifyJsonLdOptions, r as CreateProofOptions, s as createProof, t as CryptoKeyLike, u as verifyProof, v as signJsonLd, y as verifyJsonLd } from "./mod-fnE_D0lV.js";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./mod-CIjZ1RmH.js";
|
|
11
11
|
export * from "@fedify/vocab-runtime";
|
|
12
12
|
|
|
13
13
|
//#region src/mod.d.ts
|
|
14
14
|
declare namespace mod_d_exports {
|
|
15
|
-
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateProofOptions, CreateSignatureOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, DoesActorOwnKeyOptions, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, FetchKeyOptions, FetchKeyResult, ForwardActivityOptions, GetKeyOwnerOptions, GetNodeInfoOptions, GetSignedKeyOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboundService, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, JsonValue, KeyCache, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfo, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboundService, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseNodeInfoOptions, ParseUriResult, Protocol, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, Services, SharedInboxKeyDispatcher, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, Software, Usage, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestOptions, VerifySignatureOptions, WebFingerHandlerParameters, WebFingerLinksDispatcher, actorDehydrator, attachSignature, autoIdAssigner, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, createProof, createSignature, detachSignature, digest, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getAuthenticatedDocumentLoader, getDefaultActivityTransformers, getKeyOwner, getNodeInfo, handleWebFinger, importJwk, kvCache, nodeInfoToJson, parseNodeInfo, respondWithObject, respondWithObjectIfAcceptable, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
|
|
15
|
+
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateProofOptions, CreateSignatureOptions, CryptoKeyLike, CryptoKeyPairLike, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, DoesActorOwnKeyOptions, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, FetchKeyOptions, FetchKeyResult, ForwardActivityOptions, GetKeyOwnerOptions, GetNodeInfoOptions, GetSignedKeyOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboundService, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, JsonValue, KeyCache, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfo, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboundService, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseNodeInfoOptions, ParseUriResult, Protocol, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, Services, SharedInboxKeyDispatcher, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, Software, Usage, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestOptions, VerifySignatureOptions, WebFingerHandlerParameters, WebFingerLinksDispatcher, actorDehydrator, attachSignature, autoIdAssigner, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, createProof, createSignature, detachSignature, digest, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getAuthenticatedDocumentLoader, getDefaultActivityTransformers, getKeyOwner, getNodeInfo, handleWebFinger, importJwk, kvCache, nodeInfoToJson, parseNodeInfo, respondWithObject, respondWithObjectIfAcceptable, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
|
|
16
16
|
}
|
|
17
17
|
//#endregion
|
|
18
|
-
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateProofOptions, CreateSignatureOptions, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, DoesActorOwnKeyOptions, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, FetchKeyOptions, FetchKeyResult, ForwardActivityOptions, GetKeyOwnerOptions, GetNodeInfoOptions, GetSignedKeyOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboundService, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, JsonValue, KeyCache, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfo, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboundService, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseNodeInfoOptions, ParseUriResult, Protocol, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, Services, SharedInboxKeyDispatcher, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, Software, Usage, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestOptions, VerifySignatureOptions, WebFingerHandlerParameters, WebFingerLinksDispatcher, actorDehydrator, attachSignature, autoIdAssigner, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, createProof, createSignature, detachSignature, digest, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getAuthenticatedDocumentLoader, getDefaultActivityTransformers, getKeyOwner, getNodeInfo, handleWebFinger, importJwk, kvCache, nodeInfoToJson, parseNodeInfo, respondWithObject, respondWithObjectIfAcceptable, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
|
|
18
|
+
export { ActivityTransformer, ActorAliasMapper, ActorCallbackSetters, ActorDispatcher, ActorHandleMapper, ActorKeyPair, ActorKeyPairsDispatcher, AuthorizePredicate, CollectionCallbackSetters, CollectionCounter, CollectionCursor, CollectionDispatcher, ConstructorWithTypeId, Context, CreateExponentialBackoffPolicyOptions, CreateProofOptions, CreateSignatureOptions, CryptoKeyLike, CryptoKeyPairLike, CustomCollectionCallbackSetters, CustomCollectionCounter, CustomCollectionCursor, CustomCollectionDispatcher, DoesActorOwnKeyOptions, Federatable, Federation, FederationBuilder, FederationFetchOptions, FederationKvPrefixes, FederationOptions, FederationOrigin, FederationQueueOptions, FederationStartQueueOptions, FetchKeyOptions, FetchKeyResult, ForwardActivityOptions, GetKeyOwnerOptions, GetNodeInfoOptions, GetSignedKeyOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, IdempotencyKeyCallback, IdempotencyStrategy, InProcessMessageQueue, InProcessMessageQueueOptions, InboundService, InboxContext, InboxErrorHandler, InboxListener, InboxListenerSetters, JsonValue, KeyCache, KvKey, KvStore, KvStoreListEntry, KvStoreSetOptions, MemoryKvStore, Message, MessageQueue, MessageQueueEnqueueOptions, MessageQueueListenOptions, NodeInfo, NodeInfoDispatcher, ObjectAuthorizePredicate, ObjectCallbackSetters, ObjectDispatcher, OutboundService, OutboxErrorHandler, OutboxPermanentFailureHandler, PageItems, ParallelMessageQueue, ParseNodeInfoOptions, ParseUriResult, Protocol, RequestContext, RespondWithObjectOptions, RetryContext, RetryPolicy, Rfc6570Expression, RouteActivityOptions, Router, RouterError, RouterOptions, RouterRouteResult, SendActivityError, SendActivityOptions, SendActivityOptionsForCollection, SenderKeyPair, Services, SharedInboxKeyDispatcher, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, Software, Usage, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestOptions, VerifySignatureOptions, WebFingerHandlerParameters, WebFingerLinksDispatcher, actorDehydrator, attachSignature, autoIdAssigner, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, createProof, createSignature, detachSignature, digest, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getAuthenticatedDocumentLoader, getDefaultActivityTransformers, getKeyOwner, getNodeInfo, handleWebFinger, importJwk, kvCache, nodeInfoToJson, parseNodeInfo, respondWithObject, respondWithObjectIfAcceptable, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
|
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 { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "./http-
|
|
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-
|
|
6
|
+
import { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "./http-6beU7KiN.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-BqQbaTiu.js";
|
|
8
8
|
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-B1_pRFE_.js";
|
|
9
|
-
import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "./proof-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
9
|
+
import { _ as signJsonLd, a as doesActorOwnKey, b as verifySignature, d as createSignature, f as detachSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, r as verifyObject, t as createProof, y as verifyJsonLd } from "./proof-iPBfQoMT.js";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-DPBGlPnW.js";
|
|
11
11
|
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation/mod.js";
|
|
12
12
|
import "./nodeinfo/mod.js";
|
|
13
13
|
import "./runtime/mod.js";
|
|
@@ -5,7 +5,7 @@ import { n as createRequestContext } from "../context-Juj6bdHC.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
6
|
import "../std__assert-DflMZha5.mjs";
|
|
7
7
|
import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
|
|
8
|
-
import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-
|
|
8
|
+
import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-DnnYzTPv.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 { n as fetchActorDocument, s as verifyKeyOwnership, t as exportJwk } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-CZYDJcbZ.mjs";
|
|
5
|
+
import { n as fetchActorDocument, s as verifyKeyOwnership, t as exportJwk } from "./key-DjCiTRyO.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,12 +1,13 @@
|
|
|
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-CU9dab8F.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");
|
|
8
8
|
let byte_encodings_hex = require("byte-encodings/hex");
|
|
9
9
|
let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
|
|
10
|
+
let _fedify_vocab_runtime_internal = require("@fedify/vocab-runtime/internal");
|
|
10
11
|
let byte_encodings_base64 = require("byte-encodings/base64");
|
|
11
12
|
let _fedify_vocab_runtime_jsonld = require("@fedify/vocab-runtime/jsonld");
|
|
12
13
|
_fedify_vocab_runtime_jsonld = require_chunk.__toESM(_fedify_vocab_runtime_jsonld);
|
|
@@ -425,7 +426,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
|
|
|
425
426
|
...options
|
|
426
427
|
}, contextLoader) + await hashJsonLd(prepareSignatureDocument(jsonLd), contextLoader);
|
|
427
428
|
const messageBytes = new TextEncoder().encode(message);
|
|
428
|
-
const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, messageBytes);
|
|
429
|
+
const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", (0, _fedify_vocab_runtime_internal.asCryptoKey)(privateKey), messageBytes);
|
|
429
430
|
return {
|
|
430
431
|
"@context": "https://w3id.org/security/v1",
|
|
431
432
|
...options,
|
|
@@ -496,6 +497,9 @@ function detachSignature(jsonLd) {
|
|
|
496
497
|
}
|
|
497
498
|
/**
|
|
498
499
|
* Verifies Linked Data Signatures of the given JSON-LD document.
|
|
500
|
+
* Unmapped properties discarded during JSON-LD processing are tolerated, but
|
|
501
|
+
* their values are not authenticated by the signature. Other unsafe
|
|
502
|
+
* canonicalization warnings, including relative IRIs, remain rejected.
|
|
499
503
|
* @param jsonLd The JSON-LD document to verify.
|
|
500
504
|
* @param options Options for verifying the signature.
|
|
501
505
|
* @returns The public key that signed the document or `null` if the signature
|
|
@@ -526,7 +530,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
526
530
|
delete sigOpts.signatureValue;
|
|
527
531
|
let sigOptsHash;
|
|
528
532
|
try {
|
|
529
|
-
sigOptsHash = await hashJsonLd(sigOpts, options.contextLoader);
|
|
533
|
+
sigOptsHash = await hashJsonLd(sigOpts, options.contextLoader, "verify");
|
|
530
534
|
} catch (error) {
|
|
531
535
|
logger$2.warn("Failed to verify; failed to hash the signature options: {signatureOptions}\n{error}", {
|
|
532
536
|
signatureOptions: sigOpts,
|
|
@@ -538,7 +542,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
538
542
|
delete document.signature;
|
|
539
543
|
let docHash;
|
|
540
544
|
try {
|
|
541
|
-
docHash = await hashJsonLd(document, options.contextLoader);
|
|
545
|
+
docHash = await hashJsonLd(document, options.contextLoader, "verify");
|
|
542
546
|
} catch (error) {
|
|
543
547
|
logger$2.warn("Failed to verify; failed to hash the document: {document}\n{error}", {
|
|
544
548
|
document,
|
|
@@ -577,6 +581,8 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
577
581
|
* Signatures. If the document is signed, this function verifies the signature
|
|
578
582
|
* and checks if the document is attributed to the owner of the public key.
|
|
579
583
|
* If the document is not signed, this function returns `false`.
|
|
584
|
+
* Unmapped properties discarded during JSON-LD processing are not
|
|
585
|
+
* authenticated, even when verification succeeds.
|
|
580
586
|
* @param jsonLd The JSON-LD document to verify.
|
|
581
587
|
* @param options Options for verifying the document.
|
|
582
588
|
* @returns `true` if the document is authentic; `false` otherwise.
|
|
@@ -629,10 +635,17 @@ async function verifyJsonLdInternal(jsonLd, options, compact) {
|
|
|
629
635
|
}
|
|
630
636
|
});
|
|
631
637
|
}
|
|
632
|
-
|
|
638
|
+
const tolerableVerificationWarnings = new Set(["blank node predicate", "invalid property"]);
|
|
639
|
+
function handleVerificationEvent({ event, next }) {
|
|
640
|
+
if (event.level === "warning" && !tolerableVerificationWarnings.has(event.code)) throw new TypeError(`Unsafe JSON-LD canonicalization warning: ${event.code}`);
|
|
641
|
+
next();
|
|
642
|
+
}
|
|
643
|
+
async function hashJsonLd(jsonLd, contextLoader, mode = "sign") {
|
|
633
644
|
const canon = await _fedify_vocab_runtime_jsonld.default.canonize(jsonLd, {
|
|
634
645
|
format: "application/n-quads",
|
|
635
|
-
documentLoader: contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)()
|
|
646
|
+
documentLoader: contextLoader ?? (0, _fedify_vocab_runtime.getDocumentLoader)(),
|
|
647
|
+
safe: mode === "sign",
|
|
648
|
+
eventHandler: mode === "verify" ? handleVerificationEvent : void 0
|
|
636
649
|
});
|
|
637
650
|
const encoder = new TextEncoder();
|
|
638
651
|
return (0, byte_encodings_hex.encodeHex)(await crypto.subtle.digest("SHA-256", encoder.encode(canon)));
|
|
@@ -848,7 +861,7 @@ async function createProofInternal(object, privateKey, keyId, { contextLoader, c
|
|
|
848
861
|
const digest = new Uint8Array(proofDigest.byteLength + msgDigest.byteLength);
|
|
849
862
|
digest.set(new Uint8Array(proofDigest), 0);
|
|
850
863
|
digest.set(new Uint8Array(msgDigest), proofDigest.byteLength);
|
|
851
|
-
const sig = await crypto.subtle.sign("Ed25519", privateKey, digest);
|
|
864
|
+
const sig = await crypto.subtle.sign("Ed25519", (0, _fedify_vocab_runtime_internal.asCryptoKey)(privateKey), digest);
|
|
852
865
|
return {
|
|
853
866
|
proof: new _fedify_vocab.DataIntegrityProof({
|
|
854
867
|
cryptosuite: "eddsa-jcs-2022",
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { a as fetchActorDocument, d as name, f as version, i as exportJwk, l as validateCryptoKey, o as fetchKey, u as verifyKeyOwnership } from "./http-
|
|
3
|
+
import { a as fetchActorDocument, d as name, f as version, i as exportJwk, l as validateCryptoKey, o as fetchKey, u as verifyKeyOwnership } from "./http-6beU7KiN.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, getTypeId, isActor } from "@fedify/vocab";
|
|
6
6
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
7
7
|
import { encodeHex } from "byte-encodings/hex";
|
|
8
8
|
import { getDocumentLoader, preloadedContexts } from "@fedify/vocab-runtime";
|
|
9
|
+
import { asCryptoKey } from "@fedify/vocab-runtime/internal";
|
|
9
10
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
10
11
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
11
12
|
import serialize from "json-canon";
|
|
@@ -422,7 +423,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
|
|
|
422
423
|
...options
|
|
423
424
|
}, contextLoader) + await hashJsonLd(prepareSignatureDocument(jsonLd), contextLoader);
|
|
424
425
|
const messageBytes = new TextEncoder().encode(message);
|
|
425
|
-
const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, messageBytes);
|
|
426
|
+
const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", asCryptoKey(privateKey), messageBytes);
|
|
426
427
|
return {
|
|
427
428
|
"@context": "https://w3id.org/security/v1",
|
|
428
429
|
...options,
|
|
@@ -493,6 +494,9 @@ function detachSignature(jsonLd) {
|
|
|
493
494
|
}
|
|
494
495
|
/**
|
|
495
496
|
* Verifies Linked Data Signatures of the given JSON-LD document.
|
|
497
|
+
* Unmapped properties discarded during JSON-LD processing are tolerated, but
|
|
498
|
+
* their values are not authenticated by the signature. Other unsafe
|
|
499
|
+
* canonicalization warnings, including relative IRIs, remain rejected.
|
|
496
500
|
* @param jsonLd The JSON-LD document to verify.
|
|
497
501
|
* @param options Options for verifying the signature.
|
|
498
502
|
* @returns The public key that signed the document or `null` if the signature
|
|
@@ -523,7 +527,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
523
527
|
delete sigOpts.signatureValue;
|
|
524
528
|
let sigOptsHash;
|
|
525
529
|
try {
|
|
526
|
-
sigOptsHash = await hashJsonLd(sigOpts, options.contextLoader);
|
|
530
|
+
sigOptsHash = await hashJsonLd(sigOpts, options.contextLoader, "verify");
|
|
527
531
|
} catch (error) {
|
|
528
532
|
logger$2.warn("Failed to verify; failed to hash the signature options: {signatureOptions}\n{error}", {
|
|
529
533
|
signatureOptions: sigOpts,
|
|
@@ -535,7 +539,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
535
539
|
delete document.signature;
|
|
536
540
|
let docHash;
|
|
537
541
|
try {
|
|
538
|
-
docHash = await hashJsonLd(document, options.contextLoader);
|
|
542
|
+
docHash = await hashJsonLd(document, options.contextLoader, "verify");
|
|
539
543
|
} catch (error) {
|
|
540
544
|
logger$2.warn("Failed to verify; failed to hash the document: {document}\n{error}", {
|
|
541
545
|
document,
|
|
@@ -574,6 +578,8 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
574
578
|
* Signatures. If the document is signed, this function verifies the signature
|
|
575
579
|
* and checks if the document is attributed to the owner of the public key.
|
|
576
580
|
* If the document is not signed, this function returns `false`.
|
|
581
|
+
* Unmapped properties discarded during JSON-LD processing are not
|
|
582
|
+
* authenticated, even when verification succeeds.
|
|
577
583
|
* @param jsonLd The JSON-LD document to verify.
|
|
578
584
|
* @param options Options for verifying the document.
|
|
579
585
|
* @returns `true` if the document is authentic; `false` otherwise.
|
|
@@ -626,10 +632,17 @@ async function verifyJsonLdInternal(jsonLd, options, compact) {
|
|
|
626
632
|
}
|
|
627
633
|
});
|
|
628
634
|
}
|
|
629
|
-
|
|
635
|
+
const tolerableVerificationWarnings = new Set(["blank node predicate", "invalid property"]);
|
|
636
|
+
function handleVerificationEvent({ event, next }) {
|
|
637
|
+
if (event.level === "warning" && !tolerableVerificationWarnings.has(event.code)) throw new TypeError(`Unsafe JSON-LD canonicalization warning: ${event.code}`);
|
|
638
|
+
next();
|
|
639
|
+
}
|
|
640
|
+
async function hashJsonLd(jsonLd, contextLoader, mode = "sign") {
|
|
630
641
|
const canon = await jsonld.canonize(jsonLd, {
|
|
631
642
|
format: "application/n-quads",
|
|
632
|
-
documentLoader: contextLoader ?? getDocumentLoader()
|
|
643
|
+
documentLoader: contextLoader ?? getDocumentLoader(),
|
|
644
|
+
safe: mode === "sign",
|
|
645
|
+
eventHandler: mode === "verify" ? handleVerificationEvent : void 0
|
|
633
646
|
});
|
|
634
647
|
const encoder = new TextEncoder();
|
|
635
648
|
return encodeHex(await crypto.subtle.digest("SHA-256", encoder.encode(canon)));
|
|
@@ -845,7 +858,7 @@ async function createProofInternal(object, privateKey, keyId, { contextLoader, c
|
|
|
845
858
|
const digest = new Uint8Array(proofDigest.byteLength + msgDigest.byteLength);
|
|
846
859
|
digest.set(new Uint8Array(proofDigest), 0);
|
|
847
860
|
digest.set(new Uint8Array(msgDigest), proofDigest.byteLength);
|
|
848
|
-
const sig = await crypto.subtle.sign("Ed25519", privateKey, digest);
|
|
861
|
+
const sig = await crypto.subtle.sign("Ed25519", asCryptoKey(privateKey), digest);
|
|
849
862
|
return {
|
|
850
863
|
proof: new DataIntegrityProof({
|
|
851
864
|
cryptosuite: "eddsa-jcs-2022",
|
|
@@ -1,10 +1,11 @@
|
|
|
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 { o as validateCryptoKey, r as fetchKey } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-CZYDJcbZ.mjs";
|
|
5
|
+
import { o as validateCryptoKey, r as fetchKey } from "./key-DjCiTRyO.mjs";
|
|
6
6
|
import { Activity, DataIntegrityProof, Multikey, getTypeId } from "@fedify/vocab";
|
|
7
7
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
|
+
import { asCryptoKey } from "@fedify/vocab-runtime/internal";
|
|
8
9
|
import { getLogger } from "@logtape/logtape";
|
|
9
10
|
import { encodeHex } from "byte-encodings/hex";
|
|
10
11
|
import serialize from "json-canon";
|
|
@@ -53,7 +54,7 @@ async function createProofInternal(object, privateKey, keyId, { contextLoader, c
|
|
|
53
54
|
const digest = new Uint8Array(proofDigest.byteLength + msgDigest.byteLength);
|
|
54
55
|
digest.set(new Uint8Array(proofDigest), 0);
|
|
55
56
|
digest.set(new Uint8Array(msgDigest), proofDigest.byteLength);
|
|
56
|
-
const sig = await crypto.subtle.sign("Ed25519", privateKey, digest);
|
|
57
|
+
const sig = await crypto.subtle.sign("Ed25519", asCryptoKey(privateKey), digest);
|
|
57
58
|
return {
|
|
58
59
|
proof: new DataIntegrityProof({
|
|
59
60
|
cryptosuite: "eddsa-jcs-2022",
|
|
@@ -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 { r as doubleKnockScoped } from "./http-
|
|
4
|
+
import { n as version, t as name } from "./deno-CZYDJcbZ.mjs";
|
|
5
|
+
import { r as doubleKnockScoped } from "./http-BEyjd3P7.mjs";
|
|
6
6
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
7
7
|
import { FetchError, UrlError } from "@fedify/vocab-runtime";
|
|
8
8
|
import { openDirectFetch, openPublicFetch } from "@fedify/vocab-runtime/internal";
|
package/dist/sig/http.test.mjs
CHANGED
|
@@ -7,8 +7,8 @@ import { i as assertExists, t as assertStringIncludes } from "../std__assert-Dfl
|
|
|
7
7
|
import { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
|
|
8
8
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
9
9
|
import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
|
|
10
|
-
import { t as exportJwk } from "../key-
|
|
11
|
-
import { a as formatRfc9421SignatureParameters, c as signRequest, i as formatRfc9421Signature, l as timingSafeEqual, n as doubleKnock, o as parseRfc9421Signature, r as doubleKnockScoped, s as parseRfc9421SignatureInput, t as createRfc9421SignatureBase, u as verifyRequest } from "../http-
|
|
10
|
+
import { t as exportJwk } from "../key-DjCiTRyO.mjs";
|
|
11
|
+
import { a as formatRfc9421SignatureParameters, c as signRequest, i as formatRfc9421Signature, l as timingSafeEqual, n as doubleKnock, o as parseRfc9421Signature, r as doubleKnockScoped, s as parseRfc9421SignatureInput, t as createRfc9421SignatureBase, u as verifyRequest } from "../http-BEyjd3P7.mjs";
|
|
12
12
|
import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-CCxRJhWa.mjs";
|
|
13
13
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
14
14
|
import { FetchError, exportSpki } from "@fedify/vocab-runtime";
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
+
import { a as ActorCallbackSetters, c as SenderKeyPair, d as exportJwk, l as HttpMessageSignaturesSpecDeterminer, n as Context, r as InboxContext, s as InboxListenerSetters, t as ActorKeyPairsDispatcher, u as signRequest } from "../callback-CJd-aCRE.mjs";
|
|
4
|
+
import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, Recipient } from "@fedify/vocab";
|
|
5
|
+
import { TracerProvider } from "@opentelemetry/api";
|
|
6
|
+
import { AuthenticatedDocumentLoaderFactory, CryptoKeyLike, CryptoKeyPairLike, DocumentLoader, DocumentLoaderFactoryOptions, exportMultibaseKey, exportSpki } from "@fedify/vocab-runtime";
|
|
7
|
+
|
|
8
|
+
//#region src/utils/docloader.d.ts
|
|
9
|
+
/**
|
|
10
|
+
* Options for {@link getAuthenticatedDocumentLoader}.
|
|
11
|
+
* @see {@link getAuthenticatedDocumentLoader}
|
|
12
|
+
* @since 1.3.0
|
|
13
|
+
*/
|
|
14
|
+
interface GetAuthenticatedDocumentLoaderOptions extends DocumentLoaderFactoryOptions {
|
|
15
|
+
/**
|
|
16
|
+
* An optional spec determiner for HTTP Message Signatures.
|
|
17
|
+
* It determines the spec to use for signing requests.
|
|
18
|
+
* It is used for double-knocking
|
|
19
|
+
* (see <https://swicg.github.io/activitypub-http-signature/#how-to-upgrade-supported-versions>).
|
|
20
|
+
* @since 1.6.0
|
|
21
|
+
*/
|
|
22
|
+
specDeterminer?: HttpMessageSignaturesSpecDeterminer;
|
|
23
|
+
/**
|
|
24
|
+
* The OpenTelemetry tracer provider. If omitted, the global tracer provider
|
|
25
|
+
* is used.
|
|
26
|
+
* @since 1.6.0
|
|
27
|
+
*/
|
|
28
|
+
tracerProvider?: TracerProvider;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Gets an authenticated {@link DocumentLoader} for the given identity.
|
|
32
|
+
* Note that an authenticated document loader intentionally does not cache
|
|
33
|
+
* the fetched documents.
|
|
34
|
+
* At most 20 HTTP redirects and alternate document links are followed in total
|
|
35
|
+
* per call. Revisiting a URL within that chain throws a {@link FetchError}.
|
|
36
|
+
* @param identity The identity to get the document loader for.
|
|
37
|
+
* The actor's key pair.
|
|
38
|
+
* @param options The options for the document loader.
|
|
39
|
+
* @returns The authenticated document loader.
|
|
40
|
+
* @throws {TypeError} If the key is invalid or unsupported.
|
|
41
|
+
* @since 0.4.0
|
|
42
|
+
*/
|
|
43
|
+
declare function getAuthenticatedDocumentLoader(identity: {
|
|
44
|
+
keyId: URL;
|
|
45
|
+
privateKey: CryptoKeyLike;
|
|
46
|
+
}, options?: GetAuthenticatedDocumentLoaderOptions): DocumentLoader;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/sig/ld.d.ts
|
|
49
|
+
/**
|
|
50
|
+
* A signature of a JSON-LD document.
|
|
51
|
+
* @since 1.0.0
|
|
52
|
+
*/
|
|
53
|
+
interface Signature {
|
|
54
|
+
"@context"?: "https://w3id.org/identity/v1" | "https://w3id.org/security/v1";
|
|
55
|
+
type: "RsaSignature2017";
|
|
56
|
+
id?: string;
|
|
57
|
+
creator: string;
|
|
58
|
+
created: string;
|
|
59
|
+
signatureValue: string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Options for creating Linked Data Signatures.
|
|
63
|
+
* @since 1.0.0
|
|
64
|
+
*/
|
|
65
|
+
interface CreateSignatureOptions {
|
|
66
|
+
/**
|
|
67
|
+
* The context loader for loading remote JSON-LD contexts.
|
|
68
|
+
*/
|
|
69
|
+
contextLoader?: DocumentLoader;
|
|
70
|
+
/**
|
|
71
|
+
* The time when the signature was created. If not specified, the current
|
|
72
|
+
* time will be used.
|
|
73
|
+
*/
|
|
74
|
+
created?: Temporal.Instant;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Creates a LD signature for the given JSON-LD document.
|
|
78
|
+
*
|
|
79
|
+
* If the document's context does not define the `signature` property, the
|
|
80
|
+
* signature is computed over the document with a minimal inline definition
|
|
81
|
+
* added. Use {@link attachSignature} to attach the signature to that exact
|
|
82
|
+
* document. Documents that already carry a `proof`, or whose context includes
|
|
83
|
+
* an unrecognized remote context, are hashed unchanged.
|
|
84
|
+
* @param jsonLd The JSON-LD document to sign.
|
|
85
|
+
* @param privateKey The private key to sign the document.
|
|
86
|
+
* @param keyId The ID of the public key that corresponds to the private key.
|
|
87
|
+
* @param options Additional options for creating the signature.
|
|
88
|
+
* See also {@link CreateSignatureOptions}.
|
|
89
|
+
* @return The created signature.
|
|
90
|
+
* @throws {TypeError} If the private key is invalid or unsupported.
|
|
91
|
+
* @since 1.0.0
|
|
92
|
+
*/
|
|
93
|
+
declare function createSignature(jsonLd: unknown, privateKey: CryptoKeyLike, keyId: URL, {
|
|
94
|
+
contextLoader,
|
|
95
|
+
created
|
|
96
|
+
}?: CreateSignatureOptions): Promise<Signature>;
|
|
97
|
+
/**
|
|
98
|
+
* Options for signing JSON-LD documents.
|
|
99
|
+
* @since 1.0.0
|
|
100
|
+
*/
|
|
101
|
+
interface SignJsonLdOptions extends CreateSignatureOptions {
|
|
102
|
+
/**
|
|
103
|
+
* The OpenTelemetry tracer provider for tracing the signing process.
|
|
104
|
+
* If omitted, the global tracer provider is used.
|
|
105
|
+
* @since 1.3.0
|
|
106
|
+
*/
|
|
107
|
+
tracerProvider?: TracerProvider;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Signs the given JSON-LD document with the private key and returns the signed
|
|
111
|
+
* JSON-LD document.
|
|
112
|
+
* @param jsonLd The JSON-LD document to sign.
|
|
113
|
+
* @param privateKey The private key to sign the document.
|
|
114
|
+
* @param keyId The key ID to use in the signature. It will be used by the
|
|
115
|
+
* verifier to fetch the corresponding public key.
|
|
116
|
+
* @param options Additional options for signing the document.
|
|
117
|
+
* See also {@link SignJsonLdOptions}.
|
|
118
|
+
* @returns The signed JSON-LD document.
|
|
119
|
+
* @throws {TypeError} If the private key is invalid or unsupported.
|
|
120
|
+
* @since 1.0.0
|
|
121
|
+
*/
|
|
122
|
+
declare function signJsonLd(jsonLd: unknown, privateKey: CryptoKeyLike, keyId: URL, options: SignJsonLdOptions): Promise<{
|
|
123
|
+
signature: Signature;
|
|
124
|
+
}>;
|
|
125
|
+
//#endregion
|
|
126
|
+
//#region src/sig/proof.d.ts
|
|
127
|
+
/**
|
|
128
|
+
* Options for {@link createProof}.
|
|
129
|
+
* @since 0.10.0
|
|
130
|
+
*/
|
|
131
|
+
interface CreateProofOptions {
|
|
132
|
+
/**
|
|
133
|
+
* The context loader for loading remote JSON-LD contexts.
|
|
134
|
+
*/
|
|
135
|
+
contextLoader?: DocumentLoader;
|
|
136
|
+
/**
|
|
137
|
+
* The JSON-LD context to use for serializing the object to sign.
|
|
138
|
+
*/
|
|
139
|
+
context?: string | Record<string, string> | (string | Record<string, string>)[];
|
|
140
|
+
/**
|
|
141
|
+
* The time when the proof was created. If not specified, the current time
|
|
142
|
+
* will be used.
|
|
143
|
+
*/
|
|
144
|
+
created?: Temporal.Instant;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Creates a proof for the given object.
|
|
148
|
+
* @param object The object to create a proof for.
|
|
149
|
+
* @param privateKey The private key to sign the proof with.
|
|
150
|
+
* @param keyId The key ID to use in the proof. It will be used by the verifier.
|
|
151
|
+
* @param options Additional options. See also {@link CreateProofOptions}.
|
|
152
|
+
* @returns The created proof.
|
|
153
|
+
* @throws {TypeError} If the private key is invalid or unsupported.
|
|
154
|
+
* @since 0.10.0
|
|
155
|
+
*/
|
|
156
|
+
declare function createProof(object: Object$1, privateKey: CryptoKeyLike, keyId: URL, options?: CreateProofOptions): Promise<DataIntegrityProof>;
|
|
157
|
+
/**
|
|
158
|
+
* Options for {@link signObject}.
|
|
159
|
+
* @since 0.10.0
|
|
160
|
+
*/
|
|
161
|
+
interface SignObjectOptions extends CreateProofOptions {
|
|
162
|
+
/**
|
|
163
|
+
* The document loader for loading remote JSON-LD documents.
|
|
164
|
+
*/
|
|
165
|
+
documentLoader?: DocumentLoader;
|
|
166
|
+
/**
|
|
167
|
+
* The OpenTelemetry tracer provider. If omitted, the global tracer provider
|
|
168
|
+
* is used.
|
|
169
|
+
* @since 1.3.0
|
|
170
|
+
*/
|
|
171
|
+
tracerProvider?: TracerProvider;
|
|
172
|
+
}
|
|
173
|
+
/**
|
|
174
|
+
* Signs the given object with the private key and returns the signed object.
|
|
175
|
+
* @param object The object to create a proof for.
|
|
176
|
+
* @param privateKey The private key to sign the proof with.
|
|
177
|
+
* @param keyId The key ID to use in the proof. It will be used by the verifier.
|
|
178
|
+
* @param options Additional options. See also {@link SignObjectOptions}.
|
|
179
|
+
* @returns The signed object.
|
|
180
|
+
* @throws {TypeError} If the private key is invalid or unsupported.
|
|
181
|
+
* @since 0.10.0
|
|
182
|
+
*/
|
|
183
|
+
declare function signObject<T extends Object$1>(object: T, privateKey: CryptoKeyLike, keyId: URL, options?: SignObjectOptions): Promise<T>;
|
|
184
|
+
//#endregion
|
|
185
|
+
//#region src/sig/key-types.test.d.ts
|
|
186
|
+
/**
|
|
187
|
+
* Asserts at compile time that `T` is assignable to `U`.
|
|
188
|
+
*/
|
|
189
|
+
type AssertAssignable<T extends U, U> = T;
|
|
190
|
+
/**
|
|
191
|
+
* The key usages Node.js adds on top of the DOM and Web Worker ones since
|
|
192
|
+
* Node.js 24.7, when ML-KEM support was added to its Web Crypto API.
|
|
193
|
+
*/
|
|
194
|
+
type NodeKeyUsage = KeyUsage | "encapsulateBits" | "decapsulateBits" | "encapsulateKey" | "decapsulateKey";
|
|
195
|
+
/**
|
|
196
|
+
* Mirrors `import("node:crypto").webcrypto.CryptoKey`, whose `usages` array
|
|
197
|
+
* has a wider element type than the ambient `CryptoKey`.
|
|
198
|
+
*/
|
|
199
|
+
interface NodeCryptoKey extends Omit<CryptoKey, "usages"> {
|
|
200
|
+
readonly usages: NodeKeyUsage[];
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Mirrors `import("node:crypto").webcrypto.CryptoKeyPair`.
|
|
204
|
+
*/
|
|
205
|
+
interface NodeCryptoKeyPair {
|
|
206
|
+
readonly privateKey: NodeCryptoKey;
|
|
207
|
+
readonly publicKey: NodeCryptoKey;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* These are compile-time assertions. A regression in any of the public
|
|
211
|
+
* signatures fails `deno check` even though nothing here runs.
|
|
212
|
+
*/
|
|
213
|
+
type NodeKeyTypeChecks = [AssertAssignable<NodeCryptoKey, CryptoKeyLike>, AssertAssignable<NodeCryptoKeyPair, CryptoKeyPairLike>, AssertAssignable<(context: Context<void>, identifier: string) => NodeCryptoKeyPair[] | Promise<NodeCryptoKeyPair[]>, ActorKeyPairsDispatcher<void, CryptoKeyPairLike>>, AssertAssignable<ActorKeyPairsDispatcher<void, CryptoKeyPairLike>, Parameters<ActorCallbackSetters<void>["setKeyPairsDispatcher"]>[0]>, AssertAssignable<SenderKeyPair["privateKey"], CryptoKey>, AssertAssignable<NodeCryptoKey, SenderKeyPair<CryptoKeyLike>["privateKey"]>, AssertAssignable<(context: Context<void>) => SenderKeyPair<CryptoKeyLike>, Parameters<InboxListenerSetters<void>["setSharedKeyDispatcher"]>[0]>, AssertAssignable<Parameters<AuthenticatedDocumentLoaderFactory>[0]["privateKey"], CryptoKey>, AssertAssignable<NodeCryptoKey, Parameters<typeof getAuthenticatedDocumentLoader>[0]["privateKey"]>, AssertAssignable<NodeCryptoKey, Parameters<typeof signRequest>[1]>, AssertAssignable<NodeCryptoKey, Parameters<typeof createProof>[1]>, AssertAssignable<NodeCryptoKey, Parameters<typeof signObject>[1]>, AssertAssignable<NodeCryptoKey, Parameters<typeof createSignature>[1]>, AssertAssignable<NodeCryptoKey, Parameters<typeof signJsonLd>[1]>, AssertAssignable<NodeCryptoKey, Parameters<typeof exportJwk>[0]>, AssertAssignable<NodeCryptoKey, Parameters<typeof exportSpki>[0]>, AssertAssignable<NodeCryptoKey, Parameters<typeof exportMultibaseKey>[0]>, AssertAssignable<NodeCryptoKey, NonNullable<ConstructorParameters<typeof CryptographicKey>[0]["publicKey"]>>, AssertAssignable<NodeCryptoKey, NonNullable<ConstructorParameters<typeof Multikey>[0]["publicKey"]>>, AssertAssignable<NodeCryptoKey, NonNullable<NonNullable<Parameters<CryptographicKey["clone"]>[0]>["publicKey"]>>, AssertAssignable<NodeCryptoKey, NonNullable<NonNullable<Parameters<Multikey["clone"]>[0]>["publicKey"]>>, AssertAssignable<Context<void>["getDocumentLoader"], (identity: {
|
|
214
|
+
keyId: URL;
|
|
215
|
+
privateKey: NodeCryptoKey;
|
|
216
|
+
}) => unknown>, AssertAssignable<Context<void>["sendActivity"], (sender: SenderKeyPair<NodeCryptoKey>, recipients: Recipient, activity: Activity) => Promise<void>>, AssertAssignable<InboxContext<void>["forwardActivity"], (forwarder: SenderKeyPair<NodeCryptoKey>, recipients: Recipient) => Promise<void>>];
|
|
217
|
+
//#endregion
|
|
218
|
+
export { NodeKeyTypeChecks };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { test } from "@fedify/fixture";
|
|
5
|
+
//#region src/sig/key-types.test.ts
|
|
6
|
+
test("Node.js Web Crypto keys are accepted by the public key types", () => {});
|
|
7
|
+
//#endregion
|
|
8
|
+
export {};
|
package/dist/sig/key.test.mjs
CHANGED
|
@@ -6,9 +6,9 @@ import { n as assertStrictEquals } from "../std__assert-DflMZha5.mjs";
|
|
|
6
6
|
import { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
|
|
7
7
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
8
8
|
import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
|
|
9
|
-
import { a as importJwk, i as generateCryptoKeyPair, o as validateCryptoKey, r as fetchKey, t as exportJwk } from "../key-
|
|
9
|
+
import { a as importJwk, i as generateCryptoKeyPair, o as validateCryptoKey, r as fetchKey, t as exportJwk } from "../key-DjCiTRyO.mjs";
|
|
10
10
|
import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
|
|
11
|
-
import { g as wrapContextLoaderForJsonLd } from "../ld-
|
|
11
|
+
import { g as wrapContextLoaderForJsonLd } from "../ld-B5pG0yhd.mjs";
|
|
12
12
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
13
13
|
import { CryptographicKey, Multikey, Person } from "@fedify/vocab";
|
|
14
14
|
import { FetchError, UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
|