@fedify/fedify 2.4.0-dev.2010 → 2.4.0-dev.2030
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{assert-CebeUf0C.mjs → assert-D1Eafmd_.mjs} +1 -1
- package/dist/{assert_equals-CBlRfA-_.mjs → assert_equals-Z6IcEbWU.mjs} +2 -28
- package/dist/{assert_exists-DtzkXC47.mjs → assert_exists-cffSpJ7X.mjs} +1 -1
- package/dist/{assert_false-3pLLLsO4.mjs → assert_false-CPdRnc3E.mjs} +1 -1
- package/dist/{assert_greater_or_equal-BApOTh1h.mjs → assert_greater_or_equal-BlafOF4-.mjs} +2 -1
- package/dist/{assert_instance_of-g3WcyYNR.mjs → assert_instance_of-mrXWWNY-.mjs} +1 -1
- package/dist/{assert_not_equals-BN7yDMWe.mjs → assert_not_equals-CpPK2t89.mjs} +2 -1
- package/dist/{assert_rejects-wFbSPn1O.mjs → assert_rejects-CTptdYck.mjs} +2 -2
- package/dist/{assert_strict_equals-Bpjl4Psw.mjs → assert_strict_equals-CYvBmkpC.mjs} +2 -1
- package/dist/{assert_throws-BJ5wuvR2.mjs → assert_throws-BYITOvPO.mjs} +2 -1
- package/dist/assertion_error-B-cx0fFA.mjs +31 -0
- package/dist/{builder-asm96yV1.mjs → builder-BYJ5otJa.mjs} +2 -2
- package/dist/compat/outgoing-jsonld.test.mjs +71 -3
- package/dist/compat/public-audience.test.mjs +3 -3
- package/dist/compat/secured-document.test.d.mts +2 -0
- package/dist/compat/secured-document.test.mjs +58 -0
- package/dist/compat/transformers.test.mjs +4 -4
- package/dist/{compound-proof-7UIAueLV.mjs → compound-proof-BIvUoJxm.mjs} +74 -2
- package/dist/{deno-Ckq9TwCv.mjs → deno-Vj_9wePq.mjs} +1 -1
- package/dist/{docloader-DUKEPG-O.mjs → docloader-qUudHZVH.mjs} +2 -2
- package/dist/federation/builder.test.mjs +5 -5
- package/dist/federation/circuit-breaker.test.mjs +3 -3
- package/dist/federation/collection.test.mjs +2 -2
- package/dist/federation/compound-fanout.test.d.mts +2 -0
- package/dist/federation/compound-fanout.test.mjs +228 -0
- package/dist/federation/handler-compound-proof.test.mjs +5 -5
- package/dist/federation/handler.test.mjs +11 -11
- package/dist/federation/idempotency.test.mjs +4 -4
- package/dist/federation/inbox.test.mjs +2 -2
- package/dist/federation/keycache.test.mjs +3 -3
- package/dist/federation/kv.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +4 -4
- package/dist/federation/middleware.test.mjs +17 -17
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.js +1 -1
- package/dist/federation/mq.test.mjs +7 -6
- package/dist/federation/negotiation.test.mjs +3 -3
- package/dist/federation/outgoing-proof.test.d.mts +2 -0
- package/dist/federation/outgoing-proof.test.mjs +396 -0
- package/dist/federation/retry.test.mjs +3 -2
- package/dist/federation/router.test.mjs +5 -5
- package/dist/federation/send.test.mjs +11 -11
- package/dist/federation/tasks/enqueue.test.mjs +1 -1
- package/dist/federation/tasks/tasks.test.mjs +2 -2
- package/dist/federation/temporal.test.mjs +4 -4
- package/dist/federation/webfinger.test.mjs +4 -4
- package/dist/{federation-CgbvMauV.cjs → federation-CTnaljmy.cjs} +203 -37
- package/dist/{http-DQBfmkrS.cjs → http-B5F1JMh0.cjs} +1 -1
- package/dist/{http-DQA2JOEJ.js → http-By8tnmEr.js} +1 -1
- package/dist/{http-DZaAutqg.mjs → http-D4WPcJUe.mjs} +3 -3
- package/dist/{key-zxzx01Ec.mjs → key-B_Zc5Jbd.mjs} +2 -2
- package/dist/{kv-cache-sy8OMNT8.cjs → kv-cache-8K70pjtX.cjs} +1 -1
- package/dist/{kv-cache-CbrUX90H.mjs → kv-cache-BXdT7pJQ.mjs} +1 -1
- package/dist/{kv-cache-BBoePTOJ.js → kv-cache-BswMKQjC.js} +1 -1
- package/dist/{ld-CD_TN0e8.mjs → ld-B16KUSIQ.mjs} +3 -3
- package/dist/{metrics-B47Cm5gK.mjs → metrics-DpQqUAmh.mjs} +1 -1
- package/dist/{middleware-U_Gannqi.mjs → middleware-BL5HFFVU.mjs} +1 -1
- package/dist/{middleware-pHwDTAnq.mjs → middleware-C7_hqDnl.mjs} +143 -49
- package/dist/{middleware-U0OIuqwD.js → middleware-Cxto6Bq2.js} +204 -38
- package/dist/{mod-UDwMjuHM.d.ts → mod-CNRAxXEb.d.ts} +1 -5
- package/dist/{mod-CbKDOnCt.d.cts → mod-CVQFWefn.d.cts} +1 -5
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +1 -1
- package/dist/mod.d.ts +1 -1
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/client.test.mjs +2 -2
- package/dist/nodeinfo/handler.test.mjs +3 -3
- package/dist/nodeinfo/types.test.mjs +3 -3
- package/dist/otel/exporter.test.mjs +2 -2
- package/dist/{outgoing-jsonld-B5Ne7JoL.mjs → outgoing-jsonld-4IJqPYos.mjs} +11 -9
- package/dist/{owner-u3IJRhVx.mjs → owner-BIOIhZoM.mjs} +2 -2
- package/dist/{owner-BNKC3s6G.js → owner-D-E0bT2O.js} +127 -35
- package/dist/{owner--mNatWct.cjs → owner-WUYke16i.cjs} +126 -34
- package/dist/{proof-D3te0SP-.mjs → proof-BVxJu5vv.mjs} +80 -23
- package/dist/{public-audience-Cc2YJ3ip.mjs → public-audience--klBIOk1.mjs} +13 -9
- package/dist/secured-document-CxzZZ9nL.mjs +35 -0
- package/dist/{send-CDr0Zivk.mjs → send-Cr5FJ7iu.mjs} +3 -3
- package/dist/sig/compound-proof-discovery.test.mjs +3 -3
- package/dist/sig/compound-proof-producer.test.d.mts +2 -0
- package/dist/sig/compound-proof-producer.test.mjs +107 -0
- package/dist/sig/compound-proof-verification.test.mjs +5 -5
- package/dist/sig/compound-proof.test.mjs +145 -58
- package/dist/sig/http.test.mjs +11 -10
- package/dist/sig/key.test.mjs +6 -6
- package/dist/sig/ld.test.mjs +9 -9
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +1 -1
- package/dist/sig/mod.d.ts +1 -1
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +5 -5
- package/dist/sig/proof.test.mjs +9 -9
- package/dist/std__assert-DvMDRPes.mjs +8 -0
- package/dist/{temporal-DKhVF_Uk.mjs → temporal-CCf0lZV3.mjs} +1 -1
- package/dist/testing/kv.test.mjs +2 -2
- package/dist/utils/docloader.test.mjs +5 -5
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +6 -6
- package/dist/std__assert-CxFT0MNt.mjs +0 -8
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import {
|
|
4
|
+
import { t as AssertionError } from "./assertion_error-B-cx0fFA.mjs";
|
|
5
5
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert.js
|
|
6
6
|
/**
|
|
7
7
|
* Make an assertion, error will be thrown if `expr` does not have truthy value.
|
|
@@ -1,33 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Error thrown when an assertion fails.
|
|
7
|
-
*
|
|
8
|
-
* @example Usage
|
|
9
|
-
* ```ts no-eval
|
|
10
|
-
* import { AssertionError } from "@std/assert/assertion-error";
|
|
11
|
-
*
|
|
12
|
-
* throw new AssertionError("Assertion failed");
|
|
13
|
-
* ```
|
|
14
|
-
*/ var AssertionError = class extends Error {
|
|
15
|
-
/** Constructs a new instance.
|
|
16
|
-
*
|
|
17
|
-
* @example Usage
|
|
18
|
-
* ```ts no-eval
|
|
19
|
-
* import { AssertionError } from "@std/assert/assertion-error";
|
|
20
|
-
*
|
|
21
|
-
* throw new AssertionError("Assertion failed");
|
|
22
|
-
* ```
|
|
23
|
-
*
|
|
24
|
-
* @param message The error message.
|
|
25
|
-
*/ constructor(message) {
|
|
26
|
-
super(message);
|
|
27
|
-
this.name = "AssertionError";
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
//#endregion
|
|
4
|
+
import { t as AssertionError } from "./assertion_error-B-cx0fFA.mjs";
|
|
31
5
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/equal.js
|
|
32
6
|
function isKeyedCollection(x) {
|
|
33
7
|
return [Symbol.iterator, "size"].every((k) => k in x);
|
|
@@ -1010,4 +984,4 @@ const NON_WHITESPACE_REGEXP = /\S/;
|
|
|
1010
984
|
throw new AssertionError(message);
|
|
1011
985
|
}
|
|
1012
986
|
//#endregion
|
|
1013
|
-
export { red as a, equal as c, buildMessage as i,
|
|
987
|
+
export { red as a, equal as c, buildMessage as i, diffStr as n, stripAnsiCode as o, diff as r, format as s, assertEquals as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import {
|
|
4
|
+
import { t as AssertionError } from "./assertion_error-B-cx0fFA.mjs";
|
|
5
5
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_exists.js
|
|
6
6
|
/**
|
|
7
7
|
* Make an assertion that actual is not null or undefined.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import {
|
|
4
|
+
import { t as AssertionError } from "./assertion_error-B-cx0fFA.mjs";
|
|
5
5
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_false.js
|
|
6
6
|
/**
|
|
7
7
|
* Make an assertion, error will be thrown if `expr` have truthy value.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import {
|
|
4
|
+
import { t as AssertionError } from "./assertion_error-B-cx0fFA.mjs";
|
|
5
|
+
import { s as format } from "./assert_equals-Z6IcEbWU.mjs";
|
|
5
6
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_greater_or_equal.js
|
|
6
7
|
/**
|
|
7
8
|
* Make an assertion that `actual` is greater than or equal to `expected`.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import {
|
|
4
|
+
import { t as AssertionError } from "./assertion_error-B-cx0fFA.mjs";
|
|
5
5
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_instance_of.js
|
|
6
6
|
/**
|
|
7
7
|
* Make an assertion that `obj` is an instance of `type`.
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import {
|
|
4
|
+
import { t as AssertionError } from "./assertion_error-B-cx0fFA.mjs";
|
|
5
|
+
import { c as equal } from "./assert_equals-Z6IcEbWU.mjs";
|
|
5
6
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_not_equals.js
|
|
6
7
|
/**
|
|
7
8
|
* Make an assertion that `actual` and `expected` are not equal, deeply.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import {
|
|
5
|
-
import { n as assertIsError } from "./assert_throws-
|
|
4
|
+
import { t as AssertionError } from "./assertion_error-B-cx0fFA.mjs";
|
|
5
|
+
import { n as assertIsError } from "./assert_throws-BYITOvPO.mjs";
|
|
6
6
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_rejects.js
|
|
7
7
|
async function assertRejects(fn, errorClassOrMsg, msgIncludesOrMsg, msg) {
|
|
8
8
|
let ErrorClass = void 0;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import {
|
|
4
|
+
import { t as AssertionError } from "./assertion_error-B-cx0fFA.mjs";
|
|
5
|
+
import { a as red, i as buildMessage, n as diffStr, r as diff, s as format } from "./assert_equals-Z6IcEbWU.mjs";
|
|
5
6
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_strict_equals.js
|
|
6
7
|
/**
|
|
7
8
|
* Make an assertion that `actual` and `expected` are equal using
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import {
|
|
4
|
+
import { t as AssertionError } from "./assertion_error-B-cx0fFA.mjs";
|
|
5
|
+
import { o as stripAnsiCode } from "./assert_equals-Z6IcEbWU.mjs";
|
|
5
6
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_is_error.js
|
|
6
7
|
/**
|
|
7
8
|
* Make an assertion that `error` is an `Error`.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import "temporal-polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assertion_error.js
|
|
5
|
+
/**
|
|
6
|
+
* Error thrown when an assertion fails.
|
|
7
|
+
*
|
|
8
|
+
* @example Usage
|
|
9
|
+
* ```ts no-eval
|
|
10
|
+
* import { AssertionError } from "@std/assert/assertion-error";
|
|
11
|
+
*
|
|
12
|
+
* throw new AssertionError("Assertion failed");
|
|
13
|
+
* ```
|
|
14
|
+
*/ var AssertionError = class extends Error {
|
|
15
|
+
/** Constructs a new instance.
|
|
16
|
+
*
|
|
17
|
+
* @example Usage
|
|
18
|
+
* ```ts no-eval
|
|
19
|
+
* import { AssertionError } from "@std/assert/assertion-error";
|
|
20
|
+
*
|
|
21
|
+
* throw new AssertionError("Assertion failed");
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @param message The error message.
|
|
25
|
+
*/ constructor(message) {
|
|
26
|
+
super(message);
|
|
27
|
+
this.name = "AssertionError";
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { AssertionError as t };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
4
|
+
import { n as version, t as name } from "./deno-Vj_9wePq.mjs";
|
|
5
5
|
import { t as ActivityListenerSet } from "./activity-listener-C-BSbKI7.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { Router, RouterError, assertPath } from "@fedify/uri-template";
|
|
@@ -85,7 +85,7 @@ var FederationBuilderImpl = class {
|
|
|
85
85
|
* specified.
|
|
86
86
|
*/
|
|
87
87
|
async build(options) {
|
|
88
|
-
const { FederationImpl } = await import("./middleware-
|
|
88
|
+
const { FederationImpl } = await import("./middleware-BL5HFFVU.mjs");
|
|
89
89
|
const f = new FederationImpl(options);
|
|
90
90
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
91
91
|
f.router = this.router.clone();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { t as assertEquals } from "../assert_equals-
|
|
5
|
-
import { t as assertStrictEquals } from "../assert_strict_equals-
|
|
6
|
-
import { n as normalizeAttachmentArrays, r as normalizeOutgoingActivityJsonLd, t as isPreloadedContextAttachmentSafe } from "../outgoing-jsonld-
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
|
+
import { t as assertStrictEquals } from "../assert_strict_equals-CYvBmkpC.mjs";
|
|
6
|
+
import { n as normalizeAttachmentArrays, r as normalizeOutgoingActivityJsonLd, t as isPreloadedContextAttachmentSafe } from "../outgoing-jsonld-4IJqPYos.mjs";
|
|
7
7
|
import { Create, Document, Note, PUBLIC_COLLECTION } from "@fedify/vocab";
|
|
8
8
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
9
9
|
//#region src/compat/outgoing-jsonld.test.ts
|
|
@@ -185,5 +185,73 @@ test("normalizeOutgoingActivityJsonLd() applies outgoing JSON-LD workarounds", a
|
|
|
185
185
|
const normalizedObject = normalized.object;
|
|
186
186
|
assertEquals(Array.isArray(normalizedObject.attachment), true);
|
|
187
187
|
});
|
|
188
|
+
const securedChild = {
|
|
189
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"],
|
|
190
|
+
id: "ap://did:key:z6Mkabc/objects/1",
|
|
191
|
+
type: "Note",
|
|
192
|
+
content: "Hello",
|
|
193
|
+
to: "as:Public",
|
|
194
|
+
attachment: {
|
|
195
|
+
type: "Document",
|
|
196
|
+
mediaType: "image/png",
|
|
197
|
+
url: "https://example.com/image.png"
|
|
198
|
+
},
|
|
199
|
+
proof: {
|
|
200
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"],
|
|
201
|
+
type: "DataIntegrityProof",
|
|
202
|
+
cryptosuite: "eddsa-jcs-2022",
|
|
203
|
+
created: "2023-02-24T23:36:38Z",
|
|
204
|
+
verificationMethod: "did:key:z6Mkabc#z6Mkabc",
|
|
205
|
+
proofPurpose: "assertionMethod",
|
|
206
|
+
proofValue: "z3FXQ"
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
function compoundWithSecuredChild() {
|
|
210
|
+
return {
|
|
211
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"],
|
|
212
|
+
id: "ap://did:key:z6Mkdef/activities/1",
|
|
213
|
+
type: "Create",
|
|
214
|
+
actor: "ap://did:key:z6Mkdef/actor",
|
|
215
|
+
to: "as:Public",
|
|
216
|
+
object: structuredClone(securedChild)
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
test("normalizeOutgoingActivityJsonLd() can preserve a nested secured child", async () => {
|
|
220
|
+
const preserved = await normalizeOutgoingActivityJsonLd(compoundWithSecuredChild(), mockDocumentLoader, { preserveNestedSecuredDocuments: true });
|
|
221
|
+
assertEquals(preserved.to, PUBLIC_COLLECTION.href);
|
|
222
|
+
assertEquals(preserved.object, securedChild);
|
|
223
|
+
});
|
|
224
|
+
test("normalizeOutgoingActivityJsonLd() rewrites a nested secured child by default", async () => {
|
|
225
|
+
const normalized = await normalizeOutgoingActivityJsonLd(compoundWithSecuredChild(), mockDocumentLoader);
|
|
226
|
+
const child = normalized.object;
|
|
227
|
+
assertEquals(normalized.to, PUBLIC_COLLECTION.href);
|
|
228
|
+
assertEquals(child.to, PUBLIC_COLLECTION.href);
|
|
229
|
+
assertEquals(child.attachment, [securedChild.attachment]);
|
|
230
|
+
});
|
|
231
|
+
test("normalizeOutgoingActivityJsonLd() only preserves a complete secured child", async () => {
|
|
232
|
+
const cases = {
|
|
233
|
+
"no proof": (child) => delete child.proof,
|
|
234
|
+
"null proof": (child) => child.proof = null,
|
|
235
|
+
"proof set": (child) => child.proof = [securedChild.proof],
|
|
236
|
+
"proof without a verification method": (child) => delete child.proof.verificationMethod,
|
|
237
|
+
"incomplete proof": (child) => delete child.proof.cryptosuite,
|
|
238
|
+
"empty proof value": (child) => child.proof.proofValue = ""
|
|
239
|
+
};
|
|
240
|
+
for (const [name, mutate] of Object.entries(cases)) {
|
|
241
|
+
const input = compoundWithSecuredChild();
|
|
242
|
+
mutate(input.object);
|
|
243
|
+
const child = (await normalizeOutgoingActivityJsonLd(input, mockDocumentLoader, { preserveNestedSecuredDocuments: true })).object;
|
|
244
|
+
assertEquals(child.to, PUBLIC_COLLECTION.href, name);
|
|
245
|
+
assertEquals(child.attachment, [securedChild.attachment], name);
|
|
246
|
+
}
|
|
247
|
+
});
|
|
248
|
+
test("normalizeOutgoingActivityJsonLd() still normalizes a top-level secured document", async () => {
|
|
249
|
+
const normalized = await normalizeOutgoingActivityJsonLd({
|
|
250
|
+
...structuredClone(securedChild),
|
|
251
|
+
id: "ap://did:key:z6Mkabc/objects/top-level"
|
|
252
|
+
}, mockDocumentLoader, { preserveNestedSecuredDocuments: true });
|
|
253
|
+
assertEquals(normalized.to, PUBLIC_COLLECTION.href);
|
|
254
|
+
assertEquals(normalized.attachment, [securedChild.attachment]);
|
|
255
|
+
});
|
|
188
256
|
//#endregion
|
|
189
257
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { t as assertEquals } from "../assert_equals-
|
|
5
|
-
import { t as assertNotEquals } from "../assert_not_equals-
|
|
6
|
-
import { t as normalizePublicAudience } from "../public-audience
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
|
+
import { t as assertNotEquals } from "../assert_not_equals-CpPK2t89.mjs";
|
|
6
|
+
import { t as normalizePublicAudience } from "../public-audience--klBIOk1.mjs";
|
|
7
7
|
import { Create, Follow, Note, PUBLIC_COLLECTION } from "@fedify/vocab";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
import { getDocumentLoader, preloadedContexts } from "@fedify/vocab-runtime";
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import "temporal-polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
5
|
+
import { t as isSelfContainedSecuredDocument } from "../secured-document-CxzZZ9nL.mjs";
|
|
6
|
+
import { test } from "@fedify/fixture";
|
|
7
|
+
//#region src/compat/secured-document.test.ts
|
|
8
|
+
function securedDocument() {
|
|
9
|
+
return {
|
|
10
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"],
|
|
11
|
+
id: "ap://did:key:z6Mkabc/objects/1",
|
|
12
|
+
type: "Note",
|
|
13
|
+
content: "Hello",
|
|
14
|
+
proof: {
|
|
15
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"],
|
|
16
|
+
type: "DataIntegrityProof",
|
|
17
|
+
cryptosuite: "eddsa-jcs-2022",
|
|
18
|
+
created: "2023-02-24T23:36:38Z",
|
|
19
|
+
verificationMethod: "did:key:z6Mkabc#z6Mkabc",
|
|
20
|
+
proofPurpose: "assertionMethod",
|
|
21
|
+
proofValue: "z3FXQ"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
test("isSelfContainedSecuredDocument() accepts a complete secured document", () => {
|
|
26
|
+
assert(isSelfContainedSecuredDocument(securedDocument()));
|
|
27
|
+
const expandedType = securedDocument();
|
|
28
|
+
expandedType.proof.type = "https://w3id.org/security#DataIntegrityProof";
|
|
29
|
+
assert(isSelfContainedSecuredDocument(expandedType));
|
|
30
|
+
const typeArray = securedDocument();
|
|
31
|
+
typeArray.proof.type = ["DataIntegrityProof"];
|
|
32
|
+
assert(isSelfContainedSecuredDocument(typeArray));
|
|
33
|
+
});
|
|
34
|
+
test("isSelfContainedSecuredDocument() rejects anything less", () => {
|
|
35
|
+
assert(!isSelfContainedSecuredDocument(null));
|
|
36
|
+
assert(!isSelfContainedSecuredDocument("string"));
|
|
37
|
+
assert(!isSelfContainedSecuredDocument([securedDocument()]));
|
|
38
|
+
for (const mutate of [
|
|
39
|
+
(d) => delete d["@context"],
|
|
40
|
+
(d) => d["@context"] = null,
|
|
41
|
+
(d) => delete d.proof,
|
|
42
|
+
(d) => d.proof = null,
|
|
43
|
+
(d) => d.proof = [d.proof],
|
|
44
|
+
(d) => d.proof.type = "SomethingElse",
|
|
45
|
+
(d) => delete d.proof.cryptosuite,
|
|
46
|
+
(d) => delete d.proof.created,
|
|
47
|
+
(d) => delete d.proof.verificationMethod,
|
|
48
|
+
(d) => delete d.proof.proofPurpose,
|
|
49
|
+
(d) => d.proof.proofValue = "",
|
|
50
|
+
(d) => d.proof.proofValue = 42
|
|
51
|
+
]) {
|
|
52
|
+
const document = securedDocument();
|
|
53
|
+
mutate(document);
|
|
54
|
+
assert(!isSelfContainedSecuredDocument(document));
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
//#endregion
|
|
58
|
+
export {};
|
|
@@ -2,10 +2,10 @@ import "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
5
|
-
import { t as assertEquals } from "../assert_equals-
|
|
6
|
-
import { t as assertInstanceOf } from "../assert_instance_of-
|
|
7
|
-
import { t as assert } from "../assert-
|
|
8
|
-
import { b as autoIdAssigner, n as FederationImpl, y as actorDehydrator } from "../middleware-
|
|
5
|
+
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
6
|
+
import { t as assertInstanceOf } from "../assert_instance_of-mrXWWNY-.mjs";
|
|
7
|
+
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
8
|
+
import { b as autoIdAssigner, n as FederationImpl, y as actorDehydrator } from "../middleware-C7_hqDnl.mjs";
|
|
9
9
|
import { Follow, Person } from "@fedify/vocab";
|
|
10
10
|
import { test } from "@fedify/fixture";
|
|
11
11
|
//#region src/compat/transformers.test.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { i as verifyMapLocalProof, s as verifyPortableObjectProofPolicy } from "./proof-
|
|
4
|
+
import { i as verifyMapLocalProof, s as verifyPortableObjectProofPolicy } from "./proof-BVxJu5vv.mjs";
|
|
5
5
|
//#region src/sig/compound-proof.ts
|
|
6
6
|
const textEncoder = new TextEncoder();
|
|
7
7
|
const PORTABLE_OBJECT_ID_PATTERN = /^ap(?:\+ef61)?:\/\//i;
|
|
@@ -349,6 +349,78 @@ function inspectCompoundPortableObjectApplicability(json, limits) {
|
|
|
349
349
|
return "absent";
|
|
350
350
|
}
|
|
351
351
|
/**
|
|
352
|
+
* Walks every JSON map in a finite, already-materialized JSON tree, depth
|
|
353
|
+
* first in insertion order, skipping the values of `proof` and `@context`
|
|
354
|
+
* members. A map reached a second time through a repeated reference is not
|
|
355
|
+
* visited again, so a cyclic input terminates. The walk stops as soon as
|
|
356
|
+
* the visitor returns a value other than `undefined`.
|
|
357
|
+
*/
|
|
358
|
+
function findInJsonMaps(json, visit) {
|
|
359
|
+
const seen = /* @__PURE__ */ new Set();
|
|
360
|
+
const pending = [{
|
|
361
|
+
value: json,
|
|
362
|
+
path: ""
|
|
363
|
+
}];
|
|
364
|
+
while (pending.length > 0) {
|
|
365
|
+
const { value, path } = pending.pop();
|
|
366
|
+
if (typeof value !== "object" || value == null || seen.has(value)) continue;
|
|
367
|
+
seen.add(value);
|
|
368
|
+
if (Array.isArray(value)) {
|
|
369
|
+
for (let index = value.length - 1; index >= 0; index--) pending.push({
|
|
370
|
+
value: value[index],
|
|
371
|
+
path: childPath(path, String(index))
|
|
372
|
+
});
|
|
373
|
+
continue;
|
|
374
|
+
}
|
|
375
|
+
const map = value;
|
|
376
|
+
const result = visit(map, path);
|
|
377
|
+
if (result !== void 0) return result;
|
|
378
|
+
const keys = Object.keys(map);
|
|
379
|
+
for (let index = keys.length - 1; index >= 0; index--) {
|
|
380
|
+
const key = keys[index];
|
|
381
|
+
if (key === "proof" || key === "@context") continue;
|
|
382
|
+
pending.push({
|
|
383
|
+
value: map[key],
|
|
384
|
+
path: childPath(path, key)
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Determines whether an outgoing JSON tree contains portable content that
|
|
391
|
+
* requires producer-side proof-shape checks: a map, outside proof and context
|
|
392
|
+
* values, whose direct `id` or `@id` is a portable ActivityPub URI.
|
|
393
|
+
*
|
|
394
|
+
* This deliberately differs from
|
|
395
|
+
* {@link inspectCompoundPortableObjectApplicability}: it applies no resource
|
|
396
|
+
* limits, so a portable map or an unsupported proof beyond the inbox limits
|
|
397
|
+
* is still found, and a large document without portable maps stays outside
|
|
398
|
+
* the compound-proof profile. The input must be a finite JSON tree that has
|
|
399
|
+
* already been materialized, such as a compact JSON-LD document about to be
|
|
400
|
+
* sent.
|
|
401
|
+
*
|
|
402
|
+
* @internal
|
|
403
|
+
*/
|
|
404
|
+
function containsCompoundPortableObject(json) {
|
|
405
|
+
return findInJsonMaps(json, (map) => [map.id, map["@id"]].some((id) => typeof id === "string" && PORTABLE_OBJECT_ID_PATTERN.test(id)) ? true : void 0) ?? false;
|
|
406
|
+
}
|
|
407
|
+
/**
|
|
408
|
+
* Finds the first direct `proof` member whose value the map-local
|
|
409
|
+
* compound-proof profile does not accept, i.e., anything other than a single
|
|
410
|
+
* JSON map: a proof set, `null`, or a scalar. Like the inbox discovery, it
|
|
411
|
+
* does not look inside proof or context values.
|
|
412
|
+
*
|
|
413
|
+
* The input must be a finite, already-materialized JSON tree; see
|
|
414
|
+
* {@link containsCompoundPortableObject}.
|
|
415
|
+
*
|
|
416
|
+
* @returns The RFC 6901 JSON Pointer to the unsupported `proof` member, or
|
|
417
|
+
* `null` if every direct proof is a single JSON map.
|
|
418
|
+
* @internal
|
|
419
|
+
*/
|
|
420
|
+
function findUnsupportedCompoundProofShape(json) {
|
|
421
|
+
return findInJsonMaps(json, (map, path) => Object.hasOwn(map, "proof") && !isJsonMap(map.proof) ? childPath(path, "proof") : void 0) ?? null;
|
|
422
|
+
}
|
|
423
|
+
/**
|
|
352
424
|
* Discovers direct literal proof-bearing maps in an immutable JSON snapshot.
|
|
353
425
|
*
|
|
354
426
|
* Discovery is bounded and atomic. Unsupported proof shapes, non-JSON input,
|
|
@@ -492,4 +564,4 @@ async function verifyCompoundPortableObjectProofs(json, limits, options = {}) {
|
|
|
492
564
|
};
|
|
493
565
|
}
|
|
494
566
|
//#endregion
|
|
495
|
-
export {
|
|
567
|
+
export { verifyCompoundPortableObjectProofs as a, inspectCompoundPortableObjectApplicability as i, discoverCompoundProofDocuments as n, verifyCompoundProofDocuments as o, findUnsupportedCompoundProofShape as r, containsCompoundPortableObject as t };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { s as validateCryptoKey } from "./key-
|
|
5
|
-
import { n as doubleKnock } from "./http-
|
|
4
|
+
import { s as validateCryptoKey } from "./key-B_Zc5Jbd.mjs";
|
|
5
|
+
import { n as doubleKnock } from "./http-D4WPcJUe.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { curry } from "es-toolkit";
|
|
8
8
|
import { UrlError, createActivityPubRequest, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
@@ -2,11 +2,11 @@ import "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
5
|
-
import { t as assertEquals } from "../assert_equals-
|
|
6
|
-
import { t as assertExists } from "../assert_exists-
|
|
7
|
-
import { t as assertThrows } from "../assert_throws-
|
|
8
|
-
import "../std__assert-
|
|
9
|
-
import { r as createFederationBuilder } from "../builder-
|
|
5
|
+
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
6
|
+
import { t as assertExists } from "../assert_exists-cffSpJ7X.mjs";
|
|
7
|
+
import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
8
|
+
import "../std__assert-DvMDRPes.mjs";
|
|
9
|
+
import { r as createFederationBuilder } from "../builder-BYJ5otJa.mjs";
|
|
10
10
|
import { DisallowedOperatorError, DisallowedVarSpecModifierError, DuplicateRouteVariableError, RouteTemplateOptionsNotMatchedError, RouterError } from "@fedify/uri-template";
|
|
11
11
|
import { Activity, Note, Person } from "@fedify/vocab";
|
|
12
12
|
import { test } from "@fedify/fixture";
|
|
@@ -2,9 +2,9 @@ import { Temporal } from "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
5
|
-
import { t as assertEquals } from "../assert_equals-
|
|
6
|
-
import { t as assertThrows } from "../assert_throws-
|
|
7
|
-
import "../std__assert-
|
|
5
|
+
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
6
|
+
import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
7
|
+
import "../std__assert-DvMDRPes.mjs";
|
|
8
8
|
import { n as normalizeCircuitBreakerOptions, r as parseCircuitBreakerKvState, t as CircuitBreaker } from "../circuit-breaker-C5NqoLBJ.mjs";
|
|
9
9
|
import { t as markCircuitBreakerLegacySweepDone } from "../circuit-breaker-test-utils-DW6YC_Pe.mjs";
|
|
10
10
|
import { test } from "@fedify/fixture";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { t as assertEquals } from "../assert_equals-
|
|
5
|
-
import "../std__assert-
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
|
+
import "../std__assert-DvMDRPes.mjs";
|
|
6
6
|
import { n as digest, t as buildCollectionSynchronizationHeader } from "../collection-CnnP1UAv.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
import { decodeHex } from "byte-encodings/hex";
|