@fedify/fedify 1.9.6 → 1.9.8
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-CEGEmRll.js → actor-BTA45fXF.js} +1205 -2768
- package/dist/{actor-Ydzhc8dj.d.cts → actor-Be-68iJP.d.cts} +3 -3
- package/dist/{actor-C1Euqngb.d.ts → actor-C5AY0Tno.d.ts} +3 -3
- package/dist/{actor-DbpZ6pzg.js → actor-DGa1EWaV.mjs} +8 -15
- package/dist/{actor-DlS-Q8hE.cjs → actor-DxfJk4lY.cjs} +3112 -4674
- package/dist/{assert-MZs1qjMx.js → assert-DikXweDx.mjs} +5 -9
- package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Ew3jOFa3.mjs} +55 -69
- package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-C4Ri6VuN.mjs} +5 -9
- package/dist/{assert_is_error-BPGph1Jx.js → assert_is_error-C50x8tnw.mjs} +5 -9
- package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals--wG9hV7u.mjs} +6 -13
- package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-CJC9ThS-.mjs} +6 -11
- package/dist/{assert_throws-BOO88avQ.js → assert_throws-BIL7gChy.mjs} +6 -10
- package/dist/{authdocloader-DUQcOTRS.js → authdocloader-BC2rYCy1.mjs} +9 -14
- package/dist/{authdocloader-CT_V4Z7G.cjs → authdocloader-BrhFB421.cjs} +14 -22
- package/dist/{authdocloader-BLqMyboS.js → authdocloader-CqtNsX_N.js} +8 -15
- package/dist/{builder-BO61xeXE.js → builder-CIkAhIGC.mjs} +31 -40
- package/dist/{client-DF8anIB5.d.ts → client-D8OSiPBT.d.ts} +2 -2
- package/dist/{client-UG5wpNhG.js → client-MXqit6c-.mjs} +11 -15
- package/dist/{client-DjT_tegg.d.cts → client-T0VFOdMw.d.cts} +2 -2
- package/dist/{collection-CSzG2j1P.js → collection-BD6-SZ6O.mjs} +7 -12
- package/dist/compat/mod.cjs +5 -8
- package/dist/compat/mod.d.cts +78 -12
- package/dist/compat/mod.d.ts +78 -12
- package/dist/compat/mod.js +4 -8
- package/dist/compat/transformers.test.mjs +62 -0
- package/dist/{context-CwUAkopp.d.cts → context-CACMqDzl.d.cts} +33 -26
- package/dist/{context-CXUibY4L.d.ts → context-K4cCphQj.d.ts} +33 -26
- package/dist/{denokv-Bv33Xxea.js → denokv-CoSB_Eps.mjs} +22 -11
- package/dist/{docloader-BIFI3OS7.cjs → docloader-BVuUhBLI.cjs} +112 -212
- package/dist/{docloader-fJgJeqiX.js → docloader-BoXhusJ1.js} +17 -151
- package/dist/{docloader-CxWcuWqQ.d.ts → docloader-DSaLRXEA.d.ts} +2 -7
- package/dist/{docloader-D-MrRyHl.d.cts → docloader-DpGRDZrn.d.cts} +2 -7
- package/dist/{esm-C1EfGjSS.js → esm-BHJ7sdNg.mjs} +49 -85
- package/dist/federation/{builder.test.js → builder.test.mjs} +22 -41
- package/dist/federation/collection.test.d.mts +2 -0
- package/dist/federation/collection.test.mjs +21 -0
- package/dist/federation/handler.test.d.mts +2 -0
- package/dist/federation/{handler.test.js → handler.test.mjs} +22 -49
- package/dist/federation/idempotency.test.d.mts +2 -0
- package/dist/federation/{idempotency.test.js → idempotency.test.mjs} +29 -59
- package/dist/federation/inbox.test.d.mts +2 -0
- package/dist/federation/{inbox.test.js → inbox.test.mjs} +10 -15
- package/dist/federation/keycache.test.d.mts +2 -0
- package/dist/federation/{keycache.test.js → keycache.test.mjs} +13 -18
- package/dist/federation/kv.test.d.mts +2 -0
- package/dist/federation/{kv.test.js → kv.test.mjs} +9 -20
- package/dist/federation/middleware.test.d.mts +2 -0
- package/dist/federation/{middleware.test.js → middleware.test.mjs} +182 -197
- package/dist/federation/mod.cjs +223 -21
- package/dist/federation/mod.d.cts +4 -13
- package/dist/federation/mod.d.ts +4 -13
- package/dist/federation/mod.js +218 -18
- package/dist/federation/mq.test.d.mts +2 -0
- package/dist/federation/{mq.test.js → mq.test.mjs} +23 -38
- package/dist/federation/retry.test.d.mts +2 -0
- package/dist/federation/{retry.test.js → retry.test.mjs} +9 -14
- package/dist/federation/router.test.d.mts +2 -0
- package/dist/federation/{router.test.js → router.test.mjs} +12 -19
- package/dist/federation/send.test.d.mts +2 -0
- package/dist/federation/{send.test.js → send.test.mjs} +17 -26
- package/dist/{http-wsGR6KkT.d.ts → http-BZpls--H.d.ts} +5 -9
- package/dist/{http-CR-Eg1Uq.js → http-Bu5ZNlhZ.mjs} +16 -32
- package/dist/{http-B1_DzfAU.d.cts → http-C7WoprmE.d.cts} +5 -9
- package/dist/{http-BgopPF-8.cjs → http-DKw-O_VY.cjs} +51 -68
- package/dist/{http-05HxN-lp.js → http-VJbz6sKD.js} +17 -33
- package/dist/{inbox-DcJN1cxM.js → inbox-DkbTULXE.mjs} +17 -25
- package/dist/key-4fu6v0Jf.mjs +5 -0
- package/dist/{key-DjS1X9TG.cjs → key-B-wFdaPB.cjs} +42 -50
- package/dist/{key-ibMO03_0.js → key-BNMK_IVr.mjs} +12 -18
- package/dist/key-CancShOo.cjs +4 -0
- package/dist/{key-CPJcJjp-.js → key-DK3o0FEH.js} +19 -19
- package/dist/{keycache-CMUfqYqr.js → keycache-D-Vj8z88.mjs} +6 -10
- package/dist/{keys-IZ5050fT.js → keys-B27nVeIs.mjs} +6 -10
- package/dist/{kv-C7sopW2E.d.ts → kv-Bq9QLKm5.d.ts} +1 -1
- package/dist/{kv-CRZrzyXm.js → kv-DM1zFCtL.mjs} +6 -10
- package/dist/{kv-63Cil1MD.d.cts → kv-GIrOktyG.d.cts} +1 -1
- package/dist/{ld-DHNA2RSQ.js → ld-6jAVu3jV.mjs} +17 -31
- package/dist/{lookup-CKZfuyxA.js → lookup-BaU75j-d.js} +5 -11
- package/dist/{lookup-C4_dVYz7.cjs → lookup-BiIPmTwB.cjs} +16 -23
- package/dist/{lookup-BMAWLsP2.js → lookup-DmeJ8WUw.mjs} +8 -17
- package/dist/middleware-9ByEpBvV.cjs +4 -0
- package/dist/{middleware-CGbvIGvy.cjs → middleware-C188G4Go.cjs} +494 -547
- package/dist/{middleware-DrhEvfTo.js → middleware-Db1yZQaT.mjs} +276 -321
- package/dist/{middleware-ODfDRN3q.js → middleware-Do06X21v.js} +349 -393
- package/dist/middleware-DrfZEjyc.mjs +5 -0
- package/dist/{mod-CDObsV1d.d.ts → mod-BSwc3_rD.d.ts} +3 -3
- package/dist/{mod-DBzN0aCM.d.ts → mod-BTNpXcPj.d.ts} +2 -2
- package/dist/{mod-fjqfsrty.d.cts → mod-Chb_NKPp.d.cts} +4 -4
- package/dist/{mod-DgcYoyZK.d.ts → mod-DHoc3toL.d.ts} +4 -4
- package/dist/{mod-jQ4OODsl.d.cts → mod-DIMx6YjJ.d.cts} +2 -2
- package/dist/{mod-BUbqxBev.d.cts → mod-HElaq2UB.d.cts} +3 -3
- package/dist/mod.cjs +31 -33
- package/dist/mod.d.cts +15 -17
- package/dist/mod.d.ts +15 -17
- package/dist/mod.js +20 -23
- package/dist/{mq-B7R1Q-M5.d.cts → mq-CrItclRD.d.cts} +1 -1
- package/dist/{mq-CRGm1e_F.d.ts → mq-D_ZZRdby.d.ts} +1 -1
- package/dist/nodeinfo/client.test.d.mts +2 -0
- package/dist/nodeinfo/{client.test.js → client.test.mjs} +23 -45
- package/dist/nodeinfo/handler.test.d.mts +2 -0
- package/dist/nodeinfo/{handler.test.js → handler.test.mjs} +14 -43
- package/dist/nodeinfo/mod.cjs +5 -9
- package/dist/nodeinfo/mod.d.cts +2 -5
- package/dist/nodeinfo/mod.d.ts +2 -5
- package/dist/nodeinfo/mod.js +4 -9
- package/dist/nodeinfo/semver.test.d.mts +2 -0
- package/dist/nodeinfo/{semver.test.js → semver.test.mjs} +28 -51
- package/dist/nodeinfo/types.test.d.mts +2 -0
- package/dist/nodeinfo/{types.test.js → types.test.mjs} +10 -21
- package/dist/{owner-DDHsHYQO.js → owner-CKuGt_T9.mjs} +10 -13
- package/dist/{owner-BbeUDvOu.d.ts → owner-DPAPnB0R.d.ts} +4 -4
- package/dist/{owner-6KSEp9eV.d.cts → owner-_rFs0ik_.d.cts} +4 -4
- package/dist/{proof-V1uQaB2y.js → proof-CmTtG_t-.js} +33 -57
- package/dist/{proof-CX7ujFFX.cjs → proof-DLOy7HYU.cjs} +112 -135
- package/dist/{proof-exgGRW88.js → proof-mJLL2gSA.mjs} +20 -32
- package/dist/{retry-D4GJ670a.js → retry-Ddbq3AcK.mjs} +4 -7
- package/dist/rolldown-runtime-C7fyD9f2.js +15 -0
- package/dist/runtime/authdocloader.test.d.mts +2 -0
- package/dist/runtime/{authdocloader.test.js → authdocloader.test.mjs} +16 -28
- package/dist/runtime/docloader.test.d.mts +2 -0
- package/dist/runtime/{docloader.test.js → docloader.test.mjs} +52 -72
- package/dist/runtime/key.test.d.mts +2 -0
- package/dist/runtime/{key.test.js → key.test.mjs} +27 -57
- package/dist/runtime/langstr.test.d.mts +2 -0
- package/dist/runtime/{langstr.test.js → langstr.test.mjs} +9 -19
- package/dist/runtime/link.test.d.mts +2 -0
- package/dist/runtime/{link.test.js → link.test.mjs} +7 -11
- package/dist/runtime/mod.cjs +7 -13
- package/dist/runtime/mod.d.cts +103 -6
- package/dist/runtime/mod.d.ts +103 -6
- package/dist/runtime/mod.js +6 -13
- package/dist/runtime/multibase/multibase.test.d.mts +2 -0
- package/dist/runtime/multibase/{multibase.test.js → multibase.test.mjs} +16 -33
- package/dist/runtime/url.test.d.mts +2 -0
- package/dist/runtime/{url.test.js → url.test.mjs} +10 -15
- package/dist/{semver-dArNLkR9.js → semver-CgD82xxg.mjs} +13 -28
- package/dist/{send-BfMYakUE.js → send-BsQbGuw4.mjs} +7 -12
- package/dist/sig/http.test.d.mts +2 -0
- package/dist/sig/{http.test.js → http.test.mjs} +119 -203
- package/dist/sig/key.test.d.mts +2 -0
- package/dist/sig/{key.test.js → key.test.mjs} +13 -22
- package/dist/sig/ld.test.d.mts +2 -0
- package/dist/sig/{ld.test.js → ld.test.mjs} +24 -39
- package/dist/sig/mod.cjs +7 -13
- package/dist/sig/mod.d.cts +3 -7
- package/dist/sig/mod.d.ts +3 -7
- package/dist/sig/mod.js +6 -13
- package/dist/sig/owner.test.d.mts +2 -0
- package/dist/sig/owner.test.mjs +39 -0
- package/dist/sig/proof.test.d.mts +2 -0
- package/dist/sig/{proof.test.js → proof.test.mjs} +18 -31
- package/dist/{std__assert-X-_kMxKM.js → std__assert-2v7gYiZp.mjs} +13 -24
- package/dist/testing/docloader.test.d.mts +2 -0
- package/dist/testing/docloader.test.mjs +12 -0
- package/dist/testing/{mod.d.ts → mod.d.mts} +371 -541
- package/dist/testing/mod.mjs +5 -0
- package/dist/{testing-RPOc_gVG.js → testing-DS3gcq8V.mjs} +27 -35
- package/dist/{transformers-CoBS-oFG.cjs → transformers-BM0M8hnW.cjs} +20 -25
- package/dist/{transformers-BFT6d7J5.js → transformers-BV4OeK9o.js} +3 -7
- package/dist/{types-Cptev2nt.js → types-BXfL-dsX.js} +18 -36
- package/dist/{types-BIgY6c-l.js → types-CAnkAQGM.mjs} +5 -9
- package/dist/{types-CGnM1vft.cjs → types-DpM4FhjW.cjs} +45 -64
- package/dist/vocab/actor.test.d.mts +2 -0
- package/dist/vocab/{actor.test.js → actor.test.mjs} +308 -550
- package/dist/vocab/cjs.test.d.mts +2 -0
- package/dist/vocab/cjs.test.mjs +14 -0
- package/dist/vocab/lookup.test.d.mts +2 -0
- package/dist/vocab/{lookup.test.js → lookup.test.mjs} +29 -45
- package/dist/vocab/mod.cjs +251 -16
- package/dist/vocab/mod.d.cts +3 -5
- package/dist/vocab/mod.d.ts +3 -5
- package/dist/vocab/mod.js +244 -10
- package/dist/vocab/type.test.d.mts +2 -0
- package/dist/vocab/type.test.mjs +16 -0
- package/dist/vocab/vocab.test.d.mts +2 -0
- package/dist/vocab/{vocab.test.js → vocab.test.mjs} +178 -311
- package/dist/{vocab-CDHNj5zp.d.ts → vocab-BLvSEtuz.d.cts} +2 -4
- package/dist/{type-COPv6pMi.js → vocab-DuW9rL1h.mjs} +1177 -2871
- package/dist/{vocab-Cfs0937i.d.cts → vocab-lhCS9lzq.d.ts} +4 -2
- package/dist/webfinger/handler.test.d.mts +2 -0
- package/dist/webfinger/{handler.test.js → handler.test.mjs} +23 -56
- package/dist/webfinger/lookup.test.d.mts +2 -0
- package/dist/webfinger/{lookup.test.js → lookup.test.mjs} +13 -27
- package/dist/webfinger/mod.cjs +5 -9
- package/dist/webfinger/mod.d.cts +1 -3
- package/dist/webfinger/mod.d.ts +1 -3
- package/dist/webfinger/mod.js +4 -9
- package/dist/x/cfworkers.cjs +25 -14
- package/dist/x/cfworkers.d.cts +33 -6
- package/dist/x/cfworkers.d.ts +33 -6
- package/dist/x/cfworkers.js +22 -12
- package/dist/x/cfworkers.test.d.mts +2 -0
- package/dist/x/{cfworkers.test.js → cfworkers.test.mjs} +28 -26
- package/dist/x/hono.cjs +25 -14
- package/dist/x/hono.d.cts +1 -11
- package/dist/x/hono.d.ts +1 -11
- package/dist/x/hono.js +22 -12
- package/dist/x/sveltekit.cjs +23 -12
- package/dist/x/sveltekit.d.cts +1 -11
- package/dist/x/sveltekit.d.ts +1 -11
- package/dist/x/sveltekit.js +20 -10
- package/package.json +2 -2
- package/dist/chunk-DqRYRqnO.cjs +0 -34
- package/dist/compat/transformers.test.d.ts +0 -3
- package/dist/compat/transformers.test.js +0 -86
- package/dist/compat-DmDDELst.cjs +0 -4
- package/dist/compat-nxUqe4Z-.js +0 -4
- package/dist/federation/builder.test.d.ts +0 -3
- package/dist/federation/collection.test.d.ts +0 -3
- package/dist/federation/collection.test.js +0 -35
- package/dist/federation/handler.test.d.ts +0 -3
- package/dist/federation/idempotency.test.d.ts +0 -3
- package/dist/federation/inbox.test.d.ts +0 -3
- package/dist/federation/keycache.test.d.ts +0 -3
- package/dist/federation/kv.test.d.ts +0 -3
- package/dist/federation/middleware.test.d.ts +0 -3
- package/dist/federation/mq.test.d.ts +0 -3
- package/dist/federation/retry.test.d.ts +0 -3
- package/dist/federation/router.test.d.ts +0 -3
- package/dist/federation/send.test.d.ts +0 -3
- package/dist/federation-D1U8YY9t.js +0 -226
- package/dist/federation-H2_En3j5.cjs +0 -244
- package/dist/key-BCUd8FWp.js +0 -10
- package/dist/key-BUardnTH.cjs +0 -10
- package/dist/key-Dr6H_e3K.js +0 -10
- package/dist/middleware-BJ83veqi.js +0 -26
- package/dist/middleware-CJ4W2ir5.cjs +0 -17
- package/dist/middleware-Ve2mHJgo.js +0 -17
- package/dist/mod-BcObK1Lz.d.ts +0 -82
- package/dist/mod-C2tOeRkN.d.cts +0 -1
- package/dist/mod-CIbqfZW0.d.ts +0 -104
- package/dist/mod-Dt-G9ZOS.d.cts +0 -102
- package/dist/mod-FZd39qVq.d.cts +0 -1
- package/dist/mod-mXx9V0q5.d.cts +0 -80
- package/dist/nodeinfo/client.test.d.ts +0 -3
- package/dist/nodeinfo/handler.test.d.ts +0 -3
- package/dist/nodeinfo/semver.test.d.ts +0 -3
- package/dist/nodeinfo/types.test.d.ts +0 -3
- package/dist/nodeinfo-Co9lJrWl.cjs +0 -4
- package/dist/nodeinfo-DfycQ8Wf.js +0 -4
- package/dist/runtime/authdocloader.test.d.ts +0 -3
- package/dist/runtime/docloader.test.d.ts +0 -3
- package/dist/runtime/key.test.d.ts +0 -3
- package/dist/runtime/langstr.test.d.ts +0 -3
- package/dist/runtime/link.test.d.ts +0 -3
- package/dist/runtime/multibase/multibase.test.d.ts +0 -3
- package/dist/runtime/url.test.d.ts +0 -3
- package/dist/runtime-C58AJWSv.cjs +0 -4
- package/dist/runtime-DPYEDf-o.js +0 -4
- package/dist/sig/http.test.d.ts +0 -3
- package/dist/sig/key.test.d.ts +0 -3
- package/dist/sig/ld.test.d.ts +0 -3
- package/dist/sig/owner.test.d.ts +0 -3
- package/dist/sig/owner.test.js +0 -52
- package/dist/sig/proof.test.d.ts +0 -3
- package/dist/sig-ByHXzqUi.cjs +0 -4
- package/dist/sig-Cj3tk-ig.js +0 -4
- package/dist/testing/docloader.test.d.ts +0 -3
- package/dist/testing/docloader.test.js +0 -24
- package/dist/testing/mod.js +0 -10
- package/dist/vocab/actor.test.d.ts +0 -3
- package/dist/vocab/lookup.test.d.ts +0 -3
- package/dist/vocab/type.test.d.ts +0 -3
- package/dist/vocab/type.test.js +0 -25
- package/dist/vocab/vocab.test.d.ts +0 -3
- package/dist/vocab-BFy1CS5L.cjs +0 -289
- package/dist/vocab-BPFiQ650.js +0 -253
- package/dist/webfinger/handler.test.d.ts +0 -3
- package/dist/webfinger/lookup.test.d.ts +0 -3
- package/dist/webfinger-BjOEdFPs.cjs +0 -4
- package/dist/webfinger-De_bU0iE.js +0 -4
- package/dist/x/cfworkers.test.d.ts +0 -3
- /package/dist/{mod-1pDWKvUL.d.ts → compat/transformers.test.d.mts} +0 -0
- /package/dist/{mod-g0xFzAP9.d.ts → federation/builder.test.d.mts} +0 -0
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import { CryptographicKey, Object as Object$1, isActor } from "./actor-CEGEmRll.js";
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { J as getDocumentLoader, ot as name, s as CryptographicKey, st as version, v as Object$1 } from "./vocab-DuW9rL1h.mjs";
|
|
5
|
+
import { i as isActor } from "./actor-DGa1EWaV.mjs";
|
|
7
6
|
import { getLogger } from "@logtape/logtape";
|
|
8
7
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
|
-
|
|
10
8
|
//#region src/sig/key.ts
|
|
11
9
|
/**
|
|
12
10
|
* Checks if the given key is valid and supported. No-op if the key is valid,
|
|
@@ -21,8 +19,7 @@ function validateCryptoKey(key, type) {
|
|
|
21
19
|
if (!key.extractable) throw new TypeError("The key is not extractable.");
|
|
22
20
|
if (key.algorithm.name !== "RSASSA-PKCS1-v1_5" && key.algorithm.name !== "Ed25519") throw new TypeError("Currently only RSASSA-PKCS1-v1_5 and Ed25519 keys are supported. More algorithms will be added in the future!");
|
|
23
21
|
if (key.algorithm.name === "RSASSA-PKCS1-v1_5") {
|
|
24
|
-
|
|
25
|
-
if (algorithm.hash.name !== "SHA-256") throw new TypeError("For compatibility with the existing Fediverse software (e.g., Mastodon), hash algorithm for RSASSA-PKCS1-v1_5 keys must be SHA-256.");
|
|
22
|
+
if (key.algorithm.hash.name !== "SHA-256") throw new TypeError("For compatibility with the existing Fediverse software (e.g., Mastodon), hash algorithm for RSASSA-PKCS1-v1_5 keys must be SHA-256.");
|
|
26
23
|
}
|
|
27
24
|
}
|
|
28
25
|
/**
|
|
@@ -101,8 +98,7 @@ async function importJwk(jwk, type) {
|
|
|
101
98
|
* @since 1.3.0
|
|
102
99
|
*/
|
|
103
100
|
function fetchKey(keyId, cls, options = {}) {
|
|
104
|
-
const
|
|
105
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
101
|
+
const tracer = (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version);
|
|
106
102
|
keyId = typeof keyId === "string" ? new URL(keyId) : keyId;
|
|
107
103
|
return tracer.startActiveSpan("activitypub.fetch_key", {
|
|
108
104
|
kind: SpanKind.CLIENT,
|
|
@@ -158,8 +154,7 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
|
158
154
|
logger.debug("Fetching key {keyId} to verify signature...", { keyId });
|
|
159
155
|
let document;
|
|
160
156
|
try {
|
|
161
|
-
|
|
162
|
-
document = remoteDocument.document;
|
|
157
|
+
document = (await (documentLoader ?? getDocumentLoader())(keyId)).document;
|
|
163
158
|
} catch (_) {
|
|
164
159
|
logger.debug("Failed to fetch key {keyId}.", { keyId });
|
|
165
160
|
await keyCache?.set(cacheKey, null);
|
|
@@ -183,8 +178,8 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
|
183
178
|
contextLoader,
|
|
184
179
|
tracerProvider
|
|
185
180
|
});
|
|
186
|
-
} catch (e
|
|
187
|
-
if (e
|
|
181
|
+
} catch (e) {
|
|
182
|
+
if (e instanceof TypeError) {
|
|
188
183
|
logger.debug("Failed to verify; key {keyId} returned an invalid object.", { keyId });
|
|
189
184
|
await keyCache?.set(cacheKey, null);
|
|
190
185
|
return {
|
|
@@ -192,7 +187,7 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
|
192
187
|
cached: false
|
|
193
188
|
};
|
|
194
189
|
}
|
|
195
|
-
throw e
|
|
190
|
+
throw e;
|
|
196
191
|
}
|
|
197
192
|
}
|
|
198
193
|
let key = null;
|
|
@@ -255,6 +250,5 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
|
255
250
|
cached: false
|
|
256
251
|
};
|
|
257
252
|
}
|
|
258
|
-
|
|
259
253
|
//#endregion
|
|
260
|
-
export {
|
|
254
|
+
export { validateCryptoKey as a, importJwk as i, fetchKey as n, generateCryptoKeyPair as r, exportJwk as t };
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { CryptographicKey, Object as Object$1, deno_default, getDocumentLoader } from "./type-COPv6pMi.js";
|
|
7
|
-
import { isActor } from "./actor-DbpZ6pzg.js";
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
import { t as __exportAll } from "./rolldown-runtime-C7fyD9f2.js";
|
|
4
|
+
import { d as name, f as version, i as getDocumentLoader } from "./docloader-BoXhusJ1.js";
|
|
5
|
+
import { i as isActor, q as Object$1, y as CryptographicKey } from "./actor-BTA45fXF.js";
|
|
8
6
|
import { getLogger } from "@logtape/logtape";
|
|
9
7
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
|
-
|
|
11
8
|
//#region src/sig/key.ts
|
|
9
|
+
var key_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
+
exportJwk: () => exportJwk,
|
|
11
|
+
fetchKey: () => fetchKey,
|
|
12
|
+
generateCryptoKeyPair: () => generateCryptoKeyPair,
|
|
13
|
+
importJwk: () => importJwk,
|
|
14
|
+
validateCryptoKey: () => validateCryptoKey
|
|
15
|
+
});
|
|
12
16
|
/**
|
|
13
17
|
* Checks if the given key is valid and supported. No-op if the key is valid,
|
|
14
18
|
* otherwise throws an error.
|
|
@@ -22,8 +26,7 @@ function validateCryptoKey(key, type) {
|
|
|
22
26
|
if (!key.extractable) throw new TypeError("The key is not extractable.");
|
|
23
27
|
if (key.algorithm.name !== "RSASSA-PKCS1-v1_5" && key.algorithm.name !== "Ed25519") throw new TypeError("Currently only RSASSA-PKCS1-v1_5 and Ed25519 keys are supported. More algorithms will be added in the future!");
|
|
24
28
|
if (key.algorithm.name === "RSASSA-PKCS1-v1_5") {
|
|
25
|
-
|
|
26
|
-
if (algorithm.hash.name !== "SHA-256") throw new TypeError("For compatibility with the existing Fediverse software (e.g., Mastodon), hash algorithm for RSASSA-PKCS1-v1_5 keys must be SHA-256.");
|
|
29
|
+
if (key.algorithm.hash.name !== "SHA-256") throw new TypeError("For compatibility with the existing Fediverse software (e.g., Mastodon), hash algorithm for RSASSA-PKCS1-v1_5 keys must be SHA-256.");
|
|
27
30
|
}
|
|
28
31
|
}
|
|
29
32
|
/**
|
|
@@ -102,8 +105,7 @@ async function importJwk(jwk, type) {
|
|
|
102
105
|
* @since 1.3.0
|
|
103
106
|
*/
|
|
104
107
|
function fetchKey(keyId, cls, options = {}) {
|
|
105
|
-
const
|
|
106
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
108
|
+
const tracer = (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version);
|
|
107
109
|
keyId = typeof keyId === "string" ? new URL(keyId) : keyId;
|
|
108
110
|
return tracer.startActiveSpan("activitypub.fetch_key", {
|
|
109
111
|
kind: SpanKind.CLIENT,
|
|
@@ -159,8 +161,7 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
|
159
161
|
logger.debug("Fetching key {keyId} to verify signature...", { keyId });
|
|
160
162
|
let document;
|
|
161
163
|
try {
|
|
162
|
-
|
|
163
|
-
document = remoteDocument.document;
|
|
164
|
+
document = (await (documentLoader ?? getDocumentLoader())(keyId)).document;
|
|
164
165
|
} catch (_) {
|
|
165
166
|
logger.debug("Failed to fetch key {keyId}.", { keyId });
|
|
166
167
|
await keyCache?.set(cacheKey, null);
|
|
@@ -184,8 +185,8 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
|
184
185
|
contextLoader,
|
|
185
186
|
tracerProvider
|
|
186
187
|
});
|
|
187
|
-
} catch (e
|
|
188
|
-
if (e
|
|
188
|
+
} catch (e) {
|
|
189
|
+
if (e instanceof TypeError) {
|
|
189
190
|
logger.debug("Failed to verify; key {keyId} returned an invalid object.", { keyId });
|
|
190
191
|
await keyCache?.set(cacheKey, null);
|
|
191
192
|
return {
|
|
@@ -193,7 +194,7 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
|
193
194
|
cached: false
|
|
194
195
|
};
|
|
195
196
|
}
|
|
196
|
-
throw e
|
|
197
|
+
throw e;
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
let key = null;
|
|
@@ -256,6 +257,5 @@ async function fetchKeyInternal(keyId, cls, { documentLoader, contextLoader, key
|
|
|
256
257
|
cached: false
|
|
257
258
|
};
|
|
258
259
|
}
|
|
259
|
-
|
|
260
260
|
//#endregion
|
|
261
|
-
export {
|
|
261
|
+
export { key_exports as a, importJwk as i, fetchKey as n, validateCryptoKey as o, generateCryptoKeyPair as r, exportJwk as t };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { CryptographicKey, Multikey } from "./type-COPv6pMi.js";
|
|
7
|
-
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { g as Multikey, s as CryptographicKey } from "./vocab-DuW9rL1h.mjs";
|
|
8
5
|
//#region src/federation/keycache.ts
|
|
9
6
|
const NULL_KEY_CACHE_VALUE = { _fedify: "key-unavailable" };
|
|
10
7
|
const NULL_KEY_CACHE_TTL = Temporal.Duration.from({ minutes: 5 });
|
|
@@ -37,7 +34,7 @@ var KvKeyCache = class {
|
|
|
37
34
|
return await Multikey.fromJsonLd(serialized, this.options);
|
|
38
35
|
} catch {
|
|
39
36
|
await this.kv.delete([...this.prefix, keyId.href]);
|
|
40
|
-
return
|
|
37
|
+
return;
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
}
|
|
@@ -52,6 +49,5 @@ var KvKeyCache = class {
|
|
|
52
49
|
await this.kv.set([...this.prefix, keyId.href], serialized);
|
|
53
50
|
}
|
|
54
51
|
};
|
|
55
|
-
|
|
56
52
|
//#endregion
|
|
57
|
-
export { KvKeyCache };
|
|
53
|
+
export { KvKeyCache as t };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { CryptographicKey, Multikey, importSpki } from "./type-COPv6pMi.js";
|
|
7
|
-
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { I as importSpki, g as Multikey, s as CryptographicKey } from "./vocab-DuW9rL1h.mjs";
|
|
8
5
|
//#region src/testing/keys.ts
|
|
9
6
|
const rsaPublicKey1 = new CryptographicKey({
|
|
10
7
|
id: new URL("https://example.com/key"),
|
|
@@ -84,7 +81,7 @@ const rsaPublicKey3 = new CryptographicKey({
|
|
|
84
81
|
"hash": "SHA-256"
|
|
85
82
|
}, true, ["verify"])
|
|
86
83
|
});
|
|
87
|
-
|
|
84
|
+
new Multikey({
|
|
88
85
|
id: new URL("https://example.com/person2#key3"),
|
|
89
86
|
controller: new URL("https://example.com/person2"),
|
|
90
87
|
publicKey: rsaPublicKey3.publicKey
|
|
@@ -118,6 +115,5 @@ const ed25519Multikey = new Multikey({
|
|
|
118
115
|
controller: new URL("https://example.com/person2"),
|
|
119
116
|
publicKey: ed25519PublicKey.publicKey
|
|
120
117
|
});
|
|
121
|
-
|
|
122
118
|
//#endregion
|
|
123
|
-
export {
|
|
119
|
+
export { rsaPrivateKey3 as a, rsaPublicKey3 as c, rsaPrivateKey2 as i, rsaPublicKey5 as l, ed25519PrivateKey as n, rsaPublicKey1 as o, ed25519PublicKey as r, rsaPublicKey2 as s, ed25519Multikey as t };
|
|
@@ -81,4 +81,4 @@ declare class MemoryKvStore implements KvStore {
|
|
|
81
81
|
cas(key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions): Promise<boolean>;
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
|
-
export {
|
|
84
|
+
export { MemoryKvStore as i, KvStore as n, KvStoreSetOptions as r, KvKey as t };
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
globalThis.addEventListener = () => {};
|
|
5
|
-
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
6
4
|
import { isEqual } from "es-toolkit";
|
|
7
|
-
|
|
8
5
|
//#region src/federation/kv.ts
|
|
9
6
|
/**
|
|
10
7
|
* A key–value store that stores values in memory.
|
|
@@ -57,8 +54,8 @@ var MemoryKvStore = class {
|
|
|
57
54
|
let currentValue;
|
|
58
55
|
if (entry == null) currentValue = void 0;
|
|
59
56
|
else {
|
|
60
|
-
const [value, expiration
|
|
61
|
-
if (expiration
|
|
57
|
+
const [value, expiration] = entry;
|
|
58
|
+
if (expiration != null && Temporal.Now.instant().until(expiration).sign < 0) {
|
|
62
59
|
delete this.#values[encodedKey];
|
|
63
60
|
currentValue = void 0;
|
|
64
61
|
} else currentValue = value;
|
|
@@ -69,6 +66,5 @@ var MemoryKvStore = class {
|
|
|
69
66
|
return Promise.resolve(true);
|
|
70
67
|
}
|
|
71
68
|
};
|
|
72
|
-
|
|
73
69
|
//#endregion
|
|
74
|
-
export { MemoryKvStore };
|
|
70
|
+
export { MemoryKvStore as t };
|
|
@@ -78,4 +78,4 @@ declare class MemoryKvStore implements KvStore {
|
|
|
78
78
|
cas(key: KvKey, expectedValue: unknown, newValue: unknown, options?: KvStoreSetOptions): Promise<boolean>;
|
|
79
79
|
}
|
|
80
80
|
//#endregion
|
|
81
|
-
export {
|
|
81
|
+
export { MemoryKvStore as i, KvStore as n, KvStoreSetOptions as r, KvKey as t };
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { Activity, CryptographicKey, Object as Object$1, deno_default, getDocumentLoader, getTypeId } from "./type-COPv6pMi.js";
|
|
7
|
-
import { fetchKey, validateCryptoKey } from "./key-CPJcJjp-.js";
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { J as getDocumentLoader, U as getTypeId, ot as name, s as CryptographicKey, st as version, t as Activity, v as Object$1 } from "./vocab-DuW9rL1h.mjs";
|
|
5
|
+
import { a as validateCryptoKey, n as fetchKey } from "./key-BNMK_IVr.mjs";
|
|
8
6
|
import { getLogger } from "@logtape/logtape";
|
|
9
7
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
|
+
import jsonld from "jsonld";
|
|
10
9
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
11
10
|
import { encodeHex } from "byte-encodings/hex";
|
|
12
|
-
import jsonld from "jsonld";
|
|
13
|
-
|
|
14
11
|
//#region src/sig/ld.ts
|
|
15
12
|
const logger = getLogger([
|
|
16
13
|
"fedify",
|
|
@@ -52,11 +49,8 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
|
|
|
52
49
|
creator: keyId.href,
|
|
53
50
|
created: created?.toString() ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
54
51
|
};
|
|
55
|
-
const
|
|
56
|
-
const
|
|
57
|
-
const message = optionsHash + docHash;
|
|
58
|
-
const encoder = new TextEncoder();
|
|
59
|
-
const messageBytes = encoder.encode(message);
|
|
52
|
+
const message = await hashJsonLd(options, contextLoader) + await hashJsonLd(jsonLd, contextLoader);
|
|
53
|
+
const messageBytes = new TextEncoder().encode(message);
|
|
60
54
|
const signature = await crypto.subtle.sign("RSASSA-PKCS1-v1_5", privateKey, messageBytes);
|
|
61
55
|
return {
|
|
62
56
|
...options,
|
|
@@ -78,9 +72,7 @@ async function createSignature(jsonLd, privateKey, keyId, { contextLoader, creat
|
|
|
78
72
|
* @since 1.0.0
|
|
79
73
|
*/
|
|
80
74
|
async function signJsonLd(jsonLd, privateKey, keyId, options) {
|
|
81
|
-
|
|
82
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
83
|
-
return await tracer.startActiveSpan("ld_signatures.sign", { attributes: { "ld_signatures.key_id": keyId.href } }, async (span) => {
|
|
75
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("ld_signatures.sign", { attributes: { "ld_signatures.key_id": keyId.href } }, async (span) => {
|
|
84
76
|
try {
|
|
85
77
|
const signature = await createSignature(jsonLd, privateKey, keyId, options);
|
|
86
78
|
if (span.isRecording()) {
|
|
@@ -182,23 +174,21 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
182
174
|
const encoder = new TextEncoder();
|
|
183
175
|
const message = sigOptsHash + docHash;
|
|
184
176
|
const messageBytes = encoder.encode(message);
|
|
185
|
-
|
|
186
|
-
if (verified) return key;
|
|
177
|
+
if (await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, signature.slice(), messageBytes)) return key;
|
|
187
178
|
if (cached) {
|
|
188
179
|
logger.debug("Failed to verify with the cached key {keyId}; signature {signatureValue} is invalid. Retrying with the freshly fetched key...", {
|
|
189
180
|
keyId: sig.creator,
|
|
190
181
|
...sig
|
|
191
182
|
});
|
|
192
|
-
const { key
|
|
183
|
+
const { key } = await fetchKey(new URL(sig.creator), CryptographicKey, {
|
|
193
184
|
...options,
|
|
194
185
|
keyCache: {
|
|
195
186
|
get: () => Promise.resolve(void 0),
|
|
196
|
-
set: async (keyId, key
|
|
187
|
+
set: async (keyId, key) => await options.keyCache?.set(keyId, key)
|
|
197
188
|
}
|
|
198
189
|
});
|
|
199
|
-
if (key
|
|
200
|
-
|
|
201
|
-
return verified$1 ? key$1 : null;
|
|
190
|
+
if (key == null) return null;
|
|
191
|
+
return await crypto.subtle.verify("RSASSA-PKCS1-v1_5", key.publicKey, signature.slice(), messageBytes) ? key : null;
|
|
202
192
|
}
|
|
203
193
|
logger.debug("Failed to verify with the fetched key {keyId}; signature {signatureValue} is invalid. Check if the key is correct or if the signed message is correct. The message to sign is:\n{message}", {
|
|
204
194
|
keyId: sig.creator,
|
|
@@ -217,9 +207,7 @@ async function verifySignature(jsonLd, options = {}) {
|
|
|
217
207
|
* @returns `true` if the document is authentic; `false` otherwise.
|
|
218
208
|
*/
|
|
219
209
|
async function verifyJsonLd(jsonLd, options = {}) {
|
|
220
|
-
|
|
221
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
222
|
-
return await tracer.startActiveSpan("ld_signatures.verify", async (span) => {
|
|
210
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("ld_signatures.verify", async (span) => {
|
|
223
211
|
try {
|
|
224
212
|
const object = await Object$1.fromJsonLd(jsonLd, options);
|
|
225
213
|
if (object.id != null) span.setAttribute("activitypub.object.id", object.id.href);
|
|
@@ -260,9 +248,7 @@ async function hashJsonLd(jsonLd, contextLoader) {
|
|
|
260
248
|
documentLoader: contextLoader ?? getDocumentLoader()
|
|
261
249
|
});
|
|
262
250
|
const encoder = new TextEncoder();
|
|
263
|
-
|
|
264
|
-
return encodeHex(hash);
|
|
251
|
+
return encodeHex(await crypto.subtle.digest("SHA-256", encoder.encode(canon)));
|
|
265
252
|
}
|
|
266
|
-
|
|
267
253
|
//#endregion
|
|
268
|
-
export {
|
|
254
|
+
export { signJsonLd as a, hasSignature as i, createSignature as n, verifyJsonLd as o, detachSignature as r, verifySignature as s, attachSignature as t };
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import { UrlError, deno_default, getUserAgent, validatePublicUrl } from "./docloader-fJgJeqiX.js";
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
import { d as name, f as version, l as UrlError, o as getUserAgent, u as validatePublicUrl } from "./docloader-BoXhusJ1.js";
|
|
6
4
|
import { getLogger } from "@logtape/logtape";
|
|
7
5
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
|
-
|
|
9
6
|
//#region src/webfinger/lookup.ts
|
|
10
7
|
const logger = getLogger([
|
|
11
8
|
"fedify",
|
|
@@ -21,9 +18,7 @@ const DEFAULT_MAX_REDIRECTION = 5;
|
|
|
21
18
|
* @since 0.2.0
|
|
22
19
|
*/
|
|
23
20
|
async function lookupWebFinger(resource, options = {}) {
|
|
24
|
-
|
|
25
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
26
|
-
return await tracer.startActiveSpan("webfinger.lookup", {
|
|
21
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("webfinger.lookup", {
|
|
27
22
|
kind: SpanKind.CLIENT,
|
|
28
23
|
attributes: {
|
|
29
24
|
"webfinger.resource": resource.toString(),
|
|
@@ -126,6 +121,5 @@ async function lookupWebFingerInternal(resource, options = {}) {
|
|
|
126
121
|
}
|
|
127
122
|
}
|
|
128
123
|
}
|
|
129
|
-
|
|
130
124
|
//#endregion
|
|
131
|
-
export { lookupWebFinger };
|
|
125
|
+
export { lookupWebFinger as t };
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const require_docloader = require('./docloader-BIFI3OS7.cjs');
|
|
7
|
-
const __logtape_logtape = require_chunk.__toESM(require("@logtape/logtape"));
|
|
8
|
-
const __opentelemetry_api = require_chunk.__toESM(require("@opentelemetry/api"));
|
|
9
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
|
+
const require_docloader = require("./docloader-BVuUhBLI.cjs");
|
|
4
|
+
let _logtape_logtape = require("@logtape/logtape");
|
|
5
|
+
let _opentelemetry_api = require("@opentelemetry/api");
|
|
10
6
|
//#region src/webfinger/lookup.ts
|
|
11
|
-
const logger = (0,
|
|
7
|
+
const logger = (0, _logtape_logtape.getLogger)([
|
|
12
8
|
"fedify",
|
|
13
9
|
"webfinger",
|
|
14
10
|
"lookup"
|
|
@@ -22,10 +18,8 @@ const DEFAULT_MAX_REDIRECTION = 5;
|
|
|
22
18
|
* @since 0.2.0
|
|
23
19
|
*/
|
|
24
20
|
async function lookupWebFinger(resource, options = {}) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
return await tracer.startActiveSpan("webfinger.lookup", {
|
|
28
|
-
kind: __opentelemetry_api.SpanKind.CLIENT,
|
|
21
|
+
return await (options.tracerProvider ?? _opentelemetry_api.trace.getTracerProvider()).getTracer(require_docloader.name, require_docloader.version).startActiveSpan("webfinger.lookup", {
|
|
22
|
+
kind: _opentelemetry_api.SpanKind.CLIENT,
|
|
29
23
|
attributes: {
|
|
30
24
|
"webfinger.resource": resource.toString(),
|
|
31
25
|
"webfinger.resource.scheme": typeof resource === "string" ? resource.replace(/:.*$/, "") : resource.protocol.replace(/:$/, "")
|
|
@@ -33,11 +27,11 @@ async function lookupWebFinger(resource, options = {}) {
|
|
|
33
27
|
}, async (span) => {
|
|
34
28
|
try {
|
|
35
29
|
const result = await lookupWebFingerInternal(resource, options);
|
|
36
|
-
span.setStatus({ code: result === null ?
|
|
30
|
+
span.setStatus({ code: result === null ? _opentelemetry_api.SpanStatusCode.ERROR : _opentelemetry_api.SpanStatusCode.OK });
|
|
37
31
|
return result;
|
|
38
32
|
} catch (error) {
|
|
39
33
|
span.setStatus({
|
|
40
|
-
code:
|
|
34
|
+
code: _opentelemetry_api.SpanStatusCode.ERROR,
|
|
41
35
|
message: String(error)
|
|
42
36
|
});
|
|
43
37
|
throw error;
|
|
@@ -127,11 +121,10 @@ async function lookupWebFingerInternal(resource, options = {}) {
|
|
|
127
121
|
}
|
|
128
122
|
}
|
|
129
123
|
}
|
|
130
|
-
|
|
131
124
|
//#endregion
|
|
132
|
-
Object.defineProperty(exports,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
});
|
|
125
|
+
Object.defineProperty(exports, "lookupWebFinger", {
|
|
126
|
+
enumerable: true,
|
|
127
|
+
get: function() {
|
|
128
|
+
return lookupWebFinger;
|
|
129
|
+
}
|
|
130
|
+
});
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { Object as Object$1, deno_default, getDocumentLoader, getTypeId, lookupWebFinger } from "./type-COPv6pMi.js";
|
|
7
|
-
import { cloneDeep, delay } from "es-toolkit";
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { J as getDocumentLoader, U as getTypeId, W as lookupWebFinger, ot as name, st as version, v as Object$1 } from "./vocab-DuW9rL1h.mjs";
|
|
8
5
|
import { getLogger } from "@logtape/logtape";
|
|
9
6
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
7
|
+
import { cloneDeep, delay } from "es-toolkit";
|
|
10
8
|
import { Router } from "uri-template-router";
|
|
11
9
|
import { parseTemplate } from "url-template";
|
|
12
|
-
|
|
13
10
|
//#region src/federation/router.ts
|
|
14
11
|
function cloneInnerRouter(router) {
|
|
15
12
|
const clone = new Router();
|
|
@@ -116,7 +113,6 @@ var RouterError = class extends Error {
|
|
|
116
113
|
this.name = "RouterError";
|
|
117
114
|
}
|
|
118
115
|
};
|
|
119
|
-
|
|
120
116
|
//#endregion
|
|
121
117
|
//#region src/vocab/handle.ts
|
|
122
118
|
/**
|
|
@@ -170,10 +166,8 @@ function parseFediverseHandle(handle) {
|
|
|
170
166
|
function toAcctUrl(handle) {
|
|
171
167
|
const parsed = parseFediverseHandle(handle);
|
|
172
168
|
if (!parsed) return null;
|
|
173
|
-
|
|
174
|
-
return identifier;
|
|
169
|
+
return new URL(`acct:${parsed.username}@${parsed.host}`);
|
|
175
170
|
}
|
|
176
|
-
|
|
177
171
|
//#endregion
|
|
178
172
|
//#region src/vocab/lookup.ts
|
|
179
173
|
const logger = getLogger([
|
|
@@ -214,9 +208,7 @@ const logger = getLogger([
|
|
|
214
208
|
* @since 0.2.0
|
|
215
209
|
*/
|
|
216
210
|
async function lookupObject(identifier, options = {}) {
|
|
217
|
-
|
|
218
|
-
const tracer = tracerProvider.getTracer(deno_default.name, deno_default.version);
|
|
219
|
-
return await tracer.startActiveSpan("activitypub.lookup_object", async (span) => {
|
|
211
|
+
return await (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version).startActiveSpan("activitypub.lookup_object", async (span) => {
|
|
220
212
|
try {
|
|
221
213
|
const result = await lookupObjectInternal(identifier, options);
|
|
222
214
|
if (result == null) span.setStatus({ code: SpanStatusCode.ERROR });
|
|
@@ -324,6 +316,5 @@ async function* traverseCollection(collection, options = {}) {
|
|
|
324
316
|
page = await page.getNext(options);
|
|
325
317
|
}
|
|
326
318
|
}
|
|
327
|
-
|
|
328
319
|
//#endregion
|
|
329
|
-
export { Router$1 as
|
|
320
|
+
export { RouterError as i, traverseCollection as n, Router$1 as r, lookupObject as t };
|