@fedify/fedify 1.7.12 → 1.7.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{actor-CPpvuBKU.d.ts → actor-Dx5YX74F.d.ts} +3 -3
- package/dist/{actor-GZRoTRqg.js → actor-OYVgkiZG.js} +329 -465
- package/dist/{actor-TYqJGdVq.js → actor-y7shp0CR.js} +6 -6
- package/dist/{assert-LOEeCUK5.js → assert-C-mZuSQl.js} +2 -2
- package/dist/{assert_equals-B44MxcIj.js → assert_equals-Dy0MG_Zw.js} +16 -16
- package/dist/{assert_instance_of-XtuFevV_.js → assert_instance_of-lS0Jr2iu.js} +2 -2
- package/dist/{assert_is_error-BTlryvT0.js → assert_is_error-CIYFACrT.js} +2 -2
- package/dist/{assert_not_equals-C685gKx6.js → assert_not_equals-C1azCAB0.js} +3 -6
- package/dist/{assert_rejects-DWQ4jaf9.js → assert_rejects-Bkh5lA1a.js} +3 -3
- package/dist/{assert_throws-YetpVSc-.js → assert_throws-CmpfkWEM.js} +3 -3
- package/dist/{authdocloader-hiFSyM7V.js → authdocloader-C0JcfxUs.js} +7 -9
- package/dist/{authdocloader-BopfyipD.js → authdocloader-C2krvRo1.js} +6 -8
- package/dist/{builder-mi6RdzNE.js → builder-DaECqbbT.js} +7 -7
- package/dist/{chunk-Cx8LTkjm.js → chunk-DvTpRkcT.js} +22 -15
- package/dist/{client-DuUKk4pk.js → client-dfu57WLy.js} +3 -3
- package/dist/{client-DvtwXO7t.d.ts → client-wKLuY12i.d.ts} +2 -2
- package/dist/{collection-Dfb0TPno.js → collection-XNLQhehO.js} +2 -3
- package/dist/{mod-DFncUgcE.d.ts → compat/mod-Bwqav33K.d.ts} +3 -3
- package/dist/compat/mod.js +1 -2
- package/dist/compat/transformers.test.js +34 -38
- package/dist/{context-OBWjptjU.d.ts → context-CW_8R4BH.d.ts} +11 -11
- package/dist/{context-RMU32mk4.js → context-nxDPfAiA.js} +5 -5
- package/dist/{docloader-09nVWLAZ.js → docloader-BDSHZfTJ.js} +1 -1
- package/dist/{docloader-DJxET2fN.js → docloader-BU25UQLB.js} +31 -151
- package/dist/{docloader-Q42SMRIB.d.ts → docloader-D_MGP37Q.d.ts} +2 -2
- package/dist/{docloader-bgBm1Hd1.js → docloader-sGz4vcrK.js} +32 -152
- package/dist/{esm-DO9PrujO.js → esm-BRXvTSrx.js} +36 -22
- package/dist/federation/builder.test.js +20 -26
- package/dist/federation/collection.test.js +11 -16
- package/dist/federation/handler.test.js +41 -48
- package/dist/federation/inbox.test.js +11 -11
- package/dist/federation/keycache.test.js +12 -11
- package/dist/federation/kv.test.js +8 -10
- package/dist/federation/middleware.test.js +105 -134
- package/dist/federation/mod-DvlLc8Ru.d.ts +6 -0
- package/dist/federation/mod.js +206 -12
- package/dist/federation/mq.test.js +12 -17
- package/dist/federation/retry.test.js +5 -4
- package/dist/federation/router.test.js +9 -10
- package/dist/federation/send.test.js +23 -24
- package/dist/{http-D2DkwsjA.js → http-BhES0Sg9.js} +23 -30
- package/dist/{http-DMTrO3Ye.d.ts → http-DFZRNfDP.d.ts} +3 -3
- package/dist/{http-vqMAvOVs.js → http-DRePVWfE.js} +23 -30
- package/dist/{inbox-DAAZZl2k.js → inbox-Z_QlSGYN.js} +5 -5
- package/dist/key-CJuc1GE1.js +10 -0
- package/dist/{key-DmqJj57e.js → key-D2HZrCxh.js} +4 -4
- package/dist/{key-KVhaUM92.js → key-bMrDyA2T.js} +5 -5
- package/dist/key-eP5Yk7hl.js +16 -0
- package/dist/{keycache-C1pEuRyQ.js → keycache-B5Rr8Lbc.js} +2 -2
- package/dist/{keys-C4XQHW5_.js → keys-DK4k1R8e.js} +2 -2
- package/dist/{kv-DRaeSXco.d.ts → kv-CKqSUxHd.d.ts} +1 -1
- package/dist/{kv-BMY6Qf_A.js → kv-QeuZ51go.js} +1 -1
- package/dist/{langstr-DbWheeIS.js → langstr-pFHBDU4y.js} +1 -1
- package/dist/{ld-DzlJ_IpT.js → ld--auFISy7.js} +9 -12
- package/dist/{lookup-CSngxuWm.js → lookup-4uc2jh52.js} +3 -3
- package/dist/{lookup-DL62q3Xh.js → lookup-Bq8vhIG4.js} +4 -4
- package/dist/{lookup-Bf-K85bV.d.ts → lookup-CqI9jhXo.d.ts} +2 -2
- package/dist/{lookup-D0je8AqR.js → lookup-cHV4n1IB.js} +6 -6
- package/dist/middleware-72Tuh6Iw.js +17 -0
- package/dist/{middleware-3wVT6S9E.js → middleware-B7p-onxQ.js} +35 -39
- package/dist/middleware-DB3BUysJ.js +32 -0
- package/dist/{middleware-DlDXugwZ.js → middleware-QJjRfjjc.js} +38 -43
- package/dist/{mod-CCL2cvnI.d.ts → mod-BEZy4WHZ.d.ts} +4 -4
- package/dist/mod-DMn4Bxyg.d.ts +20 -0
- package/dist/{mod-CDzlVCUF.d.ts → mod-DjGYGrBd.d.ts} +3 -3
- package/dist/mod.js +17 -17
- package/dist/{mq-DYKDDJmp.d.ts → mq-Cgfbl44M.d.ts} +1 -1
- package/dist/{multibase-CnLHszip.js → multibase-DBcKTV2a.js} +1 -1
- package/dist/nodeinfo/client.test.js +19 -28
- package/dist/nodeinfo/handler.test.js +37 -44
- package/dist/nodeinfo/mod--upgPcaX.d.ts +4 -0
- package/dist/nodeinfo/mod.js +2 -3
- package/dist/nodeinfo/semver.test.js +13 -21
- package/dist/nodeinfo/types.test.js +9 -11
- package/dist/{owner-D0cOz8R5.d.ts → owner-CewLNqWO.d.ts} +4 -4
- package/dist/{owner-81ey_76X.js → owner-DkTRLQAV.js} +4 -4
- package/dist/{proof-DlI7QNdn.js → proof-D4HXHDPz.js} +14 -19
- package/dist/{proof-BlULDH4H.js → proof-DT_xxRPF.js} +11 -13
- package/dist/{retry-BiIhZWgD.js → retry-BQet39_l.js} +1 -1
- package/dist/{router-D_aVZZUc.js → router-BuDkN4RQ.js} +1 -1
- package/dist/runtime/authdocloader.test.js +22 -26
- package/dist/runtime/docloader.test.js +56 -56
- package/dist/runtime/key.test.js +31 -53
- package/dist/runtime/langstr.test.js +8 -10
- package/dist/{mod-qFMzZ3iF.d.ts → runtime/mod-BaH1vtHp.d.ts} +4 -3
- package/dist/runtime/mod.js +6 -7
- package/dist/runtime/multibase/multibase.test.js +12 -18
- package/dist/runtime/url.test.js +7 -6
- package/dist/{semver-BNrOOAs9.js → semver-D9d-VO-_.js} +7 -17
- package/dist/{send-DdxfTHo6.js → send-axIyQX2p.js} +4 -4
- package/dist/sig/http.test.js +104 -168
- package/dist/sig/key.test.js +17 -20
- package/dist/sig/ld.test.js +28 -35
- package/dist/sig/mod-BmJQTnPT.d.ts +6 -0
- package/dist/sig/mod.js +6 -7
- package/dist/sig/owner.test.js +24 -30
- package/dist/sig/proof.test.js +24 -29
- package/dist/{std__assert-o_r9vqm1.js → std__assert-BdP_WkD-.js} +7 -13
- package/dist/testing/docloader.test.js +9 -12
- package/dist/testing/mod.js +2 -1
- package/dist/{testing-DLyvtiiW.js → testing-qaAD4B0t.js} +2 -2
- package/dist/{transformers-ghwJuzGY.js → transformers-CFSWUhNi.js} +1 -1
- package/dist/{type-CFuiGLz9.js → type-DFsmi-p1.js} +1 -1
- package/dist/{types-CmVV9LT1.js → types-Bk4b1bGc.js} +8 -18
- package/dist/{types-CJHS5pXl.js → types-CB_2uuCA.js} +2 -2
- package/dist/{url-C2xuoQD1.js → url-BdNvnK9P.js} +1 -1
- package/dist/vocab/actor.test.js +76 -128
- package/dist/vocab/lookup.test.js +19 -23
- package/dist/vocab/mod-BkXGAYkx.d.ts +6 -0
- package/dist/vocab/mod.js +4 -4
- package/dist/vocab/type.test.js +10 -10
- package/dist/vocab/vocab.test.js +109 -105
- package/dist/{vocab-DFlq4Wa6.js → vocab-DCHRuBGF.js} +328 -464
- package/dist/{vocab-CzEfWQk2.d.ts → vocab-DoBcp8ow.d.ts} +2 -2
- package/dist/{vocab-BebR0kAy.js → vocab-sMuiKIWm.js} +5 -5
- package/dist/webfinger/handler.test.js +40 -48
- package/dist/webfinger/lookup.test.js +12 -15
- package/dist/webfinger/mod-B1UhCvlL.d.ts +4 -0
- package/dist/webfinger/mod.js +2 -3
- package/dist/x/{cfworkers.d.ts → cfworkers-BIcR64Sf.d.ts} +2 -2
- package/dist/x/cfworkers.test.js +7 -9
- package/dist/x/{hono.d.ts → hono-DmQmp8wi.d.ts} +2 -11
- package/dist/x/{sveltekit.d.ts → sveltekit-Cvh0XnN4.d.ts} +2 -11
- package/package.json +1 -1
- package/dist/compat/mod.d.ts +0 -15
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/federation/mod.d.ts +0 -15
- package/dist/federation-B0aljx0V.js +0 -203
- package/dist/key-5ssHQ67E.js +0 -16
- package/dist/key-DSJGnD10.js +0 -10
- package/dist/middleware-CxFoFBD8.js +0 -33
- package/dist/middleware-w7_U3fFi.js +0 -17
- package/dist/mod-1pDWKvUL.d.ts +0 -2
- package/dist/mod-GIh5OYxW.d.ts +0 -2
- package/dist/mod-g0xFzAP9.d.ts +0 -2
- package/dist/mod.d.ts +0 -20
- package/dist/nodeinfo/mod.d.ts +0 -7
- package/dist/nodeinfo-CyEbLjHs.js +0 -4
- package/dist/runtime/mod.d.ts +0 -8
- package/dist/runtime-BSkOVUWM.js +0 -4
- package/dist/sig/mod.d.ts +0 -10
- package/dist/sig-BXJO--F9.js +0 -4
- package/dist/vocab/mod.d.ts +0 -8
- package/dist/webfinger/mod.d.ts +0 -7
- package/dist/webfinger-C3GIyXIg.js +0 -4
- /package/dist/compat/{transformers.test.d.ts → transformers.test-DnJbd34u.d.ts} +0 -0
- /package/dist/{denokv-CvROlGYX.js → denokv-NcJeZ6rP.js} +0 -0
- /package/dist/federation/{builder.test.d.ts → builder.test-Bpt6NOZ6.d.ts} +0 -0
- /package/dist/federation/{collection.test.d.ts → collection.test-DKJ6JOZz.d.ts} +0 -0
- /package/dist/federation/{handler.test.d.ts → handler.test-BMT7uLC0.d.ts} +0 -0
- /package/dist/federation/{inbox.test.d.ts → inbox.test-Do6i02Qp.d.ts} +0 -0
- /package/dist/federation/{keycache.test.d.ts → keycache.test-BT83IPZY.d.ts} +0 -0
- /package/dist/federation/{kv.test.d.ts → kv.test-kFzzF2VN.d.ts} +0 -0
- /package/dist/federation/{middleware.test.d.ts → middleware.test-B1R4_e3-.d.ts} +0 -0
- /package/dist/federation/{mq.test.d.ts → mq.test-l79EQQOe.d.ts} +0 -0
- /package/dist/federation/{retry.test.d.ts → retry.test-BqS50VCX.d.ts} +0 -0
- /package/dist/federation/{router.test.d.ts → router.test-CYQl4po-.d.ts} +0 -0
- /package/dist/federation/{send.test.d.ts → send.test-COUnNUzv.d.ts} +0 -0
- /package/dist/nodeinfo/{client.test.d.ts → client.test-CZLe79hL.d.ts} +0 -0
- /package/dist/nodeinfo/{handler.test.d.ts → handler.test-B-EDZ_hK.d.ts} +0 -0
- /package/dist/nodeinfo/{semver.test.d.ts → semver.test-BEuuQSEM.d.ts} +0 -0
- /package/dist/nodeinfo/{types.test.d.ts → types.test-B5AT89WV.d.ts} +0 -0
- /package/dist/runtime/{authdocloader.test.d.ts → authdocloader.test-hCRKzn9v.d.ts} +0 -0
- /package/dist/runtime/{docloader.test.d.ts → docloader.test-CVd7i_5h.d.ts} +0 -0
- /package/dist/runtime/{key.test.d.ts → key.test-DBsILYSD.d.ts} +0 -0
- /package/dist/runtime/{langstr.test.d.ts → langstr.test-CiKxuuRY.d.ts} +0 -0
- /package/dist/runtime/multibase/{multibase.test.d.ts → multibase.test-Brh6gPBP.d.ts} +0 -0
- /package/dist/runtime/{url.test.d.ts → url.test-DlRqkU2j.d.ts} +0 -0
- /package/dist/sig/{http.test.d.ts → http.test-BpXNAWNI.d.ts} +0 -0
- /package/dist/sig/{key.test.d.ts → key.test-B2iLIugy.d.ts} +0 -0
- /package/dist/sig/{ld.test.d.ts → ld.test-D-cI70Gw.d.ts} +0 -0
- /package/dist/sig/{owner.test.d.ts → owner.test-B_YRjMPj.d.ts} +0 -0
- /package/dist/sig/{proof.test.d.ts → proof.test-BagEM_-4.d.ts} +0 -0
- /package/dist/testing/{docloader.test.d.ts → docloader.test-lrzf6sDZ.d.ts} +0 -0
- /package/dist/testing/{mod.d.ts → mod-3uM8ZvS7.d.ts} +0 -0
- /package/dist/vocab/{actor.test.d.ts → actor.test-ClC-iVWk.d.ts} +0 -0
- /package/dist/vocab/{lookup.test.d.ts → lookup.test-Cq1I-27w.d.ts} +0 -0
- /package/dist/vocab/{type.test.d.ts → type.test-bfFiYGcs.d.ts} +0 -0
- /package/dist/vocab/{vocab.test.d.ts → vocab.test-h-ZTisfu.d.ts} +0 -0
- /package/dist/webfinger/{handler.test.d.ts → handler.test-DiUeEDDD.d.ts} +0 -0
- /package/dist/webfinger/{lookup.test.d.ts → lookup.test-D9onm3U3.d.ts} +0 -0
- /package/dist/x/{cfworkers.test.d.ts → cfworkers.test-KXHlJ29z.d.ts} +0 -0
package/dist/mod.js
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import "./compat
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { lookupWebFinger } from "./lookup-
|
|
11
|
-
import {
|
|
12
|
-
import { signRequest, verifyRequest } from "./http-
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import "./nodeinfo
|
|
19
|
-
import "./runtime
|
|
20
|
-
import "./sig
|
|
21
|
-
import "./webfinger
|
|
5
|
+
import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-CFSWUhNi.js";
|
|
6
|
+
import "./compat/mod.js";
|
|
7
|
+
import { i as getDocumentLoader, o as getUserAgent, r as fetchDocumentLoader, s as kvCache, t as FetchError } from "./docloader-BU25UQLB.js";
|
|
8
|
+
import { $ as Person, A as Flag, B as Like, C as Dislike, Ct as importPkcs1, D as Endpoints, E as EmojiReact, F as Image, G as Multikey, H as Listen, I as IntransitiveActivity, J as Offer, K as Note, L as Invite, M as Group, N as Hashtag, O as Event, P as Ignore, Q as Page, R as Join, S as DidService, St as importPem, T as Emoji, Tt as getTypeId, U as Mention, V as Link, W as Move, X as OrderedCollectionPage, Y as OrderedCollection, Z as Organization, _ as CollectionPage, _t as View, a as normalizeActorHandle, at as Reject, b as DataIntegrityProof, bt as exportSpki, c as Add, ct as Service, d as Arrive, dt as TentativeReject, et as Place, f as Article, ft as Tombstone, g as Collection, gt as Video, h as ChatMessage, ht as Update, i as isActor, it as Read, j as Follow, k as Export, l as Announce, lt as Source, m as Block, mt as Undo, n as getActorHandle, nt as PropertyValue, o as Accept, ot as Relationship, p as Audio, pt as Travel, q as Object$1, r as getActorTypeName, rt as Question, s as Activity, st as Remove, t as getActorClassByTypeName, tt as Profile, u as Application, ut as TentativeAccept, v as Create, vt as LanguageString, w as Document, wt as importSpki, x as Delete, xt as importMultibaseKey, y as CryptographicKey, yt as exportMultibaseKey, z as Leave } from "./actor-OYVgkiZG.js";
|
|
9
|
+
import { a as createFederation, c as respondWithObjectIfAcceptable, d as createFederationBuilder, f as Router, l as buildCollectionSynchronizationHeader, o as createExponentialBackoffPolicy, p as RouterError, s as respondWithObject, u as digest } from "./middleware-QJjRfjjc.js";
|
|
10
|
+
import { t as lookupWebFinger } from "./lookup-4uc2jh52.js";
|
|
11
|
+
import { i as importJwk, n as fetchKey, r as generateCryptoKeyPair, t as exportJwk } from "./key-D2HZrCxh.js";
|
|
12
|
+
import { n as signRequest, r as verifyRequest } from "./http-DRePVWfE.js";
|
|
13
|
+
import { a as doesActorOwnKey, c as createSignature, d as signJsonLd, f as verifyJsonLd, i as verifyProof, l as detachSignature, n as signObject, o as getKeyOwner, p as verifySignature, r as verifyObject, s as attachSignature, t as createProof } from "./proof-D4HXHDPz.js";
|
|
14
|
+
import { a as parseSemVer, i as formatSemVer, n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-Bk4b1bGc.js";
|
|
15
|
+
import { t as getAuthenticatedDocumentLoader } from "./authdocloader-C2krvRo1.js";
|
|
16
|
+
import { n as lookupObject, r as traverseCollection, t as PUBLIC_COLLECTION } from "./vocab-sMuiKIWm.js";
|
|
17
|
+
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation/mod.js";
|
|
18
|
+
import "./nodeinfo/mod.js";
|
|
19
|
+
import "./runtime/mod.js";
|
|
20
|
+
import "./sig/mod.js";
|
|
21
|
+
import "./webfinger/mod.js";
|
|
22
22
|
|
|
23
23
|
export { Accept, Activity, Add, Announce, Application, Arrive, Article, Audio, Block, ChatMessage, Collection, CollectionPage, Create, CryptographicKey, DataIntegrityProof, Delete, DidService, Dislike, Document, Emoji, EmojiReact, Endpoints, Event, Export, FetchError, Flag, Follow, Group, Hashtag, Ignore, Image, InProcessMessageQueue, IntransitiveActivity, Invite, Join, LanguageString, Leave, Like, Link, Listen, MemoryKvStore, Mention, Move, Multikey, Note, Object$1 as Object, Offer, OrderedCollection, OrderedCollectionPage, Organization, PUBLIC_COLLECTION, Page, ParallelMessageQueue, Person, Place, Profile, PropertyValue, Question, Read, Reject, Relationship, Remove, Router, RouterError, Service, Source, TentativeAccept, TentativeReject, Tombstone, Travel, Undo, Update, Video, View, actorDehydrator, attachSignature, autoIdAssigner, buildCollectionSynchronizationHeader, createExponentialBackoffPolicy, createFederation, createFederationBuilder, createProof, createSignature, detachSignature, digest, doesActorOwnKey, exportJwk, exportMultibaseKey, exportSpki, fetchDocumentLoader, fetchKey, formatSemVer, generateCryptoKeyPair, getActorClassByTypeName, getActorHandle, getActorTypeName, getAuthenticatedDocumentLoader, getDefaultActivityTransformers, getDocumentLoader, getKeyOwner, getNodeInfo, getTypeId, getUserAgent, importJwk, importMultibaseKey, importPem, importPkcs1, importSpki, isActor, kvCache, lookupObject, lookupWebFinger, nodeInfoToJson, normalizeActorHandle, parseNodeInfo, parseSemVer, respondWithObject, respondWithObjectIfAcceptable, signJsonLd, signObject, signRequest, traverseCollection, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
|
|
@@ -140,4 +140,4 @@ declare class ParallelMessageQueue implements MessageQueue {
|
|
|
140
140
|
listen(handler: (message: any) => Promise<void> | void, options?: MessageQueueListenOptions): Promise<void>;
|
|
141
141
|
}
|
|
142
142
|
//#endregion
|
|
143
|
-
export {
|
|
143
|
+
export { MessageQueueListenOptions as a, MessageQueueEnqueueOptions as i, InProcessMessageQueueOptions as n, ParallelMessageQueue as o, MessageQueue as r, InProcessMessageQueue as t };
|
|
@@ -3,20 +3,18 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import "../
|
|
10
|
-
import "../
|
|
11
|
-
import "../
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import "../
|
|
15
|
-
import "../
|
|
16
|
-
import "../
|
|
17
|
-
import "../
|
|
18
|
-
import "../assert_throws-YetpVSc-.js";
|
|
19
|
-
import { esm_default } from "../esm-DO9PrujO.js";
|
|
6
|
+
import "../chunk-DvTpRkcT.js";
|
|
7
|
+
import { t as assertEquals } from "../assert_equals-Dy0MG_Zw.js";
|
|
8
|
+
import "../docloader-sGz4vcrK.js";
|
|
9
|
+
import "../url-BdNvnK9P.js";
|
|
10
|
+
import "../semver-D9d-VO-_.js";
|
|
11
|
+
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-dfu57WLy.js";
|
|
12
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
13
|
+
import "../std__assert-BdP_WkD-.js";
|
|
14
|
+
import "../assert_rejects-Bkh5lA1a.js";
|
|
15
|
+
import "../assert_is_error-CIYFACrT.js";
|
|
16
|
+
import "../assert_throws-CmpfkWEM.js";
|
|
17
|
+
import { t as esm_default } from "../esm-BRXvTSrx.js";
|
|
20
18
|
|
|
21
19
|
//#region nodeinfo/client.test.ts
|
|
22
20
|
test("getNodeInfo()", async (t) => {
|
|
@@ -58,32 +56,25 @@ test("getNodeInfo()", async (t) => {
|
|
|
58
56
|
}
|
|
59
57
|
};
|
|
60
58
|
await t.step("indirect", async () => {
|
|
61
|
-
|
|
62
|
-
assertEquals(
|
|
63
|
-
const raw = await getNodeInfo("https://example.com/", { parse: "none" });
|
|
64
|
-
assertEquals(raw, rawExpected);
|
|
59
|
+
assertEquals(await getNodeInfo("https://example.com/"), expected);
|
|
60
|
+
assertEquals(await getNodeInfo("https://example.com/", { parse: "none" }), rawExpected);
|
|
65
61
|
});
|
|
66
62
|
await t.step("direct", async () => {
|
|
67
|
-
|
|
68
|
-
assertEquals(info, expected);
|
|
63
|
+
assertEquals(await getNodeInfo("https://example.com/nodeinfo/2.1", { direct: true }), expected);
|
|
69
64
|
});
|
|
70
65
|
esm_default.removeRoutes();
|
|
71
66
|
esm_default.get("https://example.com/.well-known/nodeinfo", { body: { links: [] } });
|
|
72
67
|
await t.step("indirect: no links", async () => {
|
|
73
|
-
|
|
74
|
-
assertEquals(info, void 0);
|
|
68
|
+
assertEquals(await getNodeInfo("https://example.com/"), void 0);
|
|
75
69
|
});
|
|
76
70
|
esm_default.removeRoutes();
|
|
77
71
|
esm_default.get("https://example.com/.well-known/nodeinfo", { status: 404 });
|
|
78
72
|
await t.step("indirect: 404", async () => {
|
|
79
|
-
|
|
80
|
-
assertEquals(info, void 0);
|
|
73
|
+
assertEquals(await getNodeInfo("https://example.com/"), void 0);
|
|
81
74
|
});
|
|
82
75
|
await t.step("direct: 404", async () => {
|
|
83
|
-
|
|
84
|
-
assertEquals(
|
|
85
|
-
const info2 = await getNodeInfo("https://example.com/404", { direct: true });
|
|
86
|
-
assertEquals(info2, void 0);
|
|
76
|
+
assertEquals(await getNodeInfo("https://example.com/nodeinfo/2.0", { direct: true }), void 0);
|
|
77
|
+
assertEquals(await getNodeInfo("https://example.com/404", { direct: true }), void 0);
|
|
87
78
|
});
|
|
88
79
|
esm_default.hardReset();
|
|
89
80
|
});
|
|
@@ -3,51 +3,46 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import "../
|
|
12
|
-
import "../
|
|
13
|
-
import
|
|
14
|
-
import "../
|
|
15
|
-
import "../
|
|
16
|
-
import "../
|
|
17
|
-
import "../
|
|
18
|
-
import "../
|
|
19
|
-
import "../
|
|
20
|
-
import "../
|
|
21
|
-
import "../
|
|
22
|
-
import "../
|
|
23
|
-
import "../
|
|
24
|
-
import "../
|
|
25
|
-
import "../
|
|
26
|
-
import "../
|
|
27
|
-
import "../
|
|
28
|
-
import "../
|
|
29
|
-
import "../
|
|
30
|
-
import "../
|
|
31
|
-
import "../
|
|
32
|
-
import "../
|
|
33
|
-
import "../
|
|
34
|
-
import "../
|
|
35
|
-
import "../
|
|
36
|
-
import
|
|
37
|
-
import "../
|
|
38
|
-
import "../
|
|
39
|
-
import "../
|
|
40
|
-
import "../assert_not_equals-C685gKx6.js";
|
|
41
|
-
import "../assert_throws-YetpVSc-.js";
|
|
42
|
-
import "../docloader-09nVWLAZ.js";
|
|
43
|
-
import { createRequestContext } from "../context-RMU32mk4.js";
|
|
6
|
+
import "../chunk-DvTpRkcT.js";
|
|
7
|
+
import { t as assertEquals } from "../assert_equals-Dy0MG_Zw.js";
|
|
8
|
+
import { t as MemoryKvStore } from "../kv-QeuZ51go.js";
|
|
9
|
+
import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-B7p-onxQ.js";
|
|
10
|
+
import "../docloader-sGz4vcrK.js";
|
|
11
|
+
import "../url-BdNvnK9P.js";
|
|
12
|
+
import { n as parseSemVer } from "../semver-D9d-VO-_.js";
|
|
13
|
+
import "../client-dfu57WLy.js";
|
|
14
|
+
import "../router-BuDkN4RQ.js";
|
|
15
|
+
import "../types-CB_2uuCA.js";
|
|
16
|
+
import "../multibase-DBcKTV2a.js";
|
|
17
|
+
import "../vocab-DCHRuBGF.js";
|
|
18
|
+
import "../langstr-pFHBDU4y.js";
|
|
19
|
+
import "../lookup-Bq8vhIG4.js";
|
|
20
|
+
import "../actor-y7shp0CR.js";
|
|
21
|
+
import "../key-bMrDyA2T.js";
|
|
22
|
+
import "../http-BhES0Sg9.js";
|
|
23
|
+
import "../authdocloader-C0JcfxUs.js";
|
|
24
|
+
import "../ld--auFISy7.js";
|
|
25
|
+
import "../owner-DkTRLQAV.js";
|
|
26
|
+
import "../proof-DT_xxRPF.js";
|
|
27
|
+
import "../lookup-cHV4n1IB.js";
|
|
28
|
+
import "../inbox-Z_QlSGYN.js";
|
|
29
|
+
import "../builder-DaECqbbT.js";
|
|
30
|
+
import "../collection-XNLQhehO.js";
|
|
31
|
+
import "../keycache-B5Rr8Lbc.js";
|
|
32
|
+
import "../send-axIyQX2p.js";
|
|
33
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
34
|
+
import "../std__assert-BdP_WkD-.js";
|
|
35
|
+
import "../assert_rejects-Bkh5lA1a.js";
|
|
36
|
+
import "../assert_is_error-CIYFACrT.js";
|
|
37
|
+
import "../assert_throws-CmpfkWEM.js";
|
|
38
|
+
import "../docloader-BDSHZfTJ.js";
|
|
39
|
+
import { n as createRequestContext } from "../context-nxDPfAiA.js";
|
|
44
40
|
|
|
45
41
|
//#region nodeinfo/handler.test.ts
|
|
46
42
|
test("handleNodeInfo()", async () => {
|
|
47
43
|
const request = new Request("https://example.com/nodeinfo/2.1");
|
|
48
|
-
const federation = createFederation({ kv: new MemoryKvStore() });
|
|
49
44
|
const context = createRequestContext({
|
|
50
|
-
federation,
|
|
45
|
+
federation: createFederation({ kv: new MemoryKvStore() }),
|
|
51
46
|
data: void 0,
|
|
52
47
|
request,
|
|
53
48
|
url: new URL(request.url)
|
|
@@ -74,8 +69,7 @@ test("handleNodeInfo()", async () => {
|
|
|
74
69
|
});
|
|
75
70
|
assertEquals(response.status, 200);
|
|
76
71
|
assertEquals(response.headers.get("Content-Type"), "application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.1#\"");
|
|
77
|
-
|
|
78
|
-
assertEquals(json, {
|
|
72
|
+
assertEquals(await response.json(), {
|
|
79
73
|
"$schema": "http://nodeinfo.diaspora.software/ns/schema/2.1#",
|
|
80
74
|
version: "2.1",
|
|
81
75
|
software: {
|
|
@@ -102,9 +96,8 @@ test("handleNodeInfo()", async () => {
|
|
|
102
96
|
});
|
|
103
97
|
test("handleNodeInfoJrd()", async () => {
|
|
104
98
|
const request = new Request("https://example.com/.well-known/nodeinfo");
|
|
105
|
-
const federation = createFederation({ kv: new MemoryKvStore() });
|
|
106
99
|
let context = createRequestContext({
|
|
107
|
-
federation,
|
|
100
|
+
federation: createFederation({ kv: new MemoryKvStore() }),
|
|
108
101
|
data: void 0,
|
|
109
102
|
request,
|
|
110
103
|
url: new URL(request.url)
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
+
import { a as InboundService, c as OutboundService, d as Software, f as Usage, g as parseSemVer, h as formatSemVer, i as parseNodeInfo, l as Protocol, m as SemVer, n as ParseNodeInfoOptions, o as JsonValue, p as nodeInfoToJson, r as getNodeInfo, s as NodeInfo, t as GetNodeInfoOptions, u as Services } from "../client-wKLuY12i.js";
|
|
4
|
+
export { type GetNodeInfoOptions, InboundService, JsonValue, NodeInfo, OutboundService, type ParseNodeInfoOptions, Protocol, type SemVer, Services, Software, Usage, formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer };
|
package/dist/nodeinfo/mod.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import "../docloader-
|
|
6
|
-
import { formatSemVer, getNodeInfo,
|
|
7
|
-
import "../nodeinfo-CyEbLjHs.js";
|
|
5
|
+
import "../docloader-BU25UQLB.js";
|
|
6
|
+
import { a as parseSemVer, i as formatSemVer, n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "../types-Bk4b1bGc.js";
|
|
8
7
|
|
|
9
8
|
export { formatSemVer, getNodeInfo, nodeInfoToJson, parseNodeInfo, parseSemVer };
|
|
@@ -3,16 +3,14 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import "../
|
|
12
|
-
import "../
|
|
13
|
-
import "../
|
|
14
|
-
import "../assert_not_equals-C685gKx6.js";
|
|
15
|
-
import { assertThrows } from "../assert_throws-YetpVSc-.js";
|
|
6
|
+
import "../chunk-DvTpRkcT.js";
|
|
7
|
+
import { t as assertEquals } from "../assert_equals-Dy0MG_Zw.js";
|
|
8
|
+
import { n as parseSemVer, t as formatSemVer } from "../semver-D9d-VO-_.js";
|
|
9
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
10
|
+
import "../std__assert-BdP_WkD-.js";
|
|
11
|
+
import "../assert_rejects-Bkh5lA1a.js";
|
|
12
|
+
import "../assert_is_error-CIYFACrT.js";
|
|
13
|
+
import { t as assertThrows } from "../assert_throws-CmpfkWEM.js";
|
|
16
14
|
|
|
17
15
|
//#region nodeinfo/semver.test.ts
|
|
18
16
|
test("parseSemVer() handles major", async (t) => {
|
|
@@ -25,8 +23,7 @@ test("parseSemVer() handles major", async (t) => {
|
|
|
25
23
|
[" v8.2.3 ", 8],
|
|
26
24
|
[" 13.2.3", 13]
|
|
27
25
|
]) await t.step(v, () => {
|
|
28
|
-
|
|
29
|
-
assertEquals(version.major, expected);
|
|
26
|
+
assertEquals(parseSemVer(v).major, expected);
|
|
30
27
|
});
|
|
31
28
|
});
|
|
32
29
|
test("parseSemVer() handles minor", async (t) => {
|
|
@@ -39,8 +36,7 @@ test("parseSemVer() handles minor", async (t) => {
|
|
|
39
36
|
[" v1.8.3 ", 8],
|
|
40
37
|
[" 1.13.3", 13]
|
|
41
38
|
]) await t.step(v, () => {
|
|
42
|
-
|
|
43
|
-
assertEquals(version.minor, expected);
|
|
39
|
+
assertEquals(parseSemVer(v).minor, expected);
|
|
44
40
|
});
|
|
45
41
|
});
|
|
46
42
|
test("parseSemVer() handles patch", async (t) => {
|
|
@@ -68,8 +64,7 @@ test("parseSemVer() handles prerelease", async (t) => {
|
|
|
68
64
|
["1.2.0-3.6-pre2", [3, "6-pre2"]],
|
|
69
65
|
["2.0.0", []]
|
|
70
66
|
]) await t.step(`${v} : ${JSON.stringify(expected)}`, () => {
|
|
71
|
-
|
|
72
|
-
assertEquals(semver.prerelease, expected);
|
|
67
|
+
assertEquals(parseSemVer(v).prerelease, expected);
|
|
73
68
|
});
|
|
74
69
|
});
|
|
75
70
|
test({
|
|
@@ -109,8 +104,7 @@ test("parseSemVer() throws on invalid versions", async (t) => {
|
|
|
109
104
|
});
|
|
110
105
|
});
|
|
111
106
|
test("parseSemVer() handles big numeric prerelease", function() {
|
|
112
|
-
|
|
113
|
-
assertEquals(r.prerelease, ["beta", "90071992547409910"]);
|
|
107
|
+
assertEquals(parseSemVer(`1.2.3-beta.${Number.MAX_SAFE_INTEGER}0`).prerelease, ["beta", "90071992547409910"]);
|
|
114
108
|
});
|
|
115
109
|
test("formatSemVer()", async (t) => {
|
|
116
110
|
for (const [version, expected] of [
|
|
@@ -124,9 +118,7 @@ test("formatSemVer()", async (t) => {
|
|
|
124
118
|
]) await t.step({
|
|
125
119
|
name: version,
|
|
126
120
|
fn: () => {
|
|
127
|
-
|
|
128
|
-
const actual = formatSemVer(v);
|
|
129
|
-
assertEquals(actual, expected);
|
|
121
|
+
assertEquals(formatSemVer(parseSemVer(version)), expected);
|
|
130
122
|
}
|
|
131
123
|
});
|
|
132
124
|
});
|
|
@@ -3,17 +3,15 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import "../
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import "../
|
|
13
|
-
import "../
|
|
14
|
-
import "../
|
|
15
|
-
import "../assert_not_equals-C685gKx6.js";
|
|
16
|
-
import { assertThrows } from "../assert_throws-YetpVSc-.js";
|
|
6
|
+
import "../chunk-DvTpRkcT.js";
|
|
7
|
+
import { t as assertEquals } from "../assert_equals-Dy0MG_Zw.js";
|
|
8
|
+
import "../semver-D9d-VO-_.js";
|
|
9
|
+
import { t as nodeInfoToJson } from "../types-CB_2uuCA.js";
|
|
10
|
+
import { t as test } from "../testing-qaAD4B0t.js";
|
|
11
|
+
import "../std__assert-BdP_WkD-.js";
|
|
12
|
+
import "../assert_rejects-Bkh5lA1a.js";
|
|
13
|
+
import "../assert_is_error-CIYFACrT.js";
|
|
14
|
+
import { t as assertThrows } from "../assert_throws-CmpfkWEM.js";
|
|
17
15
|
|
|
18
16
|
//#region nodeinfo/types.test.ts
|
|
19
17
|
test("nodeInfoToJson()", () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { DocumentLoader } from "./docloader-
|
|
4
|
-
import {
|
|
5
|
-
import { Actor } from "./actor-
|
|
3
|
+
import { n as DocumentLoader } from "./docloader-D_MGP37Q.js";
|
|
4
|
+
import { m as CryptographicKey, n as Activity } from "./vocab-DoBcp8ow.js";
|
|
5
|
+
import { t as Actor } from "./actor-Dx5YX74F.js";
|
|
6
6
|
import { TracerProvider } from "@opentelemetry/api";
|
|
7
7
|
|
|
8
8
|
//#region sig/owner.d.ts
|
|
@@ -66,4 +66,4 @@ interface GetKeyOwnerOptions {
|
|
|
66
66
|
*/
|
|
67
67
|
declare function getKeyOwner(keyId: URL | CryptographicKey, options: GetKeyOwnerOptions): Promise<Actor | null>;
|
|
68
68
|
//#endregion
|
|
69
|
-
export {
|
|
69
|
+
export { getKeyOwner as i, GetKeyOwnerOptions as n, doesActorOwnKey as r, DoesActorOwnKeyOptions as t };
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { getDocumentLoader } from "./docloader-
|
|
7
|
-
import {
|
|
8
|
-
import { isActor } from "./actor-
|
|
6
|
+
import { i as getDocumentLoader } from "./docloader-sGz4vcrK.js";
|
|
7
|
+
import { _ as Object$1, o as CryptographicKey } from "./vocab-DCHRuBGF.js";
|
|
8
|
+
import { i as isActor } from "./actor-y7shp0CR.js";
|
|
9
9
|
import { trace } from "@opentelemetry/api";
|
|
10
10
|
|
|
11
11
|
//#region sig/owner.ts
|
|
@@ -86,4 +86,4 @@ async function getKeyOwner(keyId, options) {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
//#endregion
|
|
89
|
-
export {
|
|
89
|
+
export { getKeyOwner as n, doesActorOwnKey as t };
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { d as name, f as version, i as getDocumentLoader } from "./docloader-BU25UQLB.js";
|
|
6
|
+
import { G as Multikey, Tt as getTypeId, b as DataIntegrityProof, i as isActor, q as Object$1, s as Activity, y as CryptographicKey } from "./actor-OYVgkiZG.js";
|
|
7
|
+
import { a as validateCryptoKey, n as fetchKey } from "./key-D2HZrCxh.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
import jsonld from "jsonld";
|
|
@@ -53,9 +53,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
|
|
|
53
53
|
creator: keyId.href,
|
|
54
54
|
created: created?.toString() ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
55
55
|
};
|
|
56
|
-
const
|
|
57
|
-
const docHash = await hashJsonLd(jsonLd, contextLoader);
|
|
58
|
-
const message = optionsHash + docHash;
|
|
56
|
+
const message = await hashJsonLd(options, contextLoader) + await hashJsonLd(jsonLd, contextLoader);
|
|
59
57
|
const messageBytes = new TextEncoder().encode(message);
|
|
60
58
|
const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, messageBytes);
|
|
61
59
|
return {
|
|
@@ -78,7 +76,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
|
|
|
78
76
|
* @since 1.0.0
|
|
79
77
|
*/
|
|
80
78
|
async function signJsonLd(jsonLd, privateKey, keyId, options) {
|
|
81
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
79
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("ld_signatures.sign", { attributes: { "ld_signatures.key_id": keyId.href } }, async (span) => {
|
|
82
80
|
try {
|
|
83
81
|
const signature = await createSignature(jsonLd, privateKey, keyId, options);
|
|
84
82
|
if (span.isRecording()) {
|
|
@@ -213,7 +211,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
213
211
|
* @returns `true` if the document is authentic; `false` otherwise.
|
|
214
212
|
*/
|
|
215
213
|
async function verifyJsonLd(jsonLd, options = {}) {
|
|
216
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
214
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("ld_signatures.verify", async (span) => {
|
|
217
215
|
try {
|
|
218
216
|
const object = await Object$1.fromJsonLd(jsonLd, options);
|
|
219
217
|
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
@@ -254,8 +252,7 @@ async function hashJsonLd(jsonLd, contextLoader) {
|
|
|
254
252
|
documentLoader: contextLoader ?? getDocumentLoader()
|
|
255
253
|
});
|
|
256
254
|
const encoder = new TextEncoder();
|
|
257
|
-
|
|
258
|
-
return encodeHex(hash);
|
|
255
|
+
return encodeHex(await crypto.subtle.digest("SHA-256", encoder.encode(canon)));
|
|
259
256
|
}
|
|
260
257
|
|
|
261
258
|
//#endregion
|
|
@@ -366,15 +363,14 @@ async function createProof(object, privateKey, keyId, { contextLoader, context:
|
|
|
366
363
|
const msgBytes = encoder.encode(msgCanon);
|
|
367
364
|
const msgDigest = await crypto.subtle.digest("SHA-256", msgBytes);
|
|
368
365
|
created ??= Temporal.Now.instant();
|
|
369
|
-
const
|
|
366
|
+
const proofCanon = serialize({
|
|
370
367
|
"@context": compactMsg["@context"],
|
|
371
368
|
type: "DataIntegrityProof",
|
|
372
369
|
cryptosuite: "eddsa-jcs-2022",
|
|
373
370
|
verificationMethod: keyId.href,
|
|
374
371
|
proofPurpose: "assertionMethod",
|
|
375
372
|
created: created.toString()
|
|
376
|
-
};
|
|
377
|
-
const proofCanon = serialize(proofConfig);
|
|
373
|
+
});
|
|
378
374
|
const proofBytes = encoder.encode(proofCanon);
|
|
379
375
|
const proofDigest = await crypto.subtle.digest("SHA-256", proofBytes);
|
|
380
376
|
const digest = new Uint8Array(proofDigest.byteLength + msgDigest.byteLength);
|
|
@@ -400,7 +396,7 @@ async function createProof(object, privateKey, keyId, { contextLoader, context:
|
|
|
400
396
|
* @since 0.10.0
|
|
401
397
|
*/
|
|
402
398
|
async function signObject(object, privateKey, keyId, options = {}) {
|
|
403
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
399
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("object_integrity_proofs.sign", { attributes: { "activitypub.object.type": getTypeId(object).href } }, async (span) => {
|
|
404
400
|
try {
|
|
405
401
|
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
406
402
|
const existingProofs = [];
|
|
@@ -434,7 +430,7 @@ async function signObject(object, privateKey, keyId, options = {}) {
|
|
|
434
430
|
* @since 0.10.0
|
|
435
431
|
*/
|
|
436
432
|
async function verifyProof(jsonLd, proof, options = {}) {
|
|
437
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
433
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("object_integrity_proofs.verify", async (span) => {
|
|
438
434
|
if (span.isRecording()) {
|
|
439
435
|
if (proof.cryptosuite != null) span.setAttribute("object_integrity_proofs.cryptosuite", proof.cryptosuite);
|
|
440
436
|
if (proof.verificationMethodId != null) span.setAttribute("object_integrity_proofs.key_id", proof.verificationMethodId.href);
|
|
@@ -458,15 +454,14 @@ async function verifyProof(jsonLd, proof, options = {}) {
|
|
|
458
454
|
async function verifyProofInternal(jsonLd, proof, options) {
|
|
459
455
|
if (typeof jsonLd !== "object" || proof.cryptosuite !== "eddsa-jcs-2022" || proof.verificationMethodId == null || proof.proofPurpose !== "assertionMethod" || proof.proofValue == null || proof.created == null) return null;
|
|
460
456
|
const publicKeyPromise = fetchKey(proof.verificationMethodId, Multikey, options);
|
|
461
|
-
const
|
|
457
|
+
const proofCanon = serialize({
|
|
462
458
|
"@context": jsonLd["@context"],
|
|
463
459
|
type: "DataIntegrityProof",
|
|
464
460
|
cryptosuite: proof.cryptosuite,
|
|
465
461
|
verificationMethod: proof.verificationMethodId.href,
|
|
466
462
|
proofPurpose: proof.proofPurpose,
|
|
467
463
|
created: proof.created.toString()
|
|
468
|
-
};
|
|
469
|
-
const proofCanon = serialize(proofConfig);
|
|
464
|
+
});
|
|
470
465
|
const encoder = new TextEncoder();
|
|
471
466
|
const proofBytes = encoder.encode(proofCanon);
|
|
472
467
|
const proofDigest = await crypto.subtle.digest("SHA-256", proofBytes);
|
|
@@ -579,4 +574,4 @@ async function verifyObject(cls, jsonLd, options = {}) {
|
|
|
579
574
|
}
|
|
580
575
|
|
|
581
576
|
//#endregion
|
|
582
|
-
export {
|
|
577
|
+
export { doesActorOwnKey as a, createSignature as c, signJsonLd as d, verifyJsonLd as f, verifyProof as i, detachSignature as l, signObject as n, getKeyOwner as o, verifySignature as p, verifyObject as r, attachSignature as s, createProof as t, hasSignature as u };
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { getTypeId } from "./type-
|
|
9
|
-
import {
|
|
6
|
+
import { d as version, u as name } from "./docloader-sGz4vcrK.js";
|
|
7
|
+
import { h as Multikey, s as DataIntegrityProof, t as Activity } from "./vocab-DCHRuBGF.js";
|
|
8
|
+
import { t as getTypeId } from "./type-DFsmi-p1.js";
|
|
9
|
+
import { a as validateCryptoKey, n as fetchKey } from "./key-bMrDyA2T.js";
|
|
10
10
|
import { getLogger } from "@logtape/logtape";
|
|
11
11
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
12
12
|
import { encodeHex } from "byte-encodings/hex";
|
|
@@ -41,15 +41,14 @@ async function createProof(object, privateKey, keyId, { contextLoader, context:
|
|
|
41
41
|
const msgBytes = encoder.encode(msgCanon);
|
|
42
42
|
const msgDigest = await crypto.subtle.digest("SHA-256", msgBytes);
|
|
43
43
|
created ??= Temporal.Now.instant();
|
|
44
|
-
const
|
|
44
|
+
const proofCanon = serialize({
|
|
45
45
|
"@context": compactMsg["@context"],
|
|
46
46
|
type: "DataIntegrityProof",
|
|
47
47
|
cryptosuite: "eddsa-jcs-2022",
|
|
48
48
|
verificationMethod: keyId.href,
|
|
49
49
|
proofPurpose: "assertionMethod",
|
|
50
50
|
created: created.toString()
|
|
51
|
-
};
|
|
52
|
-
const proofCanon = serialize(proofConfig);
|
|
51
|
+
});
|
|
53
52
|
const proofBytes = encoder.encode(proofCanon);
|
|
54
53
|
const proofDigest = await crypto.subtle.digest("SHA-256", proofBytes);
|
|
55
54
|
const digest = new Uint8Array(proofDigest.byteLength + msgDigest.byteLength);
|
|
@@ -75,7 +74,7 @@ async function createProof(object, privateKey, keyId, { contextLoader, context:
|
|
|
75
74
|
* @since 0.10.0
|
|
76
75
|
*/
|
|
77
76
|
async function signObject(object, privateKey, keyId, options = {}) {
|
|
78
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
77
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("object_integrity_proofs.sign", { attributes: { "activitypub.object.type": getTypeId(object).href } }, async (span) => {
|
|
79
78
|
try {
|
|
80
79
|
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
81
80
|
const existingProofs = [];
|
|
@@ -109,7 +108,7 @@ async function signObject(object, privateKey, keyId, options = {}) {
|
|
|
109
108
|
* @since 0.10.0
|
|
110
109
|
*/
|
|
111
110
|
async function verifyProof(jsonLd, proof, options = {}) {
|
|
112
|
-
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(
|
|
111
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("object_integrity_proofs.verify", async (span) => {
|
|
113
112
|
if (span.isRecording()) {
|
|
114
113
|
if (proof.cryptosuite != null) span.setAttribute("object_integrity_proofs.cryptosuite", proof.cryptosuite);
|
|
115
114
|
if (proof.verificationMethodId != null) span.setAttribute("object_integrity_proofs.key_id", proof.verificationMethodId.href);
|
|
@@ -133,15 +132,14 @@ async function verifyProof(jsonLd, proof, options = {}) {
|
|
|
133
132
|
async function verifyProofInternal(jsonLd, proof, options) {
|
|
134
133
|
if (typeof jsonLd !== "object" || proof.cryptosuite !== "eddsa-jcs-2022" || proof.verificationMethodId == null || proof.proofPurpose !== "assertionMethod" || proof.proofValue == null || proof.created == null) return null;
|
|
135
134
|
const publicKeyPromise = fetchKey(proof.verificationMethodId, Multikey, options);
|
|
136
|
-
const
|
|
135
|
+
const proofCanon = serialize({
|
|
137
136
|
"@context": jsonLd["@context"],
|
|
138
137
|
type: "DataIntegrityProof",
|
|
139
138
|
cryptosuite: proof.cryptosuite,
|
|
140
139
|
verificationMethod: proof.verificationMethodId.href,
|
|
141
140
|
proofPurpose: proof.proofPurpose,
|
|
142
141
|
created: proof.created.toString()
|
|
143
|
-
};
|
|
144
|
-
const proofCanon = serialize(proofConfig);
|
|
142
|
+
});
|
|
145
143
|
const encoder = new TextEncoder();
|
|
146
144
|
const proofBytes = encoder.encode(proofCanon);
|
|
147
145
|
const proofDigest = await crypto.subtle.digest("SHA-256", proofBytes);
|
|
@@ -254,4 +252,4 @@ async function verifyObject(cls, jsonLd, options = {}) {
|
|
|
254
252
|
}
|
|
255
253
|
|
|
256
254
|
//#endregion
|
|
257
|
-
export {
|
|
255
|
+
export { verifyProof as i, signObject as n, verifyObject as r, createProof as t };
|