@fedify/fedify 2.1.26 → 2.1.28
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-9KbL1CoC.mjs → builder-CW1BrLbm.mjs} +3 -3
- package/dist/compat/transformers.test.mjs +2 -2
- package/dist/{deno-ChmEXNOv.mjs → deno-CJgU2mcr.mjs} +1 -1
- package/dist/{docloader-DEVImb5e.mjs → docloader-o3fCIlIa.mjs} +2 -2
- package/dist/federation/builder.test.mjs +2 -2
- package/dist/federation/collection.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +7 -7
- package/dist/federation/idempotency.test.mjs +3 -3
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/keycache.test.mjs +33 -2
- package/dist/federation/kv.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +7 -7
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.js +1 -1
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +2 -2
- package/dist/{http-B_M80hBW.mjs → http-Dcj1ulAh.mjs} +2 -2
- package/dist/{http-CeK9QmL_.js → http-DtypHuuK.js} +104 -10
- package/dist/{http-BOH-uFLj.cjs → http-EEfKB8Qb.cjs} +103 -9
- package/dist/{inbox-B_O6TjZS.mjs → inbox-CVYVJI0M.mjs} +1 -1
- package/dist/{key-BJcK-1Av.mjs → key-DRLvwDTh.mjs} +104 -10
- package/dist/{keycache-CaO7wyQA.mjs → keycache-RFlZObU3.mjs} +23 -2
- package/dist/{kv-cache-BlOG31SS.cjs → kv-cache-BWVKAAmc.cjs} +1 -1
- package/dist/{kv-cache-CEJICY0R.js → kv-cache-CEJCaF4E.js} +1 -1
- package/dist/{ld-YAXn6sG8.mjs → ld-C5BZ98YK.mjs} +2 -2
- package/dist/{middleware-DmTWC5VG.mjs → middleware-CqQoREZ9.mjs} +1 -1
- package/dist/{middleware-dGW2gSDG.cjs → middleware-DZxmsbPB.cjs} +1 -1
- package/dist/{middleware-DHGVHIUj.cjs → middleware-Dw9sPiec.cjs} +26 -6
- package/dist/{middleware-Co_QOX9H.mjs → middleware-SSrXiJIV.mjs} +15 -15
- package/dist/{middleware-C-45wr85.js → middleware-wCgWm4Eh.js} +25 -5
- package/dist/mod.cjs +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/client.test.mjs +1 -1
- package/dist/nodeinfo/handler.test.mjs +2 -2
- package/dist/nodeinfo/types.test.mjs +1 -1
- package/dist/otel/exporter.test.mjs +1 -1
- package/dist/{owner-B3ZkY-Ov.mjs → owner-cPOoPvmr.mjs} +2 -2
- package/dist/{proof-DIGrz49z.mjs → proof-BTknCsN7.mjs} +2 -2
- package/dist/{proof-BeGIkK97.js → proof-DPU3poip.js} +1 -1
- package/dist/{proof-DzOl2GlQ.cjs → proof-De1y2j-e.cjs} +1 -1
- package/dist/{send-N2w1IwXT.mjs → send-DDuHNgHz.mjs} +2 -2
- package/dist/sig/http.test.mjs +62 -3
- package/dist/sig/key.test.mjs +198 -4
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +1 -1
- package/dist/{temporal-CpT0u5Mx.mjs → temporal-CxXY--ZL.mjs} +1 -1
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +6 -6
- /package/dist/{client-DM72NZuk.mjs → client-CjDMsn4a.mjs} +0 -0
- /package/dist/{collection-ChgDTHLz.mjs → collection-BD6-SZ6O.mjs} +0 -0
- /package/dist/{kv-BrZHNugx.mjs → kv-HvthQAHr.mjs} +0 -0
- /package/dist/{types-C37hquWI.mjs → types-DCP0WLdt.mjs} +0 -0
|
@@ -2,8 +2,8 @@ import "@js-temporal/polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { n as RouterError, t as Router } from "./router-CrMLXoOr.mjs";
|
|
5
|
-
import { n as version, t as name } from "./deno-
|
|
6
|
-
import { t as InboxListenerSet } from "./inbox-
|
|
5
|
+
import { n as version, t as name } from "./deno-CJgU2mcr.mjs";
|
|
6
|
+
import { t as InboxListenerSet } from "./inbox-CVYVJI0M.mjs";
|
|
7
7
|
import { getTypeId } from "@fedify/vocab";
|
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -44,7 +44,7 @@ var FederationBuilderImpl = class {
|
|
|
44
44
|
this.collectionTypeIds = {};
|
|
45
45
|
}
|
|
46
46
|
async build(options) {
|
|
47
|
-
const { FederationImpl } = await import("./middleware-
|
|
47
|
+
const { FederationImpl } = await import("./middleware-CqQoREZ9.mjs");
|
|
48
48
|
const f = new FederationImpl(options);
|
|
49
49
|
const trailingSlashInsensitiveValue = f.router.trailingSlashInsensitive;
|
|
50
50
|
f.router = this.router.clone();
|
|
@@ -3,8 +3,8 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
|
|
6
|
-
import { t as MemoryKvStore } from "../kv-
|
|
7
|
-
import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-
|
|
6
|
+
import { t as MemoryKvStore } from "../kv-HvthQAHr.mjs";
|
|
7
|
+
import { _ as autoIdAssigner, g as actorDehydrator, n as FederationImpl } from "../middleware-SSrXiJIV.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
import { Follow, Person } from "@fedify/vocab";
|
|
10
10
|
//#region src/compat/transformers.test.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@js-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-DRLvwDTh.mjs";
|
|
5
|
+
import { n as doubleKnock } from "./http-Dcj1ulAh.mjs";
|
|
6
6
|
import { curry } from "es-toolkit";
|
|
7
7
|
import { FetchError, UrlError, createActivityPubRequest, getRemoteDocument, logRequest, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
8
8
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -4,8 +4,8 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import { i as assertExists, n as assertStrictEquals } from "../std__assert-BUOJXi-Z.mjs";
|
|
6
6
|
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
7
|
-
import { t as MemoryKvStore } from "../kv-
|
|
8
|
-
import { n as createFederationBuilder } from "../builder-
|
|
7
|
+
import { t as MemoryKvStore } from "../kv-HvthQAHr.mjs";
|
|
8
|
+
import { n as createFederationBuilder } from "../builder-CW1BrLbm.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
import { Activity, Note, Person } from "@fedify/vocab";
|
|
11
11
|
//#region src/federation/builder.test.ts
|
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import "../std__assert-BUOJXi-Z.mjs";
|
|
6
|
-
import { n as digest, t as buildCollectionSynchronizationHeader } from "../collection-
|
|
6
|
+
import { n as digest, t as buildCollectionSynchronizationHeader } from "../collection-BD6-SZ6O.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
import { decodeHex } from "byte-encodings/hex";
|
|
9
9
|
//#region src/federation/collection.test.ts
|
|
@@ -7,14 +7,14 @@ import "../std__assert-BUOJXi-Z.mjs";
|
|
|
7
7
|
import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
|
|
8
8
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
9
9
|
import { r as parseAcceptSignature } from "../accept-BavzedPB.mjs";
|
|
10
|
-
import { a as generateCryptoKeyPair } from "../key-
|
|
11
|
-
import { s as signRequest } from "../http-
|
|
10
|
+
import { a as generateCryptoKeyPair } from "../key-DRLvwDTh.mjs";
|
|
11
|
+
import { s as signRequest } from "../http-Dcj1ulAh.mjs";
|
|
12
12
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, s as rsaPublicKey2 } from "../keys-CtZLJq76.mjs";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import { a as createFederation, c as handleCollection, d as handleObject, f as respondWithObject, l as handleCustomCollection, p as respondWithObjectIfAcceptable, s as handleActor, u as handleInbox } from "../middleware-
|
|
17
|
-
import { t as InboxListenerSet } from "../inbox-
|
|
13
|
+
import { t as MemoryKvStore } from "../kv-HvthQAHr.mjs";
|
|
14
|
+
import { a as compactJsonLd, f as signJsonLd } from "../ld-C5BZ98YK.mjs";
|
|
15
|
+
import { n as signObject } from "../proof-BTknCsN7.mjs";
|
|
16
|
+
import { a as createFederation, c as handleCollection, d as handleObject, f as respondWithObject, l as handleCustomCollection, p as respondWithObjectIfAcceptable, s as handleActor, u as handleInbox } from "../middleware-SSrXiJIV.mjs";
|
|
17
|
+
import { t as InboxListenerSet } from "../inbox-CVYVJI0M.mjs";
|
|
18
18
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
19
19
|
import { Create, CryptographicKey, Multikey, Note, Person } from "@fedify/vocab";
|
|
20
20
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import "../std__assert-BUOJXi-Z.mjs";
|
|
6
6
|
import { n as ed25519PrivateKey, r as ed25519PublicKey, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { a as createFederation } from "../middleware-
|
|
7
|
+
import { t as MemoryKvStore } from "../kv-HvthQAHr.mjs";
|
|
8
|
+
import { n as signObject } from "../proof-BTknCsN7.mjs";
|
|
9
|
+
import { a as createFederation } from "../middleware-SSrXiJIV.mjs";
|
|
10
10
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
11
11
|
import { Create, Follow, Person } from "@fedify/vocab";
|
|
12
12
|
//#region src/federation/idempotency.test.ts
|
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
6
|
-
import { t as InboxListenerSet } from "../inbox-
|
|
6
|
+
import { t as InboxListenerSet } from "../inbox-CVYVJI0M.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
import { Activity, Create, Invite, Offer, Update } from "@fedify/vocab";
|
|
9
9
|
//#region src/federation/inbox.test.ts
|
|
@@ -3,8 +3,8 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
|
|
6
|
-
import { t as
|
|
7
|
-
import { t as
|
|
6
|
+
import { t as KvKeyCache } from "../keycache-RFlZObU3.mjs";
|
|
7
|
+
import { t as MemoryKvStore } from "../kv-HvthQAHr.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
10
10
|
//#region src/federation/keycache.test.ts
|
|
@@ -101,6 +101,37 @@ test("KvKeyCache fetch error metadata", async () => {
|
|
|
101
101
|
await cache.setFetchError(keyId, null);
|
|
102
102
|
assertEquals(await cache.getFetchError(keyId), void 0);
|
|
103
103
|
});
|
|
104
|
+
test("KvKeyCache reads legacy fetch errors", async () => {
|
|
105
|
+
const kv = new MemoryKvStore();
|
|
106
|
+
const keyId = new URL("https://example.com/key");
|
|
107
|
+
await kv.set([
|
|
108
|
+
"pk",
|
|
109
|
+
"__fetchError",
|
|
110
|
+
keyId.href
|
|
111
|
+
], {
|
|
112
|
+
errorName: "FetchError",
|
|
113
|
+
errorMessage: "Legacy failure"
|
|
114
|
+
});
|
|
115
|
+
const result = await new KvKeyCache(kv, ["pk"]).getFetchError(keyId);
|
|
116
|
+
assert(result != null && "error" in result);
|
|
117
|
+
assertEquals(result.error.constructor, Error);
|
|
118
|
+
assertEquals(result.error.name, "FetchError");
|
|
119
|
+
assertEquals(result.error.message, "Legacy failure");
|
|
120
|
+
assertEquals(result.error.cause, void 0);
|
|
121
|
+
});
|
|
122
|
+
test("KvKeyCache keeps unknown error types generic", async () => {
|
|
123
|
+
class CustomError extends Error {}
|
|
124
|
+
const kv = new MemoryKvStore();
|
|
125
|
+
const keyId = new URL("https://example.com/key");
|
|
126
|
+
const error = new CustomError("Custom failure");
|
|
127
|
+
error.name = "FetchError";
|
|
128
|
+
await new KvKeyCache(kv, ["pk"]).setFetchError(keyId, { error });
|
|
129
|
+
const result = await new KvKeyCache(kv, ["pk"]).getFetchError(keyId);
|
|
130
|
+
assert(result != null && "error" in result);
|
|
131
|
+
assertEquals(result.error.constructor, Error);
|
|
132
|
+
assertEquals(result.error.name, "FetchError");
|
|
133
|
+
assertEquals(result.error.message, "Custom failure");
|
|
134
|
+
});
|
|
104
135
|
test("KvKeyCache unavailable entries expire", async () => {
|
|
105
136
|
const cache = new KvKeyCache(new MemoryKvStore(), ["pk"], { unavailableKeyTtl: Temporal.Duration.from({ milliseconds: 1 }) });
|
|
106
137
|
const keyId = new URL("https://example.com/expired");
|
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import "../std__assert-BUOJXi-Z.mjs";
|
|
6
|
-
import { t as MemoryKvStore } from "../kv-
|
|
6
|
+
import { t as MemoryKvStore } from "../kv-HvthQAHr.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
//#region src/federation/kv.test.ts
|
|
9
9
|
test("MemoryKvStore", async (t) => {
|
|
@@ -9,14 +9,14 @@ import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z
|
|
|
9
9
|
import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
|
|
10
10
|
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
11
11
|
import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
|
|
12
|
-
import { l as verifyRequest, s as signRequest } from "../http-
|
|
12
|
+
import { l as verifyRequest, s as signRequest } from "../http-Dcj1ulAh.mjs";
|
|
13
13
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
|
|
14
|
-
import { t as getAuthenticatedDocumentLoader } from "../docloader-
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-
|
|
14
|
+
import { t as getAuthenticatedDocumentLoader } from "../docloader-o3fCIlIa.mjs";
|
|
15
|
+
import { t as MemoryKvStore } from "../kv-HvthQAHr.mjs";
|
|
16
|
+
import { a as compactJsonLd, f as signJsonLd, m as verifyJsonLd, s as detachSignature } from "../ld-C5BZ98YK.mjs";
|
|
17
|
+
import { t as doesActorOwnKey } from "../owner-cPOoPvmr.mjs";
|
|
18
|
+
import { n as signObject, r as verifyObject } from "../proof-BTknCsN7.mjs";
|
|
19
|
+
import { a as createFederation, i as KvSpecDeterminer, n as FederationImpl, r as InboxContextImpl, t as ContextImpl } from "../middleware-SSrXiJIV.mjs";
|
|
20
20
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
21
21
|
import * as vocab from "@fedify/vocab";
|
|
22
22
|
import { Create, Offer, Person, getTypeId, lookupObject } from "@fedify/vocab";
|
package/dist/federation/mod.cjs
CHANGED
|
@@ -2,7 +2,7 @@ const { Temporal } = require("@js-temporal/polyfill");
|
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
4
|
require("../chunk-DDcVe30Y.cjs");
|
|
5
|
-
const require_middleware = require("../middleware-
|
|
5
|
+
const require_middleware = require("../middleware-Dw9sPiec.cjs");
|
|
6
6
|
let es_toolkit = require("es-toolkit");
|
|
7
7
|
//#region src/federation/kv.ts
|
|
8
8
|
/**
|
package/dist/federation/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-
|
|
3
|
+
import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "../middleware-wCgWm4Eh.js";
|
|
4
4
|
import { isEqual } from "es-toolkit";
|
|
5
5
|
//#region src/federation/kv.ts
|
|
6
6
|
/**
|
|
@@ -7,10 +7,10 @@ import "../std__assert-BUOJXi-Z.mjs";
|
|
|
7
7
|
import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
|
|
8
8
|
import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
|
|
9
9
|
import { t as assertNotEquals } from "../assert_not_equals--wG9hV7u.mjs";
|
|
10
|
-
import { l as verifyRequest } from "../http-
|
|
10
|
+
import { l as verifyRequest } from "../http-Dcj1ulAh.mjs";
|
|
11
11
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CtZLJq76.mjs";
|
|
12
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
13
|
-
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-
|
|
12
|
+
import { t as doesActorOwnKey } from "../owner-cPOoPvmr.mjs";
|
|
13
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "../send-DDuHNgHz.mjs";
|
|
14
14
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
15
15
|
import { Activity, Application, Endpoints, Group, Person, Service } from "@fedify/vocab";
|
|
16
16
|
import { FetchError, UrlError } from "@fedify/vocab-runtime";
|
|
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import "../std__assert-BUOJXi-Z.mjs";
|
|
5
5
|
import { n as assertFalse } from "../assert_rejects-B-qJtC9Z.mjs";
|
|
6
6
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
7
|
-
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-
|
|
7
|
+
import { t as hasMalformedKnownTemporalLiteral } from "../temporal-CxXY--ZL.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 () => {
|
|
@@ -4,8 +4,8 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { n as createRequestContext } from "../context-Juj6bdHC.mjs";
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
6
|
import "../std__assert-BUOJXi-Z.mjs";
|
|
7
|
-
import { t as MemoryKvStore } from "../kv-
|
|
8
|
-
import { a as createFederation, o as handleWebFinger } from "../middleware-
|
|
7
|
+
import { t as MemoryKvStore } from "../kv-HvthQAHr.mjs";
|
|
8
|
+
import { a as createFederation, o as handleWebFinger } from "../middleware-SSrXiJIV.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
import { Image, Link, Person } from "@fedify/vocab";
|
|
11
11
|
//#region src/federation/webfinger.test.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Temporal } from "@js-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-CJgU2mcr.mjs";
|
|
5
5
|
import { i as validateAcceptSignature, n as fulfillAcceptSignature, r as parseAcceptSignature } from "./accept-BavzedPB.mjs";
|
|
6
|
-
import { i as fetchKeyDetailed, s as validateCryptoKey } from "./key-
|
|
6
|
+
import { i as fetchKeyDetailed, s as validateCryptoKey } from "./key-DRLvwDTh.mjs";
|
|
7
7
|
import { CryptographicKey } from "@fedify/vocab";
|
|
8
8
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
@@ -4,13 +4,13 @@ import { getLogger } from "@logtape/logtape";
|
|
|
4
4
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
5
5
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
6
6
|
import { encodeHex } from "byte-encodings/hex";
|
|
7
|
-
import { FetchError, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
7
|
+
import { FetchError, UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
8
8
|
import { Item, decodeDict, encodeDict, encodeItem } from "structured-field-values";
|
|
9
9
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
10
10
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
11
11
|
//#region deno.json
|
|
12
12
|
var name = "@fedify/fedify";
|
|
13
|
-
var version = "2.1.
|
|
13
|
+
var version = "2.1.28";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/sig/accept.ts
|
|
16
16
|
/**
|
|
@@ -152,6 +152,64 @@ function fulfillAcceptSignature(entry, localKeyId, localAlg) {
|
|
|
152
152
|
}
|
|
153
153
|
//#endregion
|
|
154
154
|
//#region src/sig/key.ts
|
|
155
|
+
/** Classifies decoding failures without hiding unexpected loader errors. */
|
|
156
|
+
function classifyKeyJsonLdError(error, seen = /* @__PURE__ */ new Set()) {
|
|
157
|
+
if (!(error instanceof Error) || !error.name.startsWith("jsonld.")) return null;
|
|
158
|
+
if (seen.has(error)) throw error;
|
|
159
|
+
seen.add(error);
|
|
160
|
+
const details = error.details;
|
|
161
|
+
if (typeof details?.code !== "string") return null;
|
|
162
|
+
if (details.code !== "loading remote context failed" || !("cause" in details) && !("cause" in error)) return "invalid";
|
|
163
|
+
const cause = "cause" in details ? details.cause : error.cause;
|
|
164
|
+
const nestedFailure = classifyKeyJsonLdError(cause, seen);
|
|
165
|
+
if (nestedFailure != null) return nestedFailure;
|
|
166
|
+
if (cause instanceof SyntaxError) return "invalid";
|
|
167
|
+
if (cause instanceof FetchError || cause instanceof UrlError) return "fetch";
|
|
168
|
+
if (cause instanceof Error && [
|
|
169
|
+
"AbortError",
|
|
170
|
+
"TimeoutError",
|
|
171
|
+
"NetworkError"
|
|
172
|
+
].includes(cause.name)) return "fetch";
|
|
173
|
+
if (cause instanceof TypeError) {
|
|
174
|
+
const urlCode = cause.code;
|
|
175
|
+
if (cause.name === "InvalidContextReferenceError") return "invalid";
|
|
176
|
+
if (urlCode === "ERR_INVALID_URL" || cause.message === "Invalid URL string." || /^Invalid URL(?::|$)/.test(cause.message) || / cannot be parsed as a URL\.?$/.test(cause.message)) return typeof details.url === "string" && /^[A-Za-z][A-Za-z0-9+.-]*:/.test(details.url) && !URL.canParse(details.url) ? "invalid" : "fetch";
|
|
177
|
+
const networkCause = cause.cause;
|
|
178
|
+
const code = cause.code ?? networkCause?.code;
|
|
179
|
+
if (typeof code === "string" && [
|
|
180
|
+
"ECONNREFUSED",
|
|
181
|
+
"ECONNRESET",
|
|
182
|
+
"ECONNABORTED",
|
|
183
|
+
"ETIMEDOUT",
|
|
184
|
+
"EHOSTUNREACH",
|
|
185
|
+
"ENETUNREACH",
|
|
186
|
+
"ENOTFOUND",
|
|
187
|
+
"EAI_AGAIN",
|
|
188
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
189
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
190
|
+
"UND_ERR_BODY_TIMEOUT",
|
|
191
|
+
"UND_ERR_SOCKET"
|
|
192
|
+
].includes(code) || /^(fetch failed|Failed to fetch|error sending request|error reading a body from connection|Unable to connect|ConnectionRefused|Network connection lost|The socket connection was closed unexpectedly)/.test(cause.message)) return "fetch";
|
|
193
|
+
}
|
|
194
|
+
throw cause;
|
|
195
|
+
}
|
|
196
|
+
/** Carries a context transport failure through the key decoding boundary. */
|
|
197
|
+
var KeyContextFetchError = class extends Error {
|
|
198
|
+
constructor(error) {
|
|
199
|
+
super("Failed to fetch a key's JSON-LD context.", { cause: error });
|
|
200
|
+
this.error = error;
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
function contextFetchError(error) {
|
|
204
|
+
const seen = /* @__PURE__ */ new Set();
|
|
205
|
+
while (error instanceof Error && !seen.has(error)) {
|
|
206
|
+
seen.add(error);
|
|
207
|
+
const details = error.details;
|
|
208
|
+
if (!error.name.startsWith("jsonld.") || details?.code !== "loading remote context failed") break;
|
|
209
|
+
error = "cause" in details ? details.cause : error.cause;
|
|
210
|
+
}
|
|
211
|
+
return new KeyContextFetchError(error);
|
|
212
|
+
}
|
|
155
213
|
/**
|
|
156
214
|
* Checks if the given key is valid and supported. No-op if the key is valid,
|
|
157
215
|
* otherwise throws an error.
|
|
@@ -246,6 +304,9 @@ async function importJwk(jwk, type) {
|
|
|
246
304
|
* @internal
|
|
247
305
|
*/
|
|
248
306
|
async function fetchActorDocument(actorId, options = {}) {
|
|
307
|
+
return await fetchActorDocumentInternal(actorId, options, false);
|
|
308
|
+
}
|
|
309
|
+
async function fetchActorDocumentInternal(actorId, options, propagateContextFetchErrors) {
|
|
249
310
|
const logger = getLogger([
|
|
250
311
|
"fedify",
|
|
251
312
|
"sig",
|
|
@@ -276,9 +337,12 @@ async function fetchActorDocument(actorId, options = {}) {
|
|
|
276
337
|
baseUrl: documentUrl
|
|
277
338
|
});
|
|
278
339
|
} catch (error) {
|
|
279
|
-
|
|
280
|
-
|
|
340
|
+
const failure = classifyKeyJsonLdError(error);
|
|
341
|
+
if (failure === "fetch" && propagateContextFetchErrors) throw contextFetchError(error);
|
|
342
|
+
if (failure == null && !(error instanceof TypeError)) throw error;
|
|
343
|
+
logger.debug("Failed to decode the actor document at {documentUrl}: {error}", {
|
|
281
344
|
documentUrl: documentUrl.href,
|
|
345
|
+
failure: failure ?? "invalid",
|
|
282
346
|
error
|
|
283
347
|
});
|
|
284
348
|
return null;
|
|
@@ -317,6 +381,9 @@ async function fetchActorDocument(actorId, options = {}) {
|
|
|
317
381
|
* @internal
|
|
318
382
|
*/
|
|
319
383
|
async function verifyKeyOwnership(key, options = {}) {
|
|
384
|
+
return await verifyKeyOwnershipInternal(key, options, false);
|
|
385
|
+
}
|
|
386
|
+
async function verifyKeyOwnershipInternal(key, options, propagateContextFetchErrors) {
|
|
320
387
|
const logger = getLogger([
|
|
321
388
|
"fedify",
|
|
322
389
|
"sig",
|
|
@@ -326,7 +393,7 @@ async function verifyKeyOwnership(key, options = {}) {
|
|
|
326
393
|
if (keyId == null) return null;
|
|
327
394
|
const claimedOwnerId = key instanceof CryptographicKey ? key.ownerId : key.controllerId;
|
|
328
395
|
if (claimedOwnerId == null) return null;
|
|
329
|
-
const owner = await
|
|
396
|
+
const owner = await fetchActorDocumentInternal(claimedOwnerId, options, propagateContextFetchErrors);
|
|
330
397
|
if (owner == null) {
|
|
331
398
|
logger.debug("The owner ({claimedOwnerId}) that key {keyId} claims could not be resolved.", {
|
|
332
399
|
keyId: keyId.href,
|
|
@@ -478,6 +545,21 @@ async function resolveFetchedKey(document, cacheKey, documentUrl, keyId, cls, {
|
|
|
478
545
|
tracerProvider
|
|
479
546
|
});
|
|
480
547
|
} catch (e) {
|
|
548
|
+
const failure = classifyKeyJsonLdError(e);
|
|
549
|
+
if (failure === "fetch") throw contextFetchError(e);
|
|
550
|
+
if (failure != null) {
|
|
551
|
+
logger.debug("Failed to decode key {keyId}: {error}", {
|
|
552
|
+
keyId,
|
|
553
|
+
failure,
|
|
554
|
+
error: e
|
|
555
|
+
});
|
|
556
|
+
await keyCache?.set(cacheKey, null);
|
|
557
|
+
await clearFetchErrorMetadata(cacheKey, keyCache);
|
|
558
|
+
return {
|
|
559
|
+
key: null,
|
|
560
|
+
cached: false
|
|
561
|
+
};
|
|
562
|
+
}
|
|
481
563
|
if (!(e instanceof TypeError)) throw e;
|
|
482
564
|
try {
|
|
483
565
|
object = await cls.fromJsonLd(document, {
|
|
@@ -486,8 +568,14 @@ async function resolveFetchedKey(document, cacheKey, documentUrl, keyId, cls, {
|
|
|
486
568
|
tracerProvider
|
|
487
569
|
});
|
|
488
570
|
} catch (e) {
|
|
489
|
-
|
|
490
|
-
|
|
571
|
+
const failure = classifyKeyJsonLdError(e);
|
|
572
|
+
if (failure === "fetch") throw contextFetchError(e);
|
|
573
|
+
if (failure != null || e instanceof TypeError) {
|
|
574
|
+
logger.debug("Failed to decode key {keyId}: {error}", {
|
|
575
|
+
keyId,
|
|
576
|
+
failure: failure ?? "invalid",
|
|
577
|
+
error: e
|
|
578
|
+
});
|
|
491
579
|
await keyCache?.set(cacheKey, null);
|
|
492
580
|
await clearFetchErrorMetadata(cacheKey, keyCache);
|
|
493
581
|
return {
|
|
@@ -579,16 +667,17 @@ async function resolveFetchedKey(document, cacheKey, documentUrl, keyId, cls, {
|
|
|
579
667
|
const claimedOwnerId = key instanceof CryptographicKey ? key.ownerId : key.controllerId;
|
|
580
668
|
if (ownerDocument != null && claimedOwnerId == null) key = key instanceof CryptographicKey ? key.clone({ owner: ownerDocument.id }) : key.clone({ controller: ownerDocument.id });
|
|
581
669
|
else if (claimedOwnerId != null && claimedOwnerId.href !== ownerDocument?.id?.href) {
|
|
582
|
-
if (await
|
|
670
|
+
if (await verifyKeyOwnershipInternal(key, {
|
|
583
671
|
documentLoader,
|
|
584
672
|
contextLoader,
|
|
585
673
|
tracerProvider
|
|
586
|
-
}) == null) {
|
|
674
|
+
}, true) == null) {
|
|
587
675
|
logger.debug("Failed to verify; the owner {claimedOwnerId} that key {keyId} claims does not list the key as its own.", {
|
|
588
676
|
keyId,
|
|
589
677
|
claimedOwnerId: claimedOwnerId.href
|
|
590
678
|
});
|
|
591
679
|
await keyCache?.set(cacheKey, null);
|
|
680
|
+
await clearFetchErrorMetadata(cacheKey, keyCache);
|
|
592
681
|
return {
|
|
593
682
|
key: null,
|
|
594
683
|
cached: false
|
|
@@ -626,7 +715,12 @@ async function fetchKeyWithResult(cacheKey, cls, options, onCachedUnavailable, o
|
|
|
626
715
|
} catch (error) {
|
|
627
716
|
return await onFetchError(error, cacheKey, keyId, keyCache, logger);
|
|
628
717
|
}
|
|
629
|
-
|
|
718
|
+
try {
|
|
719
|
+
return await resolveFetchedKey(document, cacheKey, documentUrl, keyId, cls, options, logger);
|
|
720
|
+
} catch (error) {
|
|
721
|
+
if (!(error instanceof KeyContextFetchError)) throw error;
|
|
722
|
+
return await onFetchError(error.error, cacheKey, keyId, keyCache, logger);
|
|
723
|
+
}
|
|
630
724
|
}
|
|
631
725
|
async function fetchKeyInternal(keyId, cls, options = {}) {
|
|
632
726
|
return await fetchKeyWithResult(typeof keyId === "string" ? new URL(keyId) : keyId, cls, options, (_cacheKey, _keyId, _keyCache, _logger) => {
|