@fedify/fedify 2.0.0-dev.1690 → 2.0.0-dev.170
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 +70 -34
- 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-CYOcDUkj.js → builder-_MVsWtsS.js} +9 -8
- package/dist/{client-bgSdkFa2.d.ts → client-CUTUGgvJ.d.ts} +19 -19
- package/dist/{client-CnOdwLLN.js → client-Dg7OfUDA.js} +28 -23
- package/dist/{client-CegPX0Rn.d.cts → client-by-PEGAJ.d.cts} +19 -19
- package/dist/compat/mod.cjs +1 -1
- package/dist/compat/mod.d.cts +6 -12
- package/dist/compat/mod.d.ts +6 -12
- package/dist/compat/mod.js +1 -1
- package/dist/compat/transformers.test.js +19 -18
- package/dist/context-Bns6uTJq.js +109 -0
- package/dist/{context-ByZprN0S.d.ts → context-C7vzWilY.d.ts} +314 -182
- package/dist/{context-C5BsZkDr.d.cts → context-CrB9RFy5.d.cts} +314 -182
- package/dist/deno-DhWON59o.js +117 -0
- package/dist/{testing-BWNCAbL-.js → dist-B5f6a8Tt.js} +90 -111
- package/dist/{authdocloader-Brax1A32.js → docloader-Cni79dmb.js} +17 -8
- package/dist/{esm-DnIzfEj0.js → esm-DGl7uK1r.js} +32 -17
- package/dist/federation/builder.test.js +11 -11
- package/dist/federation/collection.test.js +5 -8
- package/dist/federation/handler.test.js +111 -24
- package/dist/federation/idempotency.test.js +24 -24
- package/dist/federation/inbox.test.js +5 -6
- package/dist/federation/keycache.test.js +4 -5
- package/dist/federation/kv.test.js +60 -9
- package/dist/federation/middleware.test.js +102 -101
- package/dist/federation/mod.cjs +8 -12
- package/dist/federation/mod.d.cts +7 -13
- package/dist/federation/mod.d.ts +7 -13
- package/dist/federation/mod.js +8 -13
- package/dist/federation/mq.test.js +9 -10
- package/dist/federation/negotiation.test.js +5 -8
- package/dist/federation/retry.test.js +2 -4
- package/dist/federation/router.test.js +6 -8
- package/dist/federation/send.test.js +55 -15
- package/dist/{webfinger/handler.test.js → federation/webfinger.test.js} +25 -24
- package/dist/{federation-H2_En3j5.cjs → federation-B431K2gm.cjs} +22 -0
- package/dist/{federation-D1U8YY9t.js → federation-BbZwNNWj.js} +28 -6
- package/dist/{http-C7vbQwbz.cjs → http-7RQPvAkX.cjs} +410 -14
- package/dist/{http-BxbM8sEy.js → http-CZXlv4xU.js} +371 -11
- package/dist/{http-D-e6AFwR.d.cts → http-ClB3pLcL.d.cts} +2 -2
- package/dist/{http-BNOYnVsU.js → http-CwsBL5_A.js} +3 -2
- package/dist/{http-D6Uj2x2y.d.ts → http-DLBDPal9.d.ts} +2 -2
- package/dist/{inbox-BRru9pX3.js → inbox-CukSCwad.js} +2 -1
- package/dist/{key-1KXru8Ug.js → key-DKkHKzvg.js} +3 -2
- package/dist/{keycache-CN61iGVj.js → keycache-DRxpZ5r9.js} +1 -1
- package/dist/{keys-BPdFKgiy.js → keys-ZbcByPg9.js} +2 -1
- package/dist/{kv-63Cil1MD.d.cts → kv-B4vFhIYL.d.cts} +30 -1
- package/dist/{kv-C7sopW2E.d.ts → kv-CYySNrsn.d.ts} +30 -1
- package/dist/{kv-CRZrzyXm.js → kv-QzKcOQgP.js} +22 -0
- package/dist/kv-cache-BEeqyGER.js +107 -0
- package/dist/kv-cache-BVA7CrnS.cjs +134 -0
- package/dist/kv-cache-HDuc4ZaJ.js +122 -0
- package/dist/{ld-Dv8DNNAT.js → ld-CM6OO5ar.js} +4 -2
- package/dist/middleware--i9t8nKh.js +26 -0
- package/dist/middleware-C567nJlD.cjs +12 -0
- package/dist/middleware-D9oWuacw.js +12 -0
- package/dist/{middleware-DY9B2lL8.js → middleware-DXRcwk_y.js} +185 -192
- package/dist/{middleware-BmoOlgc1.cjs → middleware-TufpQUzj.cjs} +251 -241
- package/dist/{middleware-Bz_A2jeJ.js → middleware-eDeNdyRA.js} +195 -191
- package/dist/mod-0p9zUdzg.d.cts +107 -0
- package/dist/mod-0qnPv4EC.d.cts +62 -0
- package/dist/{mod-Djzcw2ry.d.cts → mod-BrS8tiad.d.cts} +3 -3
- package/dist/mod-C3SOvTD1.d.ts +64 -0
- package/dist/{mod-8DMWKtQE.d.cts → mod-D6pS5_xJ.d.cts} +4 -4
- package/dist/{mod-BhUKmBJD.d.ts → mod-jOa7W503.d.ts} +3 -3
- package/dist/{mod-D6hQoxC5.d.ts → mod-waqu-BL_.d.ts} +4 -4
- package/dist/mod-xc20HhMD.d.ts +109 -0
- package/dist/mod.cjs +17 -112
- package/dist/mod.d.cts +11 -17
- package/dist/mod.d.ts +11 -17
- package/dist/mod.js +11 -17
- package/dist/nodeinfo/client.test.js +7 -10
- package/dist/nodeinfo/handler.test.js +23 -23
- package/dist/nodeinfo/mod.cjs +2 -3
- package/dist/nodeinfo/mod.d.cts +2 -4
- package/dist/nodeinfo/mod.d.ts +2 -4
- package/dist/nodeinfo/mod.js +2 -3
- package/dist/nodeinfo/types.test.js +6 -9
- package/dist/otel/exporter.test.js +893 -0
- package/dist/otel/mod.cjs +256 -0
- package/dist/otel/mod.d.cts +230 -0
- package/dist/otel/mod.d.ts +232 -0
- package/dist/otel/mod.js +255 -0
- package/dist/{owner-e3FYDhsk.js → owner-BOEfZQv2.js} +45 -8
- package/dist/{owner-hd9lvQcP.d.ts → owner-BgI8C-VY.d.ts} +2 -3
- package/dist/{owner-BN_tO3cY.d.cts → owner-C-zfmVAD.d.cts} +2 -3
- package/dist/{proof-B-eqv0Ug.cjs → proof-CaDQpGJD.cjs} +69 -33
- package/dist/{proof-DfgvA3al.js → proof-iYIDiv8I.js} +47 -11
- package/dist/{proof-6gFMwMNJ.js → proof-iw6KtIyj.js} +3 -2
- package/dist/router-D9eI0s4b.js +118 -0
- package/dist/{send-Tl9NOnmO.js → send-Bn8o0mjW.js} +9 -4
- package/dist/sig/http.test.js +11 -13
- package/dist/sig/key.test.js +9 -11
- package/dist/sig/ld.test.js +8 -10
- package/dist/sig/mod.cjs +7 -11
- package/dist/sig/mod.d.cts +3 -7
- package/dist/sig/mod.d.ts +3 -7
- package/dist/sig/mod.js +3 -7
- package/dist/sig/owner.test.js +33 -12
- package/dist/sig/proof.test.js +13 -14
- package/dist/testing/mod.d.ts +183 -7194
- package/dist/testing/mod.js +4 -4
- package/dist/{transformers-CoBS-oFG.cjs → transformers-BjBg6Lag.cjs} +2 -2
- package/dist/{transformers-BFT6d7J5.js → transformers-N_ip_y4P.js} +2 -2
- package/dist/{types-DqxyTxOf.js → types-8l28uC8o.js} +31 -26
- package/dist/{types-zqdWZh4O.cjs → types-B6z6CqIz.cjs} +33 -28
- package/dist/{types-BSuWJsOm.js → types-CPz01LGH.js} +3 -3
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +13 -15
- package/dist/utils/kv-cache.test.js +211 -0
- package/dist/utils/mod.cjs +10 -0
- package/dist/utils/mod.d.cts +4 -0
- package/dist/utils/mod.d.ts +6 -0
- package/dist/utils/mod.js +9 -0
- package/package.json +34 -75
- package/dist/actor-Be0ThtXy.cjs +0 -42609
- package/dist/actor-ChbPLm6n.js +0 -42135
- package/dist/actor-D6K058Tb.d.cts +0 -128
- package/dist/actor-DuCeRiNh.js +0 -146
- package/dist/actor-T6RyhRgk.d.ts +0 -130
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-CrxhFL8e.js +0 -52
- package/dist/authdocloader-OSn_teLV.cjs +0 -58
- package/dist/denokv-Bv33Xxea.js +0 -57
- package/dist/docloader-CCqXeagZ.cjs +0 -4861
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- package/dist/docloader-D-MrRyHl.d.cts +0 -219
- package/dist/docloader-XK3y2jn5.js +0 -4795
- package/dist/fixtures/activitypub.academy/users/brauca_darradiul.json +0 -83
- package/dist/fixtures/example.com/announce.json +0 -6
- package/dist/fixtures/example.com/collection.json +0 -19
- package/dist/fixtures/example.com/create.json +0 -6
- package/dist/fixtures/example.com/cross-origin-actor.json +0 -6
- package/dist/fixtures/example.com/hong-gildong.json +0 -11
- package/dist/fixtures/example.com/invite.json +0 -7
- package/dist/fixtures/example.com/key.json +0 -7
- package/dist/fixtures/example.com/key2.json +0 -6
- package/dist/fixtures/example.com/object.json +0 -6
- package/dist/fixtures/example.com/orderedcollectionpage.json +0 -24
- package/dist/fixtures/example.com/paged/a.json +0 -13
- package/dist/fixtures/example.com/paged/b.json +0 -16
- package/dist/fixtures/example.com/paged-collection.json +0 -6
- package/dist/fixtures/example.com/person.json +0 -22
- package/dist/fixtures/example.com/person2.json +0 -40
- package/dist/fixtures/example.com/test.json +0 -5
- package/dist/fixtures/example.com/users/handle.json +0 -16
- package/dist/fixtures/example.com/wrong-type.json +0 -3
- package/dist/fixtures/media.example.com/avatars/test-avatar.jpg.json +0 -6
- package/dist/fixtures/oeee.cafe/ap/users/3609fd4e-d51d-4db8-9f04-4189815864dd.json +0 -24
- package/dist/fixtures/remote.domain/users/bob.json +0 -20
- package/dist/fixtures/server.example/users/alice.json +0 -20
- package/dist/fixtures/w3id.org/identity/v1.json +0 -152
- package/dist/fixtures/w3id.org/security/data-integrity/v1.json +0 -74
- package/dist/fixtures/w3id.org/security/multikey/v1.json +0 -35
- package/dist/fixtures/w3id.org/security/v1.json +0 -50
- package/dist/fixtures/wizard.casa/users/hongminhee.json +0 -69
- package/dist/fixtures/www.w3.org/ns/activitystreams.json +0 -379
- package/dist/fixtures/www.w3.org/ns/did/v1.json +0 -58
- package/dist/key-B3uag-rz.js +0 -10
- package/dist/key-BiBmb1Yy.cjs +0 -10
- package/dist/key-DK_nfU4I.js +0 -10
- package/dist/key-Z6ceKnZC.cjs +0 -290
- package/dist/key-jyNTxCvK.js +0 -260
- package/dist/lookup-BPviO8ij.js +0 -131
- package/dist/lookup-hnMAAU5r.cjs +0 -137
- package/dist/lookup-pV0JOsuV.js +0 -331
- package/dist/middleware-CI0-zw4U.js +0 -26
- package/dist/middleware-QNK-W-jE.cjs +0 -17
- package/dist/middleware-_vjt6FWU.js +0 -17
- package/dist/mod-CerN_Sza.d.ts +0 -104
- package/dist/mod-Cj1tHXBR.d.cts +0 -102
- package/dist/mod-CxkWO3Mg.d.cts +0 -307
- package/dist/mod-DBzN0aCM.d.ts +0 -115
- package/dist/mod-DlU8ISoa.d.ts +0 -309
- package/dist/mod-FZd39qVq.d.cts +0 -1
- package/dist/mod-g0xFzAP9.d.ts +0 -2
- package/dist/mod-jQ4OODsl.d.cts +0 -113
- package/dist/mq-B7R1Q-M5.d.cts +0 -140
- package/dist/mq-CRGm1e_F.d.ts +0 -143
- package/dist/runtime/docloader.test.js +0 -522
- package/dist/runtime/key.test.js +0 -103
- package/dist/runtime/langstr.test.d.ts +0 -3
- package/dist/runtime/langstr.test.js +0 -39
- 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/src/vocab/accept.yaml +0 -15
- package/dist/src/vocab/activity.yaml +0 -98
- package/dist/src/vocab/add.yaml +0 -16
- package/dist/src/vocab/announce.yaml +0 -30
- package/dist/src/vocab/application.yaml +0 -324
- package/dist/src/vocab/arrive.yaml +0 -15
- package/dist/src/vocab/article.yaml +0 -46
- package/dist/src/vocab/audio.yaml +0 -11
- package/dist/src/vocab/block.yaml +0 -16
- package/dist/src/vocab/chatmessage.yaml +0 -50
- package/dist/src/vocab/collection.yaml +0 -154
- package/dist/src/vocab/collectionpage.yaml +0 -55
- package/dist/src/vocab/create.yaml +0 -28
- package/dist/src/vocab/dataintegrityproof.yaml +0 -56
- package/dist/src/vocab/delete.yaml +0 -27
- package/dist/src/vocab/didservice.yaml +0 -22
- package/dist/src/vocab/dislike.yaml +0 -14
- package/dist/src/vocab/document.yaml +0 -31
- package/dist/src/vocab/emoji.yaml +0 -12
- package/dist/src/vocab/emojireact.yaml +0 -17
- package/dist/src/vocab/endpoints.yaml +0 -85
- package/dist/src/vocab/event.yaml +0 -11
- package/dist/src/vocab/export.yaml +0 -9
- package/dist/src/vocab/flag.yaml +0 -15
- package/dist/src/vocab/follow.yaml +0 -19
- package/dist/src/vocab/group.yaml +0 -324
- package/dist/src/vocab/hashtag.yaml +0 -14
- package/dist/src/vocab/ignore.yaml +0 -14
- package/dist/src/vocab/image.yaml +0 -9
- package/dist/src/vocab/intransitiveactivity.yaml +0 -15
- package/dist/src/vocab/invite.yaml +0 -14
- package/dist/src/vocab/join.yaml +0 -14
- package/dist/src/vocab/key.yaml +0 -28
- package/dist/src/vocab/leave.yaml +0 -14
- package/dist/src/vocab/like.yaml +0 -16
- package/dist/src/vocab/link.yaml +0 -101
- package/dist/src/vocab/listen.yaml +0 -12
- package/dist/src/vocab/mention.yaml +0 -9
- package/dist/src/vocab/move.yaml +0 -15
- package/dist/src/vocab/multikey.yaml +0 -36
- package/dist/src/vocab/note.yaml +0 -48
- package/dist/src/vocab/object.yaml +0 -404
- package/dist/src/vocab/offer.yaml +0 -15
- package/dist/src/vocab/orderedcollection.yaml +0 -39
- package/dist/src/vocab/orderedcollectionpage.yaml +0 -50
- package/dist/src/vocab/organization.yaml +0 -324
- package/dist/src/vocab/page.yaml +0 -11
- package/dist/src/vocab/person.yaml +0 -324
- package/dist/src/vocab/place.yaml +0 -75
- package/dist/src/vocab/profile.yaml +0 -26
- package/dist/src/vocab/propertyvalue.yaml +0 -32
- package/dist/src/vocab/question.yaml +0 -103
- package/dist/src/vocab/read.yaml +0 -13
- package/dist/src/vocab/reject.yaml +0 -14
- package/dist/src/vocab/relationship.yaml +0 -52
- package/dist/src/vocab/remove.yaml +0 -14
- package/dist/src/vocab/service.yaml +0 -324
- package/dist/src/vocab/source.yaml +0 -26
- package/dist/src/vocab/tentativeaccept.yaml +0 -14
- package/dist/src/vocab/tentativereject.yaml +0 -14
- package/dist/src/vocab/tombstone.yaml +0 -24
- package/dist/src/vocab/travel.yaml +0 -16
- package/dist/src/vocab/undo.yaml +0 -26
- package/dist/src/vocab/update.yaml +0 -58
- package/dist/src/vocab/video.yaml +0 -11
- package/dist/src/vocab/view.yaml +0 -13
- package/dist/testing/docloader.test.js +0 -24
- package/dist/type-C69ZBu7f.js +0 -47010
- package/dist/vocab/actor.test.d.ts +0 -3
- package/dist/vocab/actor.test.js +0 -5965
- package/dist/vocab/lookup.test.d.ts +0 -3
- package/dist/vocab/lookup.test.js +0 -456
- package/dist/vocab/mod.cjs +0 -87
- package/dist/vocab/mod.d.cts +0 -6
- package/dist/vocab/mod.d.ts +0 -8
- package/dist/vocab/mod.js +0 -10
- package/dist/vocab/schema.yaml +0 -247
- 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/vocab.test.js +0 -3787
- package/dist/vocab-B39-pFl9.cjs +0 -291
- package/dist/vocab-BI0Ak5lL.d.ts +0 -14924
- package/dist/vocab-BWoeZsME.js +0 -255
- package/dist/vocab-Dw1-yVGg.d.cts +0 -14922
- package/dist/webfinger/handler.test.d.ts +0 -3
- package/dist/webfinger/lookup.test.d.ts +0 -3
- package/dist/webfinger/lookup.test.js +0 -195
- package/dist/webfinger/mod.cjs +0 -9
- package/dist/webfinger/mod.d.cts +0 -4
- package/dist/webfinger/mod.d.ts +0 -6
- package/dist/webfinger/mod.js +0 -9
- package/dist/webfinger-BjOEdFPs.cjs +0 -4
- package/dist/webfinger-De_bU0iE.js +0 -4
- 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/{runtime/authdocloader.test.d.ts → federation/webfinger.test.d.ts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-1E3W847c.d.ts} +0 -0
- /package/dist/{mod-C2tOeRkN.d.cts → mod-C81L6_lQ.d.cts} +0 -0
- /package/dist/{nodeinfo-DfycQ8Wf.js → nodeinfo-BlLsRSiT.js} +0 -0
- /package/dist/{nodeinfo-Co9lJrWl.cjs → nodeinfo-DuMYTpbZ.cjs} +0 -0
- /package/dist/{runtime/docloader.test.d.ts → otel/exporter.test.d.ts} +0 -0
- /package/dist/{runtime-DPYEDf-o.js → sig-CwuONEzF.js} +0 -0
- /package/dist/{runtime-C58AJWSv.cjs → sig-DeXX2xnj.cjs} +0 -0
- /package/dist/{std__assert-X-_kMxKM.js → std__assert-DWivtrGR.js} +0 -0
- /package/dist/{testing → utils}/docloader.test.d.ts +0 -0
- /package/dist/{runtime/key.test.d.ts → utils/kv-cache.test.d.ts} +0 -0
- /package/dist/{sig-ByHXzqUi.cjs → utils-Db0ZmjcD.cjs} +0 -0
- /package/dist/{sig-Cj3tk-ig.js → utils-Wranxuoe.js} +0 -0
|
@@ -3,39 +3,40 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { mockDocumentLoader, test } from "../dist-B5f6a8Tt.js";
|
|
7
7
|
import { assertEquals } from "../assert_equals-DSbWqCm3.js";
|
|
8
8
|
import { assert } from "../assert-MZs1qjMx.js";
|
|
9
9
|
import { assertInstanceOf } from "../assert_instance_of-DHz7EHNU.js";
|
|
10
|
-
import { MemoryKvStore } from "../kv-
|
|
11
|
-
import
|
|
12
|
-
import "../
|
|
13
|
-
import
|
|
14
|
-
import "../
|
|
15
|
-
import "../
|
|
16
|
-
import "../key-
|
|
17
|
-
import { signRequest, verifyRequest } from "../http-
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import "../
|
|
23
|
-
import "../
|
|
10
|
+
import { MemoryKvStore } from "../kv-QzKcOQgP.js";
|
|
11
|
+
import "../deno-DhWON59o.js";
|
|
12
|
+
import { ContextImpl, FederationImpl, InboxContextImpl, KvSpecDeterminer, createFederation } from "../middleware-DXRcwk_y.js";
|
|
13
|
+
import "../client-Dg7OfUDA.js";
|
|
14
|
+
import { RouterError } from "../router-D9eI0s4b.js";
|
|
15
|
+
import "../types-CPz01LGH.js";
|
|
16
|
+
import "../key-DKkHKzvg.js";
|
|
17
|
+
import { signRequest, verifyRequest } from "../http-CwsBL5_A.js";
|
|
18
|
+
import { detachSignature, signJsonLd, verifyJsonLd } from "../ld-CM6OO5ar.js";
|
|
19
|
+
import { doesActorOwnKey } from "../owner-BOEfZQv2.js";
|
|
20
|
+
import { signObject, verifyObject } from "../proof-iw6KtIyj.js";
|
|
21
|
+
import { fetchDocumentLoader, getAuthenticatedDocumentLoader } from "../docloader-Cni79dmb.js";
|
|
22
|
+
import "../kv-cache-BEeqyGER.js";
|
|
23
|
+
import "../inbox-CukSCwad.js";
|
|
24
|
+
import "../builder-_MVsWtsS.js";
|
|
24
25
|
import "../collection-CcnIw1qY.js";
|
|
25
|
-
import "../keycache-
|
|
26
|
+
import "../keycache-DRxpZ5r9.js";
|
|
26
27
|
import "../negotiation-5NPJL6zp.js";
|
|
27
28
|
import "../retry-D4GJ670a.js";
|
|
28
|
-
import "../send-
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import "../
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import
|
|
36
|
-
import {
|
|
29
|
+
import "../send-Bn8o0mjW.js";
|
|
30
|
+
import { assertStrictEquals } from "../std__assert-DWivtrGR.js";
|
|
31
|
+
import { assertFalse, assertRejects } from "../assert_rejects-Ce45JcFg.js";
|
|
32
|
+
import { assertThrows } from "../assert_throws-BNXdRGWP.js";
|
|
33
|
+
import { assertNotEquals } from "../assert_not_equals-C80BG-_5.js";
|
|
34
|
+
import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-ZbcByPg9.js";
|
|
35
|
+
import { esm_default } from "../esm-DGl7uK1r.js";
|
|
36
|
+
import * as vocab from "@fedify/vocab";
|
|
37
|
+
import { getTypeId, lookupObject } from "@fedify/vocab";
|
|
37
38
|
|
|
38
|
-
//#region src/
|
|
39
|
+
//#region ../fixture/src/fixtures/example.com/create.json
|
|
39
40
|
var __context$2 = "https://www.w3.org/ns/activitystreams";
|
|
40
41
|
var type$2 = "Create";
|
|
41
42
|
var id$2 = "https://example.com/create";
|
|
@@ -48,7 +49,7 @@ var create_default = {
|
|
|
48
49
|
};
|
|
49
50
|
|
|
50
51
|
//#endregion
|
|
51
|
-
//#region src/
|
|
52
|
+
//#region ../fixture/src/fixtures/example.com/person.json
|
|
52
53
|
var __context$1 = ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"];
|
|
53
54
|
var id$1 = "https://example.com/person";
|
|
54
55
|
var type$1 = "Person";
|
|
@@ -72,7 +73,7 @@ var person_default = {
|
|
|
72
73
|
};
|
|
73
74
|
|
|
74
75
|
//#endregion
|
|
75
|
-
//#region src/
|
|
76
|
+
//#region ../fixture/src/fixtures/example.com/person2.json
|
|
76
77
|
var __context = [
|
|
77
78
|
"https://www.w3.org/ns/activitystreams",
|
|
78
79
|
"https://w3id.org/security/v1",
|
|
@@ -121,7 +122,7 @@ test("createFederation()", async (t) => {
|
|
|
121
122
|
await t.step("allowPrivateAddress", () => {
|
|
122
123
|
assertThrows(() => createFederation({
|
|
123
124
|
kv,
|
|
124
|
-
|
|
125
|
+
contextLoaderFactory: () => mockDocumentLoader,
|
|
125
126
|
allowPrivateAddress: true
|
|
126
127
|
}), TypeError);
|
|
127
128
|
assertThrows(() => createFederation({
|
|
@@ -258,7 +259,7 @@ test({
|
|
|
258
259
|
assertStrictEquals(ctx.federation, federation);
|
|
259
260
|
assertThrows(() => ctx.getNodeInfoUri(), RouterError);
|
|
260
261
|
assertThrows(() => ctx.getActorUri("handle"), RouterError);
|
|
261
|
-
assertThrows(() => ctx.getObjectUri(Note, {
|
|
262
|
+
assertThrows(() => ctx.getObjectUri(vocab.Note, {
|
|
262
263
|
handle: "handle",
|
|
263
264
|
id: "id"
|
|
264
265
|
}), RouterError);
|
|
@@ -275,7 +276,7 @@ test({
|
|
|
275
276
|
assertEquals(ctx.parseUri(null), null);
|
|
276
277
|
assertEquals(await ctx.getActorKeyPairs("handle"), []);
|
|
277
278
|
await assertRejects(() => ctx.getDocumentLoader({ identifier: "handle" }), Error, "No actor key pairs dispatcher registered");
|
|
278
|
-
await assertRejects(() => ctx.sendActivity({ identifier: "handle" }, [], new Create({})), Error, "No actor key pairs dispatcher registered");
|
|
279
|
+
await assertRejects(() => ctx.sendActivity({ identifier: "handle" }, [], new vocab.Create({})), Error, "No actor key pairs dispatcher registered");
|
|
279
280
|
federation.setNodeInfoDispatcher("/nodeinfo/2.1", () => ({
|
|
280
281
|
software: {
|
|
281
282
|
name: "Example",
|
|
@@ -290,7 +291,7 @@ test({
|
|
|
290
291
|
}));
|
|
291
292
|
ctx = federation.createContext(new URL("https://example.com/"), 123);
|
|
292
293
|
assertEquals(ctx.getNodeInfoUri(), new URL("https://example.com/nodeinfo/2.1"));
|
|
293
|
-
federation.setActorDispatcher("/users/{identifier}", () => new Person({})).setKeyPairsDispatcher(() => [{
|
|
294
|
+
federation.setActorDispatcher("/users/{identifier}", () => new vocab.Person({})).setKeyPairsDispatcher(() => [{
|
|
294
295
|
privateKey: rsaPrivateKey2,
|
|
295
296
|
publicKey: rsaPublicKey2.publicKey
|
|
296
297
|
}, {
|
|
@@ -314,7 +315,7 @@ test({
|
|
|
314
315
|
id: new URL("https://example.com/users/handle#main-key"),
|
|
315
316
|
owner: new URL("https://example.com/users/handle")
|
|
316
317
|
}),
|
|
317
|
-
multikey: new Multikey({
|
|
318
|
+
multikey: new vocab.Multikey({
|
|
318
319
|
id: new URL("https://example.com/users/handle#main-key"),
|
|
319
320
|
controller: new URL("https://example.com/users/handle"),
|
|
320
321
|
publicKey: rsaPublicKey2.publicKey
|
|
@@ -327,7 +328,7 @@ test({
|
|
|
327
328
|
id: new URL("https://example.com/users/handle#key-2"),
|
|
328
329
|
owner: new URL("https://example.com/users/handle")
|
|
329
330
|
}),
|
|
330
|
-
multikey: new Multikey({
|
|
331
|
+
multikey: new vocab.Multikey({
|
|
331
332
|
id: new URL("https://example.com/users/handle#key-2"),
|
|
332
333
|
controller: new URL("https://example.com/users/handle"),
|
|
333
334
|
publicKey: ed25519PublicKey.publicKey
|
|
@@ -355,8 +356,8 @@ test({
|
|
|
355
356
|
document: true
|
|
356
357
|
});
|
|
357
358
|
assertEquals(await ctx.lookupObject("https://example.com/object"), null);
|
|
358
|
-
await assertRejects(() => ctx.sendActivity({ identifier: "handle" }, [], new Create({})), TypeError, "The activity to send must have at least one actor property.");
|
|
359
|
-
await ctx.sendActivity({ identifier: "handle" }, [], new Create({ actor: new URL("https://example.com/users/handle") }));
|
|
359
|
+
await assertRejects(() => ctx.sendActivity({ identifier: "handle" }, [], new vocab.Create({})), TypeError, "The activity to send must have at least one actor property.");
|
|
360
|
+
await ctx.sendActivity({ identifier: "handle" }, [], new vocab.Create({ actor: new URL("https://example.com/users/handle") }));
|
|
360
361
|
esm_default.get("https://example.com/object", () => new Response(JSON.stringify({
|
|
361
362
|
"@context": "https://www.w3.org/ns/activitystreams",
|
|
362
363
|
type: "Object",
|
|
@@ -369,21 +370,21 @@ test({
|
|
|
369
370
|
contextLoaderFactory: () => mockDocumentLoader
|
|
370
371
|
});
|
|
371
372
|
const ctx2 = federation2.createContext(new URL("https://example.com/"), 123);
|
|
372
|
-
assertEquals(await ctx2.lookupObject("https://example.com/object"), new Object
|
|
373
|
+
assertEquals(await ctx2.lookupObject("https://example.com/object"), new vocab.Object({
|
|
373
374
|
id: new URL("https://example.com/object"),
|
|
374
375
|
name: "Fetched object"
|
|
375
376
|
}));
|
|
376
|
-
federation.setObjectDispatcher(Note, "/users/{identifier}/notes/{id}", (_ctx, values) => {
|
|
377
|
-
return new Note({ summary: `Note ${values.id} by ${values.identifier}` });
|
|
377
|
+
federation.setObjectDispatcher(vocab.Note, "/users/{identifier}/notes/{id}", (_ctx, values) => {
|
|
378
|
+
return new vocab.Note({ summary: `Note ${values.id} by ${values.identifier}` });
|
|
378
379
|
});
|
|
379
380
|
ctx = federation.createContext(new URL("https://example.com/"), 123);
|
|
380
|
-
assertEquals(ctx.getObjectUri(Note, {
|
|
381
|
+
assertEquals(ctx.getObjectUri(vocab.Note, {
|
|
381
382
|
identifier: "john",
|
|
382
383
|
id: "123"
|
|
383
384
|
}), new URL("https://example.com/users/john/notes/123"));
|
|
384
385
|
assertEquals(ctx.parseUri(new URL("https://example.com/users/john/notes/123")), {
|
|
385
386
|
type: "object",
|
|
386
|
-
class: Note,
|
|
387
|
+
class: vocab.Note,
|
|
387
388
|
typeId: new URL("https://www.w3.org/ns/activitystreams#Note"),
|
|
388
389
|
values: {
|
|
389
390
|
identifier: "john",
|
|
@@ -466,7 +467,7 @@ test({
|
|
|
466
467
|
kv,
|
|
467
468
|
origin: "https://ap.example.com",
|
|
468
469
|
documentLoaderFactory: () => mockDocumentLoader,
|
|
469
|
-
|
|
470
|
+
contextLoaderFactory: () => mockDocumentLoader
|
|
470
471
|
});
|
|
471
472
|
const ctx = federation.createContext(new URL("https://example.com:1234/"));
|
|
472
473
|
assertEquals(ctx.origin, "https://example.com:1234");
|
|
@@ -486,7 +487,7 @@ test({
|
|
|
486
487
|
}
|
|
487
488
|
}));
|
|
488
489
|
assertEquals(ctx.getNodeInfoUri(), new URL("https://ap.example.com/nodeinfo/2.1"));
|
|
489
|
-
federation.setActorDispatcher("/users/{identifier}", () => new Person({}));
|
|
490
|
+
federation.setActorDispatcher("/users/{identifier}", () => new vocab.Person({}));
|
|
490
491
|
assertEquals(ctx.getActorUri("handle"), new URL("https://ap.example.com/users/handle"));
|
|
491
492
|
assertEquals(ctx.parseUri(new URL("https://ap.example.com/users/handle")), {
|
|
492
493
|
type: "actor",
|
|
@@ -498,16 +499,16 @@ test({
|
|
|
498
499
|
handle: "handle",
|
|
499
500
|
identifier: "handle"
|
|
500
501
|
});
|
|
501
|
-
federation.setObjectDispatcher(Note, "/users/{identifier}/notes/{id}", (_ctx, values) => {
|
|
502
|
-
return new Note({ summary: `Note ${values.id} by ${values.identifier}` });
|
|
502
|
+
federation.setObjectDispatcher(vocab.Note, "/users/{identifier}/notes/{id}", (_ctx, values) => {
|
|
503
|
+
return new vocab.Note({ summary: `Note ${values.id} by ${values.identifier}` });
|
|
503
504
|
});
|
|
504
|
-
assertEquals(ctx.getObjectUri(Note, {
|
|
505
|
+
assertEquals(ctx.getObjectUri(vocab.Note, {
|
|
505
506
|
identifier: "john",
|
|
506
507
|
id: "123"
|
|
507
508
|
}), new URL("https://ap.example.com/users/john/notes/123"));
|
|
508
509
|
assertEquals(ctx.parseUri(new URL("https://ap.example.com/users/john/notes/123")), {
|
|
509
510
|
type: "object",
|
|
510
|
-
class: Note,
|
|
511
|
+
class: vocab.Note,
|
|
511
512
|
typeId: new URL("https://www.w3.org/ns/activitystreams#Note"),
|
|
512
513
|
values: {
|
|
513
514
|
identifier: "john",
|
|
@@ -516,7 +517,7 @@ test({
|
|
|
516
517
|
});
|
|
517
518
|
assertEquals(ctx.parseUri(new URL("https://example.com:1234/users/john/notes/123")), {
|
|
518
519
|
type: "object",
|
|
519
|
-
class: Note,
|
|
520
|
+
class: vocab.Note,
|
|
520
521
|
typeId: new URL("https://www.w3.org/ns/activitystreams#Note"),
|
|
521
522
|
values: {
|
|
522
523
|
identifier: "john",
|
|
@@ -703,7 +704,7 @@ test({
|
|
|
703
704
|
assertEquals(ctx.hostname, "example.com");
|
|
704
705
|
assertEquals(ctx.data, 123);
|
|
705
706
|
await assertRejects(() => ctx.getActor("someone"), Error);
|
|
706
|
-
await assertRejects(() => ctx.getObject(Note, {
|
|
707
|
+
await assertRejects(() => ctx.getObject(vocab.Note, {
|
|
707
708
|
handle: "someone",
|
|
708
709
|
id: "123"
|
|
709
710
|
}), Error);
|
|
@@ -734,23 +735,23 @@ test({
|
|
|
734
735
|
assertEquals(await signedCtx2.getSignedKeyOwner(), expectedOwner);
|
|
735
736
|
assertEquals(await signedCtx2.getSignedKey(), rsaPublicKey3);
|
|
736
737
|
assertEquals(await signedCtx2.getSignedKeyOwner(), expectedOwner);
|
|
737
|
-
federation.setActorDispatcher("/users/{identifier}", (_ctx, identifier) => new Person({ preferredUsername: identifier }));
|
|
738
|
+
federation.setActorDispatcher("/users/{identifier}", (_ctx, identifier) => new vocab.Person({ preferredUsername: identifier }));
|
|
738
739
|
const ctx2 = federation.createContext(req, 789);
|
|
739
740
|
assertEquals(ctx2.request, req);
|
|
740
741
|
assertEquals(ctx2.url, new URL("https://example.com/"));
|
|
741
742
|
assertEquals(ctx2.data, 789);
|
|
742
|
-
assertEquals(await ctx2.getActor("john"), new Person({ preferredUsername: "john" }));
|
|
743
|
-
federation.setObjectDispatcher(Note, "/users/{identifier}/notes/{id}", (_ctx, values) => {
|
|
744
|
-
return new Note({ summary: `Note ${values.id} by ${values.identifier}` });
|
|
743
|
+
assertEquals(await ctx2.getActor("john"), new vocab.Person({ preferredUsername: "john" }));
|
|
744
|
+
federation.setObjectDispatcher(vocab.Note, "/users/{identifier}/notes/{id}", (_ctx, values) => {
|
|
745
|
+
return new vocab.Note({ summary: `Note ${values.id} by ${values.identifier}` });
|
|
745
746
|
});
|
|
746
747
|
const ctx3 = federation.createContext(req, 123);
|
|
747
748
|
assertEquals(ctx3.request, req);
|
|
748
749
|
assertEquals(ctx3.url, new URL("https://example.com/"));
|
|
749
750
|
assertEquals(ctx3.data, 123);
|
|
750
|
-
assertEquals(await ctx2.getObject(Note, {
|
|
751
|
+
assertEquals(await ctx2.getObject(vocab.Note, {
|
|
751
752
|
identifier: "john",
|
|
752
753
|
id: "123"
|
|
753
|
-
}), new Note({ summary: "Note 123 by john" }));
|
|
754
|
+
}), new vocab.Note({ summary: "Note 123 by john" }));
|
|
754
755
|
});
|
|
755
756
|
await t.step("RequestContext.clone()", () => {
|
|
756
757
|
const federation = createFederation({ kv });
|
|
@@ -798,7 +799,7 @@ test("Federation.fetch()", async (t) => {
|
|
|
798
799
|
});
|
|
799
800
|
federation.setActorDispatcher("/users/{identifier}", (ctx, identifier) => {
|
|
800
801
|
dispatches.push(identifier);
|
|
801
|
-
return new Person({
|
|
802
|
+
return new vocab.Person({
|
|
802
803
|
id: ctx.getActorUri(identifier),
|
|
803
804
|
inbox: ctx.getInboxUri(identifier),
|
|
804
805
|
preferredUsername: identifier
|
|
@@ -812,7 +813,7 @@ test("Federation.fetch()", async (t) => {
|
|
|
812
813
|
federation.setInboxDispatcher("/users/{identifier}/inbox", () => {
|
|
813
814
|
return { items: [] };
|
|
814
815
|
});
|
|
815
|
-
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, (_ctx, activity) => {
|
|
816
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(vocab.Create, (_ctx, activity) => {
|
|
816
817
|
inbox.push(activity.id.toString());
|
|
817
818
|
return;
|
|
818
819
|
});
|
|
@@ -970,7 +971,7 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
|
970
971
|
}
|
|
971
972
|
});
|
|
972
973
|
const inbox = [];
|
|
973
|
-
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, (ctx, create) => {
|
|
974
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(vocab.Create, (ctx, create) => {
|
|
974
975
|
inbox.push([ctx, create]);
|
|
975
976
|
});
|
|
976
977
|
let response = await federation.fetch(new Request("https://example.com/inbox", {
|
|
@@ -979,7 +980,7 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
|
979
980
|
}), { contextData: void 0 });
|
|
980
981
|
assertEquals(inbox, []);
|
|
981
982
|
assertEquals(response.status, 404);
|
|
982
|
-
federation.setActorDispatcher("/users/{identifier}", (_, identifier) => identifier === "john" ? new Person({}) : null).setKeyPairsDispatcher(() => [{
|
|
983
|
+
federation.setActorDispatcher("/users/{identifier}", (_, identifier) => identifier === "john" ? new vocab.Person({}) : null).setKeyPairsDispatcher(() => [{
|
|
983
984
|
privateKey: rsaPrivateKey2,
|
|
984
985
|
publicKey: rsaPublicKey2.publicKey
|
|
985
986
|
}]);
|
|
@@ -987,7 +988,7 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
|
987
988
|
documentLoader: mockDocumentLoader,
|
|
988
989
|
contextLoader: mockDocumentLoader
|
|
989
990
|
};
|
|
990
|
-
const activity = () => new Create({
|
|
991
|
+
const activity = () => new vocab.Create({
|
|
991
992
|
id: new URL("https://example.com/activities/" + crypto.randomUUID()),
|
|
992
993
|
actor: new URL("https://example.com/person2")
|
|
993
994
|
});
|
|
@@ -1104,18 +1105,18 @@ test("Federation.setInboxListeners()", async (t) => {
|
|
|
1104
1105
|
};
|
|
1105
1106
|
}
|
|
1106
1107
|
});
|
|
1107
|
-
federation.setActorDispatcher("/users/{identifier}", (_, identifier) => identifier === "john" ? new Person({}) : null).setKeyPairsDispatcher(() => [{
|
|
1108
|
+
federation.setActorDispatcher("/users/{identifier}", (_, identifier) => identifier === "john" ? new vocab.Person({}) : null).setKeyPairsDispatcher(() => [{
|
|
1108
1109
|
privateKey: rsaPrivateKey2,
|
|
1109
1110
|
publicKey: rsaPublicKey2.publicKey
|
|
1110
1111
|
}]);
|
|
1111
1112
|
const error = /* @__PURE__ */ new Error("test");
|
|
1112
1113
|
const errors = [];
|
|
1113
|
-
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, () => {
|
|
1114
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(vocab.Create, () => {
|
|
1114
1115
|
throw error;
|
|
1115
1116
|
}).onError((_, e) => {
|
|
1116
1117
|
errors.push(e);
|
|
1117
1118
|
});
|
|
1118
|
-
const activity = new Create({ actor: new URL("https://example.com/person") });
|
|
1119
|
+
const activity = new vocab.Create({ actor: new URL("https://example.com/person") });
|
|
1119
1120
|
let request = new Request("https://example.com/users/john/inbox", {
|
|
1120
1121
|
method: "POST",
|
|
1121
1122
|
headers: {
|
|
@@ -1174,8 +1175,8 @@ test("FederationImpl.sendActivity()", async (t) => {
|
|
|
1174
1175
|
let json = await cl.request.json();
|
|
1175
1176
|
if (await verifyJsonLd(json, options)) verified.push("ld");
|
|
1176
1177
|
json = detachSignature(json);
|
|
1177
|
-
let activity = await verifyObject(Activity, json, options);
|
|
1178
|
-
if (activity == null) activity = await Activity.fromJsonLd(json, options);
|
|
1178
|
+
let activity = await verifyObject(vocab.Activity, json, options);
|
|
1179
|
+
if (activity == null) activity = await vocab.Activity.fromJsonLd(json, options);
|
|
1179
1180
|
else verified.push("proof");
|
|
1180
1181
|
const key = await verifyRequest(request, options);
|
|
1181
1182
|
if (key != null && await doesActorOwnKey(activity, key, options)) verified.push("http");
|
|
@@ -1185,11 +1186,11 @@ test("FederationImpl.sendActivity()", async (t) => {
|
|
|
1185
1186
|
const kv = new MemoryKvStore();
|
|
1186
1187
|
const federation = new FederationImpl({
|
|
1187
1188
|
kv,
|
|
1188
|
-
|
|
1189
|
+
contextLoaderFactory: () => mockDocumentLoader
|
|
1189
1190
|
});
|
|
1190
1191
|
const context = federation.createContext(new URL("https://example.com/"));
|
|
1191
1192
|
await t.step("success", async () => {
|
|
1192
|
-
const activity = new Create({
|
|
1193
|
+
const activity = new vocab.Create({
|
|
1193
1194
|
id: new URL("https://example.com/activity/1"),
|
|
1194
1195
|
actor: new URL("https://example.com/person")
|
|
1195
1196
|
});
|
|
@@ -1264,7 +1265,7 @@ test("FederationImpl.processQueuedTask()", async (t) => {
|
|
|
1264
1265
|
kv,
|
|
1265
1266
|
queue
|
|
1266
1267
|
});
|
|
1267
|
-
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, () => {
|
|
1268
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(vocab.Create, () => {
|
|
1268
1269
|
throw new Error("Intended error for testing");
|
|
1269
1270
|
});
|
|
1270
1271
|
await assertRejects(() => federation.processQueuedTask(void 0, {
|
|
@@ -1326,7 +1327,7 @@ test("FederationImpl.processQueuedTask()", async (t) => {
|
|
|
1326
1327
|
kv,
|
|
1327
1328
|
queue
|
|
1328
1329
|
});
|
|
1329
|
-
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(Create, () => {
|
|
1330
|
+
federation.setInboxListeners("/users/{identifier}/inbox", "/inbox").on(vocab.Create, () => {
|
|
1330
1331
|
throw new Error("Intended error for testing");
|
|
1331
1332
|
});
|
|
1332
1333
|
const outboxMessage = {
|
|
@@ -1411,7 +1412,7 @@ test("ContextImpl.lookupObject()", async (t) => {
|
|
|
1411
1412
|
});
|
|
1412
1413
|
const ctx = federation.createContext(new URL("https://example.com/"));
|
|
1413
1414
|
const result = await ctx.lookupObject("@test@localhost");
|
|
1414
|
-
assertInstanceOf(result, Person);
|
|
1415
|
+
assertInstanceOf(result, vocab.Person);
|
|
1415
1416
|
assertEquals(result.id, new URL("https://localhost/actor"));
|
|
1416
1417
|
assertEquals(result.preferredUsername, "test");
|
|
1417
1418
|
});
|
|
@@ -1460,8 +1461,8 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
1460
1461
|
let json = await cl.request.json();
|
|
1461
1462
|
if (await verifyJsonLd(json, options)) verified.push("ld");
|
|
1462
1463
|
json = detachSignature(json);
|
|
1463
|
-
let activity = await verifyObject(Activity, json, options);
|
|
1464
|
-
if (activity == null) activity = await Activity.fromJsonLd(json, options);
|
|
1464
|
+
let activity = await verifyObject(vocab.Activity, json, options);
|
|
1465
|
+
if (activity == null) activity = await vocab.Activity.fromJsonLd(json, options);
|
|
1465
1466
|
else verified.push("proof");
|
|
1466
1467
|
const key = await verifyRequest(request, options);
|
|
1467
1468
|
if (key != null && await doesActorOwnKey(activity, key, options)) verified.push("http");
|
|
@@ -1471,12 +1472,12 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
1471
1472
|
const kv = new MemoryKvStore();
|
|
1472
1473
|
const federation = new FederationImpl({
|
|
1473
1474
|
kv,
|
|
1474
|
-
|
|
1475
|
+
contextLoaderFactory: () => mockDocumentLoader
|
|
1475
1476
|
});
|
|
1476
1477
|
federation.setActorDispatcher("/{identifier}", async (ctx, identifier) => {
|
|
1477
1478
|
if (identifier !== "1") return null;
|
|
1478
1479
|
const keys = await ctx.getActorKeyPairs(identifier);
|
|
1479
|
-
return new Person({
|
|
1480
|
+
return new vocab.Person({
|
|
1480
1481
|
id: ctx.getActorUri(identifier),
|
|
1481
1482
|
preferredUsername: "john",
|
|
1482
1483
|
publicKey: keys[0].cryptographicKey,
|
|
@@ -1497,7 +1498,7 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
1497
1498
|
inboxId: new URL("https://example.com/inbox")
|
|
1498
1499
|
}] }));
|
|
1499
1500
|
await t.step("success", async () => {
|
|
1500
|
-
const activity = new Create({ actor: new URL("https://example.com/person") });
|
|
1501
|
+
const activity = new vocab.Create({ actor: new URL("https://example.com/person") });
|
|
1501
1502
|
const ctx = new ContextImpl({
|
|
1502
1503
|
data: void 0,
|
|
1503
1504
|
federation,
|
|
@@ -1580,13 +1581,13 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
1580
1581
|
};
|
|
1581
1582
|
const federation2 = new FederationImpl({
|
|
1582
1583
|
kv,
|
|
1583
|
-
|
|
1584
|
+
contextLoaderFactory: () => mockDocumentLoader,
|
|
1584
1585
|
queue
|
|
1585
1586
|
});
|
|
1586
1587
|
federation2.setActorDispatcher("/{identifier}", async (ctx, identifier) => {
|
|
1587
1588
|
if (identifier !== "john") return null;
|
|
1588
1589
|
const keys = await ctx.getActorKeyPairs(identifier);
|
|
1589
|
-
return new Person({
|
|
1590
|
+
return new vocab.Person({
|
|
1590
1591
|
id: ctx.getActorUri(identifier),
|
|
1591
1592
|
preferredUsername: "john",
|
|
1592
1593
|
publicKey: keys[0].cryptographicKey,
|
|
@@ -1610,7 +1611,7 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
1610
1611
|
contextLoader: fetchDocumentLoader
|
|
1611
1612
|
});
|
|
1612
1613
|
await t.step("fanout: \"force\"", async () => {
|
|
1613
|
-
const activity = new Create({
|
|
1614
|
+
const activity = new vocab.Create({
|
|
1614
1615
|
id: new URL("https://example.com/activity/1"),
|
|
1615
1616
|
actor: new URL("https://example.com/person")
|
|
1616
1617
|
});
|
|
@@ -1639,7 +1640,7 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
1639
1640
|
});
|
|
1640
1641
|
queue.clear();
|
|
1641
1642
|
await t.step("fanout: \"skip\"", async () => {
|
|
1642
|
-
const activity = new Create({
|
|
1643
|
+
const activity = new vocab.Create({
|
|
1643
1644
|
id: new URL("https://example.com/activity/1"),
|
|
1644
1645
|
actor: new URL("https://example.com/person")
|
|
1645
1646
|
});
|
|
@@ -1654,7 +1655,7 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
1654
1655
|
});
|
|
1655
1656
|
queue.clear();
|
|
1656
1657
|
await t.step("fanout: \"auto\"", async () => {
|
|
1657
|
-
const activity = new Create({
|
|
1658
|
+
const activity = new vocab.Create({
|
|
1658
1659
|
id: new URL("https://example.com/activity/1"),
|
|
1659
1660
|
actor: new URL("https://example.com/person")
|
|
1660
1661
|
});
|
|
@@ -1703,7 +1704,7 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
1703
1704
|
documentLoader: fetchDocumentLoader,
|
|
1704
1705
|
contextLoader: fetchDocumentLoader
|
|
1705
1706
|
});
|
|
1706
|
-
const activity = new Create({
|
|
1707
|
+
const activity = new vocab.Create({
|
|
1707
1708
|
id: new URL("https://example.com/activity/1"),
|
|
1708
1709
|
actor: ctx.getActorUri("1"),
|
|
1709
1710
|
to: ctx.getFollowersUri("1")
|
|
@@ -1720,7 +1721,7 @@ test("ContextImpl.sendActivity()", async (t) => {
|
|
|
1720
1721
|
documentLoader: fetchDocumentLoader,
|
|
1721
1722
|
contextLoader: fetchDocumentLoader
|
|
1722
1723
|
});
|
|
1723
|
-
const activity = new Create({
|
|
1724
|
+
const activity = new vocab.Create({
|
|
1724
1725
|
id: new URL("https://example.com/activity/2"),
|
|
1725
1726
|
actor: ctx.getActorUri("1"),
|
|
1726
1727
|
to: ctx.getFollowersUri("1")
|
|
@@ -1742,7 +1743,7 @@ test({
|
|
|
1742
1743
|
async fn() {
|
|
1743
1744
|
const federation = new FederationImpl({ kv: new MemoryKvStore() });
|
|
1744
1745
|
const activities = [];
|
|
1745
|
-
federation.setInboxListeners("/u/{identifier}/i", "/i").on(Offer, (ctx$1, offer) => {
|
|
1746
|
+
federation.setInboxListeners("/u/{identifier}/i", "/i").on(vocab.Offer, (ctx$1, offer) => {
|
|
1746
1747
|
activities.push([ctx$1.recipient, offer]);
|
|
1747
1748
|
});
|
|
1748
1749
|
const ctx = new ContextImpl({
|
|
@@ -1752,52 +1753,52 @@ test({
|
|
|
1752
1753
|
documentLoader: mockDocumentLoader,
|
|
1753
1754
|
contextLoader: fetchDocumentLoader
|
|
1754
1755
|
});
|
|
1755
|
-
assertFalse(await ctx.routeActivity(null, new Offer({ actor: new URL("https://example.com/person") })));
|
|
1756
|
+
assertFalse(await ctx.routeActivity(null, new vocab.Offer({ actor: new URL("https://example.com/person") })));
|
|
1756
1757
|
assertEquals(activities, []);
|
|
1757
|
-
const signedOffer = await signObject(new Offer({ actor: new URL("https://example.com/person2") }), ed25519PrivateKey, ed25519Multikey.id);
|
|
1758
|
+
const signedOffer = await signObject(new vocab.Offer({ actor: new URL("https://example.com/person2") }), ed25519PrivateKey, ed25519Multikey.id);
|
|
1758
1759
|
assert(await ctx.routeActivity(null, signedOffer));
|
|
1759
1760
|
assertEquals(activities, [[null, signedOffer]]);
|
|
1760
|
-
const signedInvite = await signObject(new Invite({ actor: new URL("https://example.com/person2") }), ed25519PrivateKey, ed25519Multikey.id);
|
|
1761
|
+
const signedInvite = await signObject(new vocab.Invite({ actor: new URL("https://example.com/person2") }), ed25519PrivateKey, ed25519Multikey.id);
|
|
1761
1762
|
assert(await ctx.routeActivity("id", signedInvite));
|
|
1762
1763
|
assertEquals(activities, [[null, signedOffer], ["id", signedInvite]]);
|
|
1763
|
-
assertFalse(await ctx.routeActivity(null, new Create({
|
|
1764
|
+
assertFalse(await ctx.routeActivity(null, new vocab.Create({
|
|
1764
1765
|
id: new URL("https://example.com/not-found"),
|
|
1765
1766
|
actor: new URL("https://example.com/person")
|
|
1766
1767
|
})));
|
|
1767
1768
|
assertEquals(activities, [[null, signedOffer], ["id", signedInvite]]);
|
|
1768
|
-
assertFalse(await ctx.routeActivity(null, new Create({
|
|
1769
|
+
assertFalse(await ctx.routeActivity(null, new vocab.Create({
|
|
1769
1770
|
id: new URL("https://example.com/person"),
|
|
1770
1771
|
actor: new URL("https://example.com/person")
|
|
1771
1772
|
})));
|
|
1772
1773
|
assertEquals(activities, [[null, signedOffer], ["id", signedInvite]]);
|
|
1773
|
-
assertFalse(await ctx.routeActivity(null, new Announce({
|
|
1774
|
+
assertFalse(await ctx.routeActivity(null, new vocab.Announce({
|
|
1774
1775
|
id: new URL("https://example.com/announce#diffrent-id"),
|
|
1775
1776
|
actor: new URL("https://example.com/person")
|
|
1776
1777
|
})));
|
|
1777
1778
|
assertEquals(activities, [[null, signedOffer], ["id", signedInvite]]);
|
|
1778
|
-
assertFalse(await ctx.routeActivity(null, new Announce({
|
|
1779
|
+
assertFalse(await ctx.routeActivity(null, new vocab.Announce({
|
|
1779
1780
|
id: new URL("https://example.com/announce"),
|
|
1780
1781
|
actor: new URL("https://example.com/person")
|
|
1781
1782
|
})));
|
|
1782
1783
|
assertEquals(activities, [[null, signedOffer], ["id", signedInvite]]);
|
|
1783
|
-
assertFalse(await ctx.routeActivity(null, new Create({
|
|
1784
|
+
assertFalse(await ctx.routeActivity(null, new vocab.Create({
|
|
1784
1785
|
id: new URL("https://example.com/cross-origin-actor"),
|
|
1785
1786
|
actor: new URL("https://cross-origin.com/actor")
|
|
1786
1787
|
})));
|
|
1787
1788
|
assertEquals(activities, [[null, signedOffer], ["id", signedInvite]]);
|
|
1788
|
-
assert(await ctx.routeActivity(null, new Create({
|
|
1789
|
+
assert(await ctx.routeActivity(null, new vocab.Create({
|
|
1789
1790
|
id: new URL("https://example.com/create"),
|
|
1790
1791
|
actor: new URL("https://example.com/person")
|
|
1791
1792
|
})));
|
|
1792
1793
|
assertEquals(activities, [[null, signedOffer], ["id", signedInvite]]);
|
|
1793
|
-
assert(await ctx.routeActivity(null, new Invite({
|
|
1794
|
+
assert(await ctx.routeActivity(null, new vocab.Invite({
|
|
1794
1795
|
id: new URL("https://example.com/invite"),
|
|
1795
1796
|
actor: new URL("https://example.com/person")
|
|
1796
1797
|
})));
|
|
1797
1798
|
assertEquals(activities, [
|
|
1798
1799
|
[null, signedOffer],
|
|
1799
1800
|
["id", signedInvite],
|
|
1800
|
-
[null, new Invite({
|
|
1801
|
+
[null, new vocab.Invite({
|
|
1801
1802
|
id: new URL("https://example.com/invite"),
|
|
1802
1803
|
actor: new URL("https://example.com/person"),
|
|
1803
1804
|
object: new URL("https://example.com/object")
|
|
@@ -1819,15 +1820,15 @@ test("ContextImpl.getCollectionUri()", () => {
|
|
|
1819
1820
|
const dispatcher = (_ctx, _values) => ({ items: [] });
|
|
1820
1821
|
let url;
|
|
1821
1822
|
const strName = "registered";
|
|
1822
|
-
federation.setCollectionDispatcher(strName, Object
|
|
1823
|
+
federation.setCollectionDispatcher(strName, vocab.Object, "/string-route/{id}", dispatcher);
|
|
1823
1824
|
url = ctx.getCollectionUri(strName, values);
|
|
1824
1825
|
assertEquals(url.href, `${base}/string-route/123`);
|
|
1825
1826
|
const unnamedSymName = Symbol(strName);
|
|
1826
|
-
federation.setCollectionDispatcher(unnamedSymName, Object
|
|
1827
|
+
federation.setCollectionDispatcher(unnamedSymName, vocab.Object, "/symbol-route/{id}", dispatcher);
|
|
1827
1828
|
url = ctx.getCollectionUri(unnamedSymName, values);
|
|
1828
1829
|
assertEquals(url.href, `${base}/symbol-route/123`);
|
|
1829
1830
|
const namedSymName = Symbol.for(strName);
|
|
1830
|
-
federation.setCollectionDispatcher(namedSymName, Object
|
|
1831
|
+
federation.setCollectionDispatcher(namedSymName, vocab.Object, "/named-symbol-route/{id}", dispatcher);
|
|
1831
1832
|
url = ctx.getCollectionUri(namedSymName, values);
|
|
1832
1833
|
assertEquals(url.href, `${base}/named-symbol-route/123`);
|
|
1833
1834
|
const notReg = "not-registered";
|
|
@@ -1849,8 +1850,8 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
1849
1850
|
let json = await cl.request.json();
|
|
1850
1851
|
if (await verifyJsonLd(json, options)) verified.push("ld");
|
|
1851
1852
|
json = detachSignature(json);
|
|
1852
|
-
let activity = await verifyObject(Activity, json, options);
|
|
1853
|
-
if (activity == null) activity = await Activity.fromJsonLd(json, options);
|
|
1853
|
+
let activity = await verifyObject(vocab.Activity, json, options);
|
|
1854
|
+
if (activity == null) activity = await vocab.Activity.fromJsonLd(json, options);
|
|
1854
1855
|
else verified.push("proof");
|
|
1855
1856
|
const key = await verifyRequest(request, options);
|
|
1856
1857
|
if (key != null && await doesActorOwnKey(activity, key, options)) verified.push("http");
|
|
@@ -1860,7 +1861,7 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
1860
1861
|
const kv = new MemoryKvStore();
|
|
1861
1862
|
const federation = new FederationImpl({
|
|
1862
1863
|
kv,
|
|
1863
|
-
|
|
1864
|
+
contextLoaderFactory: () => mockDocumentLoader
|
|
1864
1865
|
});
|
|
1865
1866
|
await t.step("skip", async () => {
|
|
1866
1867
|
const activity = {
|
|
@@ -1909,7 +1910,7 @@ test("InboxContextImpl.forwardActivity()", async (t) => {
|
|
|
1909
1910
|
assertEquals(verified, []);
|
|
1910
1911
|
});
|
|
1911
1912
|
await t.step("Object Integrity Proofs", async () => {
|
|
1912
|
-
const activity = await signObject(new Create({
|
|
1913
|
+
const activity = await signObject(new vocab.Create({
|
|
1913
1914
|
id: new URL("https://example.com/activity"),
|
|
1914
1915
|
actor: new URL("https://example.com/person2")
|
|
1915
1916
|
}), ed25519PrivateKey, ed25519Multikey.id, {
|
package/dist/federation/mod.cjs
CHANGED
|
@@ -2,18 +2,13 @@
|
|
|
2
2
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
3
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
4
|
|
|
5
|
-
require('../transformers-
|
|
6
|
-
require('../
|
|
7
|
-
require('../
|
|
8
|
-
|
|
9
|
-
require('../
|
|
10
|
-
require('../
|
|
11
|
-
require('../
|
|
12
|
-
require('../proof-B-eqv0Ug.cjs');
|
|
13
|
-
const require_federation = require('../federation-H2_En3j5.cjs');
|
|
14
|
-
require('../types-zqdWZh4O.cjs');
|
|
15
|
-
require('../authdocloader-OSn_teLV.cjs');
|
|
16
|
-
require('../vocab-B39-pFl9.cjs');
|
|
5
|
+
require('../transformers-BjBg6Lag.cjs');
|
|
6
|
+
require('../http-7RQPvAkX.cjs');
|
|
7
|
+
const require_middleware = require('../middleware-TufpQUzj.cjs');
|
|
8
|
+
require('../proof-CaDQpGJD.cjs');
|
|
9
|
+
const require_federation = require('../federation-B431K2gm.cjs');
|
|
10
|
+
require('../types-B6z6CqIz.cjs');
|
|
11
|
+
require('../kv-cache-BVA7CrnS.cjs');
|
|
17
12
|
|
|
18
13
|
exports.InProcessMessageQueue = require_federation.InProcessMessageQueue;
|
|
19
14
|
exports.MemoryKvStore = require_federation.MemoryKvStore;
|
|
@@ -25,5 +20,6 @@ exports.createExponentialBackoffPolicy = require_middleware.createExponentialBac
|
|
|
25
20
|
exports.createFederation = require_middleware.createFederation;
|
|
26
21
|
exports.createFederationBuilder = require_middleware.createFederationBuilder;
|
|
27
22
|
exports.digest = require_middleware.digest;
|
|
23
|
+
exports.handleWebFinger = require_middleware.handleWebFinger;
|
|
28
24
|
exports.respondWithObject = require_middleware.respondWithObject;
|
|
29
25
|
exports.respondWithObjectIfAcceptable = require_middleware.respondWithObjectIfAcceptable;
|