@fedify/fedify 2.5.0-dev.2358 → 2.5.0-dev.2370
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/{builder-BMEhdUoW.mjs → builder-DzGfERAV.mjs} +2 -2
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-oZzdjUys.mjs → compound-proof-hnZ7MNwN.mjs} +47 -19
- package/dist/{context-tsYPJ2Ew.d.cts → context-BjD_CTxh.d.cts} +1 -1
- package/dist/{context-7NyiqIcg.d.ts → context-C2-UDo2c.d.ts} +1 -1
- package/dist/{deno-BFtFen0c.mjs → deno-CkkDV5gw.mjs} +1 -1
- package/dist/{docloader-HB4vtU8p.mjs → docloader-D6eQ0vA8.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +3 -3
- package/dist/federation/handler-compound-proof.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +5 -5
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox-report.test.mjs +5 -5
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +7 -7
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +1 -1
- package/dist/federation/outgoing-proof.test.mjs +5 -5
- package/dist/federation/portable-actor.test.mjs +3 -3
- package/dist/federation/portable-chain.test.mjs +3 -3
- package/dist/federation/portable-collection.test.mjs +4 -4
- package/dist/federation/portable-delivery.test.mjs +2 -2
- package/dist/federation/portable-gateway-keys.test.mjs +4 -4
- package/dist/federation/portable-inbox.test.mjs +4 -4
- package/dist/federation/portable-parse-uri.test.mjs +1 -1
- package/dist/federation/portable-route-activity.test.mjs +2 -2
- package/dist/federation/portable.test.mjs +3 -3
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/tasks/enqueue.test.mjs +1 -1
- package/dist/federation/tasks/tasks.test.mjs +2 -2
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-BlSlahiZ.cjs → federation-BkIRrGXG.cjs} +48 -20
- package/dist/{http-CCnvW5x-.js → http-C2gfnrKF.js} +42 -8
- package/dist/{http-ClQ-uy-g.cjs → http-CjpGhvxc.cjs} +53 -7
- package/dist/{http-DeJUDufC.mjs → http-DxljNiCC.mjs} +4 -4
- package/dist/{key-Cf3Vy-8d.mjs → key-8sZWp4lR.mjs} +2 -2
- package/dist/{key-DYxuyd-s.d.cts → key-DhsBxxZN.d.ts} +6 -2
- package/dist/{key-C1nv7_jD.d.ts → key-nYGY4QB9.d.cts} +6 -2
- package/dist/{kv-cache-FrA7ESXq.cjs → kv-cache-BVtotkZw.cjs} +1 -1
- package/dist/{kv-cache-CPwTxfty.mjs → kv-cache-DDwF4zee.mjs} +1 -1
- package/dist/{kv-cache-DD1Rm6av.js → kv-cache-nsVJF31j.js} +1 -1
- package/dist/{ld-BGnEUgfY.mjs → ld-DXaIENwZ.mjs} +3 -3
- package/dist/{metrics-jnlUnpdI.mjs → metrics-DiQRjv6y.mjs} +1 -1
- package/dist/{middleware-BPa7IFZl.mjs → middleware-BBnHLNpJ.mjs} +1 -1
- package/dist/{middleware-BpWwcG33.js → middleware-C_EdDn9c.js} +48 -20
- package/dist/{middleware-B2a3uSU7.mjs → middleware-ClqRVObS.mjs} +14 -14
- package/dist/{mod-Dw-nPxQh.d.cts → mod-B5-wdzmJ.d.cts} +1 -1
- package/dist/{mod-BojP2Bw3.d.cts → mod-BBPd4M_0.d.cts} +1 -1
- package/dist/{mod-CtpF2BU5.d.ts → mod-BRpER-B0.d.ts} +1 -1
- package/dist/{mod-Xj5P4s4d.d.ts → mod-CUYBGKof.d.ts} +1 -1
- package/dist/{mod-DEZXwV6J.d.ts → mod-DkhfZC1u.d.ts} +1 -1
- package/dist/{mod-CavhAgLw.d.cts → mod-xAfaLS4T.d.cts} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +5 -5
- package/dist/mod.d.ts +5 -5
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-DwHkNHKv.mjs → owner-IiJfae6n.mjs} +3 -3
- package/dist/{portable-collection-D4vHh15d.cjs → portable-collection-BeS_vx1G.cjs} +1 -1
- package/dist/{portable-collection-BsRW7mno.js → portable-collection-BtyE_2Rv.js} +1 -1
- package/dist/{portable-collection-BBJFDDvt.mjs → portable-collection-CUDbGQ5_.mjs} +2 -2
- package/dist/{portable-key-ebokIyiv.mjs → portable-key-ENr3Sc97.mjs} +1 -1
- package/dist/{proof-BaRrofPH.mjs → proof-CGtiU4Lz.mjs} +45 -11
- package/dist/{send-BBnaZoZi.mjs → send-CRYlnzg6.mjs} +3 -3
- package/dist/sig/compound-proof-discovery.test.mjs +1 -1
- package/dist/sig/compound-proof-producer.test.mjs +1 -1
- package/dist/sig/compound-proof-verification.test.mjs +168 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mitra-receive-interop.test.mjs +4 -4
- package/dist/sig/mitra-send-interop.test.mjs +3 -3
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/portable-collection.test.mjs +1 -1
- package/dist/sig/portable-interop.test.mjs +3 -3
- package/dist/sig/portable-key.test.mjs +6 -6
- package/dist/sig/proof.test.mjs +3 -3
- package/dist/sig/tootik-request-interop.test.mjs +4 -4
- package/dist/sig/tootik-send-interop.test.mjs +3 -3
- package/dist/sig/verification.test.mjs +3 -3
- package/dist/{temporal-JVrtO1CV.mjs → temporal-CDbdX_g_.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/testing/mod.d.mts +5 -1
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +7 -7
|
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as MemoryKvStore } from "../../kv-DCHkaJ9-.mjs";
|
|
5
5
|
import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, t as MockQueue } from "../../tasks-IG3pHfvZ.mjs";
|
|
6
6
|
import "../../testing-t8xDeJZ5.mjs";
|
|
7
|
-
import { o as createFederation } from "../../middleware-
|
|
7
|
+
import { o as createFederation } from "../../middleware-ClqRVObS.mjs";
|
|
8
8
|
import { n as ParallelMessageQueue } from "../../mq-Dm1Wmtm-.mjs";
|
|
9
9
|
import { configure, reset } from "@logtape/logtape";
|
|
10
10
|
import { delay } from "es-toolkit";
|
|
@@ -4,8 +4,8 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as MemoryKvStore } from "../../kv-DCHkaJ9-.mjs";
|
|
5
5
|
import { a as numberSchema, i as makeSchema, n as baseOptions, o as stringSchema, t as MockQueue } from "../../tasks-IG3pHfvZ.mjs";
|
|
6
6
|
import "../../testing-t8xDeJZ5.mjs";
|
|
7
|
-
import { o as createFederation } from "../../middleware-
|
|
8
|
-
import { r as createFederationBuilder } from "../../builder-
|
|
7
|
+
import { o as createFederation } from "../../middleware-ClqRVObS.mjs";
|
|
8
|
+
import { r as createFederationBuilder } from "../../builder-DzGfERAV.mjs";
|
|
9
9
|
import { t as TaskCodec } from "../../codec-C6rTrpIp.mjs";
|
|
10
10
|
import { t as InProcessMessageQueue } from "../../mq-Dm1Wmtm-.mjs";
|
|
11
11
|
import { W3CTraceContextPropagator } from "@opentelemetry/core";
|
|
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
|
-
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-
|
|
7
|
+
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-CDbdX_g_.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/federation/temporal.test.ts
|
|
10
10
|
test("hasMalformedKnownTemporalLiteral() detects expanded proof timestamps", async () => {
|
|
@@ -6,7 +6,7 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
|
6
6
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
7
7
|
import { t as assertNotEquals } from "../assert_not_equals-CpPK2t89.mjs";
|
|
8
8
|
import "../std__assert-DvMDRPes.mjs";
|
|
9
|
-
import { o as createFederation, s as handleWebFinger } from "../middleware-
|
|
9
|
+
import { o as createFederation, s as handleWebFinger } from "../middleware-ClqRVObS.mjs";
|
|
10
10
|
import { Image, Link, Person, Tombstone } from "@fedify/vocab";
|
|
11
11
|
import { parseIri } from "@fedify/vocab-runtime";
|
|
12
12
|
import { createTestMeterProvider, test } from "@fedify/fixture";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-Dmm3t92W.cjs");
|
|
3
3
|
const require_transformers = require("./transformers-BalCrSsr.cjs");
|
|
4
|
-
const require_http = require("./http-
|
|
4
|
+
const require_http = require("./http-CjpGhvxc.cjs");
|
|
5
5
|
const require_types = require("./types-poIao40f.cjs");
|
|
6
|
-
const require_portable_collection = require("./portable-collection-
|
|
7
|
-
const require_kv_cache = require("./kv-cache-
|
|
6
|
+
const require_portable_collection = require("./portable-collection-BeS_vx1G.cjs");
|
|
7
|
+
const require_kv_cache = require("./kv-cache-BVtotkZw.cjs");
|
|
8
8
|
let _logtape_logtape = require("@logtape/logtape");
|
|
9
9
|
let _fedify_uri_template = require("@fedify/uri-template");
|
|
10
10
|
let _fedify_vocab = require("@fedify/vocab");
|
|
@@ -2054,7 +2054,7 @@ function discoverCompoundProofDocuments(json, limits) {
|
|
|
2054
2054
|
statistics: Object.freeze({ ...inspected })
|
|
2055
2055
|
};
|
|
2056
2056
|
}
|
|
2057
|
-
async function verifyDiscoveredProofDocuments(discovered, options) {
|
|
2057
|
+
async function verifyDiscoveredProofDocuments(discovered, options, rejectedPolicies = /* @__PURE__ */ new Map()) {
|
|
2058
2058
|
const documents = await Promise.all(discovered.documents.map(async (document) => {
|
|
2059
2059
|
const metadata = {
|
|
2060
2060
|
path: document.path,
|
|
@@ -2079,10 +2079,20 @@ async function verifyDiscoveredProofDocuments(discovered, options) {
|
|
|
2079
2079
|
id: subjectId,
|
|
2080
2080
|
pointer: document.path
|
|
2081
2081
|
}
|
|
2082
|
-
} }, "objectIntegrity", (observation) =>
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2082
|
+
} }, "objectIntegrity", async (observation) => {
|
|
2083
|
+
const reason = rejectedPolicies.get(document.path);
|
|
2084
|
+
if (reason != null) {
|
|
2085
|
+
if (observation.attempt != null) observation.attempt.reason = {
|
|
2086
|
+
type: "proofPolicy",
|
|
2087
|
+
reason
|
|
2088
|
+
};
|
|
2089
|
+
return null;
|
|
2090
|
+
}
|
|
2091
|
+
return await require_http.verifyMapLocalProof(document.securedDocument, {
|
|
2092
|
+
...options,
|
|
2093
|
+
[require_http.verificationObservation]: inherited == null ? void 0 : observation
|
|
2094
|
+
});
|
|
2095
|
+
}, (key) => key != null);
|
|
2086
2096
|
return key == null ? Object.freeze({
|
|
2087
2097
|
...metadata,
|
|
2088
2098
|
verified: false,
|
|
@@ -2104,7 +2114,29 @@ async function verifyDiscoveredProofDocuments(discovered, options) {
|
|
|
2104
2114
|
async function verifyCompoundPortableObjectProofs(json, limits, options = {}) {
|
|
2105
2115
|
const discovered = discoverCompoundProofDocuments(json, limits);
|
|
2106
2116
|
if (discovered.status !== "ok") return discovered;
|
|
2107
|
-
const
|
|
2117
|
+
const collected = collectPortableObjects(discovered.snapshot);
|
|
2118
|
+
const objectByPath = new Map(collected.map((object) => [object.path, object]));
|
|
2119
|
+
const isKeyCandidate = (object) => object.keyOf != null && !Object.hasOwn(object.document, "proof");
|
|
2120
|
+
const prepareObject = async (object) => {
|
|
2121
|
+
if (object.depth > 0 && !Object.hasOwn(object.document, "@context")) return {
|
|
2122
|
+
prepared: false,
|
|
2123
|
+
reason: { type: "missingContext" }
|
|
2124
|
+
};
|
|
2125
|
+
try {
|
|
2126
|
+
const policy = await require_http.preparePortableObjectProofPolicy(object.document, options);
|
|
2127
|
+
return policy.prepared ? policy : {
|
|
2128
|
+
prepared: false,
|
|
2129
|
+
reason: policy.result.reason
|
|
2130
|
+
};
|
|
2131
|
+
} catch {
|
|
2132
|
+
return {
|
|
2133
|
+
prepared: false,
|
|
2134
|
+
reason: { type: "invalidPortableObject" }
|
|
2135
|
+
};
|
|
2136
|
+
}
|
|
2137
|
+
};
|
|
2138
|
+
const preparedByPath = new Map(await Promise.all(collected.filter((object) => !isKeyCandidate(object)).map(async (object) => [object.path, await prepareObject(object)])));
|
|
2139
|
+
const proofs = await verifyDiscoveredProofDocuments(discovered, options, new Map([...preparedByPath].flatMap(([path, prepared]) => prepared.prepared ? [] : [[path, prepared.reason]])));
|
|
2108
2140
|
const proofByPath = new Map(proofs.map((proof) => [proof.path, proof]));
|
|
2109
2141
|
const verifyPortableObject = async (object) => {
|
|
2110
2142
|
const metadata = {
|
|
@@ -2112,15 +2144,14 @@ async function verifyCompoundPortableObjectProofs(json, limits, options = {}) {
|
|
|
2112
2144
|
id: object.id,
|
|
2113
2145
|
depth: object.depth
|
|
2114
2146
|
};
|
|
2115
|
-
if (object.depth > 0 && !Object.hasOwn(object.document, "@context")) return Object.freeze({
|
|
2116
|
-
...metadata,
|
|
2117
|
-
verified: false,
|
|
2118
|
-
reason: { type: "missingContext" }
|
|
2119
|
-
});
|
|
2120
|
-
const proof = proofByPath.get(object.path);
|
|
2121
|
-
const key = proof?.verified === true ? proof.key : null;
|
|
2122
2147
|
try {
|
|
2123
|
-
const
|
|
2148
|
+
const prepared = preparedByPath.get(object.path) ?? await prepareObject(object);
|
|
2149
|
+
const proof = proofByPath.get(object.path);
|
|
2150
|
+
const key = proof?.verified === true ? proof.key : null;
|
|
2151
|
+
const policy = prepared.prepared ? require_http.verifyPreparedPortableObjectProofPolicy(prepared, key) : {
|
|
2152
|
+
verified: false,
|
|
2153
|
+
reason: prepared.reason
|
|
2154
|
+
};
|
|
2124
2155
|
return policy.verified ? Object.freeze({
|
|
2125
2156
|
...metadata,
|
|
2126
2157
|
id: policy.objectId,
|
|
@@ -2139,9 +2170,6 @@ async function verifyCompoundPortableObjectProofs(json, limits, options = {}) {
|
|
|
2139
2170
|
});
|
|
2140
2171
|
}
|
|
2141
2172
|
};
|
|
2142
|
-
const collected = collectPortableObjects(discovered.snapshot);
|
|
2143
|
-
const objectByPath = new Map(collected.map((object) => [object.path, object]));
|
|
2144
|
-
const isKeyCandidate = (object) => object.keyOf != null && !Object.hasOwn(object.document, "proof");
|
|
2145
2173
|
const results = /* @__PURE__ */ new Map();
|
|
2146
2174
|
for (const result of await Promise.all(collected.filter((object) => !isKeyCandidate(object)).map(verifyPortableObject))) results.set(result.path, result);
|
|
2147
2175
|
let projections = 0;
|
|
@@ -15,7 +15,7 @@ import serialize from "json-canon";
|
|
|
15
15
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
16
16
|
//#region deno.json
|
|
17
17
|
var name = "@fedify/fedify";
|
|
18
|
-
var version = "2.5.0-dev.
|
|
18
|
+
var version = "2.5.0-dev.2370+e0cfd033";
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/sig/portable-key-id.ts
|
|
21
21
|
const COMPATIBLE_KEY_ID_PATH_PATTERN = /^\/\.well-known\/apgateway\/did(?::|%3A)/i;
|
|
@@ -4420,34 +4420,68 @@ async function preparePortableObjectProof(jsonLd, options) {
|
|
|
4420
4420
|
};
|
|
4421
4421
|
}
|
|
4422
4422
|
/**
|
|
4423
|
-
*
|
|
4423
|
+
* Checks portable-object policy without resolving keys or verifying signatures.
|
|
4424
4424
|
*
|
|
4425
4425
|
* @internal
|
|
4426
4426
|
*/
|
|
4427
|
-
async function
|
|
4427
|
+
async function preparePortableObjectProofPolicy(jsonLd, options = {}) {
|
|
4428
4428
|
const policyOptions = {
|
|
4429
4429
|
...options,
|
|
4430
4430
|
contextLoader: preloadedOnlyDocumentLoader
|
|
4431
4431
|
};
|
|
4432
4432
|
const prepared = await preparePortableObjectProof(jsonLd, policyOptions);
|
|
4433
|
-
if (!prepared.prepared) return
|
|
4433
|
+
if (!prepared.prepared) return {
|
|
4434
|
+
prepared: false,
|
|
4435
|
+
result: prepared.result
|
|
4436
|
+
};
|
|
4434
4437
|
const policyProof = prepared.proofs[0];
|
|
4435
4438
|
const literalProof = isJsonLdNode(jsonLd) && isJsonLdNode(jsonLd.proof) ? (await parseRawProofCandidates(jsonLd, [jsonLd.proof], policyOptions, prepared.proofContextLoader))[0]?.proof : null;
|
|
4436
4439
|
const verificationMethod = policyProof?.verificationMethodId;
|
|
4437
|
-
if (prepared.proofs.length !== 1 ||
|
|
4440
|
+
if (prepared.proofs.length !== 1 || policyProof == null || literalProof == null || !sameProof(policyProof, literalProof) || verificationMethod == null) return {
|
|
4441
|
+
prepared: false,
|
|
4442
|
+
result: {
|
|
4443
|
+
verified: false,
|
|
4444
|
+
reason: {
|
|
4445
|
+
type: "invalidProof",
|
|
4446
|
+
proofIndex: prepared.proofs.length > 1 ? 1 : 0
|
|
4447
|
+
}
|
|
4448
|
+
}
|
|
4449
|
+
};
|
|
4450
|
+
return {
|
|
4451
|
+
prepared: true,
|
|
4452
|
+
verificationMethod,
|
|
4453
|
+
objectId: formatIri(prepared.objectId)
|
|
4454
|
+
};
|
|
4455
|
+
}
|
|
4456
|
+
/**
|
|
4457
|
+
* Binds prepared portable-object policy to the map-local verified key.
|
|
4458
|
+
*
|
|
4459
|
+
* @internal
|
|
4460
|
+
*/
|
|
4461
|
+
function verifyPreparedPortableObjectProofPolicy(prepared, key) {
|
|
4462
|
+
if (key == null || key.id?.href !== prepared.verificationMethod.href) return {
|
|
4438
4463
|
verified: false,
|
|
4439
4464
|
reason: {
|
|
4440
4465
|
type: "invalidProof",
|
|
4441
|
-
proofIndex:
|
|
4466
|
+
proofIndex: 0
|
|
4442
4467
|
}
|
|
4443
4468
|
};
|
|
4444
4469
|
return {
|
|
4445
4470
|
verified: true,
|
|
4446
4471
|
keys: [key],
|
|
4447
|
-
objectId:
|
|
4472
|
+
objectId: prepared.objectId
|
|
4448
4473
|
};
|
|
4449
4474
|
}
|
|
4450
4475
|
/**
|
|
4476
|
+
* Applies portable-object proof policy to one map-local cryptographic result.
|
|
4477
|
+
*
|
|
4478
|
+
* @internal
|
|
4479
|
+
*/
|
|
4480
|
+
async function verifyPortableObjectProofPolicy(jsonLd, key, options = {}) {
|
|
4481
|
+
const prepared = await preparePortableObjectProofPolicy(jsonLd, options);
|
|
4482
|
+
return prepared.prepared ? verifyPreparedPortableObjectProofPolicy(prepared, key) : prepared.result;
|
|
4483
|
+
}
|
|
4484
|
+
/**
|
|
4451
4485
|
* Verifies the FEP-ef61 Object Integrity Proof policy for a portable object.
|
|
4452
4486
|
*
|
|
4453
4487
|
* This applies the FEP-2277 core-type classification to the top-level JSON-LD
|
|
@@ -6524,4 +6558,4 @@ function timingSafeEqual(a, b) {
|
|
|
6524
6558
|
return result === 0;
|
|
6525
6559
|
}
|
|
6526
6560
|
//#endregion
|
|
6527
|
-
export {
|
|
6561
|
+
export { getFederationMetrics as $, detachSignature as A, isPortableId as At, wrapContextLoaderForJsonLd as B, verifyProof as C, getAuthenticationOrigin as Ct, attachSignature as D, getRawCanonicalPortableId as Dt, assertSafeJsonLd as E, getPortableDid as Et, isInvalidUrlTypeError as F, name as Ft, generateCryptoKeyPair as G, fetchActorDocument as H, signJsonLd as I, version as It, verifyKeyOwnership as J, importJwk as K, verifyCompactJsonLd as L, hasSignature as M, isPortableUri as Mt, hasSignatureLike as N, isSameObjectId as Nt, compactJsonLd as O, hasPortableActor as Ot, isClearlyMalformedContextReference as P, isSamePublicKey as Pt, getDurationMs as Q, verifyJsonLd as R, verifyPreparedPortableObjectProofPolicy as S, verificationObservation as St, InvalidContextReferenceError as T, getGatewayKeyBase as Tt, fetchKey as U, exportJwk as V, fetchKeyDetailed as W, getVerifiedKeyOwnerEvidence as X, MAX_PORTABLE_KEY_TTL as Y, parseKeyOwnerEvidence as Z, verifyMapLocalProof as _, fulfillAcceptSignature as _t, signRequest as a, recordCollectionPageItems as at, verifyPortableObjectProofPolicy as b, observeAttempt as bt, verifyRequestDetailed as c, recordDocumentCache as ct, InvalidPortableObjectIdError as d, recordOutboxActivity as dt, getRemoteHost as et, classifyFep2277CoreType as f, recordOutboxEnqueue as ft, signObject as g, formatAcceptSignature as gt, preparePortableObjectProofPolicy as h, preloadedOnlyDocumentLoader as ht, selectRequestSignature as i, recordCollectionDispatchDuration as it, getNormalizationContextLoader as j, isPortableKeyId as jt, createSignature as k, isCompatibleKeyId as kt, fetchPortableGatewayKey as l, recordFanoutRecipients as lt, hasProofLike as m, registerQueueDepthGauge as mt, listRequestSignatures as n, isAbortError$1 as nt, validateMaxSignatures as o, recordCollectionRequest as ot, createProof as p, recordWebFingerHandle as pt, validateCryptoKey as q, parseRfc9421SignatureInput as r, recordCircuitBreakerStateChange as rt, verifyRequest as s, recordCollectionTotalItems as st, doubleKnock as t, instrumentDocumentLoader as tt, resolvePortableActorKey as u, recordInboxActivity as ut, verifyObject as v, parseAcceptSignature as vt, normalizeOutgoingActivityJsonLd as w, getCanonicalPortableId as wt, verifyPortableObjectProofWithRoot as x, snapshotKey as xt, verifyPortableObjectProof as y, validateAcceptSignature as yt, verifySignature as z };
|
|
@@ -17,7 +17,7 @@ json_canon = require_rolldown_runtime.__toESM(json_canon, 1);
|
|
|
17
17
|
let _opentelemetry_semantic_conventions = require("@opentelemetry/semantic-conventions");
|
|
18
18
|
//#region deno.json
|
|
19
19
|
var name = "@fedify/fedify";
|
|
20
|
-
var version = "2.5.0-dev.
|
|
20
|
+
var version = "2.5.0-dev.2370+e0cfd033";
|
|
21
21
|
//#endregion
|
|
22
22
|
//#region src/sig/portable-key-id.ts
|
|
23
23
|
const COMPATIBLE_KEY_ID_PATH_PATTERN = /^\/\.well-known\/apgateway\/did(?::|%3A)/i;
|
|
@@ -7989,34 +7989,68 @@ async function preparePortableObjectProof(jsonLd, options) {
|
|
|
7989
7989
|
};
|
|
7990
7990
|
}
|
|
7991
7991
|
/**
|
|
7992
|
-
*
|
|
7992
|
+
* Checks portable-object policy without resolving keys or verifying signatures.
|
|
7993
7993
|
*
|
|
7994
7994
|
* @internal
|
|
7995
7995
|
*/
|
|
7996
|
-
async function
|
|
7996
|
+
async function preparePortableObjectProofPolicy(jsonLd, options = {}) {
|
|
7997
7997
|
const policyOptions = {
|
|
7998
7998
|
...options,
|
|
7999
7999
|
contextLoader: preloadedOnlyDocumentLoader
|
|
8000
8000
|
};
|
|
8001
8001
|
const prepared = await preparePortableObjectProof(jsonLd, policyOptions);
|
|
8002
|
-
if (!prepared.prepared) return
|
|
8002
|
+
if (!prepared.prepared) return {
|
|
8003
|
+
prepared: false,
|
|
8004
|
+
result: prepared.result
|
|
8005
|
+
};
|
|
8003
8006
|
const policyProof = prepared.proofs[0];
|
|
8004
8007
|
const literalProof = isJsonLdNode(jsonLd) && isJsonLdNode(jsonLd.proof) ? (await parseRawProofCandidates(jsonLd, [jsonLd.proof], policyOptions, prepared.proofContextLoader))[0]?.proof : null;
|
|
8005
8008
|
const verificationMethod = policyProof?.verificationMethodId;
|
|
8006
|
-
if (prepared.proofs.length !== 1 ||
|
|
8009
|
+
if (prepared.proofs.length !== 1 || policyProof == null || literalProof == null || !sameProof(policyProof, literalProof) || verificationMethod == null) return {
|
|
8010
|
+
prepared: false,
|
|
8011
|
+
result: {
|
|
8012
|
+
verified: false,
|
|
8013
|
+
reason: {
|
|
8014
|
+
type: "invalidProof",
|
|
8015
|
+
proofIndex: prepared.proofs.length > 1 ? 1 : 0
|
|
8016
|
+
}
|
|
8017
|
+
}
|
|
8018
|
+
};
|
|
8019
|
+
return {
|
|
8020
|
+
prepared: true,
|
|
8021
|
+
verificationMethod,
|
|
8022
|
+
objectId: (0, _fedify_vocab_runtime.formatIri)(prepared.objectId)
|
|
8023
|
+
};
|
|
8024
|
+
}
|
|
8025
|
+
/**
|
|
8026
|
+
* Binds prepared portable-object policy to the map-local verified key.
|
|
8027
|
+
*
|
|
8028
|
+
* @internal
|
|
8029
|
+
*/
|
|
8030
|
+
function verifyPreparedPortableObjectProofPolicy(prepared, key) {
|
|
8031
|
+
if (key == null || key.id?.href !== prepared.verificationMethod.href) return {
|
|
8007
8032
|
verified: false,
|
|
8008
8033
|
reason: {
|
|
8009
8034
|
type: "invalidProof",
|
|
8010
|
-
proofIndex:
|
|
8035
|
+
proofIndex: 0
|
|
8011
8036
|
}
|
|
8012
8037
|
};
|
|
8013
8038
|
return {
|
|
8014
8039
|
verified: true,
|
|
8015
8040
|
keys: [key],
|
|
8016
|
-
objectId:
|
|
8041
|
+
objectId: prepared.objectId
|
|
8017
8042
|
};
|
|
8018
8043
|
}
|
|
8019
8044
|
/**
|
|
8045
|
+
* Applies portable-object proof policy to one map-local cryptographic result.
|
|
8046
|
+
*
|
|
8047
|
+
* @internal
|
|
8048
|
+
*/
|
|
8049
|
+
async function verifyPortableObjectProofPolicy(jsonLd, key, options = {}) {
|
|
8050
|
+
const prepared = await preparePortableObjectProofPolicy(jsonLd, options);
|
|
8051
|
+
return prepared.prepared ? verifyPreparedPortableObjectProofPolicy(prepared, key) : prepared.result;
|
|
8052
|
+
}
|
|
8053
|
+
/**
|
|
8020
8054
|
* Verifies the FEP-ef61 Object Integrity Proof policy for a portable object.
|
|
8021
8055
|
*
|
|
8022
8056
|
* This applies the FEP-2277 core-type classification to the top-level JSON-LD
|
|
@@ -10412,6 +10446,12 @@ Object.defineProperty(exports, "preloadedOnlyDocumentLoader", {
|
|
|
10412
10446
|
return preloadedOnlyDocumentLoader;
|
|
10413
10447
|
}
|
|
10414
10448
|
});
|
|
10449
|
+
Object.defineProperty(exports, "preparePortableObjectProofPolicy", {
|
|
10450
|
+
enumerable: true,
|
|
10451
|
+
get: function() {
|
|
10452
|
+
return preparePortableObjectProofPolicy;
|
|
10453
|
+
}
|
|
10454
|
+
});
|
|
10415
10455
|
Object.defineProperty(exports, "recordCircuitBreakerStateChange", {
|
|
10416
10456
|
enumerable: true,
|
|
10417
10457
|
get: function() {
|
|
@@ -10592,6 +10632,12 @@ Object.defineProperty(exports, "verifyPortableObjectProofWithRoot", {
|
|
|
10592
10632
|
return verifyPortableObjectProofWithRoot;
|
|
10593
10633
|
}
|
|
10594
10634
|
});
|
|
10635
|
+
Object.defineProperty(exports, "verifyPreparedPortableObjectProofPolicy", {
|
|
10636
|
+
enumerable: true,
|
|
10637
|
+
get: function() {
|
|
10638
|
+
return verifyPreparedPortableObjectProofPolicy;
|
|
10639
|
+
}
|
|
10640
|
+
});
|
|
10595
10641
|
Object.defineProperty(exports, "verifyProof", {
|
|
10596
10642
|
enumerable: true,
|
|
10597
10643
|
get: function() {
|
|
@@ -3,12 +3,12 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { m as parseKeyIdString } from "./portable-key-id-Ca30-hOa.mjs";
|
|
5
5
|
import { a as verificationObservation, i as triedKey, n as observeCheck, t as observeAttempt } from "./verification-Dpfcw8ml.mjs";
|
|
6
|
-
import { n as version, t as name } from "./deno-
|
|
7
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
6
|
+
import { n as version, t as name } from "./deno-CkkDV5gw.mjs";
|
|
7
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-DiQRjv6y.mjs";
|
|
8
8
|
import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-CPVqki78.mjs";
|
|
9
9
|
import { a as promoteKeyOwnerEvidence } from "./key-owner-evidence-APB6NpSk.mjs";
|
|
10
|
-
import { a as fetchKeyDetailed, c as validateCryptoKey, t as bypassKeyCacheReads } from "./key-
|
|
11
|
-
import { n as resolvePortableActorKey, r as verifyPortableGatewayKeyDocument } from "./portable-key-
|
|
10
|
+
import { a as fetchKeyDetailed, c as validateCryptoKey, t as bypassKeyCacheReads } from "./key-8sZWp4lR.mjs";
|
|
11
|
+
import { n as resolvePortableActorKey, r as verifyPortableGatewayKeyDocument } from "./portable-key-ENr3Sc97.mjs";
|
|
12
12
|
import { getLogger } from "@logtape/logtape";
|
|
13
13
|
import { CryptographicKey } from "@fedify/vocab";
|
|
14
14
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -3,8 +3,8 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { c as isPortableActorDocument, d as isPortableUri, l as isPortableId, m as parseKeyIdString, s as isCompatibleKeyId } from "./portable-key-id-Ca30-hOa.mjs";
|
|
5
5
|
import { a as verificationObservation } from "./verification-Dpfcw8ml.mjs";
|
|
6
|
-
import { n as version, t as name } from "./deno-
|
|
7
|
-
import { _ as recordKeyLookup, n as getDurationMs, t as classifyFetchError } from "./metrics-
|
|
6
|
+
import { n as version, t as name } from "./deno-CkkDV5gw.mjs";
|
|
7
|
+
import { _ as recordKeyLookup, n as getDurationMs, t as classifyFetchError } from "./metrics-DiQRjv6y.mjs";
|
|
8
8
|
import { n as attachKeyOwnerEvidence, t as MAX_PORTABLE_KEY_TTL } from "./key-owner-evidence-APB6NpSk.mjs";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
10
10
|
import { CryptographicKey, Multikey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { Actor, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "@fedify/vocab";
|
|
3
|
-
import { DocumentLoader, PortableObjectVerifier } from "@fedify/vocab-runtime";
|
|
4
3
|
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
4
|
+
import { DocumentLoader, PortableObjectVerifier } from "@fedify/vocab-runtime";
|
|
5
5
|
|
|
6
6
|
//#region src/sig/proof.d.ts
|
|
7
7
|
/**
|
|
@@ -272,7 +272,11 @@ type CompoundProofDiscoveryFailureReason = {
|
|
|
272
272
|
type CompoundProofVerificationFailureReason = {
|
|
273
273
|
/** A nested secured map does not carry its own JSON-LD context. */readonly type: "missingContext";
|
|
274
274
|
} | {
|
|
275
|
-
/**
|
|
275
|
+
/**
|
|
276
|
+
* The direct proof is malformed, unsupported, invalid, or left unverified
|
|
277
|
+
* because the portable-object policy rejects its map.
|
|
278
|
+
*/
|
|
279
|
+
readonly type: "invalidProof";
|
|
276
280
|
};
|
|
277
281
|
/** Why one portable map did not pass compound proof policy. */
|
|
278
282
|
type CompoundPortableObjectFailureReason = CompoundProofVerificationFailureReason | VerifyPortableObjectProofFailureReason | {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
2
|
import { Actor, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1 } from "@fedify/vocab";
|
|
3
|
-
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
4
3
|
import { DocumentLoader, PortableObjectVerifier } from "@fedify/vocab-runtime";
|
|
4
|
+
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
5
5
|
|
|
6
6
|
//#region src/sig/proof.d.ts
|
|
7
7
|
/**
|
|
@@ -272,7 +272,11 @@ type CompoundProofDiscoveryFailureReason = {
|
|
|
272
272
|
type CompoundProofVerificationFailureReason = {
|
|
273
273
|
/** A nested secured map does not carry its own JSON-LD context. */readonly type: "missingContext";
|
|
274
274
|
} | {
|
|
275
|
-
/**
|
|
275
|
+
/**
|
|
276
|
+
* The direct proof is malformed, unsupported, invalid, or left unverified
|
|
277
|
+
* because the portable-object policy rejects its map.
|
|
278
|
+
*/
|
|
279
|
+
readonly type: "invalidProof";
|
|
276
280
|
};
|
|
277
281
|
/** Why one portable map did not pass compound proof policy. */
|
|
278
282
|
type CompoundPortableObjectFailureReason = CompoundProofVerificationFailureReason | VerifyPortableObjectProofFailureReason | {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
|
-
const require_http = require("./http-
|
|
2
|
+
const require_http = require("./http-CjpGhvxc.cjs");
|
|
3
3
|
let _logtape_logtape = require("@logtape/logtape");
|
|
4
4
|
let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
|
|
5
5
|
let es_toolkit = require("es-toolkit");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { p as recordDocumentCache } from "./metrics-
|
|
4
|
+
import { p as recordDocumentCache } from "./metrics-DiQRjv6y.mjs";
|
|
5
5
|
import { getLogger } from "@logtape/logtape";
|
|
6
6
|
import { preloadedContexts } from "@fedify/vocab-runtime";
|
|
7
7
|
//#region src/utils/kv-cache.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import {
|
|
3
|
+
import { ct as recordDocumentCache, q as validateCryptoKey, t as doubleKnock } from "./http-C2gfnrKF.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, preloadedContexts, resolveDocumentLoaderTimeout, validatePublicUrl, withDocumentLoaderTimeout } from "@fedify/vocab-runtime";
|
|
6
6
|
import { curry } from "es-toolkit";
|
|
@@ -2,9 +2,9 @@ import "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { a as verificationObservation, i as triedKey, n as observeCheck, t as observeAttempt } from "./verification-Dpfcw8ml.mjs";
|
|
5
|
-
import { n as version, t as name } from "./deno-
|
|
6
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
7
|
-
import { c as validateCryptoKey, i as fetchKey, t as bypassKeyCacheReads } from "./key-
|
|
5
|
+
import { n as version, t as name } from "./deno-CkkDV5gw.mjs";
|
|
6
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-DiQRjv6y.mjs";
|
|
7
|
+
import { c as validateCryptoKey, i as fetchKey, t as bypassKeyCacheReads } from "./key-8sZWp4lR.mjs";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
9
9
|
import { Activity, CryptographicKey, Object as Object$1, getTypeId } from "@fedify/vocab";
|
|
10
10
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -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-CkkDV5gw.mjs";
|
|
5
5
|
import { metrics } from "@opentelemetry/api";
|
|
6
6
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
7
7
|
//#region src/federation/metrics.ts
|
|
@@ -2,10 +2,10 @@ import { Temporal } from "temporal-polyfill";
|
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
import { t as __exportAll } from "./rolldown-runtime-BC-Eo5Mj.js";
|
|
4
4
|
import { r as getDefaultActivityTransformers } from "./transformers-DAtXl_Kc.js";
|
|
5
|
-
import { $ as
|
|
5
|
+
import { $ as getFederationMetrics, A as detachSignature, At as isPortableId, B as wrapContextLoaderForJsonLd, Ct as getAuthenticationOrigin, Dt as getRawCanonicalPortableId, E as assertSafeJsonLd, Et as getPortableDid, F as isInvalidUrlTypeError, Ft as name, I as signJsonLd, It as version, K as importJwk, L as verifyCompactJsonLd, M as hasSignature, Mt as isPortableUri, N as hasSignatureLike, Nt as isSameObjectId, O as compactJsonLd, Ot as hasPortableActor, P as isClearlyMalformedContextReference, Q as getDurationMs, S as verifyPreparedPortableObjectProofPolicy, St as verificationObservation, T as InvalidContextReferenceError, Tt as getGatewayKeyBase, V as exportJwk, Y as MAX_PORTABLE_KEY_TTL, _ as verifyMapLocalProof, at as recordCollectionPageItems, b as verifyPortableObjectProofPolicy, bt as observeAttempt, c as verifyRequestDetailed, d as InvalidPortableObjectIdError, dt as recordOutboxActivity, et as getRemoteHost, f as classifyFep2277CoreType, ft as recordOutboxEnqueue, g as signObject, gt as formatAcceptSignature, h as preparePortableObjectProofPolicy, ht as preloadedOnlyDocumentLoader, i as selectRequestSignature, it as recordCollectionDispatchDuration, j as getNormalizationContextLoader, jt as isPortableKeyId, kt as isCompatibleKeyId, lt as recordFanoutRecipients, m as hasProofLike, mt as registerQueueDepthGauge, n as listRequestSignatures, nt as isAbortError, o as validateMaxSignatures, ot as recordCollectionRequest, pt as recordWebFingerHandle, q as validateCryptoKey, r as parseRfc9421SignatureInput, rt as recordCircuitBreakerStateChange, s as verifyRequest, st as recordCollectionTotalItems, t as doubleKnock, tt as instrumentDocumentLoader, ut as recordInboxActivity, v as verifyObject, w as normalizeOutgoingActivityJsonLd, wt as getCanonicalPortableId, x as verifyPortableObjectProofWithRoot, xt as snapshotKey, y as verifyPortableObjectProof } from "./http-C2gfnrKF.js";
|
|
6
6
|
import { a as MAX_BODY_SIZE, i as BodyTooLargeError, n as getNodeInfo, o as readBoundedText, t as nodeInfoToJson } from "./types-_S2_MeLF.js";
|
|
7
|
-
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-
|
|
8
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
7
|
+
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-BtyE_2Rv.js";
|
|
8
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-nsVJF31j.js";
|
|
9
9
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
10
10
|
import { Router, RouterError, assertPath } from "@fedify/uri-template";
|
|
11
11
|
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, PUBLIC_COLLECTION, Tombstone, getTypeId, isActor, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
@@ -2053,7 +2053,7 @@ function discoverCompoundProofDocuments(json, limits) {
|
|
|
2053
2053
|
statistics: Object.freeze({ ...inspected })
|
|
2054
2054
|
};
|
|
2055
2055
|
}
|
|
2056
|
-
async function verifyDiscoveredProofDocuments(discovered, options) {
|
|
2056
|
+
async function verifyDiscoveredProofDocuments(discovered, options, rejectedPolicies = /* @__PURE__ */ new Map()) {
|
|
2057
2057
|
const documents = await Promise.all(discovered.documents.map(async (document) => {
|
|
2058
2058
|
const metadata = {
|
|
2059
2059
|
path: document.path,
|
|
@@ -2078,10 +2078,20 @@ async function verifyDiscoveredProofDocuments(discovered, options) {
|
|
|
2078
2078
|
id: subjectId,
|
|
2079
2079
|
pointer: document.path
|
|
2080
2080
|
}
|
|
2081
|
-
} }, "objectIntegrity", (observation) =>
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2081
|
+
} }, "objectIntegrity", async (observation) => {
|
|
2082
|
+
const reason = rejectedPolicies.get(document.path);
|
|
2083
|
+
if (reason != null) {
|
|
2084
|
+
if (observation.attempt != null) observation.attempt.reason = {
|
|
2085
|
+
type: "proofPolicy",
|
|
2086
|
+
reason
|
|
2087
|
+
};
|
|
2088
|
+
return null;
|
|
2089
|
+
}
|
|
2090
|
+
return await verifyMapLocalProof(document.securedDocument, {
|
|
2091
|
+
...options,
|
|
2092
|
+
[verificationObservation]: inherited == null ? void 0 : observation
|
|
2093
|
+
});
|
|
2094
|
+
}, (key) => key != null);
|
|
2085
2095
|
return key == null ? Object.freeze({
|
|
2086
2096
|
...metadata,
|
|
2087
2097
|
verified: false,
|
|
@@ -2103,7 +2113,29 @@ async function verifyDiscoveredProofDocuments(discovered, options) {
|
|
|
2103
2113
|
async function verifyCompoundPortableObjectProofs(json, limits, options = {}) {
|
|
2104
2114
|
const discovered = discoverCompoundProofDocuments(json, limits);
|
|
2105
2115
|
if (discovered.status !== "ok") return discovered;
|
|
2106
|
-
const
|
|
2116
|
+
const collected = collectPortableObjects(discovered.snapshot);
|
|
2117
|
+
const objectByPath = new Map(collected.map((object) => [object.path, object]));
|
|
2118
|
+
const isKeyCandidate = (object) => object.keyOf != null && !Object.hasOwn(object.document, "proof");
|
|
2119
|
+
const prepareObject = async (object) => {
|
|
2120
|
+
if (object.depth > 0 && !Object.hasOwn(object.document, "@context")) return {
|
|
2121
|
+
prepared: false,
|
|
2122
|
+
reason: { type: "missingContext" }
|
|
2123
|
+
};
|
|
2124
|
+
try {
|
|
2125
|
+
const policy = await preparePortableObjectProofPolicy(object.document, options);
|
|
2126
|
+
return policy.prepared ? policy : {
|
|
2127
|
+
prepared: false,
|
|
2128
|
+
reason: policy.result.reason
|
|
2129
|
+
};
|
|
2130
|
+
} catch {
|
|
2131
|
+
return {
|
|
2132
|
+
prepared: false,
|
|
2133
|
+
reason: { type: "invalidPortableObject" }
|
|
2134
|
+
};
|
|
2135
|
+
}
|
|
2136
|
+
};
|
|
2137
|
+
const preparedByPath = new Map(await Promise.all(collected.filter((object) => !isKeyCandidate(object)).map(async (object) => [object.path, await prepareObject(object)])));
|
|
2138
|
+
const proofs = await verifyDiscoveredProofDocuments(discovered, options, new Map([...preparedByPath].flatMap(([path, prepared]) => prepared.prepared ? [] : [[path, prepared.reason]])));
|
|
2107
2139
|
const proofByPath = new Map(proofs.map((proof) => [proof.path, proof]));
|
|
2108
2140
|
const verifyPortableObject = async (object) => {
|
|
2109
2141
|
const metadata = {
|
|
@@ -2111,15 +2143,14 @@ async function verifyCompoundPortableObjectProofs(json, limits, options = {}) {
|
|
|
2111
2143
|
id: object.id,
|
|
2112
2144
|
depth: object.depth
|
|
2113
2145
|
};
|
|
2114
|
-
if (object.depth > 0 && !Object.hasOwn(object.document, "@context")) return Object.freeze({
|
|
2115
|
-
...metadata,
|
|
2116
|
-
verified: false,
|
|
2117
|
-
reason: { type: "missingContext" }
|
|
2118
|
-
});
|
|
2119
|
-
const proof = proofByPath.get(object.path);
|
|
2120
|
-
const key = proof?.verified === true ? proof.key : null;
|
|
2121
2146
|
try {
|
|
2122
|
-
const
|
|
2147
|
+
const prepared = preparedByPath.get(object.path) ?? await prepareObject(object);
|
|
2148
|
+
const proof = proofByPath.get(object.path);
|
|
2149
|
+
const key = proof?.verified === true ? proof.key : null;
|
|
2150
|
+
const policy = prepared.prepared ? verifyPreparedPortableObjectProofPolicy(prepared, key) : {
|
|
2151
|
+
verified: false,
|
|
2152
|
+
reason: prepared.reason
|
|
2153
|
+
};
|
|
2123
2154
|
return policy.verified ? Object.freeze({
|
|
2124
2155
|
...metadata,
|
|
2125
2156
|
id: policy.objectId,
|
|
@@ -2138,9 +2169,6 @@ async function verifyCompoundPortableObjectProofs(json, limits, options = {}) {
|
|
|
2138
2169
|
});
|
|
2139
2170
|
}
|
|
2140
2171
|
};
|
|
2141
|
-
const collected = collectPortableObjects(discovered.snapshot);
|
|
2142
|
-
const objectByPath = new Map(collected.map((object) => [object.path, object]));
|
|
2143
|
-
const isKeyCandidate = (object) => object.keyOf != null && !Object.hasOwn(object.document, "proof");
|
|
2144
2172
|
const results = /* @__PURE__ */ new Map();
|
|
2145
2173
|
for (const result of await Promise.all(collected.filter((object) => !isKeyCandidate(object)).map(verifyPortableObject))) results.set(result.path, result);
|
|
2146
2174
|
let projections = 0;
|