@fedify/fedify 1.10.0 → 2.0.0-dev.100
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/LICENSE +1 -1
- package/README.md +34 -20
- package/dist/{actor-bgf-5lfW.js → actor-CX6a_fXc.js} +220 -705
- package/dist/{actor-eeONG_sv.d.ts → actor-DqFajh9s.d.ts} +2 -2
- package/dist/{actor-BUkMfvz-.js → actor-eJqgtXKv.js} +1 -1
- package/dist/{actor-D190nbTD.d.cts → actor-f2NtjyCg.d.cts} +2 -2
- package/dist/{actor-CD3vk4f0.cjs → actor-vyab-ea8.cjs} +952 -1479
- package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-Ce45JcFg.js} +1 -1
- package/dist/{assert_is_error-BPGph1Jx.js → assert_throws-BNXdRGWP.js} +31 -1
- package/dist/{builder-CWXSdxB2.js → builder-CknaHxxc.js} +3 -4
- package/dist/{client-n6L4GtQL.d.cts → client-94iWEfQa.d.cts} +3 -75
- package/dist/{client-B3mQJNO7.d.ts → client-BsGzbnV-.d.ts} +3 -75
- package/dist/{client-BCAGZDSx.js → client-pY7-3icS.js} +3 -22
- package/dist/compat/mod.d.cts +10 -12
- package/dist/compat/mod.d.ts +10 -12
- package/dist/compat/transformers.test.js +20 -20
- package/dist/{context-WJoO0SQs.d.cts → context-DBQ7nMCw.d.cts} +152 -27
- package/dist/{context-Cr5DIxq_.d.ts → context-mM0Nu5yo.d.ts} +152 -27
- package/dist/{authdocloader-B7SytNNG.js → docloader-BFOyc5--.js} +17 -8
- package/dist/{esm-D-yelT_S.js → esm-HsBrJq8t.js} +32 -17
- package/dist/federation/builder.test.js +9 -12
- package/dist/federation/collection.test.js +7 -9
- package/dist/federation/handler.test.js +28 -149
- package/dist/federation/idempotency.test.js +26 -27
- package/dist/federation/inbox.test.js +4 -6
- package/dist/federation/keycache.test.js +3 -4
- package/dist/federation/kv.test.js +6 -8
- package/dist/federation/middleware.test.js +270 -93
- package/dist/federation/mod.cjs +9 -11
- package/dist/federation/mod.d.cts +10 -12
- package/dist/federation/mod.d.ts +10 -12
- package/dist/federation/mod.js +9 -11
- package/dist/federation/mq.test.js +10 -10
- package/dist/federation/negotiation.test.js +26 -0
- package/dist/federation/retry.test.js +4 -5
- package/dist/federation/router.test.js +6 -8
- package/dist/federation/send.test.js +14 -16
- package/dist/{http-C9loelvm.js → http-BE4MNK5A.js} +2 -2
- package/dist/{http-DS9z_HzB.d.ts → http-BbO0ejuk.d.ts} +2 -2
- package/dist/{http-BgfXfAjx.cjs → http-Cy32w9zC.cjs} +289 -9
- package/dist/{http-C_1RU1U_.d.cts → http-M8k5mKc0.d.cts} +2 -2
- package/dist/{http-D0qx-TXE.js → http-rzOkBH97.js} +256 -6
- package/dist/{inbox-BEVGwhBi.js → inbox-CC7Xf1dl.js} +2 -7
- package/dist/{key-AeBOuiHs.js → key-DP6qvTbJ.js} +3 -2
- package/dist/{keycache-Bw4Uxzi6.js → keycache-wXn_gxMw.js} +1 -1
- package/dist/{keys-Dj5daeN1.js → keys-DDn7koOQ.js} +2 -1
- package/dist/{kv-DipCBaw2.d.ts → kv-BpJND1Hr.d.ts} +2 -1
- package/dist/{kv-BqEOXcZv.d.cts → kv-cD_d4hg-.d.cts} +2 -1
- package/dist/kv-cache-BRTidUqb.cjs +134 -0
- package/dist/kv-cache-D7LFlByV.js +107 -0
- package/dist/kv-cache-DFZETuNv.js +122 -0
- package/dist/{ld-C3DOGrIw.js → ld-HxSfVcFy.js} +3 -2
- package/dist/{type-DqEM8B7_.js → lookup-B25HiNR_.js} +547 -5409
- package/dist/{lookup-Bu4FBtdO.cjs → lookup-Dwdg60Zd.cjs} +134 -5
- package/dist/{lookup-IlTVyD9K.js → lookup-G1_0vHHK.js} +125 -2
- package/dist/{middleware-DAHeKrOL.cjs → middleware-CHIX0fet.cjs} +58 -104
- package/dist/middleware-CJxiy__Z.js +15 -0
- package/dist/{middleware-eZxZNDdm.js → middleware-D0ByqW8h.js} +43 -146
- package/dist/{middleware-Bj9Trcbz.js → middleware-DYuVYS53.js} +38 -84
- package/dist/middleware-DZFLLqR4.js +26 -0
- package/dist/middleware-ItQuZXpg.cjs +15 -0
- package/dist/{mod-DS4kJskR.d.ts → mod-BlVovdcy.d.ts} +2 -2
- package/dist/{mod-D5rfgGFE.d.cts → mod-BxRCHTz-.d.cts} +2 -2
- package/dist/{mod-CxMBb_dd.d.cts → mod-C58MZ7Wx.d.cts} +1 -1
- package/dist/mod-CAdoBu0x.d.ts +109 -0
- package/dist/{mod-BZfdiPBo.d.ts → mod-D5Z2tISD.d.ts} +3 -3
- package/dist/{mod-Dz5Y15Uy.d.cts → mod-DgxG-byT.d.cts} +3 -3
- package/dist/{mod-ChbckRnC.d.ts → mod-Ds0mpFZU.d.ts} +1 -1
- package/dist/{mod-OQfb33eH.d.cts → mod-Dy2fJtmN.d.cts} +2 -2
- package/dist/{mod-CnULG6Aa.d.ts → mod-GetHzY6F.d.ts} +2 -2
- package/dist/mod-fxr25Gv7.d.cts +107 -0
- package/dist/mod.cjs +19 -34
- package/dist/mod.d.cts +15 -17
- package/dist/mod.d.ts +15 -17
- package/dist/mod.js +14 -16
- package/dist/negotiation-C4nFufNk.js +71 -0
- package/dist/nodeinfo/client.test.js +30 -111
- package/dist/nodeinfo/handler.test.js +25 -26
- package/dist/nodeinfo/mod.cjs +3 -6
- package/dist/nodeinfo/mod.d.cts +3 -5
- package/dist/nodeinfo/mod.d.ts +3 -5
- package/dist/nodeinfo/mod.js +3 -4
- package/dist/nodeinfo/types.test.js +8 -15
- package/dist/otel/exporter.test.js +44 -70
- package/dist/otel/mod.cjs +17 -34
- package/dist/otel/mod.d.cts +5 -6
- package/dist/otel/mod.d.ts +5 -6
- package/dist/otel/mod.js +17 -34
- package/dist/{otel-Chy5T2Xh.js → otel-Bfe_BgOV.js} +1 -2
- package/dist/{owner-AcrG3Xz1.d.cts → owner-B4HbyP8s.d.cts} +3 -3
- package/dist/{owner-DKFFhLVW.js → owner-BWOLrzit.js} +3 -2
- package/dist/{owner-8NMhXwJd.d.ts → owner-kQRGVXG1.d.ts} +3 -3
- package/dist/{proof-ZEESDSs6.js → proof-BYodbwm8.js} +2 -2
- package/dist/{proof-gU4Y_14I.cjs → proof-BqP89L5j.cjs} +18 -17
- package/dist/{proof-Ea3ykPsy.js → proof-ZlfOiUS5.js} +5 -4
- package/dist/{send-xtxi11p2.js → send-CC6itx2j.js} +2 -2
- package/dist/sig/http.test.js +12 -13
- package/dist/sig/key.test.js +9 -11
- package/dist/sig/ld.test.js +8 -10
- package/dist/sig/mod.cjs +9 -11
- package/dist/sig/mod.d.cts +5 -7
- package/dist/sig/mod.d.ts +5 -7
- package/dist/sig/mod.js +5 -7
- package/dist/sig/owner.test.js +11 -13
- package/dist/sig/proof.test.js +13 -14
- package/dist/src/vocab/accept.yaml +1 -1
- package/dist/src/vocab/activity.yaml +1 -1
- package/dist/src/vocab/add.yaml +1 -1
- package/dist/src/vocab/announce.yaml +1 -1
- package/dist/src/vocab/application.yaml +1 -1
- package/dist/src/vocab/arrive.yaml +1 -1
- package/dist/src/vocab/article.yaml +1 -1
- package/dist/src/vocab/audio.yaml +1 -1
- package/dist/src/vocab/block.yaml +1 -1
- package/dist/src/vocab/chatmessage.yaml +1 -1
- package/dist/src/vocab/collection.yaml +1 -1
- package/dist/src/vocab/collectionpage.yaml +1 -1
- package/dist/src/vocab/create.yaml +1 -1
- package/dist/src/vocab/dataintegrityproof.yaml +1 -1
- package/dist/src/vocab/delete.yaml +1 -1
- package/dist/src/vocab/didservice.yaml +1 -1
- package/dist/src/vocab/dislike.yaml +1 -1
- package/dist/src/vocab/document.yaml +1 -1
- package/dist/src/vocab/emoji.yaml +1 -1
- package/dist/src/vocab/emojireact.yaml +1 -1
- package/dist/src/vocab/endpoints.yaml +1 -1
- package/dist/src/vocab/event.yaml +1 -1
- package/dist/src/vocab/export.yaml +1 -1
- package/dist/src/vocab/flag.yaml +1 -1
- package/dist/src/vocab/follow.yaml +1 -1
- package/dist/src/vocab/group.yaml +1 -1
- package/dist/src/vocab/hashtag.yaml +1 -1
- package/dist/src/vocab/ignore.yaml +1 -1
- package/dist/src/vocab/image.yaml +1 -1
- package/dist/src/vocab/intransitiveactivity.yaml +1 -1
- package/dist/src/vocab/invite.yaml +1 -1
- package/dist/src/vocab/join.yaml +1 -1
- package/dist/src/vocab/key.yaml +1 -1
- package/dist/src/vocab/leave.yaml +1 -1
- package/dist/src/vocab/like.yaml +1 -1
- package/dist/src/vocab/link.yaml +1 -1
- package/dist/src/vocab/listen.yaml +1 -1
- package/dist/src/vocab/mention.yaml +1 -1
- package/dist/src/vocab/move.yaml +1 -1
- package/dist/src/vocab/multikey.yaml +1 -1
- package/dist/src/vocab/note.yaml +1 -1
- package/dist/src/vocab/object.yaml +1 -1
- package/dist/src/vocab/offer.yaml +1 -1
- package/dist/src/vocab/orderedcollection.yaml +1 -1
- package/dist/src/vocab/orderedcollectionpage.yaml +1 -1
- package/dist/src/vocab/organization.yaml +1 -1
- package/dist/src/vocab/page.yaml +1 -1
- package/dist/src/vocab/person.yaml +1 -1
- package/dist/src/vocab/place.yaml +1 -1
- package/dist/src/vocab/profile.yaml +1 -1
- package/dist/src/vocab/propertyvalue.yaml +1 -1
- package/dist/src/vocab/question.yaml +1 -1
- package/dist/src/vocab/read.yaml +1 -1
- package/dist/src/vocab/reject.yaml +1 -1
- package/dist/src/vocab/relationship.yaml +1 -1
- package/dist/src/vocab/remove.yaml +1 -1
- package/dist/src/vocab/service.yaml +1 -1
- package/dist/src/vocab/source.yaml +1 -1
- package/dist/src/vocab/tentativeaccept.yaml +1 -1
- package/dist/src/vocab/tentativereject.yaml +1 -1
- package/dist/src/vocab/tombstone.yaml +1 -1
- package/dist/src/vocab/travel.yaml +1 -1
- package/dist/src/vocab/undo.yaml +1 -1
- package/dist/src/vocab/update.yaml +1 -1
- package/dist/src/vocab/video.yaml +1 -1
- package/dist/src/vocab/view.yaml +1 -1
- package/dist/testing/docloader.test.js +6 -8
- package/dist/testing/mod.d.ts +10 -119
- package/dist/testing/mod.js +2 -3
- package/dist/{testing-DFvXSqyP.js → testing-BbJqK9NR.js} +1 -2
- package/dist/{types-DIhRCBa4.js → types-BtUjyi5y.js} +5 -166
- package/dist/{types-BIgY6c-l.js → types-C2XVl6gj.js} +1 -3
- package/dist/{types-ylHYpR3Z.cjs → types-CWgzGaqk.cjs} +6 -179
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +14 -15
- package/dist/utils/kv-cache.test.js +212 -0
- package/dist/utils/mod.cjs +12 -0
- package/dist/utils/mod.d.cts +5 -0
- package/dist/utils/mod.d.ts +7 -0
- package/dist/utils/mod.js +11 -0
- package/dist/vocab/actor.test.js +8 -10
- package/dist/vocab/lookup.test.js +8 -10
- package/dist/vocab/mod.cjs +3 -4
- package/dist/vocab/mod.d.cts +3 -5
- package/dist/vocab/mod.d.ts +3 -5
- package/dist/vocab/mod.js +3 -4
- package/dist/vocab/type.test.js +2 -3
- package/dist/vocab/vocab.test.js +7618 -1973
- package/dist/{vocab-BASuuzcJ.d.ts → vocab-BCWe1Ih5.d.ts} +9 -25
- package/dist/{vocab-DPMmFPJ1.d.cts → vocab-CeDBzu-f.d.cts} +9 -25
- package/dist/{vocab-Dp0ySvGE.js → vocab-DDf0si0L.js} +3 -3
- package/dist/{vocab-G9W9ByPV.cjs → vocab-wJpUyNt3.cjs} +5 -5
- package/dist/webfinger/handler.test.js +24 -25
- package/dist/webfinger/lookup.test.js +7 -9
- package/dist/webfinger/mod.cjs +2 -3
- package/dist/webfinger/mod.d.cts +1 -3
- package/dist/webfinger/mod.d.ts +1 -3
- package/dist/webfinger/mod.js +2 -3
- package/package.json +33 -66
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-C9QYbrJt.cjs +0 -58
- package/dist/authdocloader-yFPHUiNm.js +0 -52
- package/dist/denokv-D0nfNQ1x.js +0 -57
- package/dist/docloader-BucCRHZI.d.ts +0 -221
- package/dist/docloader-CankQbIm.cjs +0 -4901
- package/dist/docloader-ChxNLZAA.d.cts +0 -219
- package/dist/docloader-RhwM6pxE.js +0 -4835
- package/dist/key-Bvfy40Rb.js +0 -10
- package/dist/key-CGhTsWG9.cjs +0 -290
- package/dist/key-CS_ify3S.cjs +0 -10
- package/dist/key-J8ksMDYz.js +0 -10
- package/dist/key-LaW_EfdQ.js +0 -260
- package/dist/lookup-CoaKXsmO.js +0 -336
- package/dist/middleware-BffIkFC3.js +0 -17
- package/dist/middleware-DjtcxgEk.cjs +0 -17
- package/dist/middleware-DmIAQdDr.js +0 -26
- package/dist/mod-CD7gfdq3.d.ts +0 -104
- package/dist/mod-JUhOKMHj.d.cts +0 -102
- package/dist/mq-B7R1Q-M5.d.cts +0 -140
- package/dist/mq-CRGm1e_F.d.ts +0 -143
- package/dist/nodeinfo/semver.test.js +0 -143
- package/dist/runtime/docloader.test.js +0 -599
- package/dist/runtime/key.test.d.ts +0 -3
- package/dist/runtime/key.test.js +0 -103
- package/dist/runtime/langstr.test.d.ts +0 -3
- package/dist/runtime/langstr.test.js +0 -40
- package/dist/runtime/link.test.d.ts +0 -3
- package/dist/runtime/link.test.js +0 -61
- package/dist/runtime/mod.cjs +0 -25
- package/dist/runtime/mod.d.cts +0 -6
- package/dist/runtime/mod.d.ts +0 -8
- package/dist/runtime/mod.js +0 -13
- package/dist/runtime/multibase/multibase.test.d.ts +0 -3
- package/dist/runtime/multibase/multibase.test.js +0 -358
- package/dist/runtime/url.test.d.ts +0 -3
- package/dist/runtime/url.test.js +0 -45
- package/dist/semver-dArNLkR9.js +0 -149
- package/dist/vocab/schema.yaml +0 -247
- package/dist/x/cfworkers.cjs +0 -100
- package/dist/x/cfworkers.d.cts +0 -59
- package/dist/x/cfworkers.d.ts +0 -61
- package/dist/x/cfworkers.js +0 -98
- package/dist/x/cfworkers.test.d.ts +0 -3
- package/dist/x/cfworkers.test.js +0 -179
- package/dist/x/hono.cjs +0 -61
- package/dist/x/hono.d.cts +0 -54
- package/dist/x/hono.d.ts +0 -56
- package/dist/x/hono.js +0 -60
- package/dist/x/sveltekit.cjs +0 -69
- package/dist/x/sveltekit.d.cts +0 -46
- package/dist/x/sveltekit.d.ts +0 -48
- package/dist/x/sveltekit.js +0 -68
- /package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-C80BG-_5.js} +0 -0
- /package/dist/{collection-CSzG2j1P.js → collection-BzWsN9pB.js} +0 -0
- /package/dist/{nodeinfo/semver.test.d.ts → federation/negotiation.test.d.ts} +0 -0
- /package/dist/{federation-C15gGOh1.cjs → federation-CoW-KDKv.cjs} +0 -0
- /package/dist/{federation-K-xsO03l.js → federation-D0hkM4T7.js} +0 -0
- /package/dist/{mod-C2tOeRkN.d.cts → mod-B-hUPT2N.d.cts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-CVgZgliM.d.ts} +0 -0
- /package/dist/{mod-FZd39qVq.d.cts → mod-CcDPcLJW.d.cts} +0 -0
- /package/dist/{mod-g0xFzAP9.d.ts → mod-bjzj5QIb.d.ts} +0 -0
- /package/dist/{nodeinfo-DfycQ8Wf.js → nodeinfo-BnthBobC.js} +0 -0
- /package/dist/{nodeinfo-Co9lJrWl.cjs → nodeinfo-CdN0rEnZ.cjs} +0 -0
- /package/dist/{retry-D4GJ670a.js → retry-CfF8Gn4d.js} +0 -0
- /package/dist/{runtime-DPYEDf-o.js → sig-C34-oHBl.js} +0 -0
- /package/dist/{runtime-C58AJWSv.cjs → sig-YYj5tCnr.cjs} +0 -0
- /package/dist/{std__assert-X-_kMxKM.js → std__assert-DWivtrGR.js} +0 -0
- /package/dist/{runtime → utils}/docloader.test.d.ts +0 -0
- /package/dist/{runtime/authdocloader.test.d.ts → utils/kv-cache.test.d.ts} +0 -0
- /package/dist/{sig-Cj3tk-ig.js → utils-D-Va7aXC.js} +0 -0
- /package/dist/{sig-ByHXzqUi.cjs → utils-DyRU1gdZ.cjs} +0 -0
- /package/dist/{webfinger-De_bU0iE.js → webfinger-C72Y8lrh.js} +0 -0
- /package/dist/{webfinger-BjOEdFPs.cjs → webfinger-vAtLmxOF.cjs} +0 -0
package/dist/otel/mod.cjs
CHANGED
|
@@ -30,8 +30,9 @@ const __opentelemetry_core = require_chunk.__toESM(require("@opentelemetry/core"
|
|
|
30
30
|
* ttl: Temporal.Duration.from({ hours: 1 }),
|
|
31
31
|
* });
|
|
32
32
|
*
|
|
33
|
-
* const provider = new BasicTracerProvider(
|
|
34
|
-
*
|
|
33
|
+
* const provider = new BasicTracerProvider({
|
|
34
|
+
* spanProcessors: [new SimpleSpanProcessor(exporter)],
|
|
35
|
+
* });
|
|
35
36
|
* ```
|
|
36
37
|
*
|
|
37
38
|
* @example Querying stored traces
|
|
@@ -56,21 +57,16 @@ var FedifySpanExporter = class {
|
|
|
56
57
|
#kv;
|
|
57
58
|
#ttl;
|
|
58
59
|
#keyPrefix;
|
|
59
|
-
#useList;
|
|
60
60
|
/**
|
|
61
61
|
* Creates a new FedifySpanExporter.
|
|
62
62
|
*
|
|
63
|
-
* @param kv The KvStore to persist trace data to.
|
|
64
|
-
* `list()` or `cas()` method.
|
|
63
|
+
* @param kv The KvStore to persist trace data to.
|
|
65
64
|
* @param options Configuration options.
|
|
66
|
-
* @throws {Error} If the KvStore supports neither `list()` nor `cas()`.
|
|
67
65
|
*/
|
|
68
66
|
constructor(kv, options) {
|
|
69
|
-
if (kv.list == null && kv.cas == null) throw new Error("KvStore must support either list() or cas() method to use FedifySpanExporter. Consider using a KvStore implementation that supports these operations, such as MemoryKvStore, RedisKvStore, PostgresKvStore, or SqliteKvStore.");
|
|
70
67
|
this.#kv = kv;
|
|
71
68
|
this.#ttl = options?.ttl;
|
|
72
69
|
this.#keyPrefix = options?.keyPrefix ?? ["fedify", "traces"];
|
|
73
|
-
this.#useList = kv.list != null;
|
|
74
70
|
}
|
|
75
71
|
/**
|
|
76
72
|
* Exports spans to the KvStore.
|
|
@@ -103,7 +99,7 @@ var FedifySpanExporter = class {
|
|
|
103
99
|
const spanContext = span.spanContext();
|
|
104
100
|
const traceId = spanContext.traceId;
|
|
105
101
|
const spanId = spanContext.spanId;
|
|
106
|
-
const parentSpanId = span.
|
|
102
|
+
const parentSpanId = span.parentSpanContext?.spanId;
|
|
107
103
|
for (const event of span.events) if (event.name === "activitypub.activity.received") {
|
|
108
104
|
const record = this.#extractInboundRecord(event, traceId, spanId, parentSpanId);
|
|
109
105
|
if (record != null) records.push(record);
|
|
@@ -184,15 +180,13 @@ var FedifySpanExporter = class {
|
|
|
184
180
|
}
|
|
185
181
|
async #storeRecord(record) {
|
|
186
182
|
const options = this.#ttl != null ? { ttl: this.#ttl } : void 0;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
await this.#updateTraceSummary(record, options);
|
|
195
|
-
} else await this.#storeWithCas(record, options);
|
|
183
|
+
const key = [
|
|
184
|
+
...this.#keyPrefix,
|
|
185
|
+
record.traceId,
|
|
186
|
+
record.spanId
|
|
187
|
+
];
|
|
188
|
+
await this.#kv.set(key, record, options);
|
|
189
|
+
await this.#updateTraceSummary(record, options);
|
|
196
190
|
}
|
|
197
191
|
async #setWithCasRetry(key, transform, options) {
|
|
198
192
|
if (this.#kv.cas != null) for (let attempt = 0; attempt < 3; attempt++) {
|
|
@@ -227,11 +221,6 @@ var FedifySpanExporter = class {
|
|
|
227
221
|
return summary;
|
|
228
222
|
}, options);
|
|
229
223
|
}
|
|
230
|
-
async #storeWithCas(record, options) {
|
|
231
|
-
const key = [...this.#keyPrefix, record.traceId];
|
|
232
|
-
await this.#setWithCasRetry(key, (existing) => existing ? [...existing, record] : [record], options);
|
|
233
|
-
await this.#updateTraceSummary(record, options);
|
|
234
|
-
}
|
|
235
224
|
/**
|
|
236
225
|
* Gets all activity records for a specific trace ID.
|
|
237
226
|
*
|
|
@@ -239,16 +228,10 @@ var FedifySpanExporter = class {
|
|
|
239
228
|
* @returns An array of activity records belonging to the trace.
|
|
240
229
|
*/
|
|
241
230
|
async getActivitiesByTraceId(traceId) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
return records;
|
|
247
|
-
} else {
|
|
248
|
-
const key = [...this.#keyPrefix, traceId];
|
|
249
|
-
const records = await this.#kv.get(key);
|
|
250
|
-
return records ?? [];
|
|
251
|
-
}
|
|
231
|
+
const prefix = [...this.#keyPrefix, traceId];
|
|
232
|
+
const records = [];
|
|
233
|
+
for await (const entry of this.#kv.list(prefix)) records.push(entry.value);
|
|
234
|
+
return records;
|
|
252
235
|
}
|
|
253
236
|
/**
|
|
254
237
|
* Gets recent traces with summary information.
|
|
@@ -259,7 +242,7 @@ var FedifySpanExporter = class {
|
|
|
259
242
|
async getRecentTraces(options) {
|
|
260
243
|
const summaryPrefix = [...this.#keyPrefix, "_summaries"];
|
|
261
244
|
const summaries = [];
|
|
262
|
-
|
|
245
|
+
for await (const entry of this.#kv.list(summaryPrefix)) summaries.push(entry.value);
|
|
263
246
|
summaries.sort((a, b) => b.timestamp.localeCompare(a.timestamp));
|
|
264
247
|
if (options?.limit != null) return summaries.slice(0, options.limit);
|
|
265
248
|
return summaries;
|
package/dist/otel/mod.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { KvKey, KvStore } from "../kv-
|
|
1
|
+
import { KvKey, KvStore } from "../kv-cD_d4hg-.cjs";
|
|
2
2
|
import { ReadableSpan, SpanExporter } from "@opentelemetry/sdk-trace-base";
|
|
3
3
|
import { ExportResultCode } from "@opentelemetry/core";
|
|
4
4
|
|
|
@@ -161,8 +161,9 @@ interface GetRecentTracesOptions {
|
|
|
161
161
|
* ttl: Temporal.Duration.from({ hours: 1 }),
|
|
162
162
|
* });
|
|
163
163
|
*
|
|
164
|
-
* const provider = new BasicTracerProvider(
|
|
165
|
-
*
|
|
164
|
+
* const provider = new BasicTracerProvider({
|
|
165
|
+
* spanProcessors: [new SimpleSpanProcessor(exporter)],
|
|
166
|
+
* });
|
|
166
167
|
* ```
|
|
167
168
|
*
|
|
168
169
|
* @example Querying stored traces
|
|
@@ -188,10 +189,8 @@ declare class FedifySpanExporter implements SpanExporter {
|
|
|
188
189
|
/**
|
|
189
190
|
* Creates a new FedifySpanExporter.
|
|
190
191
|
*
|
|
191
|
-
* @param kv The KvStore to persist trace data to.
|
|
192
|
-
* `list()` or `cas()` method.
|
|
192
|
+
* @param kv The KvStore to persist trace data to.
|
|
193
193
|
* @param options Configuration options.
|
|
194
|
-
* @throws {Error} If the KvStore supports neither `list()` nor `cas()`.
|
|
195
194
|
*/
|
|
196
195
|
constructor(kv: KvStore, options?: FedifySpanExporterOptions);
|
|
197
196
|
/**
|
package/dist/otel/mod.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { KvKey, KvStore } from "../kv-
|
|
3
|
+
import { KvKey, KvStore } from "../kv-BpJND1Hr.js";
|
|
4
4
|
import { ExportResultCode } from "@opentelemetry/core";
|
|
5
5
|
import { ReadableSpan, SpanExporter } from "@opentelemetry/sdk-trace-base";
|
|
6
6
|
|
|
@@ -163,8 +163,9 @@ interface GetRecentTracesOptions {
|
|
|
163
163
|
* ttl: Temporal.Duration.from({ hours: 1 }),
|
|
164
164
|
* });
|
|
165
165
|
*
|
|
166
|
-
* const provider = new BasicTracerProvider(
|
|
167
|
-
*
|
|
166
|
+
* const provider = new BasicTracerProvider({
|
|
167
|
+
* spanProcessors: [new SimpleSpanProcessor(exporter)],
|
|
168
|
+
* });
|
|
168
169
|
* ```
|
|
169
170
|
*
|
|
170
171
|
* @example Querying stored traces
|
|
@@ -190,10 +191,8 @@ declare class FedifySpanExporter implements SpanExporter {
|
|
|
190
191
|
/**
|
|
191
192
|
* Creates a new FedifySpanExporter.
|
|
192
193
|
*
|
|
193
|
-
* @param kv The KvStore to persist trace data to.
|
|
194
|
-
* `list()` or `cas()` method.
|
|
194
|
+
* @param kv The KvStore to persist trace data to.
|
|
195
195
|
* @param options Configuration options.
|
|
196
|
-
* @throws {Error} If the KvStore supports neither `list()` nor `cas()`.
|
|
197
196
|
*/
|
|
198
197
|
constructor(kv: KvStore, options?: FedifySpanExporterOptions);
|
|
199
198
|
/**
|
package/dist/otel/mod.js
CHANGED
|
@@ -29,8 +29,9 @@ import { ExportResultCode } from "@opentelemetry/core";
|
|
|
29
29
|
* ttl: Temporal.Duration.from({ hours: 1 }),
|
|
30
30
|
* });
|
|
31
31
|
*
|
|
32
|
-
* const provider = new BasicTracerProvider(
|
|
33
|
-
*
|
|
32
|
+
* const provider = new BasicTracerProvider({
|
|
33
|
+
* spanProcessors: [new SimpleSpanProcessor(exporter)],
|
|
34
|
+
* });
|
|
34
35
|
* ```
|
|
35
36
|
*
|
|
36
37
|
* @example Querying stored traces
|
|
@@ -55,21 +56,16 @@ var FedifySpanExporter = class {
|
|
|
55
56
|
#kv;
|
|
56
57
|
#ttl;
|
|
57
58
|
#keyPrefix;
|
|
58
|
-
#useList;
|
|
59
59
|
/**
|
|
60
60
|
* Creates a new FedifySpanExporter.
|
|
61
61
|
*
|
|
62
|
-
* @param kv The KvStore to persist trace data to.
|
|
63
|
-
* `list()` or `cas()` method.
|
|
62
|
+
* @param kv The KvStore to persist trace data to.
|
|
64
63
|
* @param options Configuration options.
|
|
65
|
-
* @throws {Error} If the KvStore supports neither `list()` nor `cas()`.
|
|
66
64
|
*/
|
|
67
65
|
constructor(kv, options) {
|
|
68
|
-
if (kv.list == null && kv.cas == null) throw new Error("KvStore must support either list() or cas() method to use FedifySpanExporter. Consider using a KvStore implementation that supports these operations, such as MemoryKvStore, RedisKvStore, PostgresKvStore, or SqliteKvStore.");
|
|
69
66
|
this.#kv = kv;
|
|
70
67
|
this.#ttl = options?.ttl;
|
|
71
68
|
this.#keyPrefix = options?.keyPrefix ?? ["fedify", "traces"];
|
|
72
|
-
this.#useList = kv.list != null;
|
|
73
69
|
}
|
|
74
70
|
/**
|
|
75
71
|
* Exports spans to the KvStore.
|
|
@@ -102,7 +98,7 @@ var FedifySpanExporter = class {
|
|
|
102
98
|
const spanContext = span.spanContext();
|
|
103
99
|
const traceId = spanContext.traceId;
|
|
104
100
|
const spanId = spanContext.spanId;
|
|
105
|
-
const parentSpanId = span.
|
|
101
|
+
const parentSpanId = span.parentSpanContext?.spanId;
|
|
106
102
|
for (const event of span.events) if (event.name === "activitypub.activity.received") {
|
|
107
103
|
const record = this.#extractInboundRecord(event, traceId, spanId, parentSpanId);
|
|
108
104
|
if (record != null) records.push(record);
|
|
@@ -183,15 +179,13 @@ var FedifySpanExporter = class {
|
|
|
183
179
|
}
|
|
184
180
|
async #storeRecord(record) {
|
|
185
181
|
const options = this.#ttl != null ? { ttl: this.#ttl } : void 0;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
await this.#updateTraceSummary(record, options);
|
|
194
|
-
} else await this.#storeWithCas(record, options);
|
|
182
|
+
const key = [
|
|
183
|
+
...this.#keyPrefix,
|
|
184
|
+
record.traceId,
|
|
185
|
+
record.spanId
|
|
186
|
+
];
|
|
187
|
+
await this.#kv.set(key, record, options);
|
|
188
|
+
await this.#updateTraceSummary(record, options);
|
|
195
189
|
}
|
|
196
190
|
async #setWithCasRetry(key, transform, options) {
|
|
197
191
|
if (this.#kv.cas != null) for (let attempt = 0; attempt < 3; attempt++) {
|
|
@@ -226,11 +220,6 @@ var FedifySpanExporter = class {
|
|
|
226
220
|
return summary;
|
|
227
221
|
}, options);
|
|
228
222
|
}
|
|
229
|
-
async #storeWithCas(record, options) {
|
|
230
|
-
const key = [...this.#keyPrefix, record.traceId];
|
|
231
|
-
await this.#setWithCasRetry(key, (existing) => existing ? [...existing, record] : [record], options);
|
|
232
|
-
await this.#updateTraceSummary(record, options);
|
|
233
|
-
}
|
|
234
223
|
/**
|
|
235
224
|
* Gets all activity records for a specific trace ID.
|
|
236
225
|
*
|
|
@@ -238,16 +227,10 @@ var FedifySpanExporter = class {
|
|
|
238
227
|
* @returns An array of activity records belonging to the trace.
|
|
239
228
|
*/
|
|
240
229
|
async getActivitiesByTraceId(traceId) {
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
return records;
|
|
246
|
-
} else {
|
|
247
|
-
const key = [...this.#keyPrefix, traceId];
|
|
248
|
-
const records = await this.#kv.get(key);
|
|
249
|
-
return records ?? [];
|
|
250
|
-
}
|
|
230
|
+
const prefix = [...this.#keyPrefix, traceId];
|
|
231
|
+
const records = [];
|
|
232
|
+
for await (const entry of this.#kv.list(prefix)) records.push(entry.value);
|
|
233
|
+
return records;
|
|
251
234
|
}
|
|
252
235
|
/**
|
|
253
236
|
* Gets recent traces with summary information.
|
|
@@ -258,7 +241,7 @@ var FedifySpanExporter = class {
|
|
|
258
241
|
async getRecentTraces(options) {
|
|
259
242
|
const summaryPrefix = [...this.#keyPrefix, "_summaries"];
|
|
260
243
|
const summaries = [];
|
|
261
|
-
|
|
244
|
+
for await (const entry of this.#kv.list(summaryPrefix)) summaries.push(entry.value);
|
|
262
245
|
summaries.sort((a, b) => b.timestamp.localeCompare(a.timestamp));
|
|
263
246
|
if (options?.limit != null) return summaries.slice(0, options.limit);
|
|
264
247
|
return summaries;
|
|
@@ -55,8 +55,7 @@ var TestSpanExporter = class {
|
|
|
55
55
|
*/
|
|
56
56
|
function createTestTracerProvider() {
|
|
57
57
|
const exporter = new TestSpanExporter();
|
|
58
|
-
const provider = new BasicTracerProvider();
|
|
59
|
-
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
|
|
58
|
+
const provider = new BasicTracerProvider({ spanProcessors: [new SimpleSpanProcessor(exporter)] });
|
|
60
59
|
return [provider, exporter];
|
|
61
60
|
}
|
|
62
61
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Activity, CryptographicKey } from "./vocab-CeDBzu-f.cjs";
|
|
2
|
+
import { Actor } from "./actor-f2NtjyCg.cjs";
|
|
3
|
+
import { DocumentLoader } from "@fedify/vocab-runtime";
|
|
4
4
|
import { TracerProvider } from "@opentelemetry/api";
|
|
5
5
|
|
|
6
6
|
//#region src/sig/owner.d.ts
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { CryptographicKey, Object as Object$1, deno_default
|
|
7
|
-
import { isActor } from "./actor-
|
|
6
|
+
import { CryptographicKey, Object as Object$1, deno_default } from "./lookup-B25HiNR_.js";
|
|
7
|
+
import { isActor } from "./actor-eJqgtXKv.js";
|
|
8
|
+
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
8
9
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
10
|
|
|
10
11
|
//#region src/sig/owner.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { Actor } from "./actor-eeONG_sv.js";
|
|
3
|
+
import { Activity, CryptographicKey } from "./vocab-BCWe1Ih5.js";
|
|
4
|
+
import { Actor } from "./actor-DqFajh9s.js";
|
|
6
5
|
import { TracerProvider } from "@opentelemetry/api";
|
|
6
|
+
import { DocumentLoader } from "@fedify/vocab-runtime";
|
|
7
7
|
|
|
8
8
|
//#region src/sig/owner.d.ts
|
|
9
9
|
/**
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { Activity, DataIntegrityProof, Multikey, deno_default, getTypeId } from "./
|
|
7
|
-
import { fetchKey, validateCryptoKey } from "./key-
|
|
6
|
+
import { Activity, DataIntegrityProof, Multikey, deno_default, getTypeId } from "./lookup-B25HiNR_.js";
|
|
7
|
+
import { fetchKey, validateCryptoKey } from "./key-DP6qvTbJ.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
import { encodeHex } from "byte-encodings/hex";
|
|
@@ -3,14 +3,15 @@
|
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
4
|
|
|
5
5
|
const require_chunk = require('./chunk-DqRYRqnO.cjs');
|
|
6
|
-
const
|
|
7
|
-
const require_actor = require('./actor-
|
|
8
|
-
const
|
|
6
|
+
const require_lookup = require('./lookup-Dwdg60Zd.cjs');
|
|
7
|
+
const require_actor = require('./actor-vyab-ea8.cjs');
|
|
8
|
+
const require_http = require('./http-Cy32w9zC.cjs');
|
|
9
9
|
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
|
10
10
|
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
|
11
11
|
const jsonld = require_chunk.__toESM(require("jsonld"));
|
|
12
|
-
const
|
|
12
|
+
const __fedify_vocab_runtime = require_chunk.__toESM(require("@fedify/vocab-runtime"));
|
|
13
13
|
const byte_encodings_hex = require_chunk.__toESM(require("byte-encodings/hex"));
|
|
14
|
+
const byte_encodings_base64 = require_chunk.__toESM(require("byte-encodings/base64"));
|
|
14
15
|
const json_canon = require_chunk.__toESM(require("json-canon"));
|
|
15
16
|
|
|
16
17
|
//#region src/sig/ld.ts
|
|
@@ -47,7 +48,7 @@ function attachSignature(jsonLd, signature) {
|
|
|
47
48
|
* @since 1.0.0
|
|
48
49
|
*/
|
|
49
50
|
async function createSignature(jsonLd, privateKey, keyId, { contextLoader, created } = {}) {
|
|
50
|
-
|
|
51
|
+
require_http.validateCryptoKey(privateKey, "private");
|
|
51
52
|
if (privateKey.algorithm.name !== "RSASSA-PKCS1-v1_5") throw new TypeError("Unsupported algorithm: " + privateKey.algorithm.name);
|
|
52
53
|
const options = {
|
|
53
54
|
"@context": "https://w3id.org/identity/v1",
|
|
@@ -81,7 +82,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
|
|
|
81
82
|
*/
|
|
82
83
|
async function signJsonLd(jsonLd, privateKey, keyId, options) {
|
|
83
84
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
|
84
|
-
const tracer = tracerProvider.getTracer(
|
|
85
|
+
const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
|
85
86
|
return await tracer.startActiveSpan("ld_signatures.sign", { attributes: { "ld_signatures.key_id": keyId.href } }, async (span) => {
|
|
86
87
|
try {
|
|
87
88
|
const signature = await createSignature(jsonLd, privateKey, keyId, options);
|
|
@@ -150,7 +151,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
150
151
|
});
|
|
151
152
|
return null;
|
|
152
153
|
}
|
|
153
|
-
const { key, cached } = await
|
|
154
|
+
const { key, cached } = await require_http.fetchKey(new URL(sig.creator), require_actor.CryptographicKey, options);
|
|
154
155
|
if (key == null) return null;
|
|
155
156
|
const sigOpts = {
|
|
156
157
|
...sig,
|
|
@@ -191,7 +192,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
191
192
|
keyId: sig.creator,
|
|
192
193
|
...sig
|
|
193
194
|
});
|
|
194
|
-
const { key: key$1 } = await
|
|
195
|
+
const { key: key$1 } = await require_http.fetchKey(new URL(sig.creator), require_actor.CryptographicKey, {
|
|
195
196
|
...options,
|
|
196
197
|
keyCache: {
|
|
197
198
|
get: () => Promise.resolve(void 0),
|
|
@@ -220,7 +221,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
220
221
|
*/
|
|
221
222
|
async function verifyJsonLd(jsonLd, options = {}) {
|
|
222
223
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
|
223
|
-
const tracer = tracerProvider.getTracer(
|
|
224
|
+
const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
|
224
225
|
return await tracer.startActiveSpan("ld_signatures.verify", async (span) => {
|
|
225
226
|
try {
|
|
226
227
|
const object = await require_actor.Object.fromJsonLd(jsonLd, options);
|
|
@@ -259,7 +260,7 @@ async function verifyJsonLd(jsonLd, options = {}) {
|
|
|
259
260
|
async function hashJsonLd(jsonLd, contextLoader) {
|
|
260
261
|
const canon = await jsonld.default.canonize(jsonLd, {
|
|
261
262
|
format: "application/n-quads",
|
|
262
|
-
documentLoader: contextLoader ??
|
|
263
|
+
documentLoader: contextLoader ?? (0, __fedify_vocab_runtime.getDocumentLoader)()
|
|
263
264
|
});
|
|
264
265
|
const encoder = new TextEncoder();
|
|
265
266
|
const hash = await crypto.subtle.digest("SHA-256", encoder.encode(canon));
|
|
@@ -277,7 +278,7 @@ async function hashJsonLd(jsonLd, contextLoader) {
|
|
|
277
278
|
*/
|
|
278
279
|
async function doesActorOwnKey(activity, key, options) {
|
|
279
280
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
|
280
|
-
const tracer = tracerProvider.getTracer(
|
|
281
|
+
const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
|
281
282
|
return await tracer.startActiveSpan("activitypub.verify_key_ownership", {
|
|
282
283
|
kind: __opentelemetry_api.SpanKind.INTERNAL,
|
|
283
284
|
attributes: {
|
|
@@ -330,8 +331,8 @@ async function doesActorOwnKey(activity, key, options) {
|
|
|
330
331
|
*/
|
|
331
332
|
async function getKeyOwner(keyId, options) {
|
|
332
333
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
|
333
|
-
const documentLoader = options.documentLoader ??
|
|
334
|
-
const contextLoader = options.contextLoader ??
|
|
334
|
+
const documentLoader = options.documentLoader ?? (0, __fedify_vocab_runtime.getDocumentLoader)();
|
|
335
|
+
const contextLoader = options.contextLoader ?? (0, __fedify_vocab_runtime.getDocumentLoader)();
|
|
335
336
|
let object;
|
|
336
337
|
if (keyId instanceof require_actor.CryptographicKey) {
|
|
337
338
|
object = keyId;
|
|
@@ -398,7 +399,7 @@ const logger = (0, __logtape_logtape.getLogger)([
|
|
|
398
399
|
* @since 0.10.0
|
|
399
400
|
*/
|
|
400
401
|
async function createProof(object, privateKey, keyId, { contextLoader, context, created } = {}) {
|
|
401
|
-
|
|
402
|
+
require_http.validateCryptoKey(privateKey, "private");
|
|
402
403
|
if (privateKey.algorithm.name !== "Ed25519") throw new TypeError("Unsupported algorithm: " + privateKey.algorithm.name);
|
|
403
404
|
const objectWithoutProofs = object.clone({ proofs: [] });
|
|
404
405
|
const compactMsg = await objectWithoutProofs.toJsonLd({
|
|
@@ -446,7 +447,7 @@ async function createProof(object, privateKey, keyId, { contextLoader, context,
|
|
|
446
447
|
*/
|
|
447
448
|
async function signObject(object, privateKey, keyId, options = {}) {
|
|
448
449
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
|
449
|
-
const tracer = tracerProvider.getTracer(
|
|
450
|
+
const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
|
450
451
|
return await tracer.startActiveSpan("object_integrity_proofs.sign", { attributes: { "activitypub.object.type": require_actor.getTypeId(object).href } }, async (span) => {
|
|
451
452
|
try {
|
|
452
453
|
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
@@ -482,7 +483,7 @@ async function signObject(object, privateKey, keyId, options = {}) {
|
|
|
482
483
|
*/
|
|
483
484
|
async function verifyProof(jsonLd, proof, options = {}) {
|
|
484
485
|
const tracerProvider = options.tracerProvider ?? __opentelemetry_api.trace.getTracerProvider();
|
|
485
|
-
const tracer = tracerProvider.getTracer(
|
|
486
|
+
const tracer = tracerProvider.getTracer(require_lookup.deno_default.name, require_lookup.deno_default.version);
|
|
486
487
|
return await tracer.startActiveSpan("object_integrity_proofs.verify", async (span) => {
|
|
487
488
|
if (span.isRecording()) {
|
|
488
489
|
if (proof.cryptosuite != null) span.setAttribute("object_integrity_proofs.cryptosuite", proof.cryptosuite);
|
|
@@ -506,7 +507,7 @@ async function verifyProof(jsonLd, proof, options = {}) {
|
|
|
506
507
|
}
|
|
507
508
|
async function verifyProofInternal(jsonLd, proof, options) {
|
|
508
509
|
if (typeof jsonLd !== "object" || proof.cryptosuite !== "eddsa-jcs-2022" || proof.verificationMethodId == null || proof.proofPurpose !== "assertionMethod" || proof.proofValue == null || proof.created == null) return null;
|
|
509
|
-
const publicKeyPromise =
|
|
510
|
+
const publicKeyPromise = require_http.fetchKey(proof.verificationMethodId, require_actor.Multikey, options);
|
|
510
511
|
const proofConfig = {
|
|
511
512
|
"@context": jsonLd["@context"],
|
|
512
513
|
type: "DataIntegrityProof",
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
|
|
5
|
-
import { deno_default
|
|
6
|
-
import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, getTypeId, isActor } from "./actor-
|
|
7
|
-
import { fetchKey, validateCryptoKey } from "./
|
|
5
|
+
import { deno_default } from "./lookup-G1_0vHHK.js";
|
|
6
|
+
import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, getTypeId, isActor } from "./actor-CX6a_fXc.js";
|
|
7
|
+
import { fetchKey, validateCryptoKey } from "./http-rzOkBH97.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
import jsonld from "jsonld";
|
|
11
|
-
import {
|
|
11
|
+
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
12
12
|
import { encodeHex } from "byte-encodings/hex";
|
|
13
|
+
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
13
14
|
import serialize from "json-canon";
|
|
14
15
|
|
|
15
16
|
//#region src/sig/ld.ts
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { deno_default } from "./
|
|
7
|
-
import { doubleKnock } from "./http-
|
|
6
|
+
import { deno_default } from "./lookup-B25HiNR_.js";
|
|
7
|
+
import { doubleKnock } from "./http-BE4MNK5A.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
|
package/dist/sig/http.test.js
CHANGED
|
@@ -3,22 +3,21 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import "../lookup-B25HiNR_.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
|
-
import "../
|
|
11
|
-
import "../
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import "../
|
|
18
|
-
import "../
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import { esm_default } from "../esm-D-yelT_S.js";
|
|
10
|
+
import "../actor-eJqgtXKv.js";
|
|
11
|
+
import { exportJwk } from "../key-DP6qvTbJ.js";
|
|
12
|
+
import { createRfc9421SignatureBase, doubleKnock, formatRfc9421Signature, formatRfc9421SignatureParameters, parseRfc9421Signature, parseRfc9421SignatureInput, signRequest, timingSafeEqual, verifyRequest } from "../http-BE4MNK5A.js";
|
|
13
|
+
import { mockDocumentLoader, test } from "../testing-BbJqK9NR.js";
|
|
14
|
+
import { assertExists, assertStringIncludes } from "../std__assert-DWivtrGR.js";
|
|
15
|
+
import { assertFalse, assertRejects } from "../assert_rejects-Ce45JcFg.js";
|
|
16
|
+
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
|
17
|
+
import "../assert_not_equals-C80BG-_5.js";
|
|
18
|
+
import { rsaPrivateKey2, rsaPublicKey1, rsaPublicKey2, rsaPublicKey5 } from "../keys-DDn7koOQ.js";
|
|
19
|
+
import { esm_default } from "../esm-HsBrJq8t.js";
|
|
20
|
+
import { exportSpki } from "@fedify/vocab-runtime";
|
|
22
21
|
import { encodeBase64 } from "byte-encodings/base64";
|
|
23
22
|
|
|
24
23
|
//#region src/sig/http.test.ts
|
package/dist/sig/key.test.js
CHANGED
|
@@ -3,20 +3,18 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { CryptographicKey, Multikey } from "../
|
|
6
|
+
import { CryptographicKey, Multikey } from "../lookup-B25HiNR_.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import "../assert-MZs1qjMx.js";
|
|
9
9
|
import "../assert_instance_of-DHz7EHNU.js";
|
|
10
|
-
import "../
|
|
11
|
-
import "../
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import "../
|
|
15
|
-
import {
|
|
16
|
-
import "../
|
|
17
|
-
import "../
|
|
18
|
-
import { assertThrows } from "../assert_throws-BOO88avQ.js";
|
|
19
|
-
import { ed25519Multikey, rsaPrivateKey2, rsaPublicKey1, rsaPublicKey2, rsaPublicKey3 } from "../keys-Dj5daeN1.js";
|
|
10
|
+
import "../actor-eJqgtXKv.js";
|
|
11
|
+
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk, validateCryptoKey } from "../key-DP6qvTbJ.js";
|
|
12
|
+
import { mockDocumentLoader, test } from "../testing-BbJqK9NR.js";
|
|
13
|
+
import "../std__assert-DWivtrGR.js";
|
|
14
|
+
import { assertRejects } from "../assert_rejects-Ce45JcFg.js";
|
|
15
|
+
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
|
16
|
+
import "../assert_not_equals-C80BG-_5.js";
|
|
17
|
+
import { ed25519Multikey, rsaPrivateKey2, rsaPublicKey1, rsaPublicKey2, rsaPublicKey3 } from "../keys-DDn7koOQ.js";
|
|
20
18
|
|
|
21
19
|
//#region src/sig/key.test.ts
|
|
22
20
|
test("validateCryptoKey()", async () => {
|
package/dist/sig/ld.test.js
CHANGED
|
@@ -3,18 +3,16 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { CryptographicKey } from "../
|
|
6
|
+
import { CryptographicKey } from "../lookup-B25HiNR_.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
|
9
|
-
import "../
|
|
10
|
-
import "../
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import "../
|
|
16
|
-
import { assertThrows } from "../assert_throws-BOO88avQ.js";
|
|
17
|
-
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-Dj5daeN1.js";
|
|
9
|
+
import "../actor-eJqgtXKv.js";
|
|
10
|
+
import { generateCryptoKeyPair } from "../key-DP6qvTbJ.js";
|
|
11
|
+
import { attachSignature, createSignature, detachSignature, signJsonLd, verifyJsonLd, verifySignature } from "../ld-HxSfVcFy.js";
|
|
12
|
+
import { mockDocumentLoader, test } from "../testing-BbJqK9NR.js";
|
|
13
|
+
import { assertFalse, assertRejects } from "../assert_rejects-Ce45JcFg.js";
|
|
14
|
+
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
|
15
|
+
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-DDn7koOQ.js";
|
|
18
16
|
import { encodeBase64 } from "byte-encodings/base64";
|
|
19
17
|
|
|
20
18
|
//#region src/sig/ld.test.ts
|
package/dist/sig/mod.cjs
CHANGED
|
@@ -2,24 +2,22 @@
|
|
|
2
2
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
4
|
|
|
5
|
-
require('../
|
|
6
|
-
require('../actor-
|
|
7
|
-
require('../
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
const require_proof = require('../proof-gU4Y_14I.cjs');
|
|
11
|
-
require('../sig-ByHXzqUi.cjs');
|
|
5
|
+
require('../lookup-Dwdg60Zd.cjs');
|
|
6
|
+
require('../actor-vyab-ea8.cjs');
|
|
7
|
+
const require_http = require('../http-Cy32w9zC.cjs');
|
|
8
|
+
const require_proof = require('../proof-BqP89L5j.cjs');
|
|
9
|
+
require('../sig-YYj5tCnr.cjs');
|
|
12
10
|
|
|
13
11
|
exports.attachSignature = require_proof.attachSignature;
|
|
14
12
|
exports.createProof = require_proof.createProof;
|
|
15
13
|
exports.createSignature = require_proof.createSignature;
|
|
16
14
|
exports.detachSignature = require_proof.detachSignature;
|
|
17
15
|
exports.doesActorOwnKey = require_proof.doesActorOwnKey;
|
|
18
|
-
exports.exportJwk =
|
|
19
|
-
exports.fetchKey =
|
|
20
|
-
exports.generateCryptoKeyPair =
|
|
16
|
+
exports.exportJwk = require_http.exportJwk;
|
|
17
|
+
exports.fetchKey = require_http.fetchKey;
|
|
18
|
+
exports.generateCryptoKeyPair = require_http.generateCryptoKeyPair;
|
|
21
19
|
exports.getKeyOwner = require_proof.getKeyOwner;
|
|
22
|
-
exports.importJwk =
|
|
20
|
+
exports.importJwk = require_http.importJwk;
|
|
23
21
|
exports.signJsonLd = require_proof.signJsonLd;
|
|
24
22
|
exports.signObject = require_proof.signObject;
|
|
25
23
|
exports.signRequest = require_http.signRequest;
|