@fedify/fedify 2.0.0-dev.1485 → 2.0.0-dev.149
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 +38 -18
- package/dist/actor-CCAL5-E_.cjs +42079 -0
- package/dist/{actor-7ivEf1H3.js → actor-DYdPViDz.js} +4 -1
- package/dist/{actor-C22bXuuC.d.ts → actor-DqFajh9s.d.ts} +2 -2
- package/dist/{actor-DXTdNCfp.js → actor-U_BZZ2ps.js} +7058 -2722
- package/dist/actor-f2NtjyCg.d.cts +128 -0
- package/dist/{assert-MZs1qjMx.js → assert-Dp5_aoAs.js} +1 -1
- package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-D1m8F7x0.js} +1 -1
- package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals-B2R_8p36.js} +1 -1
- package/dist/{assert_rejects-DiIiJbZn.js → assert_rejects-BoKYY0g1.js} +2 -2
- package/dist/{assert_is_error-BPGph1Jx.js → assert_throws-DjkXin1a.js} +32 -2
- package/dist/{builder-BPGqEvtB.js → builder-CYR2yKqn.js} +20 -8
- package/dist/chunk-DqRYRqnO.cjs +34 -0
- package/dist/chunk-HsBuZ-b2.js +41 -0
- package/dist/client-94iWEfQa.d.cts +222 -0
- package/dist/{client-DF8anIB5.d.ts → client-BsGzbnV-.d.ts} +3 -75
- package/dist/{client-g2FDBoeY.js → client-CD87uCL_.js} +4 -23
- package/dist/compat/mod.cjs +10 -0
- package/dist/compat/mod.d.cts +11 -0
- package/dist/compat/mod.d.ts +10 -12
- package/dist/compat/mod.js +5 -5
- package/dist/compat/transformers.test.js +29 -24
- package/dist/compat-DmDDELst.cjs +4 -0
- package/dist/compat-nxUqe4Z-.js +4 -0
- package/dist/context-DBQ7nMCw.d.cts +2449 -0
- package/dist/context-DH7LHJdw.js +109 -0
- package/dist/{context-DmlbRh9p.d.ts → context-mM0Nu5yo.d.ts} +335 -134
- package/dist/deno-BTeveqhY.js +131 -0
- package/dist/{testing-BG_8Fyas.js → dist-lStjlyET.js} +73 -114
- package/dist/{authdocloader-D_IvQE4z.js → docloader-BSGGKhrl.js} +17 -8
- package/dist/{esm-CPZhxxGc.js → esm-B52TuumP.js} +32 -17
- package/dist/federation/builder.test.js +16 -16
- package/dist/federation/collection.test.js +9 -12
- package/dist/federation/handler.test.js +123 -152
- package/dist/federation/idempotency.test.js +206 -0
- package/dist/federation/inbox.test.js +7 -7
- package/dist/federation/keycache.test.js +7 -8
- package/dist/federation/kv.test.js +64 -12
- package/dist/federation/middleware.test.js +281 -99
- package/dist/federation/mod.cjs +27 -0
- package/dist/federation/mod.d.cts +11 -0
- package/dist/federation/mod.d.ts +11 -13
- package/dist/federation/mod.js +13 -15
- package/dist/federation/mq.test.js +12 -13
- package/dist/federation/negotiation.test.js +25 -0
- package/dist/federation/retry.test.js +4 -6
- package/dist/federation/router.test.js +9 -11
- package/dist/federation/send.test.js +61 -18
- package/dist/federation-CoW-KDKv.cjs +266 -0
- package/dist/{federation-CMX7WzeL.js → federation-D0hkM4T7.js} +25 -3
- package/dist/{http-C7rxW7Kh.js → http-BIDOYI9f.js} +4 -3
- package/dist/{http-zsOxPKCt.js → http-BQRnmfXP.js} +260 -10
- package/dist/{http-DqSNLFNY.d.ts → http-BbO0ejuk.d.ts} +2 -2
- package/dist/http-DtYHWbwa.cjs +1106 -0
- package/dist/http-M8k5mKc0.d.cts +253 -0
- package/dist/{inbox-eK2W2MF3.js → inbox-DNjplQSR.js} +26 -7
- package/dist/{key-CYOcZ9G5.js → key-dws2_YsP.js} +4 -2
- package/dist/{keycache-BLq6GT4_.js → keycache-BbbXRjc-.js} +1 -1
- package/dist/{keys-BIwlbtMN.js → keys-C6QyjjIN.js} +2 -1
- package/dist/{kv-C7sopW2E.d.ts → kv-BpJND1Hr.d.ts} +30 -1
- package/dist/{kv-CRZrzyXm.js → kv-DaWUKuhD.js} +22 -0
- package/dist/kv-cD_d4hg-.d.cts +110 -0
- package/dist/kv-cache-1_lcnUMp.cjs +134 -0
- package/dist/kv-cache-BEP4OyiZ.js +122 -0
- package/dist/kv-cache-C6NrTtII.js +107 -0
- package/dist/{ld-DWwLYT4e.js → ld-C6UrncJk.js} +7 -4
- package/dist/lookup-BORWbouU.cjs +268 -0
- package/dist/lookup-BV72lfsA.js +256 -0
- package/dist/{lookup-DNQyH8UQ.js → lookup-BoiLMtAx.js} +33 -125
- package/dist/{lookup-BHYMosdS.js → lookup-yv_aH7K7.js} +3 -1
- package/dist/{middleware-BcVqlHyD.js → middleware--1K3DAB8.js} +143 -136
- package/dist/middleware-7Yg2p_nl.js +31 -0
- package/dist/{middleware-DakCaqXu.js → middleware-8Oymc6Na.js} +105 -188
- package/dist/middleware-C6YBw2qx.cjs +15 -0
- package/dist/middleware-D6XNERu3.js +15 -0
- package/dist/middleware-DBHDivdC.cjs +4237 -0
- package/dist/mod-B-hUPT2N.d.cts +1 -0
- package/dist/{mod-Cxt4Kpf6.d.ts → mod-BlVovdcy.d.ts} +20 -2
- package/dist/mod-BxRCHTz-.d.cts +307 -0
- package/dist/mod-C58MZ7Wx.d.cts +113 -0
- package/dist/mod-CAdoBu0x.d.ts +109 -0
- package/dist/mod-CcDPcLJW.d.cts +1 -0
- package/dist/{mod-Drmz72EK.d.ts → mod-D5Z2tISD.d.ts} +3 -3
- package/dist/mod-DgxG-byT.d.cts +266 -0
- package/dist/{lookup-3czM5mmU.d.ts → mod-Ds0mpFZU.d.ts} +9 -2
- package/dist/mod-Dy2fJtmN.d.cts +80 -0
- package/dist/{mod-0EysZ-dJ.d.ts → mod-GetHzY6F.d.ts} +2 -2
- package/dist/mod-fxr25Gv7.d.cts +107 -0
- package/dist/mod.cjs +137 -0
- package/dist/mod.d.cts +15 -0
- package/dist/mod.d.ts +15 -18
- package/dist/mod.js +19 -21
- package/dist/negotiation-B4NJHk1f.js +71 -0
- package/dist/nodeinfo/client.test.js +32 -114
- package/dist/nodeinfo/handler.test.js +35 -30
- package/dist/nodeinfo/mod.cjs +10 -0
- package/dist/nodeinfo/mod.d.cts +3 -0
- package/dist/nodeinfo/mod.d.ts +3 -5
- package/dist/nodeinfo/mod.js +6 -7
- package/dist/nodeinfo/types.test.js +10 -18
- package/dist/nodeinfo-BnthBobC.js +4 -0
- package/dist/nodeinfo-CdN0rEnZ.cjs +4 -0
- package/dist/otel/exporter.test.js +899 -0
- package/dist/otel/mod.cjs +262 -0
- package/dist/otel/mod.d.cts +230 -0
- package/dist/otel/mod.d.ts +232 -0
- package/dist/otel/mod.js +261 -0
- package/dist/owner-B4HbyP8s.d.cts +67 -0
- package/dist/{owner-smArESGi.js → owner-DQuVKHuY.js} +46 -8
- package/dist/{owner-CQPnQVtf.d.ts → owner-kQRGVXG1.d.ts} +3 -3
- package/dist/{proof-CT1SITRP.js → proof-BG2G4cDG.js} +53 -16
- package/dist/proof-C3K5Z8RT.cjs +710 -0
- package/dist/{proof-C6z-uqeO.js → proof-GrivUN5L.js} +5 -3
- package/dist/router-CVRQXlZi.js +118 -0
- package/dist/{send-1zdmNlUo.js → send-B_dTZyUD.js} +9 -4
- package/dist/sig/http.test.js +19 -17
- package/dist/sig/key.test.js +15 -14
- package/dist/sig/ld.test.js +13 -12
- package/dist/sig/mod.cjs +28 -0
- package/dist/sig/mod.d.cts +6 -0
- package/dist/sig/mod.d.ts +5 -7
- package/dist/sig/mod.js +8 -10
- package/dist/sig/owner.test.js +40 -15
- package/dist/sig/proof.test.js +19 -17
- package/dist/sig-C34-oHBl.js +4 -0
- package/dist/sig-YYj5tCnr.cjs +4 -0
- package/dist/{std__assert-X-_kMxKM.js → std__assert-Cm-MfI66.js} +1 -1
- package/dist/testing/mod.d.ts +410 -232
- package/dist/testing/mod.js +9 -4
- package/dist/{transformers-Dna8Fg7k.js → transformers-BFT6d7J5.js} +3 -3
- package/dist/transformers-CoBS-oFG.cjs +116 -0
- package/dist/type-BSNcIxTd.js +14 -0
- package/dist/{types-BzyGRkRt.js → types-BtUjyi5y.js} +9 -170
- package/dist/types-CWgzGaqk.cjs +315 -0
- package/dist/{types-BIgY6c-l.js → types-D2jhK2VG.js} +1 -3
- package/dist/{runtime/authdocloader.test.js → utils/docloader.test.js} +20 -18
- package/dist/utils/kv-cache.test.js +211 -0
- package/dist/utils/mod.cjs +12 -0
- package/dist/utils/mod.d.cts +5 -0
- package/dist/utils/mod.d.ts +7 -0
- package/dist/utils/mod.js +11 -0
- package/dist/utils-D-Va7aXC.js +4 -0
- package/dist/utils-DyRU1gdZ.cjs +4 -0
- package/dist/vocab/actor.test.js +15 -13
- package/dist/vocab/lookup.test.js +285 -12
- package/dist/vocab/mod.cjs +86 -0
- package/dist/vocab/mod.d.cts +4 -0
- package/dist/vocab/mod.d.ts +3 -5
- package/dist/vocab/mod.js +6 -7
- package/dist/vocab/type.test.js +4 -4
- package/dist/vocab/vocab.test.js +8058 -1987
- package/dist/{vocab-Bg1J3mu4.js → vocab-Aig1Fmi8.js} +32 -18
- package/dist/{vocab-SOE1ifCr.d.ts → vocab-BCWe1Ih5.d.ts} +292 -21
- package/dist/{type-I68qwqmo.js → vocab-C3nSleOZ.js} +6947 -7381
- package/dist/vocab-CeDBzu-f.d.cts +14903 -0
- package/dist/vocab-DFMYh9aV.cjs +296 -0
- package/dist/webfinger/handler.test.js +62 -29
- package/dist/webfinger/lookup.test.js +11 -12
- package/dist/webfinger/mod.cjs +8 -0
- package/dist/webfinger/mod.d.cts +2 -0
- package/dist/webfinger/mod.d.ts +1 -4
- package/dist/webfinger/mod.js +5 -6
- package/dist/webfinger-C72Y8lrh.js +4 -0
- package/dist/webfinger-vAtLmxOF.cjs +4 -0
- package/package.json +81 -45
- package/dist/assert_throws-BOO88avQ.js +0 -39
- package/dist/authdocloader-Bq0gEHRj.js +0 -52
- package/dist/compat-Bb5myD13.js +0 -4
- package/dist/denokv-Bv33Xxea.js +0 -57
- package/dist/docloader-BlVueewg.js +0 -4615
- package/dist/docloader-CxWcuWqQ.d.ts +0 -221
- 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/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-Dn7Lram-.js +0 -260
- package/dist/key-S7WllAWz.js +0 -10
- package/dist/key-rRCUafNm.js +0 -10
- package/dist/middleware-CWbGhXnl.js +0 -26
- package/dist/middleware-D-OlNiyj.js +0 -17
- package/dist/mod-TFoH2Ql8.d.ts +0 -104
- package/dist/mod-g0xFzAP9.d.ts +0 -2
- package/dist/mq-CRGm1e_F.d.ts +0 -143
- package/dist/nodeinfo/semver.test.js +0 -143
- package/dist/nodeinfo-CyEbLjHs.js +0 -4
- 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/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/runtime-BSkOVUWM.js +0 -4
- package/dist/semver-dArNLkR9.js +0 -149
- package/dist/sig-BXJO--F9.js +0 -4
- 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/vocab/schema.yaml +0 -247
- package/dist/webfinger-C3GIyXIg.js +0 -4
- 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.d.ts +0 -56
- package/dist/x/hono.js +0 -60
- package/dist/x/sveltekit.d.ts +0 -48
- package/dist/x/sveltekit.js +0 -68
- /package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Gbplq4lg.js} +0 -0
- /package/dist/{collection-CSzG2j1P.js → collection-CrkRM5Ep.js} +0 -0
- /package/dist/{nodeinfo/semver.test.d.ts → federation/idempotency.test.d.ts} +0 -0
- /package/dist/{runtime/authdocloader.test.d.ts → federation/negotiation.test.d.ts} +0 -0
- /package/dist/{mod-1pDWKvUL.d.ts → mod-CVgZgliM.d.ts} +0 -0
- /package/dist/{mod-GIh5OYxW.d.ts → mod-bjzj5QIb.d.ts} +0 -0
- /package/dist/{runtime/docloader.test.d.ts → otel/exporter.test.d.ts} +0 -0
- /package/dist/{retry-D4GJ670a.js → retry-Bz5pP75o.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
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { deno_default } from "./deno-BTeveqhY.js";
|
|
7
|
+
import { Activity, DataIntegrityProof, Multikey } from "./vocab-C3nSleOZ.js";
|
|
8
|
+
import { getTypeId } from "./type-BSNcIxTd.js";
|
|
9
|
+
import { fetchKey, validateCryptoKey } from "./key-dws2_YsP.js";
|
|
8
10
|
import { getLogger } from "@logtape/logtape";
|
|
9
11
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
12
|
import { encodeHex } from "byte-encodings/hex";
|
|
@@ -195,7 +197,7 @@ async function verifyProofInternal(jsonLd, proof, options) {
|
|
|
195
197
|
});
|
|
196
198
|
return null;
|
|
197
199
|
}
|
|
198
|
-
const verified = await crypto.subtle.verify("Ed25519", publicKey.publicKey, proof.proofValue, digest);
|
|
200
|
+
const verified = await crypto.subtle.verify("Ed25519", publicKey.publicKey, proof.proofValue.slice(), digest);
|
|
199
201
|
if (!verified) {
|
|
200
202
|
if (fetchedKey.cached) {
|
|
201
203
|
logger.debug("Failed to verify the proof with the cached key {keyId}; retrying with the freshly fetched key...", {
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
globalThis.addEventListener = () => {};
|
|
5
|
+
|
|
6
|
+
import { cloneDeep } from "es-toolkit";
|
|
7
|
+
import { Router } from "uri-template-router";
|
|
8
|
+
import { parseTemplate } from "url-template";
|
|
9
|
+
|
|
10
|
+
//#region src/federation/router.ts
|
|
11
|
+
function cloneInnerRouter(router) {
|
|
12
|
+
const clone = new Router();
|
|
13
|
+
clone.nid = router.nid;
|
|
14
|
+
clone.fsm = cloneDeep(router.fsm);
|
|
15
|
+
clone.routeSet = new Set(router.routeSet);
|
|
16
|
+
clone.templateRouteMap = new Map(router.templateRouteMap);
|
|
17
|
+
clone.valueRouteMap = new Map(router.valueRouteMap);
|
|
18
|
+
clone.hierarchy = cloneDeep(router.hierarchy);
|
|
19
|
+
return clone;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* URL router and constructor based on URI Template
|
|
23
|
+
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)).
|
|
24
|
+
*/
|
|
25
|
+
var Router$1 = class Router$1 {
|
|
26
|
+
#router;
|
|
27
|
+
#templates;
|
|
28
|
+
#templateStrings;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to ignore trailing slashes when matching paths.
|
|
31
|
+
* @since 1.6.0
|
|
32
|
+
*/
|
|
33
|
+
trailingSlashInsensitive;
|
|
34
|
+
/**
|
|
35
|
+
* Create a new {@link Router}.
|
|
36
|
+
* @param options Options for the router.
|
|
37
|
+
*/
|
|
38
|
+
constructor(options = {}) {
|
|
39
|
+
this.#router = new Router();
|
|
40
|
+
this.#templates = {};
|
|
41
|
+
this.#templateStrings = {};
|
|
42
|
+
this.trailingSlashInsensitive = options.trailingSlashInsensitive ?? false;
|
|
43
|
+
}
|
|
44
|
+
clone() {
|
|
45
|
+
const clone = new Router$1({ trailingSlashInsensitive: this.trailingSlashInsensitive });
|
|
46
|
+
clone.#router = cloneInnerRouter(this.#router);
|
|
47
|
+
clone.#templates = { ...this.#templates };
|
|
48
|
+
clone.#templateStrings = { ...this.#templateStrings };
|
|
49
|
+
return clone;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Checks if a path name exists in the router.
|
|
53
|
+
* @param name The name of the path.
|
|
54
|
+
* @returns `true` if the path name exists, otherwise `false`.
|
|
55
|
+
*/
|
|
56
|
+
has(name) {
|
|
57
|
+
return name in this.#templates;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Adds a new path rule to the router.
|
|
61
|
+
* @param template The path pattern.
|
|
62
|
+
* @param name The name of the path.
|
|
63
|
+
* @returns The names of the variables in the path pattern.
|
|
64
|
+
*/
|
|
65
|
+
add(template, name) {
|
|
66
|
+
if (!template.startsWith("/")) throw new RouterError("Path must start with a slash.");
|
|
67
|
+
const rule = this.#router.addTemplate(template, {}, name);
|
|
68
|
+
this.#templates[name] = parseTemplate(template);
|
|
69
|
+
this.#templateStrings[name] = template;
|
|
70
|
+
return new Set(rule.variables.map((v) => v.varname));
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Resolves a path name and values from a URL, if any match.
|
|
74
|
+
* @param url The URL to resolve.
|
|
75
|
+
* @returns The name of the path and its values, if any match. Otherwise,
|
|
76
|
+
* `null`.
|
|
77
|
+
*/
|
|
78
|
+
route(url) {
|
|
79
|
+
let match = this.#router.resolveURI(url);
|
|
80
|
+
if (match == null) {
|
|
81
|
+
if (!this.trailingSlashInsensitive) return null;
|
|
82
|
+
url = url.endsWith("/") ? url.replace(/\/+$/, "") : `${url}/`;
|
|
83
|
+
match = this.#router.resolveURI(url);
|
|
84
|
+
if (match == null) return null;
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
name: match.matchValue,
|
|
88
|
+
template: this.#templateStrings[match.matchValue],
|
|
89
|
+
values: match.params
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Constructs a URL/path from a path name and values.
|
|
94
|
+
* @param name The name of the path.
|
|
95
|
+
* @param values The values to expand the path with.
|
|
96
|
+
* @returns The URL/path, if the name exists. Otherwise, `null`.
|
|
97
|
+
*/
|
|
98
|
+
build(name, values) {
|
|
99
|
+
if (name in this.#templates) return this.#templates[name].expand(values);
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* An error thrown by the {@link Router}.
|
|
105
|
+
*/
|
|
106
|
+
var RouterError = class extends Error {
|
|
107
|
+
/**
|
|
108
|
+
* Create a new {@link RouterError}.
|
|
109
|
+
* @param message The error message.
|
|
110
|
+
*/
|
|
111
|
+
constructor(message) {
|
|
112
|
+
super(message);
|
|
113
|
+
this.name = "RouterError";
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
//#endregion
|
|
118
|
+
export { Router$1 as Router, RouterError };
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { deno_default } from "./
|
|
7
|
-
import { doubleKnock } from "./http-
|
|
6
|
+
import { deno_default } from "./deno-BTeveqhY.js";
|
|
7
|
+
import { doubleKnock } from "./http-BIDOYI9f.js";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
|
|
@@ -55,7 +55,7 @@ function sendActivity(options) {
|
|
|
55
55
|
await sendActivityInternal({
|
|
56
56
|
...options,
|
|
57
57
|
tracerProvider
|
|
58
|
-
});
|
|
58
|
+
}, span);
|
|
59
59
|
} catch (e) {
|
|
60
60
|
span.setStatus({
|
|
61
61
|
code: SpanStatusCode.ERROR,
|
|
@@ -67,7 +67,7 @@ function sendActivity(options) {
|
|
|
67
67
|
}
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
async function sendActivityInternal({ activity, activityId, keys, inbox, headers, specDeterminer, tracerProvider }) {
|
|
70
|
+
async function sendActivityInternal({ activity, activityId, keys, inbox, headers, specDeterminer, tracerProvider }, span) {
|
|
71
71
|
const logger = getLogger([
|
|
72
72
|
"fedify",
|
|
73
73
|
"federation",
|
|
@@ -122,6 +122,11 @@ async function sendActivityInternal({ activity, activityId, keys, inbox, headers
|
|
|
122
122
|
});
|
|
123
123
|
throw new Error(`Failed to send activity ${activityId} to ${inbox.href} (${response.status} ${response.statusText}):\n${error}`);
|
|
124
124
|
}
|
|
125
|
+
span.addEvent("activitypub.activity.sent", {
|
|
126
|
+
"activitypub.activity.json": JSON.stringify(activity),
|
|
127
|
+
"activitypub.inbox.url": inbox.href,
|
|
128
|
+
"activitypub.activity.id": activityId ?? ""
|
|
129
|
+
});
|
|
125
130
|
}
|
|
126
131
|
|
|
127
132
|
//#endregion
|
package/dist/sig/http.test.js
CHANGED
|
@@ -3,22 +3,24 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { assertEquals } from "../assert_equals-
|
|
8
|
-
import { assert } from "../assert-
|
|
9
|
-
import "../assert_instance_of-
|
|
10
|
-
import "../
|
|
11
|
-
import "../
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import "../
|
|
18
|
-
import "../
|
|
19
|
-
import { assertThrows } from "../assert_throws-
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
6
|
+
import { mockDocumentLoader, test } from "../dist-lStjlyET.js";
|
|
7
|
+
import { assertEquals } from "../assert_equals-Gbplq4lg.js";
|
|
8
|
+
import { assert } from "../assert-Dp5_aoAs.js";
|
|
9
|
+
import "../assert_instance_of-D1m8F7x0.js";
|
|
10
|
+
import "../deno-BTeveqhY.js";
|
|
11
|
+
import "../vocab-C3nSleOZ.js";
|
|
12
|
+
import "../lookup-yv_aH7K7.js";
|
|
13
|
+
import "../type-BSNcIxTd.js";
|
|
14
|
+
import "../actor-DYdPViDz.js";
|
|
15
|
+
import { exportJwk } from "../key-dws2_YsP.js";
|
|
16
|
+
import { createRfc9421SignatureBase, doubleKnock, formatRfc9421Signature, formatRfc9421SignatureParameters, parseRfc9421Signature, parseRfc9421SignatureInput, signRequest, timingSafeEqual, verifyRequest } from "../http-BIDOYI9f.js";
|
|
17
|
+
import { assertExists, assertStringIncludes } from "../std__assert-Cm-MfI66.js";
|
|
18
|
+
import { assertFalse, assertRejects } from "../assert_rejects-BoKYY0g1.js";
|
|
19
|
+
import { assertThrows } from "../assert_throws-DjkXin1a.js";
|
|
20
|
+
import "../assert_not_equals-B2R_8p36.js";
|
|
21
|
+
import { rsaPrivateKey2, rsaPublicKey1, rsaPublicKey2, rsaPublicKey5 } from "../keys-C6QyjjIN.js";
|
|
22
|
+
import { esm_default } from "../esm-B52TuumP.js";
|
|
23
|
+
import { exportSpki } from "@fedify/vocab-runtime";
|
|
22
24
|
import { encodeBase64 } from "byte-encodings/base64";
|
|
23
25
|
|
|
24
26
|
//#region src/sig/http.test.ts
|
|
@@ -381,7 +383,7 @@ test("verifyRequest() [rfc9421] manual POST verification", async () => {
|
|
|
381
383
|
headers: new Headers(signedPostRequest.headers)
|
|
382
384
|
});
|
|
383
385
|
const signatureBase = createRfc9421SignatureBase(manualRequest, parsedInput.sig1.components, parsedInput.sig1.parameters);
|
|
384
|
-
const signatureVerified = await crypto.subtle.verify("RSASSA-PKCS1-v1_5", rsaPublicKey2.publicKey, parsedSignature.sig1, new TextEncoder().encode(signatureBase));
|
|
386
|
+
const signatureVerified = await crypto.subtle.verify("RSASSA-PKCS1-v1_5", rsaPublicKey2.publicKey, parsedSignature.sig1.slice(), new TextEncoder().encode(signatureBase));
|
|
385
387
|
assert(signatureVerified, "Manual verification of POST signature should succeed");
|
|
386
388
|
});
|
|
387
389
|
test("verifyRequest() [rfc9421] error cases and edge cases", async () => {
|
package/dist/sig/key.test.js
CHANGED
|
@@ -3,20 +3,21 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { assertEquals } from "../assert_equals-
|
|
8
|
-
import "../assert-
|
|
9
|
-
import "../assert_instance_of-
|
|
10
|
-
import "../
|
|
11
|
-
import "../
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import "../
|
|
15
|
-
import {
|
|
16
|
-
import "../
|
|
17
|
-
import "../
|
|
18
|
-
import { assertThrows } from "../assert_throws-
|
|
19
|
-
import
|
|
6
|
+
import { mockDocumentLoader, test } from "../dist-lStjlyET.js";
|
|
7
|
+
import { assertEquals } from "../assert_equals-Gbplq4lg.js";
|
|
8
|
+
import "../assert-Dp5_aoAs.js";
|
|
9
|
+
import "../assert_instance_of-D1m8F7x0.js";
|
|
10
|
+
import "../deno-BTeveqhY.js";
|
|
11
|
+
import { CryptographicKey, Multikey } from "../vocab-C3nSleOZ.js";
|
|
12
|
+
import "../lookup-yv_aH7K7.js";
|
|
13
|
+
import "../type-BSNcIxTd.js";
|
|
14
|
+
import "../actor-DYdPViDz.js";
|
|
15
|
+
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk, validateCryptoKey } from "../key-dws2_YsP.js";
|
|
16
|
+
import "../std__assert-Cm-MfI66.js";
|
|
17
|
+
import { assertRejects } from "../assert_rejects-BoKYY0g1.js";
|
|
18
|
+
import { assertThrows } from "../assert_throws-DjkXin1a.js";
|
|
19
|
+
import "../assert_not_equals-B2R_8p36.js";
|
|
20
|
+
import { ed25519Multikey, rsaPrivateKey2, rsaPublicKey1, rsaPublicKey2, rsaPublicKey3 } from "../keys-C6QyjjIN.js";
|
|
20
21
|
|
|
21
22
|
//#region src/sig/key.test.ts
|
|
22
23
|
test("validateCryptoKey()", async () => {
|
package/dist/sig/ld.test.js
CHANGED
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { assertEquals } from "../assert_equals-
|
|
8
|
-
import { assert } from "../assert-
|
|
9
|
-
import "../
|
|
10
|
-
import "../
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import {
|
|
15
|
-
import "../
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
6
|
+
import { mockDocumentLoader, test } from "../dist-lStjlyET.js";
|
|
7
|
+
import { assertEquals } from "../assert_equals-Gbplq4lg.js";
|
|
8
|
+
import { assert } from "../assert-Dp5_aoAs.js";
|
|
9
|
+
import "../deno-BTeveqhY.js";
|
|
10
|
+
import { CryptographicKey } from "../vocab-C3nSleOZ.js";
|
|
11
|
+
import "../lookup-yv_aH7K7.js";
|
|
12
|
+
import "../type-BSNcIxTd.js";
|
|
13
|
+
import "../actor-DYdPViDz.js";
|
|
14
|
+
import { generateCryptoKeyPair } from "../key-dws2_YsP.js";
|
|
15
|
+
import { attachSignature, createSignature, detachSignature, signJsonLd, verifyJsonLd, verifySignature } from "../ld-C6UrncJk.js";
|
|
16
|
+
import { assertFalse, assertRejects } from "../assert_rejects-BoKYY0g1.js";
|
|
17
|
+
import { assertThrows } from "../assert_throws-DjkXin1a.js";
|
|
18
|
+
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-C6QyjjIN.js";
|
|
18
19
|
import { encodeBase64 } from "byte-encodings/base64";
|
|
19
20
|
|
|
20
21
|
//#region src/sig/ld.test.ts
|
package/dist/sig/mod.cjs
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
3
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
|
4
|
+
|
|
5
|
+
require('../lookup-BORWbouU.cjs');
|
|
6
|
+
require('../actor-CCAL5-E_.cjs');
|
|
7
|
+
const require_http = require('../http-DtYHWbwa.cjs');
|
|
8
|
+
const require_proof = require('../proof-C3K5Z8RT.cjs');
|
|
9
|
+
require('../sig-YYj5tCnr.cjs');
|
|
10
|
+
|
|
11
|
+
exports.attachSignature = require_proof.attachSignature;
|
|
12
|
+
exports.createProof = require_proof.createProof;
|
|
13
|
+
exports.createSignature = require_proof.createSignature;
|
|
14
|
+
exports.detachSignature = require_proof.detachSignature;
|
|
15
|
+
exports.doesActorOwnKey = require_proof.doesActorOwnKey;
|
|
16
|
+
exports.exportJwk = require_http.exportJwk;
|
|
17
|
+
exports.fetchKey = require_http.fetchKey;
|
|
18
|
+
exports.generateCryptoKeyPair = require_http.generateCryptoKeyPair;
|
|
19
|
+
exports.getKeyOwner = require_proof.getKeyOwner;
|
|
20
|
+
exports.importJwk = require_http.importJwk;
|
|
21
|
+
exports.signJsonLd = require_proof.signJsonLd;
|
|
22
|
+
exports.signObject = require_proof.signObject;
|
|
23
|
+
exports.signRequest = require_http.signRequest;
|
|
24
|
+
exports.verifyJsonLd = require_proof.verifyJsonLd;
|
|
25
|
+
exports.verifyObject = require_proof.verifyObject;
|
|
26
|
+
exports.verifyProof = require_proof.verifyProof;
|
|
27
|
+
exports.verifyRequest = require_http.verifyRequest;
|
|
28
|
+
exports.verifySignature = require_proof.verifySignature;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import "../vocab-CeDBzu-f.cjs";
|
|
2
|
+
import "../actor-f2NtjyCg.cjs";
|
|
3
|
+
import { FetchKeyOptions, FetchKeyResult, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, SignRequestOptions, VerifyRequestOptions, exportJwk, fetchKey, generateCryptoKeyPair, importJwk, signRequest, verifyRequest } from "../http-M8k5mKc0.cjs";
|
|
4
|
+
import { DoesActorOwnKeyOptions, GetKeyOwnerOptions, doesActorOwnKey, getKeyOwner } from "../owner-B4HbyP8s.cjs";
|
|
5
|
+
import { CreateProofOptions, CreateSignatureOptions, SignJsonLdOptions, SignObjectOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "../mod-DgxG-byT.cjs";
|
|
6
|
+
export { CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyOptions, FetchKeyResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getKeyOwner, importJwk, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
|
package/dist/sig/mod.d.ts
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import "../
|
|
4
|
-
import "../
|
|
5
|
-
import "../
|
|
6
|
-
import "../
|
|
7
|
-
import {
|
|
8
|
-
import { DoesActorOwnKeyOptions, GetKeyOwnerOptions, doesActorOwnKey, getKeyOwner } from "../owner-CQPnQVtf.js";
|
|
9
|
-
import { CreateProofOptions, CreateSignatureOptions, SignJsonLdOptions, SignObjectOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "../mod-Drmz72EK.js";
|
|
3
|
+
import "../vocab-BCWe1Ih5.js";
|
|
4
|
+
import "../actor-DqFajh9s.js";
|
|
5
|
+
import { FetchKeyOptions, FetchKeyResult, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, SignRequestOptions, VerifyRequestOptions, exportJwk, fetchKey, generateCryptoKeyPair, importJwk, signRequest, verifyRequest } from "../http-BbO0ejuk.js";
|
|
6
|
+
import { DoesActorOwnKeyOptions, GetKeyOwnerOptions, doesActorOwnKey, getKeyOwner } from "../owner-kQRGVXG1.js";
|
|
7
|
+
import { CreateProofOptions, CreateSignatureOptions, SignJsonLdOptions, SignObjectOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "../mod-D5Z2tISD.js";
|
|
10
8
|
export { CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyOptions, FetchKeyResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getKeyOwner, importJwk, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
|
package/dist/sig/mod.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import "../
|
|
6
|
-
import "../actor-
|
|
7
|
-
import "../
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, getKeyOwner, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "../proof-CT1SITRP.js";
|
|
11
|
-
import "../sig-BXJO--F9.js";
|
|
2
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
3
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
4
|
+
|
|
5
|
+
import "../lookup-BV72lfsA.js";
|
|
6
|
+
import "../actor-U_BZZ2ps.js";
|
|
7
|
+
import { exportJwk, fetchKey, generateCryptoKeyPair, importJwk, signRequest, verifyRequest } from "../http-BQRnmfXP.js";
|
|
8
|
+
import { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, getKeyOwner, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "../proof-BG2G4cDG.js";
|
|
9
|
+
import "../sig-C34-oHBl.js";
|
|
12
10
|
|
|
13
11
|
export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getKeyOwner, importJwk, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
|
package/dist/sig/owner.test.js
CHANGED
|
@@ -3,21 +3,23 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { assertEquals } from "../assert_equals-
|
|
8
|
-
import { assert } from "../assert-
|
|
9
|
-
import "../assert_instance_of-
|
|
10
|
-
import
|
|
11
|
-
import "../
|
|
12
|
-
import "../
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import "../
|
|
16
|
-
import {
|
|
17
|
-
import "../
|
|
18
|
-
import "../
|
|
19
|
-
import "../
|
|
20
|
-
import
|
|
6
|
+
import { createTestTracerProvider, mockDocumentLoader, test } from "../dist-lStjlyET.js";
|
|
7
|
+
import { assertEquals } from "../assert_equals-Gbplq4lg.js";
|
|
8
|
+
import { assert } from "../assert-Dp5_aoAs.js";
|
|
9
|
+
import "../assert_instance_of-D1m8F7x0.js";
|
|
10
|
+
import "../deno-BTeveqhY.js";
|
|
11
|
+
import { Create, CryptographicKey } from "../vocab-C3nSleOZ.js";
|
|
12
|
+
import "../lookup-yv_aH7K7.js";
|
|
13
|
+
import "../type-BSNcIxTd.js";
|
|
14
|
+
import "../actor-DYdPViDz.js";
|
|
15
|
+
import "../key-dws2_YsP.js";
|
|
16
|
+
import { doesActorOwnKey, getKeyOwner } from "../owner-DQuVKHuY.js";
|
|
17
|
+
import { lookupObject } from "../lookup-BoiLMtAx.js";
|
|
18
|
+
import "../std__assert-Cm-MfI66.js";
|
|
19
|
+
import { assertFalse } from "../assert_rejects-BoKYY0g1.js";
|
|
20
|
+
import "../assert_throws-DjkXin1a.js";
|
|
21
|
+
import "../assert_not_equals-B2R_8p36.js";
|
|
22
|
+
import { rsaPublicKey1, rsaPublicKey2 } from "../keys-C6QyjjIN.js";
|
|
21
23
|
|
|
22
24
|
//#region src/sig/owner.test.ts
|
|
23
25
|
test("doesActorOwnKey()", async () => {
|
|
@@ -48,5 +50,28 @@ test("getKeyOwner()", async () => {
|
|
|
48
50
|
const noOwner2 = await getKeyOwner(new URL("https://example.com/object"), options);
|
|
49
51
|
assertEquals(noOwner2, null);
|
|
50
52
|
});
|
|
53
|
+
test("doesActorOwnKey() records OpenTelemetry span", async () => {
|
|
54
|
+
const [tracerProvider, exporter] = createTestTracerProvider();
|
|
55
|
+
const activity = new Create({
|
|
56
|
+
id: new URL("https://example.com/activity"),
|
|
57
|
+
actor: new URL("https://example.com/person")
|
|
58
|
+
});
|
|
59
|
+
const key = new CryptographicKey({
|
|
60
|
+
id: new URL("https://example.com/person#key"),
|
|
61
|
+
owner: new URL("https://example.com/person")
|
|
62
|
+
});
|
|
63
|
+
const result = await doesActorOwnKey(activity, key, {
|
|
64
|
+
documentLoader: mockDocumentLoader,
|
|
65
|
+
tracerProvider
|
|
66
|
+
});
|
|
67
|
+
assert(result);
|
|
68
|
+
const spans = exporter.getSpans("activitypub.verify_key_ownership");
|
|
69
|
+
assertEquals(spans.length, 1);
|
|
70
|
+
const span = spans[0];
|
|
71
|
+
assertEquals(span.attributes["activitypub.actor.id"], "https://example.com/person");
|
|
72
|
+
assertEquals(span.attributes["activitypub.key.id"], "https://example.com/person#key");
|
|
73
|
+
assertEquals(span.attributes["activitypub.key_ownership.verified"], true);
|
|
74
|
+
assertEquals(span.attributes["activitypub.key_ownership.method"], "owner_id");
|
|
75
|
+
});
|
|
51
76
|
|
|
52
77
|
//#endregion
|
package/dist/sig/proof.test.js
CHANGED
|
@@ -3,21 +3,23 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import {
|
|
7
|
-
import { assertEquals } from "../assert_equals-
|
|
8
|
-
import "../assert-
|
|
9
|
-
import { assertInstanceOf } from "../assert_instance_of-
|
|
10
|
-
import "../
|
|
11
|
-
import "../
|
|
12
|
-
import "../
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import "../
|
|
16
|
-
import {
|
|
17
|
-
import "../
|
|
18
|
-
import "../
|
|
19
|
-
import "../assert_throws-
|
|
20
|
-
import
|
|
6
|
+
import { mockDocumentLoader, test } from "../dist-lStjlyET.js";
|
|
7
|
+
import { assertEquals } from "../assert_equals-Gbplq4lg.js";
|
|
8
|
+
import "../assert-Dp5_aoAs.js";
|
|
9
|
+
import { assertInstanceOf } from "../assert_instance_of-D1m8F7x0.js";
|
|
10
|
+
import "../deno-BTeveqhY.js";
|
|
11
|
+
import { Create, DataIntegrityProof, Multikey, Note, Place } from "../vocab-C3nSleOZ.js";
|
|
12
|
+
import "../lookup-yv_aH7K7.js";
|
|
13
|
+
import "../type-BSNcIxTd.js";
|
|
14
|
+
import "../actor-DYdPViDz.js";
|
|
15
|
+
import "../key-dws2_YsP.js";
|
|
16
|
+
import { createProof, signObject, verifyObject, verifyProof } from "../proof-GrivUN5L.js";
|
|
17
|
+
import "../std__assert-Cm-MfI66.js";
|
|
18
|
+
import { assertRejects } from "../assert_rejects-BoKYY0g1.js";
|
|
19
|
+
import "../assert_throws-DjkXin1a.js";
|
|
20
|
+
import "../assert_not_equals-B2R_8p36.js";
|
|
21
|
+
import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-C6QyjjIN.js";
|
|
22
|
+
import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
|
|
21
23
|
import { decodeHex, encodeHex } from "byte-encodings/hex";
|
|
22
24
|
|
|
23
25
|
//#region src/sig/proof.test.ts
|
|
@@ -74,7 +76,7 @@ test("createProof()", async () => {
|
|
|
74
76
|
assertEquals(proof2.cryptosuite, "eddsa-jcs-2022");
|
|
75
77
|
assertEquals(proof2.verificationMethodId, fep8b32TestVectorKeyId);
|
|
76
78
|
assertEquals(proof2.proofPurpose, "assertionMethod");
|
|
77
|
-
assertEquals(proof2.proofValue,
|
|
79
|
+
assertEquals(proof2.proofValue, decodeMultibase("zLaewdp4H9kqtwyrLatK4cjY5oRHwVcw4gibPSUDYDMhi4M49v8pcYk3ZB6D69dNpAPbUmY8ocuJ3m9KhKJEEg7z"));
|
|
78
80
|
assertEquals(proof2.created, created);
|
|
79
81
|
await assertRejects(() => createProof(create, rsaPrivateKey2, rsaPublicKey2.id, {
|
|
80
82
|
created,
|
|
@@ -198,7 +200,7 @@ test("verifyProof()", async () => {
|
|
|
198
200
|
cryptosuite: "eddsa-jcs-2022",
|
|
199
201
|
verificationMethod: new URL("https://server.example/users/alice#ed25519-key"),
|
|
200
202
|
proofPurpose: "assertionMethod",
|
|
201
|
-
proofValue:
|
|
203
|
+
proofValue: decodeMultibase("zLaewdp4H9kqtwyrLatK4cjY5oRHwVcw4gibPSUDYDMhi4M49v8pcYk3ZB6D69dNpAPbUmY8ocuJ3m9KhKJEEg7z"),
|
|
202
204
|
created: Temporal.Instant.from("2023-02-24T23:36:38Z")
|
|
203
205
|
});
|
|
204
206
|
const expectedKey = new Multikey({
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { URLPattern } from "urlpattern-polyfill";
|
|
4
4
|
globalThis.addEventListener = () => {};
|
|
5
5
|
|
|
6
|
-
import { AssertionError, buildMessage, diff, diffStr, format, red } from "./assert_equals-
|
|
6
|
+
import { AssertionError, buildMessage, diff, diffStr, format, red } from "./assert_equals-Gbplq4lg.js";
|
|
7
7
|
|
|
8
8
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_exists.js
|
|
9
9
|
/**
|