@fedify/fedify 2.3.7 → 2.3.9-dev.2048

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.
Files changed (108) hide show
  1. package/dist/{assert_instance_of-DBC5X09g.mjs → assert-jSdZMYam.mjs} +19 -1
  2. package/dist/{builder-Bg7nkigw.mjs → builder-BfY2wZ4V.mjs} +3 -3
  3. package/dist/{client-D1KuWxjH.mjs → client-DYDoDpMa.mjs} +78 -4
  4. package/dist/compat/mod.d.cts +1 -1
  5. package/dist/compat/mod.d.ts +1 -1
  6. package/dist/compat/outgoing-jsonld.test.mjs +1 -1
  7. package/dist/compat/public-audience.test.mjs +1 -1
  8. package/dist/compat/transformers.test.mjs +3 -4
  9. package/dist/{context-DVoTs_wM.mjs → context-BepjCFHN.mjs} +1 -0
  10. package/dist/{context-BxVVO5Ro.d.ts → context-CAKnQy1x.d.ts} +4 -3
  11. package/dist/{context-BpmLyiPx.d.cts → context-CSIggG9_.d.cts} +4 -3
  12. package/dist/{deno-CTdCdRmf.mjs → deno-ayal9buz.mjs} +1 -1
  13. package/dist/{docloader-BVBWf8Bg.mjs → docloader-C-JrNL14.mjs} +2 -2
  14. package/dist/federation/builder.test.mjs +2 -2
  15. package/dist/federation/circuit-breaker.test.mjs +3 -3
  16. package/dist/federation/collection.test.mjs +1 -1
  17. package/dist/federation/handler.test.mjs +128 -11
  18. package/dist/federation/idempotency.test.mjs +4 -4
  19. package/dist/federation/inbox.test.mjs +1 -1
  20. package/dist/federation/keycache.test.mjs +44 -10
  21. package/dist/federation/kv.test.mjs +1 -1
  22. package/dist/federation/metrics.test.mjs +1 -1
  23. package/dist/federation/middleware.test.mjs +109 -19
  24. package/dist/federation/mod.cjs +1 -1
  25. package/dist/federation/mod.d.cts +2 -2
  26. package/dist/federation/mod.d.ts +2 -2
  27. package/dist/federation/mod.js +1 -1
  28. package/dist/federation/mq.test.mjs +1 -1
  29. package/dist/federation/negotiation.test.mjs +2 -2
  30. package/dist/federation/retry.test.mjs +1 -1
  31. package/dist/federation/router.test.mjs +1 -1
  32. package/dist/federation/send.test.mjs +141 -7
  33. package/dist/federation/temporal.test.mjs +2 -2
  34. package/dist/federation/webfinger.test.mjs +3 -3
  35. package/dist/{http-B3-zan5-.mjs → http-B2u6PvNX.mjs} +4 -4
  36. package/dist/{http-BjV0BTWd.cjs → http-BGP2QCbe.cjs} +166 -6
  37. package/dist/{http-DRVY9K4R.js → http-BPPCh0xN.js} +155 -7
  38. package/dist/{http-lf8Hsd91.d.ts → http-DQmNpfym.d.ts} +1 -1
  39. package/dist/{http-VyDTd4G3.d.cts → http-DiWQB8Mr.d.cts} +1 -1
  40. package/dist/{key-C_a6iE1-.mjs → key-C9DkrWwb.mjs} +155 -7
  41. package/dist/{keycache-BeU0LCII.mjs → keycache-B3qRQNLj.mjs} +12 -4
  42. package/dist/{kv-cache-OzUoHKnZ.cjs → kv-cache-C1TC_e9y.cjs} +2 -2
  43. package/dist/{kv-cache-b1dJZHUx.js → kv-cache-Cl1q1aA9.js} +2 -2
  44. package/dist/{kv-cache-BjjcmjtG.mjs → kv-cache-qJSjfLGm.mjs} +1 -1
  45. package/dist/{ld-COo05yJj.mjs → ld-DNl7KwLY.mjs} +3 -3
  46. package/dist/{metrics-V6vX0M13.mjs → metrics-Ce55disp.mjs} +1 -1
  47. package/dist/{middleware-DRk6xiYo.mjs → middleware-BCG2BX1n.mjs} +41 -30
  48. package/dist/{middleware-EDVv6ewB.cjs → middleware-BZojifnF.cjs} +101 -25
  49. package/dist/{middleware-DRGWEo0V.mjs → middleware-C96wm_7x.mjs} +1 -1
  50. package/dist/{middleware-K13LhN5w.js → middleware-C_utyVa_.js} +101 -25
  51. package/dist/{mod-yvIXFAEi.d.cts → mod-1TuoXkGs.d.cts} +1 -1
  52. package/dist/{mod-B0hW12_O.d.cts → mod-Bid79LFU.d.cts} +1 -1
  53. package/dist/{mod-Rpy4Uwkk.d.ts → mod-CFuyfw3c.d.ts} +1 -1
  54. package/dist/{mod-DFvNJcNb.d.ts → mod-DHgc4ygG.d.ts} +1 -1
  55. package/dist/{mod-CjERT09F.d.cts → mod-PVR75MeU.d.cts} +1 -1
  56. package/dist/{mod-COIAjwRS.d.ts → mod-TLEvgT1i.d.ts} +1 -1
  57. package/dist/mod.cjs +5 -5
  58. package/dist/mod.d.cts +6 -6
  59. package/dist/mod.d.ts +6 -6
  60. package/dist/mod.js +5 -5
  61. package/dist/nodeinfo/client.test.mjs +28 -1
  62. package/dist/nodeinfo/handler.test.mjs +3 -3
  63. package/dist/nodeinfo/mod.cjs +1 -1
  64. package/dist/nodeinfo/mod.js +1 -1
  65. package/dist/nodeinfo/types.test.mjs +1 -1
  66. package/dist/otel/exporter.test.mjs +1 -1
  67. package/dist/{outgoing-jsonld-OFoubetZ.mjs → outgoing-jsonld-HOAywiid.mjs} +1 -1
  68. package/dist/{owner-CnngXDNJ.d.ts → owner-B3hNQCG8.d.cts} +12 -1
  69. package/dist/{owner-DEvZuyOE.d.cts → owner-CiBPcC6F.d.ts} +12 -1
  70. package/dist/owner-DqqDBw-l.mjs +175 -0
  71. package/dist/{proof-kFq0IDK4.mjs → proof-D5vP7VIN.mjs} +5 -5
  72. package/dist/{proof-D6gZeewf.js → proof-Dz9ObvUq.js} +112 -58
  73. package/dist/{proof-Xk8lHNc0.cjs → proof-I6YcKRRq.cjs} +112 -58
  74. package/dist/{send-3lH63Nqf.mjs → send-CBtR8DQK.mjs} +68 -11
  75. package/dist/sig/accept.test.mjs +1 -1
  76. package/dist/sig/http.test.mjs +4 -4
  77. package/dist/sig/key.test.mjs +170 -3
  78. package/dist/sig/ld.test.mjs +56 -4
  79. package/dist/sig/mod.cjs +2 -2
  80. package/dist/sig/mod.d.cts +3 -3
  81. package/dist/sig/mod.d.ts +3 -3
  82. package/dist/sig/mod.js +2 -2
  83. package/dist/sig/owner.test.mjs +105 -6
  84. package/dist/sig/proof.test.mjs +73 -5
  85. package/dist/{temporal-Chwx9cEn.mjs → temporal-B9t2tY9A.mjs} +1 -1
  86. package/dist/testing/mod.mjs +1 -1
  87. package/dist/{types-m8u9L86X.cjs → types-DWs-qZaY.cjs} +94 -2
  88. package/dist/{types-DTONwNqL.js → types-sXITXcWa.js} +78 -4
  89. package/dist/utils/docloader.test.mjs +28 -4
  90. package/dist/utils/kv-cache.test.mjs +1 -1
  91. package/dist/utils/mod.cjs +1 -1
  92. package/dist/utils/mod.d.cts +1 -1
  93. package/dist/utils/mod.d.ts +1 -1
  94. package/dist/utils/mod.js +1 -1
  95. package/package.json +6 -6
  96. package/dist/assert-OguE97r2.mjs +0 -23
  97. package/dist/owner-B3720pz3.mjs +0 -120
  98. /package/dist/{accept-CPkZzmGN.mjs → accept-Dd__NiUL.mjs} +0 -0
  99. /package/dist/{activity-listener-tztVvlNb.mjs → activity-listener-ell7W1s9.mjs} +0 -0
  100. /package/dist/{circuit-breaker-D1fxthDI.mjs → circuit-breaker-CDABzqVf.mjs} +0 -0
  101. /package/dist/{circuit-breaker-test-utils-CAdwjgMi.mjs → circuit-breaker-test-utils-Dm5MM6l9.mjs} +0 -0
  102. /package/dist/{collection-Cc3DVAhE.mjs → collection-CA3V5zyK.mjs} +0 -0
  103. /package/dist/{keys-DGu1NFwu.mjs → keys-BAK-tUlf.mjs} +0 -0
  104. /package/dist/{kv-rV3vodCc.mjs → kv-CX8qfaad.mjs} +0 -0
  105. /package/dist/{negotiation-DDstyBvc.mjs → negotiation-CDW-_gUU.mjs} +0 -0
  106. /package/dist/{public-audience-DZJAUUi8.mjs → public-audience-jwoSIGUw.mjs} +0 -0
  107. /package/dist/{retry-CXg_MBI-.mjs → retry-_VvV0h9f.mjs} +0 -0
  108. /package/dist/{types-J53Kw7so.mjs → types-s4mCTGkT.mjs} +0 -0
@@ -1,7 +1,7 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature, t as formatAcceptSignature } from "../accept-CPkZzmGN.mjs";
4
+ import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature, t as formatAcceptSignature } from "../accept-Dd__NiUL.mjs";
5
5
  import { test } from "@fedify/fixture";
6
6
  import { deepStrictEqual, strictEqual } from "node:assert/strict";
7
7
  //#region src/sig/accept.test.ts
@@ -5,11 +5,11 @@ import { t as esm_default } from "../esm-vrlUxr60.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
6
6
  import { r as assertExists, t as assertStringIncludes } from "../std__assert-BBjXFNOb.mjs";
7
7
  import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
8
+ import { t as assert } from "../assert-jSdZMYam.mjs";
8
9
  import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
9
- import { t as assert } from "../assert-OguE97r2.mjs";
10
- import { t as exportJwk } from "../key-C_a6iE1-.mjs";
11
- import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase, u as verifyRequestDetailed } from "../http-B3-zan5-.mjs";
12
- import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DGu1NFwu.mjs";
10
+ import { t as exportJwk } from "../key-C9DkrWwb.mjs";
11
+ import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase, u as verifyRequestDetailed } from "../http-B2u6PvNX.mjs";
12
+ import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-BAK-tUlf.mjs";
13
13
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
14
14
  import { FetchError, exportSpki } from "@fedify/vocab-runtime";
15
15
  import { encodeBase64 } from "byte-encodings/base64";
@@ -4,9 +4,10 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
5
  import "../std__assert-BBjXFNOb.mjs";
6
6
  import { t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
7
+ import { t as assert } from "../assert-jSdZMYam.mjs";
7
8
  import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
8
- import { a as importJwk, i as generateCryptoKeyPair, n as fetchKey, o as validateCryptoKey, r as fetchKeyDetailed, t as exportJwk } from "../key-C_a6iE1-.mjs";
9
- import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DGu1NFwu.mjs";
9
+ import { a as generateCryptoKeyPair, i as fetchKeyDetailed, o as importJwk, r as fetchKey, s as validateCryptoKey, t as exportJwk } from "../key-C9DkrWwb.mjs";
10
+ import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
10
11
  import { CryptographicKey, Multikey } from "@fedify/vocab";
11
12
  import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
12
13
  import { FetchError } from "@fedify/vocab-runtime";
@@ -267,7 +268,7 @@ test("fetchKeyDetailed()", async () => {
267
268
  key: rsaPublicKey1,
268
269
  cached: false
269
270
  });
270
- assertEquals(documentLoaderCalls, 1);
271
+ assertEquals(documentLoaderCalls, 2);
271
272
  const spans = exporter.getSpans("activitypub.fetch_key");
272
273
  assertEquals(spans.length, 2);
273
274
  assertEquals(spans[0].attributes["activitypub.actor.key.cached"], true);
@@ -495,5 +496,171 @@ test("fetchKey() returns null for a malformed actor publicKey", async () => {
495
496
  cached: true
496
497
  });
497
498
  });
499
+ test("fetchKey() rejects a key whose owner does not link back", async () => {
500
+ const keyId = "https://attacker.example/key";
501
+ const keyDocument = await rsaPublicKey1.toJsonLd({ contextLoader: mockDocumentLoader });
502
+ const serveKeyOwnedBy = (owner) => ({
503
+ documentLoader(resource) {
504
+ if (resource === keyId) return Promise.resolve({
505
+ contextUrl: null,
506
+ documentUrl: resource,
507
+ document: {
508
+ ...keyDocument,
509
+ id: keyId,
510
+ owner
511
+ }
512
+ });
513
+ return mockDocumentLoader(resource);
514
+ },
515
+ contextLoader: mockDocumentLoader
516
+ });
517
+ assertEquals(await fetchKey(keyId, CryptographicKey, serveKeyOwnedBy("https://example.com/person")), {
518
+ key: null,
519
+ cached: false
520
+ });
521
+ assertEquals(await fetchKey(keyId, CryptographicKey, serveKeyOwnedBy("https://impersonated.invalid/users/victim")), {
522
+ key: null,
523
+ cached: false
524
+ });
525
+ });
526
+ test("fetchKey() rejects a Multikey whose controller does not link back", async () => {
527
+ const keyId = "https://attacker.example/multikey";
528
+ const keyDocument = await ed25519Multikey.toJsonLd({ contextLoader: mockDocumentLoader });
529
+ assertEquals(await fetchKey(keyId, Multikey, {
530
+ documentLoader(resource) {
531
+ if (resource === keyId) return Promise.resolve({
532
+ contextUrl: null,
533
+ documentUrl: resource,
534
+ document: {
535
+ ...keyDocument,
536
+ id: keyId,
537
+ controller: "https://example.com/person2"
538
+ }
539
+ });
540
+ return mockDocumentLoader(resource);
541
+ },
542
+ contextLoader: mockDocumentLoader
543
+ }), {
544
+ key: null,
545
+ cached: false
546
+ });
547
+ });
548
+ test("fetchKey() rejects an actor document from another origin", async () => {
549
+ const keyId = "https://attacker.example/key";
550
+ const impersonated = "https://example.com/person";
551
+ const { publicKeyPem } = await rsaPublicKey1.toJsonLd({ contextLoader: mockDocumentLoader });
552
+ assertEquals(await fetchKey(keyId, CryptographicKey, {
553
+ documentLoader(resource) {
554
+ if (resource === keyId) return Promise.resolve({
555
+ contextUrl: null,
556
+ documentUrl: resource,
557
+ document: {
558
+ "@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
559
+ id: impersonated,
560
+ type: "Person",
561
+ publicKey: [{
562
+ id: `${impersonated}#main-key`,
563
+ type: "CryptographicKey",
564
+ owner: impersonated,
565
+ publicKeyPem
566
+ }]
567
+ }
568
+ });
569
+ return mockDocumentLoader(resource);
570
+ },
571
+ contextLoader: mockDocumentLoader
572
+ }), {
573
+ key: null,
574
+ cached: false
575
+ });
576
+ });
577
+ test("fetchKey() rejects a key that disowns the actor document holding it", async () => {
578
+ const actorId = "https://attacker.example/actor";
579
+ const keyId = `${actorId}#main-key`;
580
+ const { publicKeyPem } = await rsaPublicKey1.toJsonLd({ contextLoader: mockDocumentLoader });
581
+ assertEquals(await fetchKey(keyId, CryptographicKey, {
582
+ documentLoader(resource) {
583
+ if (resource === keyId || resource === actorId) return Promise.resolve({
584
+ contextUrl: null,
585
+ documentUrl: resource,
586
+ document: {
587
+ "@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
588
+ id: actorId,
589
+ type: "Person",
590
+ publicKey: [{
591
+ id: keyId,
592
+ type: "CryptographicKey",
593
+ owner: "https://example.com/person",
594
+ publicKeyPem
595
+ }]
596
+ }
597
+ });
598
+ return mockDocumentLoader(resource);
599
+ },
600
+ contextLoader: mockDocumentLoader
601
+ }), {
602
+ key: null,
603
+ cached: false
604
+ });
605
+ });
606
+ test("fetchKey() records the owner its actor document establishes", async () => {
607
+ const { key } = await fetchKey("https://example.com/users/handle#main-key", CryptographicKey, {
608
+ documentLoader: mockDocumentLoader,
609
+ contextLoader: mockDocumentLoader
610
+ });
611
+ assertEquals(key?.ownerId, new URL("https://example.com/users/handle"));
612
+ });
613
+ test("fetchKey() accepts a key document that leaves its id implicit", async () => {
614
+ const keyId = "https://example.com/key";
615
+ const keyDocument = await rsaPublicKey1.toJsonLd({ contextLoader: mockDocumentLoader });
616
+ delete keyDocument.id;
617
+ const { key } = await fetchKey(keyId, CryptographicKey, {
618
+ documentLoader(resource) {
619
+ if (resource === keyId) return Promise.resolve({
620
+ contextUrl: null,
621
+ documentUrl: resource,
622
+ document: keyDocument
623
+ });
624
+ return mockDocumentLoader(resource);
625
+ },
626
+ contextLoader: mockDocumentLoader
627
+ });
628
+ assertEquals(key?.id, new URL(keyId));
629
+ assertEquals(key?.ownerId, new URL("https://example.com/person"));
630
+ assert(key?.publicKey != null);
631
+ });
632
+ test("fetchKey() records the controller an actor document establishes", async () => {
633
+ const actorId = "https://example.com/multikey-actor";
634
+ const keyId = `${actorId}#assertion`;
635
+ const { publicKeyMultibase } = await ed25519Multikey.toJsonLd({ contextLoader: mockDocumentLoader });
636
+ const { key } = await fetchKey(keyId, Multikey, {
637
+ documentLoader(resource) {
638
+ if (resource === actorId || resource === keyId) return Promise.resolve({
639
+ contextUrl: null,
640
+ documentUrl: actorId,
641
+ document: {
642
+ "@context": [
643
+ "https://www.w3.org/ns/activitystreams",
644
+ "https://w3id.org/security/v1",
645
+ "https://w3id.org/security/multikey/v1",
646
+ "https://w3id.org/security/data-integrity/v1",
647
+ "https://www.w3.org/ns/did/v1"
648
+ ],
649
+ id: actorId,
650
+ type: "Person",
651
+ assertionMethod: [{
652
+ id: keyId,
653
+ type: "Multikey",
654
+ publicKeyMultibase
655
+ }]
656
+ }
657
+ });
658
+ return mockDocumentLoader(resource);
659
+ },
660
+ contextLoader: mockDocumentLoader
661
+ });
662
+ assertEquals(key?.controllerId, new URL(actorId));
663
+ assert(key?.publicKey != null);
664
+ });
498
665
  //#endregion
499
666
  export {};
@@ -3,11 +3,11 @@ import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
5
  import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
6
+ import { n as assertInstanceOf, t as assert } from "../assert-jSdZMYam.mjs";
6
7
  import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
7
- import { t as assert } from "../assert-OguE97r2.mjs";
8
- import { i as generateCryptoKeyPair } from "../key-C_a6iE1-.mjs";
9
- import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DGu1NFwu.mjs";
10
- import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-COo05yJj.mjs";
8
+ import { a as generateCryptoKeyPair } from "../key-C9DkrWwb.mjs";
9
+ import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
10
+ import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-DNl7KwLY.mjs";
11
11
  import { CryptographicKey } from "@fedify/vocab";
12
12
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
13
13
  import { encodeBase64 } from "byte-encodings/base64";
@@ -938,5 +938,57 @@ test("compactJsonLd() rejects inputs that compact into @graph wrappers", async (
938
938
  content: "two"
939
939
  }], mockDocumentLoader), UnsafeJsonLdError, "Unsupported JSON-LD keyword: @graph.");
940
940
  });
941
+ test("verifyJsonLd() rejects a key that claims a forged owner", async () => {
942
+ const keyId = new URL("https://attacker.example/key");
943
+ const impersonated = "https://example.com/person";
944
+ const { publicKeyPem } = await rsaPublicKey2.toJsonLd({ contextLoader: mockDocumentLoader });
945
+ const signed = await signJsonLd({
946
+ "@context": "https://www.w3.org/ns/activitystreams",
947
+ id: "https://attacker.example/activities/1",
948
+ type: "Create",
949
+ actor: impersonated
950
+ }, rsaPrivateKey2, keyId, { contextLoader: mockDocumentLoader });
951
+ const serveKeyOwnedBy = (owner) => (resource) => {
952
+ if (resource === keyId.href) return Promise.resolve({
953
+ contextUrl: null,
954
+ documentUrl: resource,
955
+ document: {
956
+ "@context": "https://w3id.org/security/v1",
957
+ id: keyId.href,
958
+ type: "CryptographicKey",
959
+ owner,
960
+ publicKeyPem
961
+ }
962
+ });
963
+ if (resource === "https://attacker.example/actor") return Promise.resolve({
964
+ contextUrl: null,
965
+ documentUrl: resource,
966
+ document: {
967
+ "@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
968
+ id: resource,
969
+ type: "Person",
970
+ publicKey: [keyId.href]
971
+ }
972
+ });
973
+ return mockDocumentLoader(resource);
974
+ };
975
+ assertEquals(await verifySignature(signed, {
976
+ documentLoader: serveKeyOwnedBy(impersonated),
977
+ contextLoader: mockDocumentLoader
978
+ }), null);
979
+ assertFalse(await verifyJsonLd(signed, {
980
+ documentLoader: serveKeyOwnedBy(impersonated),
981
+ contextLoader: mockDocumentLoader
982
+ }));
983
+ const honestLoader = serveKeyOwnedBy("https://attacker.example/actor");
984
+ assertInstanceOf(await verifySignature(signed, {
985
+ documentLoader: honestLoader,
986
+ contextLoader: mockDocumentLoader
987
+ }), CryptographicKey);
988
+ assertFalse(await verifyJsonLd(signed, {
989
+ documentLoader: honestLoader,
990
+ contextLoader: mockDocumentLoader
991
+ }));
992
+ });
941
993
  //#endregion
942
994
  export {};
package/dist/sig/mod.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  const { Temporal } = require("@js-temporal/polyfill");
2
2
  const { URLPattern } = require("urlpattern-polyfill");
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- const require_http = require("../http-BjV0BTWd.cjs");
5
- const require_proof = require("../proof-Xk8lHNc0.cjs");
4
+ const require_http = require("../http-BGP2QCbe.cjs");
5
+ const require_proof = require("../proof-I6YcKRRq.cjs");
6
6
  exports.attachSignature = require_proof.attachSignature;
7
7
  exports.createProof = require_proof.createProof;
8
8
  exports.createSignature = require_proof.createSignature;
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-VyDTd4G3.cjs";
3
- import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-DEvZuyOE.cjs";
4
- import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-B0hW12_O.cjs";
2
+ import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-DiWQB8Mr.cjs";
3
+ import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-B3hNQCG8.cjs";
4
+ import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-Bid79LFU.cjs";
5
5
  export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
package/dist/sig/mod.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference lib="esnext.temporal" />
2
- import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-lf8Hsd91.js";
3
- import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-CnngXDNJ.js";
4
- import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-COIAjwRS.js";
2
+ import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-DQmNpfym.js";
3
+ import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-CiBPcC6F.js";
4
+ import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-TLEvgT1i.js";
5
5
  export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
package/dist/sig/mod.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { A as formatAcceptSignature, M as parseAcceptSignature, N as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, j as fulfillAcceptSignature, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk } from "../http-DRVY9K4R.js";
4
- import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "../proof-D6gZeewf.js";
3
+ import { F as validateAcceptSignature, M as formatAcceptSignature, N as fulfillAcceptSignature, P as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, i as verifyRequest, l as fetchKeyDetailed, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "../http-BPPCh0xN.js";
4
+ import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "../proof-Dz9ObvUq.js";
5
5
  export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
5
  import "../std__assert-BBjXFNOb.mjs";
6
6
  import { r as assertFalse } from "../assert_rejects-DN60FHPX.mjs";
7
- import { t as assert } from "../assert-OguE97r2.mjs";
8
- import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DGu1NFwu.mjs";
9
- import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-B3720pz3.mjs";
7
+ import { t as assert } from "../assert-jSdZMYam.mjs";
8
+ import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-BAK-tUlf.mjs";
9
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-DqqDBw-l.mjs";
10
10
  import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
11
11
  import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
12
12
  //#region src/sig/owner.test.ts
@@ -40,7 +40,7 @@ test("doesActorOwnKey() records OpenTelemetry span", async () => {
40
40
  id: new URL("https://example.com/activity"),
41
41
  actor: new URL("https://example.com/person")
42
42
  }), new CryptographicKey({
43
- id: new URL("https://example.com/person#key"),
43
+ id: new URL("https://example.com/key"),
44
44
  owner: new URL("https://example.com/person")
45
45
  }), {
46
46
  documentLoader: mockDocumentLoader,
@@ -50,9 +50,108 @@ test("doesActorOwnKey() records OpenTelemetry span", async () => {
50
50
  assertEquals(spans.length, 1);
51
51
  const span = spans[0];
52
52
  assertEquals(span.attributes["activitypub.actor.id"], "https://example.com/person");
53
- assertEquals(span.attributes["activitypub.key.id"], "https://example.com/person#key");
53
+ assertEquals(span.attributes["activitypub.key.id"], "https://example.com/key");
54
54
  assertEquals(span.attributes["activitypub.key_ownership.verified"], true);
55
- assertEquals(span.attributes["activitypub.key_ownership.method"], "owner_id");
55
+ assertEquals(span.attributes["activitypub.key_ownership.method"], "key_owner");
56
+ });
57
+ test("doesActorOwnKey() rejects a key that only claims to be owned", async () => {
58
+ const options = {
59
+ documentLoader: mockDocumentLoader,
60
+ contextLoader: mockDocumentLoader
61
+ };
62
+ assertFalse(await doesActorOwnKey(new Create({ actor: new URL("https://example.com/person") }), new CryptographicKey({
63
+ id: new URL("https://attacker.example/key"),
64
+ owner: new URL("https://example.com/person")
65
+ }), options));
66
+ const unresolvable = new URL("https://impersonated.invalid/users/victim");
67
+ assertFalse(await doesActorOwnKey(new Create({ actor: unresolvable }), new CryptographicKey({
68
+ id: new URL("https://attacker.example/key"),
69
+ owner: unresolvable
70
+ }), options));
71
+ });
72
+ test("doesActorOwnKey() ignores an actor embedded in the activity", async () => {
73
+ const { publicKeyPem } = await rsaPublicKey1.toJsonLd({ contextLoader: mockDocumentLoader });
74
+ const activity = await Create.fromJsonLd({
75
+ "@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
76
+ id: "https://example.com/activity",
77
+ type: "Create",
78
+ actor: {
79
+ id: "https://example.com/person",
80
+ type: "Person",
81
+ publicKey: {
82
+ id: "https://attacker.example/key",
83
+ type: "CryptographicKey",
84
+ owner: "https://example.com/person",
85
+ publicKeyPem
86
+ }
87
+ }
88
+ }, {
89
+ documentLoader: mockDocumentLoader,
90
+ contextLoader: mockDocumentLoader
91
+ });
92
+ assertEquals(activity.actorId, new URL("https://example.com/person"));
93
+ assertFalse(await doesActorOwnKey(activity, new CryptographicKey({ id: new URL("https://attacker.example/key") }), {
94
+ documentLoader: mockDocumentLoader,
95
+ contextLoader: mockDocumentLoader
96
+ }));
97
+ });
98
+ test("getKeyOwner() rejects an actor document from another origin", async () => {
99
+ const keyId = "https://attacker.example/key";
100
+ const { publicKeyPem } = await rsaPublicKey1.toJsonLd({ contextLoader: mockDocumentLoader });
101
+ const options = {
102
+ documentLoader(resource) {
103
+ if (resource === keyId) return Promise.resolve({
104
+ contextUrl: null,
105
+ documentUrl: resource,
106
+ document: {
107
+ "@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
108
+ id: "https://example.com/person",
109
+ type: "Person",
110
+ publicKey: [{
111
+ id: keyId,
112
+ type: "CryptographicKey",
113
+ publicKeyPem
114
+ }]
115
+ }
116
+ });
117
+ return mockDocumentLoader(resource);
118
+ },
119
+ contextLoader: mockDocumentLoader
120
+ };
121
+ assertEquals(await getKeyOwner(new URL(keyId), options), null);
122
+ });
123
+ test("doesActorOwnKey() matches a key that leaves its id implicit", async () => {
124
+ const actorId = "https://example.com/implicit-key-actor";
125
+ const { publicKeyPem } = await rsaPublicKey1.toJsonLd({ contextLoader: mockDocumentLoader });
126
+ const options = {
127
+ documentLoader(resource) {
128
+ if (resource === actorId) return Promise.resolve({
129
+ contextUrl: null,
130
+ documentUrl: resource,
131
+ document: {
132
+ "@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
133
+ id: actorId,
134
+ type: "Person",
135
+ publicKey: [{
136
+ type: "CryptographicKey",
137
+ owner: actorId,
138
+ publicKeyPem
139
+ }]
140
+ }
141
+ });
142
+ return mockDocumentLoader(resource);
143
+ },
144
+ contextLoader: mockDocumentLoader
145
+ };
146
+ const activity = new Create({ actor: new URL(actorId) });
147
+ assert(await doesActorOwnKey(activity, new CryptographicKey({
148
+ owner: new URL(actorId),
149
+ publicKey: rsaPublicKey1.publicKey
150
+ }), options));
151
+ assertFalse(await doesActorOwnKey(activity, new CryptographicKey({
152
+ owner: new URL(actorId),
153
+ publicKey: rsaPublicKey2.publicKey
154
+ }), options));
56
155
  });
57
156
  //#endregion
58
157
  export {};
@@ -4,11 +4,10 @@ globalThis.addEventListener = () => {};
4
4
  import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
5
5
  import "../std__assert-BBjXFNOb.mjs";
6
6
  import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
7
- import { t as assertInstanceOf } from "../assert_instance_of-DBC5X09g.mjs";
8
- import { t as assert } from "../assert-OguE97r2.mjs";
9
- import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DGu1NFwu.mjs";
10
- import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-OFoubetZ.mjs";
11
- import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-kFq0IDK4.mjs";
7
+ import { n as assertInstanceOf, t as assert } from "../assert-jSdZMYam.mjs";
8
+ import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
9
+ import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-HOAywiid.mjs";
10
+ import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-D5vP7VIN.mjs";
12
11
  import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place } from "@fedify/vocab";
13
12
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
14
13
  import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
@@ -530,5 +529,74 @@ test("verifyObject()", async () => {
530
529
  assertInstanceOf(note, Note);
531
530
  assertEquals(note.content, "Hello world");
532
531
  });
532
+ test("verifyObject() rejects a key that claims a forged controller", async () => {
533
+ const keyId = new URL("https://attacker.example/multikey");
534
+ const impersonated = "https://example.com/person2";
535
+ const attackerActor = "https://attacker.example/actor";
536
+ const multikeyDocument = await ed25519Multikey.toJsonLd({ contextLoader: mockDocumentLoader });
537
+ const options = {
538
+ format: "compact",
539
+ contextLoader: mockDocumentLoader,
540
+ documentLoader: mockDocumentLoader,
541
+ context: ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"]
542
+ };
543
+ const signed = await signObject(new Create({
544
+ id: new URL("https://attacker.example/activities/1"),
545
+ actor: new URL(impersonated),
546
+ object: new Note({
547
+ id: new URL("https://attacker.example/notes/1"),
548
+ attribution: new URL(impersonated),
549
+ content: "Hello world"
550
+ })
551
+ }), ed25519PrivateKey, keyId, options);
552
+ const jsonLd = await signed.toJsonLd(options);
553
+ const serveKeyControlledBy = (controller) => (resource) => {
554
+ if (resource === keyId.href) return Promise.resolve({
555
+ contextUrl: null,
556
+ documentUrl: resource,
557
+ document: {
558
+ ...multikeyDocument,
559
+ id: keyId.href,
560
+ controller
561
+ }
562
+ });
563
+ if (resource === attackerActor) return Promise.resolve({
564
+ contextUrl: null,
565
+ documentUrl: resource,
566
+ document: {
567
+ "@context": [
568
+ "https://www.w3.org/ns/activitystreams",
569
+ "https://w3id.org/security/v1",
570
+ "https://w3id.org/security/multikey/v1",
571
+ "https://w3id.org/security/data-integrity/v1",
572
+ "https://www.w3.org/ns/did/v1"
573
+ ],
574
+ id: resource,
575
+ type: "Person",
576
+ assertionMethod: [keyId.href]
577
+ }
578
+ });
579
+ return mockDocumentLoader(resource);
580
+ };
581
+ assertEquals(await verifyObject(Create, jsonLd, {
582
+ documentLoader: serveKeyControlledBy(impersonated),
583
+ contextLoader: mockDocumentLoader
584
+ }), null);
585
+ const honestLoader = serveKeyControlledBy(attackerActor);
586
+ let proof = null;
587
+ for await (const p of signed.getProofs(options)) {
588
+ proof = p;
589
+ break;
590
+ }
591
+ assertInstanceOf(proof, DataIntegrityProof);
592
+ assertInstanceOf(await verifyProof(jsonLd, proof, {
593
+ documentLoader: honestLoader,
594
+ contextLoader: mockDocumentLoader
595
+ }), Multikey);
596
+ assertEquals(await verifyObject(Create, jsonLd, {
597
+ documentLoader: honestLoader,
598
+ contextLoader: mockDocumentLoader
599
+ }), null);
600
+ });
533
601
  //#endregion
534
602
  export {};
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { c as getNormalizationContextLoader } from "./ld-COo05yJj.mjs";
4
+ import { c as getNormalizationContextLoader } from "./ld-DNl7KwLY.mjs";
5
5
  import jsonld from "@fedify/vocab-runtime/jsonld";
6
6
  //#region src/federation/temporal.ts
7
7
  function isPlainObject(value) {
@@ -1,5 +1,5 @@
1
1
  import "@js-temporal/polyfill";
2
2
  import "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { i as testDefinitions, n as createOutboxContext, r as createRequestContext, t as createInboxContext } from "../context-DVoTs_wM.mjs";
4
+ import { i as testDefinitions, n as createOutboxContext, r as createRequestContext, t as createInboxContext } from "../context-BepjCFHN.mjs";
5
5
  export { createInboxContext, createOutboxContext, createRequestContext, testDefinitions };