@fedify/fedify 2.4.0-dev.2169 → 2.4.0-dev.2193
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-B2d_Pt0j.mjs → builder-0onlMY4u.mjs} +26 -6
- package/dist/{circuit-breaker-C5NqoLBJ.mjs → circuit-breaker-XJ53md4S.mjs} +16 -11
- 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-D28gMFqP.mjs → compound-proof-B-Fk6Slo.mjs} +3 -3
- package/dist/{context-BykNUf04.d.ts → context-9T--NSo4.d.ts} +55 -1
- package/dist/{context-L0Fnib9j.d.cts → context-CDcAgm4l.d.cts} +55 -1
- package/dist/{deno-DU8dvnWk.mjs → deno-DB_Sh0LK.mjs} +1 -1
- package/dist/{docloader-CghLH7Zi.mjs → docloader-DpWYYY6a.mjs} +25 -17
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/circuit-breaker.test.mjs +50 -1
- package/dist/federation/compound-fanout.test.mjs +3 -3
- package/dist/federation/handler-compound-proof.test.mjs +52 -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/keycache.test.mjs +1 -1
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +182 -13
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +2 -2
- package/dist/federation/mod.d.ts +2 -2
- 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-gateway-keys.test.mjs +6 -6
- package/dist/federation/portable-inbox.test.mjs +35 -5
- package/dist/federation/portable-parse-uri.test.mjs +1 -1
- package/dist/federation/portable-route-activity.test.d.mts +2 -0
- package/dist/federation/portable-route-activity.test.mjs +259 -0
- package/dist/federation/portable.test.mjs +49 -5
- 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-DrNgkLfJ.cjs → federation-BsGo0EH2.cjs} +76 -35
- package/dist/{http-5CJBdU8n.cjs → http-BEivI0TS.cjs} +279 -87
- package/dist/{http-BGpexPO7.js → http-BGmxtpo2.js} +263 -89
- package/dist/{http-Cok5-vIC.d.ts → http-BrwKINQn.d.cts} +29 -1
- package/dist/{http-DC1cqAQ2.d.cts → http-DGx0KOws.d.ts} +29 -1
- package/dist/{http-Bd6rZlJX.mjs → http-DQf9Mw4V.mjs} +180 -92
- package/dist/{key-gIhVZO3p.mjs → key-DA3Yx8p2.mjs} +4 -4
- package/dist/{key-owner-evidence-Bo3yaeL5.mjs → key-owner-evidence-APB6NpSk.mjs} +1 -1
- package/dist/{keycache-PiOM9pM0.mjs → keycache-Da8A8mZa.mjs} +1 -1
- package/dist/{kv-cache-YRi_g8GB.cjs → kv-cache-1hafSoqH.cjs} +23 -15
- package/dist/{kv-cache-iR55fqlk.js → kv-cache-DduYhpee.js} +24 -16
- package/dist/{kv-cache-D0qjSeWY.mjs → kv-cache-OFBvrKh3.mjs} +1 -1
- package/dist/{ld-BsTkRrwF.mjs → ld-C15yzuY6.mjs} +3 -3
- package/dist/{metrics-jUDFfVgi.mjs → metrics-B1H23mlq.mjs} +1 -1
- package/dist/{middleware-Dq-OCmb6.mjs → middleware-BZQnf0nI.mjs} +1 -1
- package/dist/{middleware-Coqgp-K0.mjs → middleware-BqqycC0P.mjs} +52 -36
- package/dist/{middleware-DlxMxVp5.js → middleware-ClaUFaLb.js} +77 -36
- package/dist/{mod-DK0y9fd-.d.ts → mod-B3OBLj5g.d.ts} +1 -1
- package/dist/{mod-B5z_q9TH.d.ts → mod-C5Mwx5ty.d.ts} +5 -1
- package/dist/{mod-CPPqkyV_.d.cts → mod-Cy9VNHVw.d.ts} +14 -3
- package/dist/{mod-BLOXGs6m.d.cts → mod-D58KCqUg.d.cts} +1 -1
- package/dist/{mod--jv6vyrP.d.ts → mod-DoTWIc7F.d.cts} +14 -3
- package/dist/{mod-BA_F2x53.d.cts → mod-Dp3Ij7sw.d.cts} +5 -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-D3GoetXS.mjs → owner-BVpZBM-V.mjs} +5 -5
- package/dist/{portable-collection-CnlCamup.cjs → portable-collection-BFSShzwh.cjs} +1 -1
- package/dist/{portable-collection-Bkdh_WpL.js → portable-collection-D535cSz_.js} +1 -1
- package/dist/{portable-collection-C60_acmx.mjs → portable-collection-Dn2GdZdI.mjs} +2 -2
- package/dist/{portable-key-DyF5AnZo.mjs → portable-key-Bmwmq7Y6.mjs} +2 -2
- package/dist/{portable-key-id-Bg259c4Z.mjs → portable-key-id-Ca30-hOa.mjs} +45 -1
- package/dist/{proof-CQAYqWdj.mjs → proof-DrJWKeOl.mjs} +49 -7
- package/dist/{send-DjkQrxt5.mjs → send-CT3a-0Vd.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 +2 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +495 -23
- package/dist/sig/key-owner-evidence.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +2 -2
- 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-key-id.test.d.mts +2 -0
- package/dist/sig/portable-key-id.test.mjs +67 -0
- package/dist/sig/portable-key.test.mjs +7 -7
- package/dist/sig/proof.test.mjs +141 -7
- package/dist/{temporal-oRKP803M.mjs → temporal-DNqluyEc.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/testing/mod.d.mts +52 -0
- package/dist/utils/docloader.test.mjs +93 -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
package/dist/mod.js
CHANGED
|
@@ -3,11 +3,11 @@ import { URLPattern } from "urlpattern-polyfill";
|
|
|
3
3
|
import "./rolldown-runtime-BC-Eo5Mj.js";
|
|
4
4
|
import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-DAtXl_Kc.js";
|
|
5
5
|
import "./compat/mod.js";
|
|
6
|
-
import {
|
|
7
|
-
import { a as respondWithObjectIfAcceptable, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as respondWithObject, l as CircuitBreaker, n as handleWebFinger, o as SendActivityError, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "./middleware-
|
|
6
|
+
import { D as createSignature, H as fetchKeyDetailed, I as verifyJsonLd, L as verifySignature, O as detachSignature, P as signJsonLd, T as attachSignature, U as generateCryptoKeyPair, V as fetchKey, W as importJwk, _ as verifyObject, _t as validateAcceptSignature, a as signRequest, c as verifyRequestDetailed, gt as parseAcceptSignature, h as signObject, ht as fulfillAcceptSignature, j as hasSignatureLike, m as hasProofLike, mt as formatAcceptSignature, p as createProof, s as verifyRequest, v as verifyPortableObjectProof, x as verifyProof, z as exportJwk } from "./http-BGmxtpo2.js";
|
|
7
|
+
import { a as respondWithObjectIfAcceptable, c as digest, d as parseCircuitBreakerKvState, f as createFederationBuilder, i as respondWithObject, l as CircuitBreaker, n as handleWebFinger, o as SendActivityError, r as createExponentialBackoffPolicy, s as buildCollectionSynchronizationHeader, t as createFederation, u as normalizeCircuitBreakerOptions } from "./middleware-ClaUFaLb.js";
|
|
8
8
|
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-_S2_MeLF.js";
|
|
9
|
-
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
9
|
+
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "./portable-collection-D535cSz_.js";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-DduYhpee.js";
|
|
11
11
|
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue, Router, RouterError } from "./federation/mod.js";
|
|
12
12
|
import "./nodeinfo/mod.js";
|
|
13
13
|
import "./runtime/mod.js";
|
|
@@ -5,7 +5,7 @@ import { r as createRequestContext } from "../context-B2rlkkyJ.mjs";
|
|
|
5
5
|
import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
6
6
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
7
7
|
import "../std__assert-DvMDRPes.mjs";
|
|
8
|
-
import { C as handleNodeInfo, o as createFederation, w as handleNodeInfoJrd } from "../middleware-
|
|
8
|
+
import { C as handleNodeInfo, o as createFederation, w as handleNodeInfoJrd } from "../middleware-BqqycC0P.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
//#region src/nodeinfo/handler.test.ts
|
|
11
11
|
test("handleNodeInfo()", async () => {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import {
|
|
6
|
-
import { i as parseKeyOwnerEvidence, r as getVerifiedKeyOwnerEvidence } from "./key-owner-evidence-
|
|
7
|
-
import { l as verifyKeyOwnership, n as exportJwk, r as fetchActorDocument } from "./key-
|
|
8
|
-
import { n as resolvePortableActorKey, t as fetchPortableGatewayKey } from "./portable-key-
|
|
4
|
+
import { n as version, t as name } from "./deno-DB_Sh0LK.mjs";
|
|
5
|
+
import { d as isPortableUri, l as isPortableId, n as getCanonicalPortableId, p as isSamePublicKey$1, s as isCompatibleKeyId } from "./portable-key-id-Ca30-hOa.mjs";
|
|
6
|
+
import { i as parseKeyOwnerEvidence, r as getVerifiedKeyOwnerEvidence } from "./key-owner-evidence-APB6NpSk.mjs";
|
|
7
|
+
import { l as verifyKeyOwnership, n as exportJwk, r as fetchActorDocument } from "./key-DA3Yx8p2.mjs";
|
|
8
|
+
import { n as resolvePortableActorKey, t as fetchPortableGatewayKey } from "./portable-key-Bmwmq7Y6.mjs";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
10
10
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
11
11
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
|
-
const require_http = require("./http-
|
|
2
|
+
const require_http = require("./http-BEivI0TS.cjs");
|
|
3
3
|
let _logtape_logtape = require("@logtape/logtape");
|
|
4
4
|
let _fedify_vocab = require("@fedify/vocab");
|
|
5
5
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import {
|
|
3
|
+
import { At as name, B as fetchActorDocument, Dt as isPortableUri, J as getVerifiedKeyOwnerEvidence, K as verifyKeyOwnership, Tt as isPortableId, Y as parseKeyOwnerEvidence, b as verifyPortableObjectProofWithRoot, jt as version, kt as isSamePublicKey$1, l as fetchPortableGatewayKey, u as resolvePortableActorKey, v as verifyPortableObjectProof, wt as isCompatibleKeyId, yt as getCanonicalPortableId, z as exportJwk } from "./http-BGmxtpo2.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { CollectionPage, CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
6
6
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { c as verifyPortableObjectProof, u as verifyPortableObjectProofWithRoot } from "./proof-
|
|
4
|
+
import { n as version, t as name } from "./deno-DB_Sh0LK.mjs";
|
|
5
|
+
import { c as verifyPortableObjectProof, u as verifyPortableObjectProofWithRoot } from "./proof-DrJWKeOl.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { CollectionPage, Object as Object$1, isActor } from "@fedify/vocab";
|
|
8
8
|
import { trace } from "@opentelemetry/api";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import {
|
|
5
|
-
import { u as verifyPortableObjectProofWithRoot } from "./proof-
|
|
4
|
+
import { a as getRawCanonicalPortableId, c as isPortableActorDocument, d as isPortableUri, n as getCanonicalPortableId, p as isSamePublicKey } from "./portable-key-id-Ca30-hOa.mjs";
|
|
5
|
+
import { u as verifyPortableObjectProofWithRoot } from "./proof-DrJWKeOl.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { CryptographicKey, Multikey, Object as Object$1 } from "@fedify/vocab";
|
|
8
8
|
import { FetchError, formatIri, getDocumentLoader, isGatewayUrl, parseIri, toCompatibleEf61Id } from "@fedify/vocab-runtime";
|
|
@@ -103,6 +103,50 @@ function getCanonicalPortableId(id) {
|
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
/**
|
|
106
|
+
* Gets the [FEP-fe34] origin of an ID for same-origin checks. The origin of
|
|
107
|
+
* an `ap:` or `ap+ef61:` URI, or of a compatible identifier on any gateway,
|
|
108
|
+
* is the DID of its canonical portable ID, as FEP-ef61 treats a compatible
|
|
109
|
+
* identifier as the portable ID it stands for; unlike `getFe34Origin()`,
|
|
110
|
+
* which gives a compatible identifier the web origin of its gateway. The
|
|
111
|
+
* origin of any other HTTP(S) URL is its web origin, and that of a DID URL
|
|
112
|
+
* is its DID.
|
|
113
|
+
*
|
|
114
|
+
* Only the parsed `URL` is validated, so dot segments that URL parsing has
|
|
115
|
+
* already resolved cannot be detected here.
|
|
116
|
+
*
|
|
117
|
+
* [FEP-fe34]: https://w3id.org/fep/fe34
|
|
118
|
+
* @returns The origin, or `null` if the ID has none that is supported, or is
|
|
119
|
+
* a malformed portable ID or compatible identifier.
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
function getAuthenticationOrigin(id) {
|
|
123
|
+
try {
|
|
124
|
+
if (isPortableId(id)) {
|
|
125
|
+
const canonical = getCanonicalPortableId(id);
|
|
126
|
+
return canonical == null ? null : getFe34Origin(canonical);
|
|
127
|
+
}
|
|
128
|
+
return getFe34Origin(id);
|
|
129
|
+
} catch (error) {
|
|
130
|
+
if (error instanceof TypeError) return null;
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Checks whether two IDs identify the same object. Two portable IDs, i.e.,
|
|
136
|
+
* `ap:` or `ap+ef61:` URIs or compatible identifiers, are compared by their
|
|
137
|
+
* canonical portable IDs, so that the same object on different gateways and
|
|
138
|
+
* with different location hints matches. Other IDs have to be equal as
|
|
139
|
+
* they are.
|
|
140
|
+
* @internal
|
|
141
|
+
*/
|
|
142
|
+
function isSameObjectId(a, b) {
|
|
143
|
+
const aPortable = isPortableId(a);
|
|
144
|
+
if (aPortable !== isPortableId(b)) return false;
|
|
145
|
+
if (!aPortable) return a.href === b.href;
|
|
146
|
+
const canonical = getCanonicalPortableId(a);
|
|
147
|
+
return canonical != null && canonical === getCanonicalPortableId(b);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
106
150
|
* Gets the canonical portable ID of an `ap:` or `ap+ef61:` URI or
|
|
107
151
|
* a compatible identifier as it is written, before any URL parsing.
|
|
108
152
|
* Parsing an ID into a `URL` resolves dot segments in its path, which would
|
|
@@ -201,4 +245,4 @@ async function isSamePublicKey(a, b) {
|
|
|
201
245
|
return x.kty === y.kty && x.crv === y.crv && x.n === y.n && x.e === y.e && x.x === y.x && x.y === y.y;
|
|
202
246
|
}
|
|
203
247
|
//#endregion
|
|
204
|
-
export {
|
|
248
|
+
export { getRawCanonicalPortableId as a, isPortableActorDocument as c, isPortableUri as d, isSameObjectId as f, getPortableDid as i, isPortableId as l, parseKeyIdString as m, getCanonicalPortableId as n, hasPortableActor as o, isSamePublicKey as p, getGatewayKeyBase as r, isCompatibleKeyId as s, getAuthenticationOrigin as t, isPortableKeyId as u };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
6
|
-
import {
|
|
7
|
-
import { c as validateCryptoKey, i as fetchKey, t as bypassKeyCacheReads } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-DB_Sh0LK.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-B1H23mlq.mjs";
|
|
6
|
+
import { i as getPortableDid, l as isPortableId } from "./portable-key-id-Ca30-hOa.mjs";
|
|
7
|
+
import { c as validateCryptoKey, i as fetchKey, t as bypassKeyCacheReads } from "./key-DA3Yx8p2.mjs";
|
|
8
8
|
import { n as preloadedOnlyDocumentLoader } from "./public-audience--klBIOk1.mjs";
|
|
9
9
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-4IJqPYos.mjs";
|
|
10
|
-
import { c as getNormalizationContextLoader } from "./ld-
|
|
10
|
+
import { c as getNormalizationContextLoader } from "./ld-C15yzuY6.mjs";
|
|
11
11
|
import { getLogger } from "@logtape/logtape";
|
|
12
12
|
import { Activity, DataIntegrityProof, Multikey, getTypeId } from "@fedify/vocab";
|
|
13
13
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
14
|
-
import { encodeMultibase, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, parseIri } from "@fedify/vocab-runtime";
|
|
14
|
+
import { encodeMultibase, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, parseGatewayUrl, parseIri } from "@fedify/vocab-runtime";
|
|
15
15
|
import { encodeHex } from "byte-encodings/hex";
|
|
16
16
|
import { isPlainJsonTree, retainSignedRepresentation } from "@fedify/vocab-runtime/internal/signed-representation";
|
|
17
17
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
@@ -676,6 +676,7 @@ const FEP_2277_COLLECTION_PROPERTIES = [
|
|
|
676
676
|
"prev",
|
|
677
677
|
"current"
|
|
678
678
|
].map((property) => AS_NAMESPACE + property);
|
|
679
|
+
const FEP_EF61_GATEWAYS = "https://w3id.org/fep/ef61/gateways";
|
|
679
680
|
const PORTABLE_OBJECT_ID_PATTERN = /^ap(?:\+ef61)?:\/\//i;
|
|
680
681
|
const FUNCTIONAL_PROOF_PROPERTIES = [
|
|
681
682
|
`${SECURITY_NAMESPACE}cryptosuite`,
|
|
@@ -702,6 +703,35 @@ function hasValidPortableProofShape(proofValue) {
|
|
|
702
703
|
});
|
|
703
704
|
}
|
|
704
705
|
/**
|
|
706
|
+
* Checks whether an expanded portable actor node has the `gateways` that
|
|
707
|
+
* FEP-ef61 requires: a non-empty list whose items are all HTTP(S) URIs with
|
|
708
|
+
* an empty path, query, and fragment. Like the generated vocabulary decoder,
|
|
709
|
+
* this also tolerates a plain set of values instead of a `@list`, and gateway
|
|
710
|
+
* strings given as `@value`s instead of `@id`s.
|
|
711
|
+
*/
|
|
712
|
+
function hasValidPortableActorGateways(node) {
|
|
713
|
+
const values = node[FEP_EF61_GATEWAYS];
|
|
714
|
+
if (!Array.isArray(values)) return false;
|
|
715
|
+
let items = values;
|
|
716
|
+
if (values.some((value) => isJsonLdNode(value) && "@list" in value)) {
|
|
717
|
+
if (values.length !== 1) return false;
|
|
718
|
+
items = values[0]["@list"];
|
|
719
|
+
}
|
|
720
|
+
if (!Array.isArray(items) || items.length < 1) return false;
|
|
721
|
+
return items.every((item) => {
|
|
722
|
+
if (!isJsonLdNode(item)) return false;
|
|
723
|
+
const gateway = typeof item["@id"] === "string" ? item["@id"] : item["@value"];
|
|
724
|
+
if (typeof gateway !== "string") return false;
|
|
725
|
+
try {
|
|
726
|
+
parseGatewayUrl(gateway);
|
|
727
|
+
} catch (error) {
|
|
728
|
+
if (error instanceof TypeError) return false;
|
|
729
|
+
throw error;
|
|
730
|
+
}
|
|
731
|
+
return true;
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
705
735
|
* Classifies an expanded JSON-LD node into an FEP-2277 core type by the
|
|
706
736
|
* properties it has.
|
|
707
737
|
* @internal
|
|
@@ -905,6 +935,15 @@ async function preparePortableObjectProof(jsonLd, options) {
|
|
|
905
935
|
}
|
|
906
936
|
};
|
|
907
937
|
}
|
|
938
|
+
if (objectType === "actor" && !hasValidPortableActorGateways(root)) return {
|
|
939
|
+
prepared: false,
|
|
940
|
+
root,
|
|
941
|
+
objectType,
|
|
942
|
+
result: {
|
|
943
|
+
verified: false,
|
|
944
|
+
reason: { type: "invalidGateways" }
|
|
945
|
+
}
|
|
946
|
+
};
|
|
908
947
|
return {
|
|
909
948
|
prepared: true,
|
|
910
949
|
root,
|
|
@@ -958,7 +997,10 @@ async function verifyPortableObjectProofPolicy(jsonLd, key, options = {}) {
|
|
|
958
997
|
*
|
|
959
998
|
* Every proof must use a DID URL whose DID matches the portable object's
|
|
960
999
|
* authority, i.e., the DID of its canonical portable ID, and every proof must
|
|
961
|
-
* pass {@link verifyProof}.
|
|
1000
|
+
* pass {@link verifyProof}. A portable actor must also have a non-empty
|
|
1001
|
+
* `gateways` list whose items are all HTTP(S) URIs with an empty path, query,
|
|
1002
|
+
* and fragment; otherwise, it is rejected with the `invalidGateways` reason
|
|
1003
|
+
* before its proofs are verified. The proofs are verified over the document as
|
|
962
1004
|
* given; a compatible identifier is never rewritten into a portable ID.
|
|
963
1005
|
*
|
|
964
1006
|
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "temporal-polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics } from "./metrics-
|
|
6
|
-
import { n as doubleKnock } from "./http-
|
|
4
|
+
import { n as version, t as name } from "./deno-DB_Sh0LK.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics } from "./metrics-B1H23mlq.mjs";
|
|
6
|
+
import { n as doubleKnock } from "./http-DQf9Mw4V.mjs";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
import { FetchError, UrlError, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
|
-
import { i as inspectCompoundPortableObjectApplicability, n as discoverCompoundProofDocuments } from "../compound-proof-
|
|
6
|
+
import { i as inspectCompoundPortableObjectApplicability, n as discoverCompoundProofDocuments } from "../compound-proof-B-Fk6Slo.mjs";
|
|
7
7
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/sig/compound-proof-discovery.test.ts
|
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
|
-
import { i as inspectCompoundPortableObjectApplicability, r as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "../compound-proof-
|
|
6
|
+
import { i as inspectCompoundPortableObjectApplicability, r as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "../compound-proof-B-Fk6Slo.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
//#region src/sig/compound-proof-producer.test.ts
|
|
9
9
|
const portableId = "ap+ef61://did:key:z6MkAlice/objects/1";
|
|
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
|
-
import { l as verifyPortableObjectProofPolicy, o as verifyMapLocalProof } from "../proof-
|
|
7
|
+
import { l as verifyPortableObjectProofPolicy, o as verifyMapLocalProof } from "../proof-DrJWKeOl.mjs";
|
|
8
8
|
import { n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
9
|
-
import { a as verifyCompoundPortableObjectProofs, i as inspectCompoundPortableObjectApplicability, o as verifyCompoundProofDocuments, t as containsCompoundPortableObject } from "../compound-proof-
|
|
9
|
+
import { a as verifyCompoundPortableObjectProofs, i as inspectCompoundPortableObjectApplicability, o as verifyCompoundProofDocuments, t as containsCompoundPortableObject } from "../compound-proof-B-Fk6Slo.mjs";
|
|
10
10
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
11
11
|
import { t as map_local_context_conflict_default } from "../map-local-context-conflict-DOYEEJ3u.mjs";
|
|
12
12
|
import { CryptographicKey, Multikey, Person } from "@fedify/vocab";
|
|
@@ -6,9 +6,9 @@ import "../std__assert-DvMDRPes.mjs";
|
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
7
|
import { n as preloadedOnlyDocumentLoader } from "../public-audience--klBIOk1.mjs";
|
|
8
8
|
import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-4IJqPYos.mjs";
|
|
9
|
-
import { a as signObject, d as verifyProof } from "../proof-
|
|
9
|
+
import { a as signObject, d as verifyProof } from "../proof-DrJWKeOl.mjs";
|
|
10
10
|
import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
|
|
11
|
-
import { o as verifyCompoundProofDocuments } from "../compound-proof-
|
|
11
|
+
import { o as verifyCompoundProofDocuments } from "../compound-proof-B-Fk6Slo.mjs";
|
|
12
12
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
13
13
|
import { t as map_local_context_conflict_default } from "../map-local-context-conflict-DOYEEJ3u.mjs";
|
|
14
14
|
import { Create, DataIntegrityProof, Note, Question } from "@fedify/vocab";
|