@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,106 +1,78 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import { assertEquals } from "../assert_equals-
|
|
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 "../inbox-DcJN1cxM.js";
|
|
24
|
-
import "../builder-BO61xeXE.js";
|
|
25
|
-
import "../collection-CSzG2j1P.js";
|
|
26
|
-
import "../keycache-CMUfqYqr.js";
|
|
27
|
-
import "../retry-D4GJ670a.js";
|
|
28
|
-
import "../send-BfMYakUE.js";
|
|
29
|
-
import { mockDocumentLoader, test } from "../testing-RPOc_gVG.js";
|
|
30
|
-
import { assertStrictEquals } from "../std__assert-X-_kMxKM.js";
|
|
31
|
-
import { assertFalse, assertRejects } from "../assert_rejects-DiIiJbZn.js";
|
|
32
|
-
import "../assert_is_error-BPGph1Jx.js";
|
|
33
|
-
import { assertNotEquals } from "../assert_not_equals-f3m3epl3.js";
|
|
34
|
-
import { assertThrows } from "../assert_throws-BOO88avQ.js";
|
|
35
|
-
import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-IZ5050fT.js";
|
|
36
|
-
import { esm_default } from "../esm-C1EfGjSS.js";
|
|
37
|
-
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { C as Person, G as FetchError, U as getTypeId, _ as Note, g as Multikey, m as Invite, n as Announce, o as Create, q as fetchDocumentLoader, t as Activity, v as Object$1, y as Offer } from "../vocab-DuW9rL1h.mjs";
|
|
5
|
+
import { i as RouterError, t as lookupObject } from "../lookup-DmeJ8WUw.mjs";
|
|
6
|
+
import { a as mockDocumentLoader, t as test } from "../testing-DS3gcq8V.mjs";
|
|
7
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
8
|
+
import { n as assertStrictEquals } from "../std__assert-2v7gYiZp.mjs";
|
|
9
|
+
import { n as assertFalse, t as assertRejects } from "../assert_rejects-CJC9ThS-.mjs";
|
|
10
|
+
import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
|
|
11
|
+
import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
|
|
12
|
+
import { t as assertThrows } from "../assert_throws-BIL7gChy.mjs";
|
|
13
|
+
import { t as assert } from "../assert-DikXweDx.mjs";
|
|
14
|
+
import { t as MemoryKvStore } from "../kv-DM1zFCtL.mjs";
|
|
15
|
+
import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-Db1yZQaT.mjs";
|
|
16
|
+
import { l as verifyRequest, s as signRequest } from "../http-Bu5ZNlhZ.mjs";
|
|
17
|
+
import { t as getAuthenticatedDocumentLoader } from "../authdocloader-BC2rYCy1.mjs";
|
|
18
|
+
import { a as signJsonLd, o as verifyJsonLd, r as detachSignature } from "../ld-6jAVu3jV.mjs";
|
|
19
|
+
import { t as doesActorOwnKey } from "../owner-CKuGt_T9.mjs";
|
|
20
|
+
import { n as signObject, r as verifyObject } from "../proof-mJLL2gSA.mjs";
|
|
21
|
+
import { t as esm_default } from "../esm-BHJ7sdNg.mjs";
|
|
22
|
+
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-B27nVeIs.mjs";
|
|
38
23
|
//#region src/testing/fixtures/example.com/person.json
|
|
39
|
-
var __context$1 = ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"];
|
|
40
|
-
var id$1 = "https://example.com/person";
|
|
41
|
-
var type$1 = "Person";
|
|
42
|
-
var name$1 = "John Doe";
|
|
43
|
-
var publicKey$1 = [{
|
|
44
|
-
"id": "https://example.com/key",
|
|
45
|
-
"owner": "https://example.com/person",
|
|
46
|
-
"type": "CryptographicKey",
|
|
47
|
-
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyIB9rotX8G6r6/6toT+x\n24BUiQ/HaPH1Em9dOt4c94s+OPFoEdH7DY7Iym9A8LlH4JaGF8KD38bLHWe1S4x0\njV3gHJKhK7veJfGZCKUENcQecBZ+YWUs5HWvUIX1vVB//0luHrg6BQKGOrSOE+WI\nAxyr0qsWCFfZzQrvSnUD2yvg1arJX2xhms14uxoRd5Kg9efKSCmmQaNEapicARUm\nFWrIEpGFa/nUUnqimssAGw1eZFqf3wA4TjhsuARBhGaJtv/3KEa016eMZxy3kDlO\njZnXZTaTgWkXdodwUvy8563fes3Al6BlcS2iJ9qbtha8rSm0FHqoUKH73JsLPKQI\nwQIDAQAB\n-----END PUBLIC KEY-----"
|
|
48
|
-
}, {
|
|
49
|
-
"id": "https://example.com/key2",
|
|
50
|
-
"type": "CryptographicKey",
|
|
51
|
-
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoRmBtnxbdFutoRd1GLGw\nwGTrsqlRRWUe11hHQaoRLGf5LwQ0tIc6I9q+dynliw+2kxYsLn9SH2je6HcTYOol\ngW7F/cOWXZQN04b+OiYcU1ConAhLjmn4k1uKawJ614y0ScPNd8PQ+CljsnlPxbq9\nofaCMe2BV3B6y09aCuGFJ0nxn1/ubjmIBIWWFTAznoz1J9BhJDGyt3IO3ABy3f9z\nDVlR32L/n5VIkXnxkjUKdzMAOzYb62kuKOp1iznRTPrV71SNtivJMwSh/LVgBrmZ\njtIn/oim+KyX/fdLU3tQ7VClyqmJzyAjccOH6Qj6nFTPh+vX07gqN8IlLT2uye4w\nawIDAQAB\n-----END PUBLIC KEY-----"
|
|
52
|
-
}];
|
|
53
24
|
var person_default = {
|
|
54
|
-
"@context":
|
|
55
|
-
id:
|
|
56
|
-
type:
|
|
57
|
-
name:
|
|
58
|
-
publicKey:
|
|
25
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
|
|
26
|
+
id: "https://example.com/person",
|
|
27
|
+
type: "Person",
|
|
28
|
+
name: "John Doe",
|
|
29
|
+
publicKey: [{
|
|
30
|
+
"id": "https://example.com/key",
|
|
31
|
+
"owner": "https://example.com/person",
|
|
32
|
+
"type": "CryptographicKey",
|
|
33
|
+
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyIB9rotX8G6r6/6toT+x\n24BUiQ/HaPH1Em9dOt4c94s+OPFoEdH7DY7Iym9A8LlH4JaGF8KD38bLHWe1S4x0\njV3gHJKhK7veJfGZCKUENcQecBZ+YWUs5HWvUIX1vVB//0luHrg6BQKGOrSOE+WI\nAxyr0qsWCFfZzQrvSnUD2yvg1arJX2xhms14uxoRd5Kg9efKSCmmQaNEapicARUm\nFWrIEpGFa/nUUnqimssAGw1eZFqf3wA4TjhsuARBhGaJtv/3KEa016eMZxy3kDlO\njZnXZTaTgWkXdodwUvy8563fes3Al6BlcS2iJ9qbtha8rSm0FHqoUKH73JsLPKQI\nwQIDAQAB\n-----END PUBLIC KEY-----"
|
|
34
|
+
}, {
|
|
35
|
+
"id": "https://example.com/key2",
|
|
36
|
+
"type": "CryptographicKey",
|
|
37
|
+
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoRmBtnxbdFutoRd1GLGw\nwGTrsqlRRWUe11hHQaoRLGf5LwQ0tIc6I9q+dynliw+2kxYsLn9SH2je6HcTYOol\ngW7F/cOWXZQN04b+OiYcU1ConAhLjmn4k1uKawJ614y0ScPNd8PQ+CljsnlPxbq9\nofaCMe2BV3B6y09aCuGFJ0nxn1/ubjmIBIWWFTAznoz1J9BhJDGyt3IO3ABy3f9z\nDVlR32L/n5VIkXnxkjUKdzMAOzYb62kuKOp1iznRTPrV71SNtivJMwSh/LVgBrmZ\njtIn/oim+KyX/fdLU3tQ7VClyqmJzyAjccOH6Qj6nFTPh+vX07gqN8IlLT2uye4w\nawIDAQAB\n-----END PUBLIC KEY-----"
|
|
38
|
+
}]
|
|
59
39
|
};
|
|
60
|
-
|
|
61
40
|
//#endregion
|
|
62
41
|
//#region src/testing/fixtures/example.com/person2.json
|
|
63
|
-
var __context = [
|
|
64
|
-
"https://www.w3.org/ns/activitystreams",
|
|
65
|
-
"https://w3id.org/security/v1",
|
|
66
|
-
"https://w3id.org/security/multikey/v1",
|
|
67
|
-
"https://w3id.org/security/data-integrity/v1",
|
|
68
|
-
"https://www.w3.org/ns/did/v1"
|
|
69
|
-
];
|
|
70
|
-
var id = "https://example.com/person2";
|
|
71
|
-
var type = "Person";
|
|
72
|
-
var name = "Jane Doe";
|
|
73
|
-
var publicKey = [{
|
|
74
|
-
"id": "https://example.com/person2#key3",
|
|
75
|
-
"type": "CryptographicKey",
|
|
76
|
-
"owner": "https://example.com/person2",
|
|
77
|
-
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4GUqWgdiYlN3Su5Gr4l6\ni+xRS8gDDVKZ718vpGk6eIpvqs33q430nRbHIzbHRXRaAhc/1++rUBcK0V4/kjZl\nCSzVtRgGU6HMkmjcD+uE56a8XbTczfltbEDj7afoEuB2F3UhQEWrSz+QJ29DPXaL\nMIa1Yv61NR2vxGqNbdtoMjDORMBYtg77CYbcFkiJHw65PDa7+f/yjLxuCRPye5L7\nhncN0UZuuFoRJmHNRLSg5omBad9WTvQXmSyXEhEdk9fHwlI022AqAzlWbT79hldc\nDSKGGLLbQIs1c3JZIG8G5i6Uh5Vy0Z7tSNBcxbhqoI9i9je4f/x/OPIVc19f04BE\n1LgWuHsftZzRgW9Sdqz53W83XxVdxlyHeywXOnstSWT11f8dkLyQUcHKTH+E6urb\nH+aiPLiRpYK8W7D9KTQA9kZ5JXaEuveBd5vJX7wakhbzAn8pWJU7GYIHNY38Ycok\nmivkU5pY8S2cKFMwY0b7ade3MComlir5P3ZYSjF+n6gRVsT96P+9mNfCu9gXt/f8\nXCyjKlH89kGwuJ7HhR8CuVdm0l+jYozVt6GsDy0hHYyn79NCCAEzP7ZbhBMR0T5V\nrkl+TIGXoJH9WFiz4VxO+NnglF6dNQjDS5IzYLoFRXIK1f3cmQiEB4FZmL70l9HL\nrgwR+Xys83xia79OqFDRezMCAwEAAQ==\n-----END PUBLIC KEY-----\n"
|
|
78
|
-
}, {
|
|
79
|
-
"id": "https://example.com/person2#key4",
|
|
80
|
-
"type": "CryptographicKey",
|
|
81
|
-
"owner": "https://example.com/person2",
|
|
82
|
-
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEALR8epAGDe+cVq5p2Tx49CCfphpk1rNhkNoY9i+XEUfg=\n-----END PUBLIC KEY-----\n"
|
|
83
|
-
}];
|
|
84
|
-
var assertionMethod = [{
|
|
85
|
-
"id": "https://example.com/peson2#key3",
|
|
86
|
-
"type": "Multikey",
|
|
87
|
-
"controller": "https://example.com/person2",
|
|
88
|
-
"publicKeyMultibase": "zgghBUVkqmWS8e1j4aN2yowLAEkJC6wowB9wWmLRACYCok7UzstWcTBp3waKiDUM7wqL9bbBD9W9FvNaXEK2KPCZ9ffhvd5dxChJL9bdPQSrMwa28FEYMGDtcF1uocrYNmZm2dBBMaWrCu8U3s4PpVVhn4hsWDL8GLuE466pkJs9Hy8xmECoaaVgAZLiYDw2gwrjHDiX2i7aDHKfE7aSZWUWmC8nAGNZ7DX5pXoyXK3pxuaCWxNxXwPmaFwgKDyy9uhtBJ8znp9NZXkXHBTQe5uAi8GFwHY5asvqCmYPrAGWxcT6pdbZaJHdWkM7nw6apBHfakKs42oMqdBoJ2WkkresoT1qHrX2GW7gNP9PLtveF4vfEd6cwgHKQCdYgayG3muGfZiPvML75cyfkNrjkctvuQUfMxY9umbd2TG3V3mPnLrvQnqHpuRMZYtCn3nX1qfZaqFhTwT4NFPqVNLqvgR6k9vcuGXn6Ndaumhd5xtTK64jk3e2gPBit9iq6MrFUSoxNsbTty4kqcHAodtkK8CMSxUxbFP1kK3nyy8ZfeMgDCts1KboBcT2m5FMpQpYxKtNBfvhTuyeDDC34uhbY8itmTAnDwSr5mKrniwwDUGPZFejda51TYs1N9D9Ejzaw5Mvr8qN6wahHmsDBWTbWwV6YKVMD1MjAhJBUopWJWB5x6mEBAX25MssKfAEhJyDtqYWjq63uQHUJCsPJp"
|
|
89
|
-
}, {
|
|
90
|
-
"id": "https://example.com/person2#key4",
|
|
91
|
-
"type": "Multikey",
|
|
92
|
-
"controller": "https://example.com/person2",
|
|
93
|
-
"publicKeyMultibase": "z6MkhVPuyvgG1RkMv67azDqDCDERPXVrUg1i3qchXY5EACE3"
|
|
94
|
-
}];
|
|
95
42
|
var person2_default = {
|
|
96
|
-
"@context":
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
43
|
+
"@context": [
|
|
44
|
+
"https://www.w3.org/ns/activitystreams",
|
|
45
|
+
"https://w3id.org/security/v1",
|
|
46
|
+
"https://w3id.org/security/multikey/v1",
|
|
47
|
+
"https://w3id.org/security/data-integrity/v1",
|
|
48
|
+
"https://www.w3.org/ns/did/v1"
|
|
49
|
+
],
|
|
50
|
+
id: "https://example.com/person2",
|
|
51
|
+
type: "Person",
|
|
52
|
+
name: "Jane Doe",
|
|
53
|
+
publicKey: [{
|
|
54
|
+
"id": "https://example.com/person2#key3",
|
|
55
|
+
"type": "CryptographicKey",
|
|
56
|
+
"owner": "https://example.com/person2",
|
|
57
|
+
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4GUqWgdiYlN3Su5Gr4l6\ni+xRS8gDDVKZ718vpGk6eIpvqs33q430nRbHIzbHRXRaAhc/1++rUBcK0V4/kjZl\nCSzVtRgGU6HMkmjcD+uE56a8XbTczfltbEDj7afoEuB2F3UhQEWrSz+QJ29DPXaL\nMIa1Yv61NR2vxGqNbdtoMjDORMBYtg77CYbcFkiJHw65PDa7+f/yjLxuCRPye5L7\nhncN0UZuuFoRJmHNRLSg5omBad9WTvQXmSyXEhEdk9fHwlI022AqAzlWbT79hldc\nDSKGGLLbQIs1c3JZIG8G5i6Uh5Vy0Z7tSNBcxbhqoI9i9je4f/x/OPIVc19f04BE\n1LgWuHsftZzRgW9Sdqz53W83XxVdxlyHeywXOnstSWT11f8dkLyQUcHKTH+E6urb\nH+aiPLiRpYK8W7D9KTQA9kZ5JXaEuveBd5vJX7wakhbzAn8pWJU7GYIHNY38Ycok\nmivkU5pY8S2cKFMwY0b7ade3MComlir5P3ZYSjF+n6gRVsT96P+9mNfCu9gXt/f8\nXCyjKlH89kGwuJ7HhR8CuVdm0l+jYozVt6GsDy0hHYyn79NCCAEzP7ZbhBMR0T5V\nrkl+TIGXoJH9WFiz4VxO+NnglF6dNQjDS5IzYLoFRXIK1f3cmQiEB4FZmL70l9HL\nrgwR+Xys83xia79OqFDRezMCAwEAAQ==\n-----END PUBLIC KEY-----\n"
|
|
58
|
+
}, {
|
|
59
|
+
"id": "https://example.com/person2#key4",
|
|
60
|
+
"type": "CryptographicKey",
|
|
61
|
+
"owner": "https://example.com/person2",
|
|
62
|
+
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEALR8epAGDe+cVq5p2Tx49CCfphpk1rNhkNoY9i+XEUfg=\n-----END PUBLIC KEY-----\n"
|
|
63
|
+
}],
|
|
64
|
+
assertionMethod: [{
|
|
65
|
+
"id": "https://example.com/peson2#key3",
|
|
66
|
+
"type": "Multikey",
|
|
67
|
+
"controller": "https://example.com/person2",
|
|
68
|
+
"publicKeyMultibase": "zgghBUVkqmWS8e1j4aN2yowLAEkJC6wowB9wWmLRACYCok7UzstWcTBp3waKiDUM7wqL9bbBD9W9FvNaXEK2KPCZ9ffhvd5dxChJL9bdPQSrMwa28FEYMGDtcF1uocrYNmZm2dBBMaWrCu8U3s4PpVVhn4hsWDL8GLuE466pkJs9Hy8xmECoaaVgAZLiYDw2gwrjHDiX2i7aDHKfE7aSZWUWmC8nAGNZ7DX5pXoyXK3pxuaCWxNxXwPmaFwgKDyy9uhtBJ8znp9NZXkXHBTQe5uAi8GFwHY5asvqCmYPrAGWxcT6pdbZaJHdWkM7nw6apBHfakKs42oMqdBoJ2WkkresoT1qHrX2GW7gNP9PLtveF4vfEd6cwgHKQCdYgayG3muGfZiPvML75cyfkNrjkctvuQUfMxY9umbd2TG3V3mPnLrvQnqHpuRMZYtCn3nX1qfZaqFhTwT4NFPqVNLqvgR6k9vcuGXn6Ndaumhd5xtTK64jk3e2gPBit9iq6MrFUSoxNsbTty4kqcHAodtkK8CMSxUxbFP1kK3nyy8ZfeMgDCts1KboBcT2m5FMpQpYxKtNBfvhTuyeDDC34uhbY8itmTAnDwSr5mKrniwwDUGPZFejda51TYs1N9D9Ejzaw5Mvr8qN6wahHmsDBWTbWwV6YKVMD1MjAhJBUopWJWB5x6mEBAX25MssKfAEhJyDtqYWjq63uQHUJCsPJp"
|
|
69
|
+
}, {
|
|
70
|
+
"id": "https://example.com/person2#key4",
|
|
71
|
+
"type": "Multikey",
|
|
72
|
+
"controller": "https://example.com/person2",
|
|
73
|
+
"publicKeyMultibase": "z6MkhVPuyvgG1RkMv67azDqDCDERPXVrUg1i3qchXY5EACE3"
|
|
74
|
+
}]
|
|
102
75
|
};
|
|
103
|
-
|
|
104
76
|
//#endregion
|
|
105
77
|
//#region src/federation/middleware.test.ts
|
|
106
78
|
test("createFederation()", async (t) => {
|
|
@@ -331,23 +303,20 @@ test({
|
|
|
331
303
|
publicKey: ed25519PublicKey.publicKey
|
|
332
304
|
})
|
|
333
305
|
}]);
|
|
334
|
-
|
|
335
|
-
assertEquals(await loader("https://example.com/object"), {
|
|
306
|
+
assertEquals(await (await ctx.getDocumentLoader({ identifier: "handle" }))("https://example.com/object"), {
|
|
336
307
|
contextUrl: null,
|
|
337
308
|
documentUrl: "https://example.com/object",
|
|
338
309
|
document: true
|
|
339
310
|
});
|
|
340
|
-
|
|
341
|
-
assertEquals(await loader2("https://example.com/object"), {
|
|
311
|
+
assertEquals(await (await ctx.getDocumentLoader({ username: "HANDLE" }))("https://example.com/object"), {
|
|
342
312
|
contextUrl: null,
|
|
343
313
|
documentUrl: "https://example.com/object",
|
|
344
314
|
document: true
|
|
345
315
|
});
|
|
346
|
-
|
|
316
|
+
assertEquals(await ctx.getDocumentLoader({
|
|
347
317
|
keyId: new URL("https://example.com/key2"),
|
|
348
318
|
privateKey: rsaPrivateKey2
|
|
349
|
-
})
|
|
350
|
-
assertEquals(await loader3("https://example.com/object"), {
|
|
319
|
+
})("https://example.com/object"), {
|
|
351
320
|
contextUrl: null,
|
|
352
321
|
documentUrl: "https://example.com/object",
|
|
353
322
|
document: true
|
|
@@ -355,13 +324,11 @@ test({
|
|
|
355
324
|
assertEquals(await ctx.lookupObject("https://example.com/object"), null);
|
|
356
325
|
await assertRejects(() => ctx.sendActivity({ identifier: "handle" }, [], new Create({})), TypeError, "The activity to send must have at least one actor property.");
|
|
357
326
|
await ctx.sendActivity({ identifier: "handle" }, [], new Create({ actor: new URL("https://example.com/users/handle") }));
|
|
358
|
-
|
|
327
|
+
assertEquals(await createFederation({
|
|
359
328
|
kv,
|
|
360
329
|
documentLoader: mockDocumentLoader,
|
|
361
330
|
contextLoader: mockDocumentLoader
|
|
362
|
-
})
|
|
363
|
-
const ctx2 = federation2.createContext(new URL("https://example.com/"), 123);
|
|
364
|
-
assertEquals(await ctx2.lookupObject("https://example.com/object"), new Object$1({
|
|
331
|
+
}).createContext(new URL("https://example.com/"), 123).lookupObject("https://example.com/object"), new Object$1({
|
|
365
332
|
id: new URL("https://example.com/object"),
|
|
366
333
|
name: "Fetched object"
|
|
367
334
|
}));
|
|
@@ -616,8 +583,7 @@ test({
|
|
|
616
583
|
});
|
|
617
584
|
});
|
|
618
585
|
await t.step("Context.clone()", () => {
|
|
619
|
-
const
|
|
620
|
-
const ctx = federation.createContext(new URL("https://example.com/"), 123);
|
|
586
|
+
const ctx = createFederation({ kv }).createContext(new URL("https://example.com/"), 123);
|
|
621
587
|
const clone = ctx.clone(456);
|
|
622
588
|
assertStrictEquals(clone.canonicalOrigin, ctx.canonicalOrigin);
|
|
623
589
|
assertStrictEquals(clone.origin, ctx.origin);
|
|
@@ -653,13 +619,11 @@ test({
|
|
|
653
619
|
}));
|
|
654
620
|
});
|
|
655
621
|
await t.step("Context.lookupNodeInfo()", async () => {
|
|
656
|
-
const
|
|
622
|
+
const ctx = createFederation({
|
|
657
623
|
kv,
|
|
658
624
|
userAgent: "CustomUserAgent/1.2.3"
|
|
659
|
-
});
|
|
660
|
-
|
|
661
|
-
const nodeInfo = await ctx.lookupNodeInfo("https://example.com/");
|
|
662
|
-
assertEquals(nodeInfo, {
|
|
625
|
+
}).createContext(new URL("https://example.com/"), 123);
|
|
626
|
+
assertEquals(await ctx.lookupNodeInfo("https://example.com/"), {
|
|
663
627
|
software: {
|
|
664
628
|
name: "foo",
|
|
665
629
|
version: {
|
|
@@ -677,8 +641,7 @@ test({
|
|
|
677
641
|
localComments: 456
|
|
678
642
|
}
|
|
679
643
|
});
|
|
680
|
-
|
|
681
|
-
assertEquals(rawNodeInfo, {
|
|
644
|
+
assertEquals(await ctx.lookupNodeInfo("https://example.com/", { parse: "none" }), {
|
|
682
645
|
software: {
|
|
683
646
|
name: "foo",
|
|
684
647
|
version: "1.2.3"
|
|
@@ -923,8 +886,7 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
|
923
886
|
authenticatedDocumentLoaderFactory(identity) {
|
|
924
887
|
const docLoader = getAuthenticatedDocumentLoader(identity);
|
|
925
888
|
return (url) => {
|
|
926
|
-
|
|
927
|
-
if (urlObj.host === "example.com") return docLoader(url);
|
|
889
|
+
if (new URL(url).host === "example.com") return docLoader(url);
|
|
928
890
|
return mockDocumentLoader(url);
|
|
929
891
|
};
|
|
930
892
|
}
|
|
@@ -1004,9 +966,8 @@ test("FederationImpl.sendActivity()", async (t) => {
|
|
|
1004
966
|
if (verified.length > 0) return new Response(null, { status: 202 });
|
|
1005
967
|
return new Response(null, { status: 401 });
|
|
1006
968
|
});
|
|
1007
|
-
const kv = new MemoryKvStore();
|
|
1008
969
|
const federation = new FederationImpl({
|
|
1009
|
-
kv,
|
|
970
|
+
kv: new MemoryKvStore(),
|
|
1010
971
|
contextLoader: mockDocumentLoader
|
|
1011
972
|
});
|
|
1012
973
|
const context = federation.createContext(new URL("https://example.com/"));
|
|
@@ -1072,19 +1033,18 @@ test("FederationImpl.processQueuedTask()", async (t) => {
|
|
|
1072
1033
|
await t.step("with MessageQueue having nativeRetrial", async () => {
|
|
1073
1034
|
const kv = new MemoryKvStore();
|
|
1074
1035
|
const queuedMessages = [];
|
|
1075
|
-
const queue = {
|
|
1076
|
-
nativeRetrial: true,
|
|
1077
|
-
enqueue(message, _options) {
|
|
1078
|
-
queuedMessages.push(message);
|
|
1079
|
-
return Promise.resolve();
|
|
1080
|
-
},
|
|
1081
|
-
listen(_handler, _options) {
|
|
1082
|
-
return Promise.resolve();
|
|
1083
|
-
}
|
|
1084
|
-
};
|
|
1085
1036
|
const federation = new FederationImpl({
|
|
1086
1037
|
kv,
|
|
1087
|
-
queue
|
|
1038
|
+
queue: {
|
|
1039
|
+
nativeRetrial: true,
|
|
1040
|
+
enqueue(message, _options) {
|
|
1041
|
+
queuedMessages.push(message);
|
|
1042
|
+
return Promise.resolve();
|
|
1043
|
+
},
|
|
1044
|
+
listen(_handler, _options) {
|
|
1045
|
+
return Promise.resolve();
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1088
1048
|
});
|
|
1089
1049
|
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, () => {
|
|
1090
1050
|
throw new Error("Intended error for testing");
|
|
@@ -1135,18 +1095,17 @@ test("FederationImpl.processQueuedTask()", async (t) => {
|
|
|
1135
1095
|
await t.step("with MessageQueue having no nativeRetrial", async () => {
|
|
1136
1096
|
const kv = new MemoryKvStore();
|
|
1137
1097
|
let queuedMessages = [];
|
|
1138
|
-
const queue = {
|
|
1139
|
-
enqueue(message, _options) {
|
|
1140
|
-
queuedMessages.push(message);
|
|
1141
|
-
return Promise.resolve();
|
|
1142
|
-
},
|
|
1143
|
-
listen(_handler, _options) {
|
|
1144
|
-
return Promise.resolve();
|
|
1145
|
-
}
|
|
1146
|
-
};
|
|
1147
1098
|
const federation = new FederationImpl({
|
|
1148
1099
|
kv,
|
|
1149
|
-
queue
|
|
1100
|
+
queue: {
|
|
1101
|
+
enqueue(message, _options) {
|
|
1102
|
+
queuedMessages.push(message);
|
|
1103
|
+
return Promise.resolve();
|
|
1104
|
+
},
|
|
1105
|
+
listen(_handler, _options) {
|
|
1106
|
+
return Promise.resolve();
|
|
1107
|
+
}
|
|
1108
|
+
}
|
|
1150
1109
|
});
|
|
1151
1110
|
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, () => {
|
|
1152
1111
|
throw new Error("Intended error for testing");
|
|
@@ -1227,24 +1186,19 @@ test("ContextImpl.lookupObject()", async (t) => {
|
|
|
1227
1186
|
}
|
|
1228
1187
|
});
|
|
1229
1188
|
await t.step("allowPrivateAddress: true", async () => {
|
|
1230
|
-
const
|
|
1189
|
+
const result = await createFederation({
|
|
1231
1190
|
kv: new MemoryKvStore(),
|
|
1232
1191
|
allowPrivateAddress: true
|
|
1233
|
-
});
|
|
1234
|
-
const ctx = federation.createContext(new URL("https://example.com/"));
|
|
1235
|
-
const result = await ctx.lookupObject("@test@localhost");
|
|
1192
|
+
}).createContext(new URL("https://example.com/")).lookupObject("@test@localhost");
|
|
1236
1193
|
assertInstanceOf(result, Person);
|
|
1237
1194
|
assertEquals(result.id, new URL("https://localhost/actor"));
|
|
1238
1195
|
assertEquals(result.preferredUsername, "test");
|
|
1239
1196
|
});
|
|
1240
1197
|
await t.step("allowPrivateAddress: false", async () => {
|
|
1241
|
-
|
|
1198
|
+
assertEquals(await createFederation({
|
|
1242
1199
|
kv: new MemoryKvStore(),
|
|
1243
1200
|
allowPrivateAddress: false
|
|
1244
|
-
});
|
|
1245
|
-
const ctx = federation.createContext(new URL("https://example.com/"));
|
|
1246
|
-
const result = await ctx.lookupObject("@test@localhost");
|
|
1247
|
-
assertEquals(result, null);
|
|
1201
|
+
}).createContext(new URL("https://example.com/")).lookupObject("@test@localhost"), null);
|
|
1248
1202
|
});
|
|
1249
1203
|
esm_default.hardReset();
|
|
1250
1204
|
});
|
|
@@ -1270,11 +1224,9 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
1270
1224
|
contextLoader: mockDocumentLoader,
|
|
1271
1225
|
keyCache: {
|
|
1272
1226
|
async get(keyId) {
|
|
1273
|
-
const
|
|
1274
|
-
const keys
|
|
1275
|
-
|
|
1276
|
-
else return key$1.cryptographicKey;
|
|
1277
|
-
return void 0;
|
|
1227
|
+
const keys = await federation.createContext(new URL("https://example.com/"), void 0).getActorKeyPairs("1");
|
|
1228
|
+
for (const key of keys) if (key.keyId.href === keyId.href) if (key.publicKey.algorithm.name === "Ed25519") return key.multikey;
|
|
1229
|
+
else return key.cryptographicKey;
|
|
1278
1230
|
},
|
|
1279
1231
|
async set(_keyId, _key) {}
|
|
1280
1232
|
}
|
|
@@ -1516,6 +1468,60 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
1516
1468
|
type: "fanout"
|
|
1517
1469
|
}]);
|
|
1518
1470
|
});
|
|
1471
|
+
await t.step("fanout: fanoutQueue.enqueue() is awaited before sendActivity() returns", async () => {
|
|
1472
|
+
const asyncEnqueued = [];
|
|
1473
|
+
const fed = new FederationImpl({
|
|
1474
|
+
kv,
|
|
1475
|
+
contextLoader: mockDocumentLoader,
|
|
1476
|
+
queue: {
|
|
1477
|
+
enqueue(message) {
|
|
1478
|
+
return new Promise((resolve) => {
|
|
1479
|
+
setTimeout(() => {
|
|
1480
|
+
asyncEnqueued.push(message);
|
|
1481
|
+
resolve();
|
|
1482
|
+
}, 0);
|
|
1483
|
+
});
|
|
1484
|
+
},
|
|
1485
|
+
async listen() {}
|
|
1486
|
+
},
|
|
1487
|
+
manuallyStartQueue: true
|
|
1488
|
+
});
|
|
1489
|
+
fed.setActorDispatcher("/{identifier}", async (ctx, identifier) => {
|
|
1490
|
+
if (identifier !== "john") return null;
|
|
1491
|
+
const keys = await ctx.getActorKeyPairs(identifier);
|
|
1492
|
+
return new Person({
|
|
1493
|
+
id: ctx.getActorUri(identifier),
|
|
1494
|
+
preferredUsername: "john",
|
|
1495
|
+
publicKey: keys[0].cryptographicKey,
|
|
1496
|
+
assertionMethods: keys.map((k) => k.multikey)
|
|
1497
|
+
});
|
|
1498
|
+
}).setKeyPairsDispatcher((_ctx, identifier) => {
|
|
1499
|
+
if (identifier !== "john") return [];
|
|
1500
|
+
return [{
|
|
1501
|
+
privateKey: rsaPrivateKey2,
|
|
1502
|
+
publicKey: rsaPublicKey2.publicKey
|
|
1503
|
+
}, {
|
|
1504
|
+
privateKey: ed25519PrivateKey,
|
|
1505
|
+
publicKey: ed25519PublicKey.publicKey
|
|
1506
|
+
}];
|
|
1507
|
+
});
|
|
1508
|
+
const ctx3 = new ContextImpl({
|
|
1509
|
+
data: void 0,
|
|
1510
|
+
federation: fed,
|
|
1511
|
+
url: new URL("https://example.com/"),
|
|
1512
|
+
documentLoader: fetchDocumentLoader,
|
|
1513
|
+
contextLoader: fetchDocumentLoader
|
|
1514
|
+
});
|
|
1515
|
+
const activity = new Create({
|
|
1516
|
+
id: new URL("https://example.com/activity/1"),
|
|
1517
|
+
actor: new URL("https://example.com/person")
|
|
1518
|
+
});
|
|
1519
|
+
await ctx3.sendActivity({ username: "john" }, {
|
|
1520
|
+
id: new URL("https://example.com/recipient"),
|
|
1521
|
+
inboxId: new URL("https://example.com/inbox")
|
|
1522
|
+
}, activity, { fanout: "force" });
|
|
1523
|
+
assertEquals(asyncEnqueued.length, 1, "fanoutQueue.enqueue() must be awaited before sendActivity() returns");
|
|
1524
|
+
});
|
|
1519
1525
|
collectionSyncHeader = null;
|
|
1520
1526
|
await t.step("followers collection without syncCollection", async () => {
|
|
1521
1527
|
const ctx = new ContextImpl({
|
|
@@ -1564,8 +1570,8 @@ test({
|
|
|
1564
1570
|
async fn() {
|
|
1565
1571
|
const federation = new FederationImpl({ kv: new MemoryKvStore() });
|
|
1566
1572
|
const activities = [];
|
|
1567
|
-
federation.setInboxListeners("/u/{identifier}/i", "/i").on(Offer, (ctx
|
|
1568
|
-
activities.push([ctx
|
|
1573
|
+
federation.setInboxListeners("/u/{identifier}/i", "/i").on(Offer, (ctx, offer) => {
|
|
1574
|
+
activities.push([ctx.recipient, offer]);
|
|
1569
1575
|
});
|
|
1570
1576
|
const ctx = new ContextImpl({
|
|
1571
1577
|
url: new URL("https://example.com/"),
|
|
@@ -1679,26 +1685,23 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
1679
1685
|
if (verified.length > 0) return new Response(null, { status: 202 });
|
|
1680
1686
|
return new Response(null, { status: 401 });
|
|
1681
1687
|
});
|
|
1682
|
-
const kv = new MemoryKvStore();
|
|
1683
1688
|
const federation = new FederationImpl({
|
|
1684
|
-
kv,
|
|
1689
|
+
kv: new MemoryKvStore(),
|
|
1685
1690
|
contextLoader: mockDocumentLoader
|
|
1686
1691
|
});
|
|
1687
1692
|
await t.step("skip", async () => {
|
|
1688
|
-
|
|
1693
|
+
await new InboxContextImpl(null, {
|
|
1689
1694
|
"@context": "https://www.w3.org/ns/activitystreams",
|
|
1690
1695
|
"type": "Create",
|
|
1691
1696
|
"id": "https://example.com/activity",
|
|
1692
1697
|
"actor": "https://example.com/person2"
|
|
1693
|
-
}
|
|
1694
|
-
const ctx = new InboxContextImpl(null, activity, "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
|
|
1698
|
+
}, "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
|
|
1695
1699
|
data: void 0,
|
|
1696
1700
|
federation,
|
|
1697
1701
|
url: new URL("https://example.com/"),
|
|
1698
1702
|
documentLoader: fetchDocumentLoader,
|
|
1699
1703
|
contextLoader: fetchDocumentLoader
|
|
1700
|
-
})
|
|
1701
|
-
await ctx.forwardActivity([{
|
|
1704
|
+
}).forwardActivity([{
|
|
1702
1705
|
privateKey: rsaPrivateKey2,
|
|
1703
1706
|
keyId: rsaPublicKey2.id
|
|
1704
1707
|
}], {
|
|
@@ -1708,13 +1711,12 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
1708
1711
|
assertEquals(verified, null);
|
|
1709
1712
|
});
|
|
1710
1713
|
await t.step("unsigned", async () => {
|
|
1711
|
-
const
|
|
1714
|
+
const ctx = new InboxContextImpl(null, {
|
|
1712
1715
|
"@context": "https://www.w3.org/ns/activitystreams",
|
|
1713
1716
|
"type": "Create",
|
|
1714
1717
|
"id": "https://example.com/activity",
|
|
1715
1718
|
"actor": "https://example.com/person2"
|
|
1716
|
-
}
|
|
1717
|
-
const ctx = new InboxContextImpl(null, activity, "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
|
|
1719
|
+
}, "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
|
|
1718
1720
|
data: void 0,
|
|
1719
1721
|
federation,
|
|
1720
1722
|
url: new URL("https://example.com/"),
|
|
@@ -1738,14 +1740,13 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
1738
1740
|
contextLoader: mockDocumentLoader,
|
|
1739
1741
|
documentLoader: mockDocumentLoader
|
|
1740
1742
|
});
|
|
1741
|
-
|
|
1743
|
+
await new InboxContextImpl(null, await activity.toJsonLd({ contextLoader: mockDocumentLoader }), activity.id?.href, getTypeId(activity).href, {
|
|
1742
1744
|
data: void 0,
|
|
1743
1745
|
federation,
|
|
1744
1746
|
url: new URL("https://example.com/"),
|
|
1745
1747
|
documentLoader: fetchDocumentLoader,
|
|
1746
1748
|
contextLoader: fetchDocumentLoader
|
|
1747
|
-
})
|
|
1748
|
-
await ctx.forwardActivity([{
|
|
1749
|
+
}).forwardActivity([{
|
|
1749
1750
|
privateKey: rsaPrivateKey2,
|
|
1750
1751
|
keyId: rsaPublicKey2.id
|
|
1751
1752
|
}], {
|
|
@@ -1755,20 +1756,18 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
1755
1756
|
assertEquals(verified, ["proof"]);
|
|
1756
1757
|
});
|
|
1757
1758
|
await t.step("LD Signatures", async () => {
|
|
1758
|
-
|
|
1759
|
+
await new InboxContextImpl(null, await signJsonLd({
|
|
1759
1760
|
"@context": "https://www.w3.org/ns/activitystreams",
|
|
1760
1761
|
"type": "Create",
|
|
1761
1762
|
"id": "https://example.com/activity",
|
|
1762
1763
|
"actor": "https://example.com/person2"
|
|
1763
|
-
}, rsaPrivateKey3, rsaPublicKey3.id, { contextLoader: mockDocumentLoader })
|
|
1764
|
-
const ctx = new InboxContextImpl(null, activity, "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
|
|
1764
|
+
}, rsaPrivateKey3, rsaPublicKey3.id, { contextLoader: mockDocumentLoader }), "https://example.com/activity", "https://www.w3.org/ns/activitystreams#Create", {
|
|
1765
1765
|
data: void 0,
|
|
1766
1766
|
federation,
|
|
1767
1767
|
url: new URL("https://example.com/"),
|
|
1768
1768
|
documentLoader: fetchDocumentLoader,
|
|
1769
1769
|
contextLoader: fetchDocumentLoader
|
|
1770
|
-
})
|
|
1771
|
-
await ctx.forwardActivity([{
|
|
1770
|
+
}).forwardActivity([{
|
|
1772
1771
|
privateKey: rsaPrivateKey2,
|
|
1773
1772
|
keyId: rsaPublicKey2.id
|
|
1774
1773
|
}], {
|
|
@@ -1781,33 +1780,19 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
1781
1780
|
});
|
|
1782
1781
|
test("KvSpecDeterminer", async (t) => {
|
|
1783
1782
|
await t.step("should use default spec when not found in KV", async () => {
|
|
1784
|
-
|
|
1785
|
-
const prefix = ["test", "spec"];
|
|
1786
|
-
const determiner = new KvSpecDeterminer(kv, prefix);
|
|
1787
|
-
const spec = await determiner.determineSpec("example.com");
|
|
1788
|
-
assertEquals(spec, "rfc9421");
|
|
1783
|
+
assertEquals(await new KvSpecDeterminer(new MemoryKvStore(), ["test", "spec"]).determineSpec("example.com"), "rfc9421");
|
|
1789
1784
|
});
|
|
1790
1785
|
await t.step("should use custom default spec", async () => {
|
|
1791
|
-
|
|
1792
|
-
const prefix = ["test", "spec"];
|
|
1793
|
-
const determiner = new KvSpecDeterminer(kv, prefix, "draft-cavage-http-signatures-12");
|
|
1794
|
-
const spec = await determiner.determineSpec("example.com");
|
|
1795
|
-
assertEquals(spec, "draft-cavage-http-signatures-12");
|
|
1786
|
+
assertEquals(await new KvSpecDeterminer(new MemoryKvStore(), ["test", "spec"], "draft-cavage-http-signatures-12").determineSpec("example.com"), "draft-cavage-http-signatures-12");
|
|
1796
1787
|
});
|
|
1797
1788
|
await t.step("should remember and retrieve spec from KV", async () => {
|
|
1798
|
-
const
|
|
1799
|
-
const prefix = ["test", "spec"];
|
|
1800
|
-
const determiner = new KvSpecDeterminer(kv, prefix);
|
|
1789
|
+
const determiner = new KvSpecDeterminer(new MemoryKvStore(), ["test", "spec"]);
|
|
1801
1790
|
await determiner.rememberSpec("example.com", "draft-cavage-http-signatures-12");
|
|
1802
|
-
|
|
1803
|
-
assertEquals(
|
|
1804
|
-
const defaultSpec = await determiner.determineSpec("other.com");
|
|
1805
|
-
assertEquals(defaultSpec, "rfc9421");
|
|
1791
|
+
assertEquals(await determiner.determineSpec("example.com"), "draft-cavage-http-signatures-12");
|
|
1792
|
+
assertEquals(await determiner.determineSpec("other.com"), "rfc9421");
|
|
1806
1793
|
});
|
|
1807
1794
|
await t.step("should override remembered spec", async () => {
|
|
1808
|
-
const
|
|
1809
|
-
const prefix = ["test", "spec"];
|
|
1810
|
-
const determiner = new KvSpecDeterminer(kv, prefix);
|
|
1795
|
+
const determiner = new KvSpecDeterminer(new MemoryKvStore(), ["test", "spec"]);
|
|
1811
1796
|
await determiner.rememberSpec("example.com", "draft-cavage-http-signatures-12");
|
|
1812
1797
|
let spec = await determiner.determineSpec("example.com");
|
|
1813
1798
|
assertEquals(spec, "draft-cavage-http-signatures-12");
|
|
@@ -1816,5 +1801,5 @@ test("KvSpecDeterminer", async (t) => {
|
|
|
1816
1801
|
assertEquals(spec, "rfc9421");
|
|
1817
1802
|
});
|
|
1818
1803
|
});
|
|
1819
|
-
|
|
1820
|
-
|
|
1804
|
+
//#endregion
|
|
1805
|
+
export {};
|