@fedify/fedify 2.4.0-dev.1570 → 2.4.0-dev.1573

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 (51) hide show
  1. package/README.md +0 -4
  2. package/dist/{builder-CJnWbgbj.mjs → builder-DRvTk1DV.mjs} +2 -2
  3. package/dist/compat/transformers.test.mjs +1 -1
  4. package/dist/{deno-klNxGW7W.mjs → deno-NNtxIQMN.mjs} +1 -1
  5. package/dist/{docloader-CuFH35j1.mjs → docloader-B3zJcGV1.mjs} +2 -2
  6. package/dist/federation/builder.test.mjs +1 -1
  7. package/dist/federation/handler.test.mjs +13 -3
  8. package/dist/federation/idempotency.test.mjs +2 -2
  9. package/dist/federation/metrics.test.mjs +1 -1
  10. package/dist/federation/middleware.test.mjs +7 -7
  11. package/dist/federation/mod.cjs +1 -1
  12. package/dist/federation/mod.js +1 -1
  13. package/dist/federation/send.test.mjs +3 -3
  14. package/dist/federation/tasks/enqueue.test.mjs +1 -1
  15. package/dist/federation/tasks/tasks.test.mjs +2 -2
  16. package/dist/federation/temporal.test.mjs +1 -1
  17. package/dist/federation/webfinger.test.mjs +1 -1
  18. package/dist/{http-D0jH0kco.js → http-B7tuUJIL.js} +77 -11
  19. package/dist/{http-JdRPUYku.mjs → http-Bz2dzdDd.mjs} +3 -3
  20. package/dist/{http-DeuPW1Oh.cjs → http-DTLIxKTx.cjs} +75 -9
  21. package/dist/{key-o0_ipvUR.mjs → key-DRzXlJqV.mjs} +76 -10
  22. package/dist/{kv-cache-DSWq2JHU.js → kv-cache-CtSufpZ1.js} +1 -1
  23. package/dist/{kv-cache-CM7w20U5.mjs → kv-cache-DCxdceYC.mjs} +1 -1
  24. package/dist/{kv-cache-C3rqzQvu.cjs → kv-cache-FrvAhESd.cjs} +1 -1
  25. package/dist/{ld-C__CEgQH.mjs → ld-Fg4L4ACx.mjs} +3 -3
  26. package/dist/{metrics-CLSPm4dZ.mjs → metrics-BcukmbIq.mjs} +3 -3
  27. package/dist/{middleware-zuLSkPIk.js → middleware-Bq3xO08m.js} +3 -3
  28. package/dist/{middleware-CdMiavoh.mjs → middleware-DIkD3qG1.mjs} +1 -1
  29. package/dist/{middleware-B502nwxx.cjs → middleware-DluTV87a.cjs} +3 -3
  30. package/dist/{middleware-CjHqy-1i.mjs → middleware-eIA8GL1A.mjs} +12 -12
  31. package/dist/mod.cjs +4 -4
  32. package/dist/mod.js +4 -4
  33. package/dist/nodeinfo/handler.test.mjs +1 -1
  34. package/dist/{owner-gz4TUfKG.mjs → owner-BuTQfsLw.mjs} +2 -2
  35. package/dist/{proof-CiDzRtr0.cjs → proof-0kBkKeh3.cjs} +1 -1
  36. package/dist/{proof-DQWTf6oB.js → proof-BZxwbdof.js} +1 -1
  37. package/dist/{proof-CuQpZ_AT.mjs → proof-CYRfoVyl.mjs} +3 -3
  38. package/dist/{send-B60teucv.mjs → send-CUsSH2KQ.mjs} +3 -3
  39. package/dist/sig/http.test.mjs +2 -2
  40. package/dist/sig/key.test.mjs +187 -3
  41. package/dist/sig/ld.test.mjs +2 -2
  42. package/dist/sig/mod.cjs +2 -2
  43. package/dist/sig/mod.js +2 -2
  44. package/dist/sig/owner.test.mjs +1 -1
  45. package/dist/sig/proof.test.mjs +62 -2
  46. package/dist/{temporal-CvVMrvJJ.mjs → temporal-uleCkDIj.mjs} +1 -1
  47. package/dist/utils/docloader.test.mjs +2 -2
  48. package/dist/utils/kv-cache.test.mjs +1 -1
  49. package/dist/utils/mod.cjs +1 -1
  50. package/dist/utils/mod.js +1 -1
  51. package/package.json +6 -6
@@ -6,7 +6,7 @@ import "../std__assert-Dh6uLf_q.mjs";
6
6
  import { r as assertFalse } from "../assert_rejects-DAdaaIWM.mjs";
7
7
  import { t as assert } from "../assert-DvVHoIZ0.mjs";
8
8
  import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-CSYsOMFG.mjs";
9
- import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-gz4TUfKG.mjs";
9
+ import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-BuTQfsLw.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
@@ -8,10 +8,10 @@ import { t as assertInstanceOf } from "../assert_instance_of-CxoC8bVq.mjs";
8
8
  import { t as assert } from "../assert-DvVHoIZ0.mjs";
9
9
  import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CSYsOMFG.mjs";
10
10
  import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-BNL8AC14.mjs";
11
- import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-CuQpZ_AT.mjs";
11
+ import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-CYRfoVyl.mjs";
12
12
  import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place } from "@fedify/vocab";
13
13
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
14
- import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
14
+ import { decodeMultibase, exportDidKey, exportMultibaseKey, importMultibaseKey, parseIri } from "@fedify/vocab-runtime";
15
15
  import { decodeHex } from "byte-encodings/hex";
16
16
  //#region src/sig/proof.test.ts
17
17
  const fep8b32TestVectorPrivateKey = await crypto.subtle.importKey("jwk", {
@@ -326,6 +326,66 @@ test("verifyProof()", async () => {
326
326
  }), null);
327
327
  assertFalse(contextLoaderCalls.includes("https://attacker.example/ctx"));
328
328
  });
329
+ test("verifyProof() resolves did:key verification methods locally", async () => {
330
+ const multibaseKey = (await exportDidKey(ed25519PublicKey.publicKey)).slice(8);
331
+ const did = `did:key:${multibaseKey}`;
332
+ const keyId = new URL(`${did}#${multibaseKey}`);
333
+ const created = Temporal.Instant.from("2023-02-24T23:36:38Z");
334
+ const note = new Note({
335
+ id: parseIri(`ap://did:key:${multibaseKey}/objects/1`),
336
+ attribution: parseIri(`ap://did:key:${multibaseKey}/actor`),
337
+ content: "Portable hello"
338
+ });
339
+ const proof = await createProof(note, ed25519PrivateKey, keyId, {
340
+ created,
341
+ contextLoader: mockDocumentLoader,
342
+ context: ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"]
343
+ });
344
+ const jsonLd = await note.toJsonLd({
345
+ format: "compact",
346
+ contextLoader: mockDocumentLoader,
347
+ context: ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"]
348
+ });
349
+ let documentLoaderCalls = 0;
350
+ assertEquals(await verifyProof(jsonLd, proof, {
351
+ contextLoader: mockDocumentLoader,
352
+ documentLoader() {
353
+ documentLoaderCalls++;
354
+ throw new TypeError("did:key must not use the document loader");
355
+ }
356
+ }), new Multikey({
357
+ id: keyId,
358
+ controller: new URL(did),
359
+ publicKey: ed25519PublicKey.publicKey
360
+ }));
361
+ assertEquals(documentLoaderCalls, 0);
362
+ const tampered = { ...jsonLd };
363
+ tampered.content = "Portable goodbye";
364
+ assertEquals(await verifyProof(tampered, proof, {
365
+ contextLoader: mockDocumentLoader,
366
+ documentLoader() {
367
+ throw new TypeError("did:key must not use the document loader");
368
+ }
369
+ }), null);
370
+ assertEquals(await verifyProof(jsonLd, proof.clone({ verificationMethod: new URL(`${did}#z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK`) }), {
371
+ contextLoader: mockDocumentLoader,
372
+ documentLoader() {
373
+ throw new TypeError("did:key must not use the document loader");
374
+ }
375
+ }), null);
376
+ const unsupportedMultibaseKey = await exportMultibaseKey(rsaPublicKey2.publicKey);
377
+ const unsupportedDid = `did:key:${unsupportedMultibaseKey}`;
378
+ const unsupportedProof = proof.clone({ verificationMethod: new URL(`${unsupportedDid}#${unsupportedMultibaseKey}`) });
379
+ let unsupportedDocumentLoaderCalls = 0;
380
+ assertEquals(await verifyProof(jsonLd, unsupportedProof, {
381
+ contextLoader: mockDocumentLoader,
382
+ documentLoader() {
383
+ unsupportedDocumentLoaderCalls++;
384
+ throw new TypeError("did:key must not use the document loader");
385
+ }
386
+ }), null);
387
+ assertEquals(unsupportedDocumentLoaderCalls, 0);
388
+ });
329
389
  test("verifyProof() records verification duration metric", async (t) => {
330
390
  const jsonLd = {
331
391
  "@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"],
@@ -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-C__CEgQH.mjs";
4
+ import { c as getNormalizationContextLoader } from "./ld-Fg4L4ACx.mjs";
5
5
  import jsonld from "@fedify/vocab-runtime/jsonld";
6
6
  //#region src/federation/temporal.ts
7
7
  function isPlainObject(value) {
@@ -5,9 +5,9 @@ import { t as esm_default } from "../esm-vrlUxr60.mjs";
5
5
  import { t as assertEquals } from "../assert_equals-PBVKNMJd.mjs";
6
6
  import "../std__assert-Dh6uLf_q.mjs";
7
7
  import { t as assertRejects } from "../assert_rejects-DAdaaIWM.mjs";
8
- import { l as verifyRequest } from "../http-JdRPUYku.mjs";
8
+ import { l as verifyRequest } from "../http-Bz2dzdDd.mjs";
9
9
  import { i as rsaPrivateKey2 } from "../keys-CSYsOMFG.mjs";
10
- import { t as getAuthenticatedDocumentLoader } from "../docloader-CuFH35j1.mjs";
10
+ import { t as getAuthenticatedDocumentLoader } from "../docloader-B3zJcGV1.mjs";
11
11
  import { mockDocumentLoader, test } from "@fedify/fixture";
12
12
  import { UrlError } from "@fedify/vocab-runtime";
13
13
  //#region src/utils/docloader.test.ts
@@ -1,7 +1,7 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
3
  globalThis.addEventListener = () => {};
4
- import { n as kvCache, t as MockKvStore } from "../kv-cache-CM7w20U5.mjs";
4
+ import { n as kvCache, t as MockKvStore } from "../kv-cache-DCxdceYC.mjs";
5
5
  import { deepStrictEqual, throws } from "node:assert";
6
6
  import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
7
7
  import { preloadedContexts } from "@fedify/vocab-runtime";
@@ -1,6 +1,6 @@
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_kv_cache = require("../kv-cache-C3rqzQvu.cjs");
4
+ const require_kv_cache = require("../kv-cache-FrvAhESd.cjs");
5
5
  exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
6
6
  exports.kvCache = require_kv_cache.kvCache;
package/dist/utils/mod.js CHANGED
@@ -1,4 +1,4 @@
1
1
  import { Temporal } from "@js-temporal/polyfill";
2
2
  import { URLPattern } from "urlpattern-polyfill";
3
- import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-DSWq2JHU.js";
3
+ import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-CtSufpZ1.js";
4
4
  export { getAuthenticatedDocumentLoader, kvCache };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/fedify",
3
- "version": "2.4.0-dev.1570+f1b6aaa3",
3
+ "version": "2.4.0-dev.1573+246bd0b2",
4
4
  "description": "An ActivityPub server framework",
5
5
  "keywords": [
6
6
  "ActivityPub",
@@ -151,10 +151,10 @@
151
151
  "jsonld": "^9.0.0",
152
152
  "structured-field-values": "^2.0.4",
153
153
  "urlpattern-polyfill": "^10.1.0",
154
- "@fedify/vocab": "2.4.0-dev.1570+f1b6aaa3",
155
- "@fedify/vocab-runtime": "2.4.0-dev.1570+f1b6aaa3",
156
- "@fedify/uri-template": "2.4.0-dev.1570+f1b6aaa3",
157
- "@fedify/webfinger": "2.4.0-dev.1570+f1b6aaa3"
154
+ "@fedify/vocab": "2.4.0-dev.1573+246bd0b2",
155
+ "@fedify/webfinger": "2.4.0-dev.1573+246bd0b2",
156
+ "@fedify/uri-template": "2.4.0-dev.1573+246bd0b2",
157
+ "@fedify/vocab-runtime": "2.4.0-dev.1573+246bd0b2"
158
158
  },
159
159
  "devDependencies": {
160
160
  "@std/assert": "npm:@jsr/std__assert@^0.226.0",
@@ -167,7 +167,7 @@
167
167
  "typescript": "^6.0.0",
168
168
  "wrangler": "^4.17.0",
169
169
  "@fedify/fixture": "2.0.0",
170
- "@fedify/vocab-tools": "^2.4.0-dev.1570+f1b6aaa3"
170
+ "@fedify/vocab-tools": "^2.4.0-dev.1573+246bd0b2"
171
171
  },
172
172
  "scripts": {
173
173
  "build:self": "tsdown",