@fedify/fedify 2.3.0-dev.994 → 2.3.0-pr.809.36
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/README.md +16 -7
- package/dist/{assert-DikXweDx.mjs → assert-OguE97r2.mjs} +1 -1
- package/dist/{assert_instance_of-C4Ri6VuN.mjs → assert_instance_of-DBC5X09g.mjs} +1 -1
- package/dist/{assert_not_equals--wG9hV7u.mjs → assert_not_equals-DkVK8oqV.mjs} +1 -1
- package/dist/{assert_rejects-B-qJtC9Z.mjs → assert_rejects-DN60FHPX.mjs} +28 -3
- package/dist/{assert_strict_equals-Dmjbg-bA.mjs → assert_strict_equals-XEgZAlrj.mjs} +1 -1
- package/dist/{assert_throws-4NwKEy2q.mjs → assert_throws-BOkhLGYc.mjs} +1 -1
- package/dist/{builder-yAlpiIqP.mjs → builder-DSZ7FZmg.mjs} +96 -42
- package/dist/{chunk-nlSIicah.js → chunk-CRNNMoPX.js} +2 -2
- package/dist/circuit-breaker-CSWsyoef.mjs +337 -0
- package/dist/{client-z-8dc-e1.d.cts → client-CAM_bQXx.d.cts} +1 -0
- package/dist/{client-AtlibPOU.d.ts → client-CSddvgWN.d.ts} +1 -2
- package/dist/compat/mod.d.cts +2 -1
- package/dist/compat/mod.d.ts +2 -3
- package/dist/compat/mod.js +3 -3
- package/dist/compat/outgoing-jsonld.test.mjs +4 -4
- package/dist/compat/public-audience.test.mjs +4 -4
- package/dist/compat/transformers.test.mjs +5 -5
- package/dist/{context-BzH2-ajs.d.ts → context-BBVLF7lx.d.cts} +342 -269
- package/dist/{context-DJGagtNd.d.cts → context-BU6jSQdo.d.ts} +344 -266
- package/dist/{context-Dk_tacqz.mjs → context-DVoTs_wM.mjs} +64 -5
- package/dist/{deno-XBVlKnOX.mjs → deno-DCdM7d93.mjs} +1 -1
- package/dist/{docloader-DPp-X6gk.mjs → docloader-B7mVwA5_.mjs} +4 -4
- package/dist/{esm-DVILvP5e.mjs → esm-vrlUxr60.mjs} +4 -7
- package/dist/federation/builder.test.mjs +163 -11
- package/dist/federation/circuit-breaker.test.d.mts +2 -0
- package/dist/federation/circuit-breaker.test.mjs +446 -0
- package/dist/federation/collection.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +1770 -29
- package/dist/federation/idempotency.test.mjs +5 -5
- package/dist/federation/inbox.test.mjs +4 -4
- package/dist/federation/keycache.test.mjs +5 -5
- package/dist/federation/kv.test.mjs +2 -2
- package/dist/federation/metrics.test.d.mts +2 -0
- package/dist/federation/metrics.test.mjs +634 -0
- package/dist/federation/middleware.test.mjs +4036 -146
- package/dist/federation/mod.cjs +195 -14
- package/dist/federation/mod.d.cts +6 -4
- package/dist/federation/mod.d.ts +6 -6
- package/dist/federation/mod.js +192 -14
- package/dist/federation/mq.test.mjs +176 -15
- package/dist/federation/negotiation.test.mjs +4 -4
- package/dist/federation/retry.test.mjs +3 -3
- package/dist/federation/router.test.mjs +190 -9
- package/dist/federation/send.test.mjs +153 -15
- package/dist/federation/temporal.test.d.mts +2 -0
- package/dist/federation/temporal.test.mjs +71 -0
- package/dist/federation/webfinger.test.mjs +150 -5
- package/dist/{http-CSlLA54v.mjs → http-BufbkLuW.mjs} +146 -47
- package/dist/{http-B4rrzxtg.js → http-Dh18nwJg.js} +994 -64
- package/dist/{http-aQzN9Ayi.d.ts → http-VyDTd4G3.d.cts} +15 -3
- package/dist/{http-BrGqJDXL.cjs → http-gOiudB3g.cjs} +1099 -61
- package/dist/{http-CrGuipxe.d.cts → http-lf8Hsd91.d.ts} +15 -1
- package/dist/{key-Bzx--sHD.mjs → key-DZdKLJXT.mjs} +43 -18
- package/dist/{kv-CbLNp3zQ.d.cts → kv-D6hNiMTK.d.ts} +1 -0
- package/dist/{kv-cache-DI-Sk7-I.cjs → kv-cache-BuK_nlpY.cjs} +20 -3
- package/dist/{kv-cache-U__xU4qR.mjs → kv-cache-C7SQnkGI.mjs} +21 -3
- package/dist/{kv-cache-EMIqoIuB.js → kv-cache-DNDSb6Po.js} +20 -3
- package/dist/{kv-GFYnFoOl.d.ts → kv-gJ8LYbxX.d.cts} +1 -3
- package/dist/ld-0Lsznacf.mjs +626 -0
- package/dist/metrics-BHeWd24f.mjs +815 -0
- package/dist/{middleware-zjZ6AFCW.mjs → middleware-BNANvDh2.mjs} +1 -1
- package/dist/{middleware-nidH7VZH.js → middleware-BgzRkDcm.js} +2260 -556
- package/dist/{middleware-An4DjES4.cjs → middleware-D-iES1nQ.cjs} +2318 -623
- package/dist/{middleware-K1g6bEkV.mjs → middleware-EV6J_eAc.mjs} +1639 -373
- package/dist/{mod-CR8soWa9.d.ts → mod-B0hW12_O.d.cts} +26 -4
- package/dist/mod-C0F6kvgS.d.cts +182 -0
- package/dist/{mod-Cr3f-ACa.d.cts → mod-COIAjwRS.d.ts} +26 -2
- package/dist/{mod-CMEbIaNh.d.cts → mod-DFvNJcNb.d.ts} +56 -4
- package/dist/mod-vPYVoa5n.d.ts +182 -0
- package/dist/{mod-CLgIXe9w.d.ts → mod-yvIXFAEi.d.cts} +56 -6
- package/dist/mod.cjs +9 -6
- package/dist/mod.d.cts +12 -10
- package/dist/mod.d.ts +12 -12
- package/dist/mod.js +11 -11
- package/dist/mq-D-nlpY04.d.ts +208 -0
- package/dist/mq-D8uSFzxe.d.cts +208 -0
- package/dist/{negotiation-SQvQgUqe.mjs → negotiation-DDstyBvc.mjs} +29 -0
- package/dist/nodeinfo/client.test.mjs +4 -4
- package/dist/nodeinfo/handler.test.mjs +4 -4
- package/dist/nodeinfo/mod.d.cts +2 -1
- package/dist/nodeinfo/mod.d.ts +2 -3
- package/dist/nodeinfo/mod.js +3 -3
- package/dist/nodeinfo/types.test.mjs +3 -3
- package/dist/otel/exporter.test.mjs +28 -25
- package/dist/otel/mod.cjs +6 -5
- package/dist/otel/mod.d.cts +5 -3
- package/dist/otel/mod.d.ts +5 -5
- package/dist/otel/mod.js +8 -7
- package/dist/{outgoing-jsonld-CNmZLixq.mjs → outgoing-jsonld-L_DbOaFe.mjs} +2 -2
- package/dist/{owner-C-tqfvxn.mjs → owner-Cl-1cAR8.mjs} +2 -2
- package/dist/{owner-CptqhsOy.d.cts → owner-CnngXDNJ.d.ts} +2 -1
- package/dist/{owner-74ARJ5TL.d.ts → owner-DEvZuyOE.d.cts} +2 -3
- package/dist/{proof-Bbbwf8_x.js → proof-CyXndf6-.js} +378 -15
- package/dist/{proof-BlmRPzrK.mjs → proof-Dnz8jtiQ.mjs} +26 -8
- package/dist/{proof-BW89QMVB.cjs → proof-tz35unOj.cjs} +432 -15
- package/dist/runtime/mod.d.cts +1 -0
- package/dist/runtime/mod.d.ts +1 -2
- package/dist/runtime/mod.js +3 -3
- package/dist/{send-05pJLcb6.mjs → send-DIbBYN5P.mjs} +72 -26
- package/dist/sig/http.test.mjs +356 -33
- package/dist/sig/key.test.mjs +103 -6
- package/dist/sig/ld.test.mjs +696 -7
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +4 -3
- package/dist/sig/mod.d.ts +4 -5
- package/dist/sig/mod.js +4 -4
- package/dist/sig/owner.test.mjs +6 -6
- package/dist/sig/proof.test.mjs +169 -8
- package/dist/{std__assert-CRDpx_HF.mjs → std__assert-BBjXFNOb.mjs} +5 -30
- package/dist/temporal-BEwob1Vg.mjs +95 -0
- package/dist/testing/mod.d.mts +110 -10
- package/dist/testing/mod.mjs +1 -2
- package/dist/{transformers-ve6e2xcg.js → transformers-BGMIq1cs.js} +2 -2
- package/dist/{types-hvL8ElAs.js → types-CAY3OdLq.js} +2 -2
- package/dist/utils/docloader.test.mjs +6 -6
- package/dist/utils/kv-cache.test.mjs +67 -2
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +2 -1
- package/dist/utils/mod.d.ts +2 -3
- package/dist/utils/mod.js +3 -3
- package/dist/vocab/cjs.test.mjs +1 -1
- package/dist/vocab/mod.d.cts +1 -0
- package/dist/vocab/mod.d.ts +1 -2
- package/dist/vocab/mod.js +2 -2
- package/package.json +16 -16
- package/dist/ld-DR78beiv.mjs +0 -279
- package/dist/middleware-BFBaR0mF.cjs +0 -4
- package/dist/mod-2d12ffz3.d.ts +0 -64
- package/dist/mod-D35TRn09.d.cts +0 -62
- package/dist/router-CrMLXoOr.mjs +0 -114
- package/dist/{activity-listener-ell7W1s9.mjs → activity-listener-tztVvlNb.mjs} +0 -0
- package/dist/{assert_equals-Ew3jOFa3.mjs → assert_equals-C-ZRDbaf.mjs} +0 -0
- package/dist/{client-D_1QpnWt.mjs → client-ByXmQhYD.mjs} +1 -1
- package/dist/{collection-D-HqUuA2.mjs → collection-Cc3DVAhE.mjs} +0 -0
- package/dist/{keycache-EGATflN-.mjs → keycache-BeU0LCII.mjs} +0 -0
- package/dist/{public-audience-DYFHzm_c.mjs → public-audience-Cvbr2Gzt.mjs} +1 -1
- /package/dist/{retry-bMXBL97A.mjs → retry-CXg_MBI-.mjs} +0 -0
package/dist/sig/mod.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const require_http = require("../http-
|
|
5
|
-
const require_proof = require("../proof-
|
|
4
|
+
const require_http = require("../http-gOiudB3g.cjs");
|
|
5
|
+
const require_proof = require("../proof-tz35unOj.cjs");
|
|
6
6
|
exports.attachSignature = require_proof.attachSignature;
|
|
7
7
|
exports.createProof = require_proof.createProof;
|
|
8
8
|
exports.createSignature = require_proof.createSignature;
|
package/dist/sig/mod.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import { i as
|
|
3
|
-
import {
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
2
|
+
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-VyDTd4G3.cjs";
|
|
3
|
+
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-DEvZuyOE.cjs";
|
|
4
|
+
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-B0hW12_O.cjs";
|
|
4
5
|
export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
package/dist/sig/mod.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { i as
|
|
5
|
-
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-CR8soWa9.js";
|
|
1
|
+
/// <reference lib="esnext.temporal" />
|
|
2
|
+
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-lf8Hsd91.js";
|
|
3
|
+
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-CnngXDNJ.js";
|
|
4
|
+
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-COIAjwRS.js";
|
|
6
5
|
export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
package/dist/sig/mod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "@js-temporal/polyfill";
|
|
2
|
-
import "urlpattern-polyfill";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
+
import { A as formatAcceptSignature, M as parseAcceptSignature, N as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKeyDetailed, i as verifyRequest, j as fulfillAcceptSignature, l as generateCryptoKeyPair, o as exportJwk, r as signRequest, s as fetchKey, u as importJwk } from "../http-Dh18nwJg.js";
|
|
4
|
+
import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "../proof-CyXndf6-.js";
|
|
5
5
|
export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
package/dist/sig/owner.test.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { t as assertEquals } from "../assert_equals-
|
|
5
|
-
import "../std__assert-
|
|
6
|
-
import {
|
|
7
|
-
import { t as assert } from "../assert-
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
5
|
+
import "../std__assert-BBjXFNOb.mjs";
|
|
6
|
+
import { r as assertFalse } from "../assert_rejects-DN60FHPX.mjs";
|
|
7
|
+
import { t as assert } from "../assert-OguE97r2.mjs";
|
|
8
8
|
import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DGu1NFwu.mjs";
|
|
9
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-
|
|
10
|
-
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
9
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-Cl-1cAR8.mjs";
|
|
11
10
|
import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
|
|
11
|
+
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
//#region src/sig/owner.test.ts
|
|
13
13
|
test("doesActorOwnKey()", async () => {
|
|
14
14
|
const options = {
|
package/dist/sig/proof.test.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { t as assertEquals } from "../assert_equals-
|
|
5
|
-
import "../std__assert-
|
|
6
|
-
import { n as assertFalse, t as assertRejects } from "../assert_rejects-
|
|
7
|
-
import { t as assertInstanceOf } from "../assert_instance_of-
|
|
8
|
-
import { t as assert } from "../assert-
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
5
|
+
import "../std__assert-BBjXFNOb.mjs";
|
|
6
|
+
import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
|
|
7
|
+
import { t as assertInstanceOf } from "../assert_instance_of-DBC5X09g.mjs";
|
|
8
|
+
import { t as assert } from "../assert-OguE97r2.mjs";
|
|
9
9
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DGu1NFwu.mjs";
|
|
10
|
-
import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-
|
|
11
|
-
import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-
|
|
12
|
-
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
10
|
+
import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-L_DbOaFe.mjs";
|
|
11
|
+
import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-Dnz8jtiQ.mjs";
|
|
13
12
|
import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place } from "@fedify/vocab";
|
|
13
|
+
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
14
14
|
import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
|
|
15
15
|
import { decodeHex } from "byte-encodings/hex";
|
|
16
16
|
//#region src/sig/proof.test.ts
|
|
@@ -326,6 +326,167 @@ test("verifyProof()", async () => {
|
|
|
326
326
|
}), null);
|
|
327
327
|
assertFalse(contextLoaderCalls.includes("https://attacker.example/ctx"));
|
|
328
328
|
});
|
|
329
|
+
test("verifyProof() records verification duration metric", async (t) => {
|
|
330
|
+
const jsonLd = {
|
|
331
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"],
|
|
332
|
+
id: "https://server.example/activities/1",
|
|
333
|
+
type: "Create",
|
|
334
|
+
actor: "https://server.example/users/alice",
|
|
335
|
+
object: {
|
|
336
|
+
id: "https://server.example/objects/1",
|
|
337
|
+
type: "Note",
|
|
338
|
+
attributedTo: "https://server.example/users/alice",
|
|
339
|
+
content: "Hello world",
|
|
340
|
+
location: {
|
|
341
|
+
type: "Place",
|
|
342
|
+
longitude: -71.184902,
|
|
343
|
+
latitude: 25.273962
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
};
|
|
347
|
+
const proof = new DataIntegrityProof({
|
|
348
|
+
cryptosuite: "eddsa-jcs-2022",
|
|
349
|
+
verificationMethod: new URL("https://server.example/users/alice#ed25519-key"),
|
|
350
|
+
proofPurpose: "assertionMethod",
|
|
351
|
+
proofValue: decodeMultibase("zLaewdp4H9kqtwyrLatK4cjY5oRHwVcw4gibPSUDYDMhi4M49v8pcYk3ZB6D69dNpAPbUmY8ocuJ3m9KhKJEEg7z"),
|
|
352
|
+
created: Temporal.Instant.from("2023-02-24T23:36:38Z")
|
|
353
|
+
});
|
|
354
|
+
await t.step("verified path records result=verified with bounded cryptosuite", async () => {
|
|
355
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
356
|
+
assert(await verifyProof(jsonLd, proof, {
|
|
357
|
+
documentLoader: mockDocumentLoader,
|
|
358
|
+
contextLoader: mockDocumentLoader,
|
|
359
|
+
meterProvider
|
|
360
|
+
}) != null);
|
|
361
|
+
const measurements = recorder.getMeasurements("activitypub.signature.verification.duration");
|
|
362
|
+
assertEquals(measurements.length, 1);
|
|
363
|
+
const m = measurements[0];
|
|
364
|
+
assertEquals(m.type, "histogram");
|
|
365
|
+
assertGreaterOrEqual(m.value, 0);
|
|
366
|
+
assertEquals(m.attributes["activitypub.signature.kind"], "object_integrity");
|
|
367
|
+
assertEquals(m.attributes["activitypub.signature.result"], "verified");
|
|
368
|
+
assertEquals(m.attributes["object_integrity_proofs.cryptosuite"], "eddsa-jcs-2022");
|
|
369
|
+
});
|
|
370
|
+
await t.step("rejected path records result=rejected", async () => {
|
|
371
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
372
|
+
assertEquals(await verifyProof({
|
|
373
|
+
...jsonLd,
|
|
374
|
+
object: {
|
|
375
|
+
...jsonLd.object,
|
|
376
|
+
content: "bye"
|
|
377
|
+
}
|
|
378
|
+
}, proof, {
|
|
379
|
+
documentLoader: mockDocumentLoader,
|
|
380
|
+
contextLoader: mockDocumentLoader,
|
|
381
|
+
meterProvider
|
|
382
|
+
}), null);
|
|
383
|
+
const measurements = recorder.getMeasurements("activitypub.signature.verification.duration");
|
|
384
|
+
assertEquals(measurements.length, 1);
|
|
385
|
+
assertEquals(measurements[0].attributes["activitypub.signature.result"], "rejected");
|
|
386
|
+
assertEquals(measurements[0].attributes["object_integrity_proofs.cryptosuite"], "eddsa-jcs-2022");
|
|
387
|
+
});
|
|
388
|
+
await t.step("cached-key retry emits one measurement, not two", async () => {
|
|
389
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
390
|
+
const cache = { ["https://server.example/users/alice#ed25519-key"]: ed25519Multikey };
|
|
391
|
+
assert(await verifyProof(jsonLd, proof, {
|
|
392
|
+
documentLoader: mockDocumentLoader,
|
|
393
|
+
contextLoader: mockDocumentLoader,
|
|
394
|
+
meterProvider,
|
|
395
|
+
keyCache: {
|
|
396
|
+
get(id) {
|
|
397
|
+
return Promise.resolve(cache[id.href]);
|
|
398
|
+
},
|
|
399
|
+
set(id, k) {
|
|
400
|
+
cache[id.href] = k;
|
|
401
|
+
return Promise.resolve();
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}) != null);
|
|
405
|
+
assertEquals(recorder.getMeasurements("activitypub.signature.verification.duration").length, 1);
|
|
406
|
+
const keyFetches = recorder.getMeasurements("activitypub.signature.key_fetch.duration");
|
|
407
|
+
assertEquals(keyFetches.length, 2);
|
|
408
|
+
assertEquals(keyFetches[0].attributes["activitypub.signature.key_fetch.result"], "hit");
|
|
409
|
+
assertEquals(keyFetches[1].attributes["activitypub.signature.key_fetch.result"], "fetched");
|
|
410
|
+
});
|
|
411
|
+
await t.step("key fetch records result=fetched on a cold cache", async () => {
|
|
412
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
413
|
+
assert(await verifyProof(jsonLd, proof, {
|
|
414
|
+
documentLoader: mockDocumentLoader,
|
|
415
|
+
contextLoader: mockDocumentLoader,
|
|
416
|
+
meterProvider
|
|
417
|
+
}) != null);
|
|
418
|
+
const measurements = recorder.getMeasurements("activitypub.signature.key_fetch.duration");
|
|
419
|
+
assertEquals(measurements.length, 1);
|
|
420
|
+
assertGreaterOrEqual(measurements[0].value, 0);
|
|
421
|
+
assertEquals(measurements[0].attributes["activitypub.signature.kind"], "object_integrity");
|
|
422
|
+
assertEquals(measurements[0].attributes["activitypub.signature.key_fetch.result"], "fetched");
|
|
423
|
+
});
|
|
424
|
+
await t.step("key fetch records result=hit when served from the key cache", async () => {
|
|
425
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
426
|
+
const cache = { "https://server.example/users/alice#ed25519-key": new Multikey({
|
|
427
|
+
id: new URL("https://server.example/users/alice#ed25519-key"),
|
|
428
|
+
controller: new URL("https://server.example/users/alice"),
|
|
429
|
+
publicKey: await importMultibaseKey("z6MkrJVnaZkeFzdQyMZu1cgjg7k1pZZ6pvBQ7XJPt4swbTQ2")
|
|
430
|
+
}) };
|
|
431
|
+
assert(await verifyProof(jsonLd, proof, {
|
|
432
|
+
documentLoader: mockDocumentLoader,
|
|
433
|
+
contextLoader: mockDocumentLoader,
|
|
434
|
+
meterProvider,
|
|
435
|
+
keyCache: {
|
|
436
|
+
get(id) {
|
|
437
|
+
return Promise.resolve(cache[id.href]);
|
|
438
|
+
},
|
|
439
|
+
set(id, k) {
|
|
440
|
+
cache[id.href] = k;
|
|
441
|
+
return Promise.resolve();
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
}) != null);
|
|
445
|
+
const measurements = recorder.getMeasurements("activitypub.signature.key_fetch.duration");
|
|
446
|
+
assertEquals(measurements.length, 1);
|
|
447
|
+
assertEquals(measurements[0].attributes["activitypub.signature.key_fetch.result"], "hit");
|
|
448
|
+
});
|
|
449
|
+
await t.step("verifyObject() wrapper emits one measurement per inner verifyProof()", async () => {
|
|
450
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
451
|
+
assert(await verifyObject(Create, {
|
|
452
|
+
...jsonLd,
|
|
453
|
+
proof: await proof.toJsonLd({
|
|
454
|
+
format: "compact",
|
|
455
|
+
contextLoader: mockDocumentLoader
|
|
456
|
+
})
|
|
457
|
+
}, {
|
|
458
|
+
documentLoader: mockDocumentLoader,
|
|
459
|
+
contextLoader: mockDocumentLoader,
|
|
460
|
+
meterProvider
|
|
461
|
+
}) != null);
|
|
462
|
+
assertEquals(recorder.getMeasurements("activitypub.signature.verification.duration").length, 1);
|
|
463
|
+
});
|
|
464
|
+
await t.step("unknown cryptosuite omits the cryptosuite metric attribute", async () => {
|
|
465
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
466
|
+
const exoticProof = await DataIntegrityProof.fromJsonLd({
|
|
467
|
+
"@context": "https://w3id.org/security/data-integrity/v1",
|
|
468
|
+
type: "DataIntegrityProof",
|
|
469
|
+
cryptosuite: "made-up-suite-9999",
|
|
470
|
+
verificationMethod: "https://server.example/users/alice#ed25519-key",
|
|
471
|
+
proofPurpose: "assertionMethod",
|
|
472
|
+
proofValue: "zLaewdp4H9kqtwyrLatK4cjY5oRHwVcw4gibPSUDYDMhi4M49v8pcYk3ZB6D69dNpAPbUmY8ocuJ3m9KhKJEEg7z",
|
|
473
|
+
created: "2023-02-24T23:36:38Z"
|
|
474
|
+
}, {
|
|
475
|
+
documentLoader: mockDocumentLoader,
|
|
476
|
+
contextLoader: mockDocumentLoader
|
|
477
|
+
});
|
|
478
|
+
assertEquals(exoticProof.cryptosuite, "made-up-suite-9999");
|
|
479
|
+
assertEquals(await verifyProof(jsonLd, exoticProof, {
|
|
480
|
+
documentLoader: mockDocumentLoader,
|
|
481
|
+
contextLoader: mockDocumentLoader,
|
|
482
|
+
meterProvider
|
|
483
|
+
}), null);
|
|
484
|
+
const measurements = recorder.getMeasurements("activitypub.signature.verification.duration");
|
|
485
|
+
assertEquals(measurements.length, 1);
|
|
486
|
+
assertEquals(measurements[0].attributes["activitypub.signature.result"], "rejected");
|
|
487
|
+
assertFalse("object_integrity_proofs.cryptosuite" in measurements[0].attributes);
|
|
488
|
+
});
|
|
489
|
+
});
|
|
329
490
|
test("verifyObject()", async () => {
|
|
330
491
|
const options = {
|
|
331
492
|
documentLoader: mockDocumentLoader,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { l as AssertionError, s as format } from "./assert_equals-
|
|
5
|
-
import "./assert_rejects-
|
|
6
|
-
import "./assert_throws-
|
|
7
|
-
import "./assert_strict_equals-
|
|
4
|
+
import { l as AssertionError, s as format } from "./assert_equals-C-ZRDbaf.mjs";
|
|
5
|
+
import "./assert_rejects-DN60FHPX.mjs";
|
|
6
|
+
import "./assert_throws-BOkhLGYc.mjs";
|
|
7
|
+
import "./assert_strict_equals-XEgZAlrj.mjs";
|
|
8
8
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_exists.js
|
|
9
9
|
/**
|
|
10
10
|
* Make an assertion that actual is not null or undefined.
|
|
@@ -28,31 +28,6 @@ import "./assert_strict_equals-Dmjbg-bA.mjs";
|
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
//#endregion
|
|
31
|
-
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_greater_or_equal.js
|
|
32
|
-
/**
|
|
33
|
-
* Make an assertion that `actual` is greater than or equal to `expected`.
|
|
34
|
-
* If not then throw.
|
|
35
|
-
*
|
|
36
|
-
* @example Usage
|
|
37
|
-
* ```ts no-eval
|
|
38
|
-
* import { assertGreaterOrEqual } from "@std/assert/assert-greater-or-equal";
|
|
39
|
-
*
|
|
40
|
-
* assertGreaterOrEqual(2, 1); // Doesn't throw
|
|
41
|
-
* assertGreaterOrEqual(1, 1); // Doesn't throw
|
|
42
|
-
* assertGreaterOrEqual(0, 1); // Throws
|
|
43
|
-
* ```
|
|
44
|
-
*
|
|
45
|
-
* @typeParam T The type of the values to compare.
|
|
46
|
-
* @param actual The actual value to compare.
|
|
47
|
-
* @param expected The expected value to compare.
|
|
48
|
-
* @param msg The optional message to display if the assertion fails.
|
|
49
|
-
*/ function assertGreaterOrEqual(actual, expected, msg) {
|
|
50
|
-
if (actual >= expected) return;
|
|
51
|
-
const actualString = format(actual);
|
|
52
|
-
const expectedString = format(expected);
|
|
53
|
-
throw new AssertionError(msg ?? `Expect ${actualString} >= ${expectedString}`);
|
|
54
|
-
}
|
|
55
|
-
//#endregion
|
|
56
31
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_greater.js
|
|
57
32
|
/**
|
|
58
33
|
* Make an assertion that `actual` is greater than `expected`.
|
|
@@ -101,4 +76,4 @@ import "./assert_strict_equals-Dmjbg-bA.mjs";
|
|
|
101
76
|
}
|
|
102
77
|
}
|
|
103
78
|
//#endregion
|
|
104
|
-
export {
|
|
79
|
+
export { assertGreater as n, assertExists as r, assertStringIncludes as t };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { c as getNormalizationContextLoader } from "./ld-0Lsznacf.mjs";
|
|
5
|
+
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
6
|
+
//#region src/federation/temporal.ts
|
|
7
|
+
function isPlainObject(value) {
|
|
8
|
+
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
9
|
+
}
|
|
10
|
+
function normalizeDateTimeLiteral(value) {
|
|
11
|
+
return value.substring(19).match(/[Z+-]/) ? value : value + "Z";
|
|
12
|
+
}
|
|
13
|
+
function isMalformedDateTimeLiteral(value) {
|
|
14
|
+
if (typeof value !== "string") return false;
|
|
15
|
+
try {
|
|
16
|
+
Temporal.Instant.from(normalizeDateTimeLiteral(value));
|
|
17
|
+
return false;
|
|
18
|
+
} catch {
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
function isMalformedDurationLiteral(value) {
|
|
23
|
+
if (typeof value !== "string") return false;
|
|
24
|
+
try {
|
|
25
|
+
Temporal.Duration.from(value);
|
|
26
|
+
return false;
|
|
27
|
+
} catch {
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const TEMPORAL_DATE_TIME_IRIS = new Set([
|
|
32
|
+
"https://www.w3.org/ns/activitystreams#deleted",
|
|
33
|
+
"https://www.w3.org/ns/activitystreams#endTime",
|
|
34
|
+
"https://www.w3.org/ns/activitystreams#published",
|
|
35
|
+
"https://www.w3.org/ns/activitystreams#startTime",
|
|
36
|
+
"https://www.w3.org/ns/activitystreams#updated",
|
|
37
|
+
"http://purl.org/dc/terms/created",
|
|
38
|
+
"https://w3id.org/security#created"
|
|
39
|
+
]);
|
|
40
|
+
const TEMPORAL_DURATION_IRIS = new Set(["https://www.w3.org/ns/activitystreams#duration"]);
|
|
41
|
+
const QUESTION_CLOSED_IRI = "https://www.w3.org/ns/activitystreams#closed";
|
|
42
|
+
const XSD_DATE_TIME_IRI = "http://www.w3.org/2001/XMLSchema#dateTime";
|
|
43
|
+
function hasMalformedExpandedDateTimeLiteral(value) {
|
|
44
|
+
if (Array.isArray(value)) return value.some(hasMalformedExpandedDateTimeLiteral);
|
|
45
|
+
return isPlainObject(value) && "@value" in value && isMalformedDateTimeLiteral(value["@value"]);
|
|
46
|
+
}
|
|
47
|
+
function hasMalformedExpandedQuestionClosedLiteral(value) {
|
|
48
|
+
if (Array.isArray(value)) return value.some(hasMalformedExpandedQuestionClosedLiteral);
|
|
49
|
+
if (!isPlainObject(value) || !("@value" in value)) return false;
|
|
50
|
+
const literal = value["@value"];
|
|
51
|
+
if (typeof literal === "boolean") return false;
|
|
52
|
+
if (typeof literal !== "string") return false;
|
|
53
|
+
if (value["@type"] !== XSD_DATE_TIME_IRI) return false;
|
|
54
|
+
if (new Date(literal).toString() === "Invalid Date") return false;
|
|
55
|
+
return isMalformedDateTimeLiteral(literal);
|
|
56
|
+
}
|
|
57
|
+
function hasMalformedExpandedDurationLiteral(value) {
|
|
58
|
+
if (Array.isArray(value)) return value.some(hasMalformedExpandedDurationLiteral);
|
|
59
|
+
return isPlainObject(value) && "@value" in value && isMalformedDurationLiteral(value["@value"]);
|
|
60
|
+
}
|
|
61
|
+
function hasMalformedKnownTemporalLiteralInternal(value, visited) {
|
|
62
|
+
if (Array.isArray(value)) return value.some((item) => hasMalformedKnownTemporalLiteralInternal(item, visited));
|
|
63
|
+
if (!isPlainObject(value)) return false;
|
|
64
|
+
if (visited.has(value)) return false;
|
|
65
|
+
visited.add(value);
|
|
66
|
+
if ("@value" in value) return false;
|
|
67
|
+
for (const [key, child] of Object.entries(value)) {
|
|
68
|
+
if (TEMPORAL_DATE_TIME_IRIS.has(key)) {
|
|
69
|
+
if (hasMalformedExpandedDateTimeLiteral(child)) return true;
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
if (key === QUESTION_CLOSED_IRI) {
|
|
73
|
+
if (hasMalformedExpandedQuestionClosedLiteral(child)) return true;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
if (TEMPORAL_DURATION_IRIS.has(key)) {
|
|
77
|
+
if (hasMalformedExpandedDurationLiteral(child)) return true;
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
if (hasMalformedKnownTemporalLiteralInternal(child, visited)) return true;
|
|
81
|
+
}
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
async function hasMalformedKnownTemporalLiteral(value, contextLoader) {
|
|
85
|
+
try {
|
|
86
|
+
return hasMalformedKnownTemporalLiteralInternal(await jsonld.expand(value, {
|
|
87
|
+
documentLoader: getNormalizationContextLoader(contextLoader),
|
|
88
|
+
keepFreeFloatingNodes: true
|
|
89
|
+
}), /* @__PURE__ */ new Set());
|
|
90
|
+
} catch {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//#endregion
|
|
95
|
+
export { hasMalformedKnownTemporalLiteral as t };
|
package/dist/testing/mod.d.mts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import {
|
|
3
|
+
import { ExportResultCode } from "@opentelemetry/core";
|
|
4
|
+
import { Router } from "@fedify/uri-template";
|
|
4
5
|
import { Activity, Actor, Collection, CryptographicKey, Hashtag, Link, LookupObjectOptions, Multikey, Object as Object$1, Recipient, Tombstone, TraverseCollectionOptions } from "@fedify/vocab";
|
|
5
6
|
import { Link as Link$1, LookupWebFingerOptions, ResourceDescriptor } from "@fedify/webfinger";
|
|
6
|
-
import { TracerProvider } from "@opentelemetry/api";
|
|
7
|
+
import { MeterProvider, TracerProvider } from "@opentelemetry/api";
|
|
7
8
|
import { DocumentLoader, GetUserAgentOptions } from "@fedify/vocab-runtime";
|
|
9
|
+
import { MeterProvider as MeterProvider$1, MetricReader } from "@opentelemetry/sdk-metrics";
|
|
8
10
|
|
|
9
11
|
//#region src/nodeinfo/types.d.ts
|
|
10
12
|
/**
|
|
@@ -263,14 +265,20 @@ declare class SendActivityError extends Error {
|
|
|
263
265
|
* If truncated, the string will end with `"… (truncated)"`.
|
|
264
266
|
*/
|
|
265
267
|
readonly responseBody: string;
|
|
268
|
+
/**
|
|
269
|
+
* The response headers from the inbox.
|
|
270
|
+
* @since 2.3.0
|
|
271
|
+
*/
|
|
272
|
+
readonly responseHeaders: Headers;
|
|
266
273
|
/**
|
|
267
274
|
* Creates a new {@link SendActivityError}.
|
|
268
275
|
* @param inbox The inbox URL.
|
|
269
276
|
* @param statusCode The HTTP status code.
|
|
270
277
|
* @param message The error message.
|
|
271
278
|
* @param responseBody The response body.
|
|
279
|
+
* @param responseHeaders The response headers.
|
|
272
280
|
*/
|
|
273
|
-
constructor(inbox: URL, statusCode: number, message: string, responseBody: string);
|
|
281
|
+
constructor(inbox: URL, statusCode: number, message: string, responseBody: string, responseHeaders?: HeadersInit);
|
|
274
282
|
}
|
|
275
283
|
//#endregion
|
|
276
284
|
//#region src/federation/callback.d.ts
|
|
@@ -484,10 +492,27 @@ type SharedInboxKeyDispatcher<TContextData> = (context: Context<TContextData>) =
|
|
|
484
492
|
* @since 2.0.0
|
|
485
493
|
*/
|
|
486
494
|
type OutboxPermanentFailureHandler<TContextData> = (context: Context<TContextData>, values: {
|
|
487
|
-
/**
|
|
495
|
+
/**
|
|
496
|
+
* Why Fedify is giving up on delivery.
|
|
497
|
+
*
|
|
498
|
+
* `"http"` means the inbox returned a configured permanent-failure HTTP
|
|
499
|
+
* status. `"circuit-breaker-ttl"` means the outbound circuit breaker held
|
|
500
|
+
* the activity until its retention period expired.
|
|
501
|
+
*
|
|
502
|
+
* @since 2.3.0
|
|
503
|
+
*/
|
|
504
|
+
readonly reason: "http" | "circuit-breaker-ttl"; /** The inbox URL that failed. */
|
|
505
|
+
readonly inbox: URL; /** The activity that failed to deliver. */
|
|
488
506
|
readonly activity: Activity; /** The error that occurred. */
|
|
489
507
|
readonly error: SendActivityError; /** The HTTP status code returned by the inbox. */
|
|
490
508
|
readonly statusCode: number;
|
|
509
|
+
/**
|
|
510
|
+
* The time when the circuit breaker first held the activity, if
|
|
511
|
+
* {@link reason} is `"circuit-breaker-ttl"`.
|
|
512
|
+
*
|
|
513
|
+
* @since 2.3.0
|
|
514
|
+
*/
|
|
515
|
+
readonly circuitHeldSince?: Temporal.Instant;
|
|
491
516
|
/**
|
|
492
517
|
* The actor IDs that were supposed to receive the activity at this inbox.
|
|
493
518
|
*/
|
|
@@ -610,6 +635,17 @@ interface OutboxMessage {
|
|
|
610
635
|
readonly attempt: number;
|
|
611
636
|
readonly headers: Readonly<Record<string, string>>;
|
|
612
637
|
readonly orderingKey?: string;
|
|
638
|
+
/**
|
|
639
|
+
* Whether this message is currently held by the outbound circuit breaker.
|
|
640
|
+
* @internal
|
|
641
|
+
*/
|
|
642
|
+
readonly circuitHeld?: true;
|
|
643
|
+
/**
|
|
644
|
+
* When Fedify first held this message because the remote host circuit was
|
|
645
|
+
* open.
|
|
646
|
+
* @internal
|
|
647
|
+
*/
|
|
648
|
+
readonly circuitHeldSince?: string;
|
|
613
649
|
readonly traceContext: Readonly<Record<string, string>>;
|
|
614
650
|
}
|
|
615
651
|
interface InboxMessage {
|
|
@@ -617,6 +653,42 @@ interface InboxMessage {
|
|
|
617
653
|
readonly id: ReturnType<typeof crypto.randomUUID>;
|
|
618
654
|
readonly baseUrl: string;
|
|
619
655
|
readonly activity: unknown;
|
|
656
|
+
/**
|
|
657
|
+
* The normalized JSON-LD representation of a signed inbox activity that
|
|
658
|
+
* Fedify already compacted successfully while accepting the request. Queue
|
|
659
|
+
* workers can reuse this producer-side parse cache under stricter loader or
|
|
660
|
+
* network constraints without changing the raw payload preserved for
|
|
661
|
+
* forwarding.
|
|
662
|
+
*
|
|
663
|
+
* This may exist even when {@link ldSignatureVerified} is `false`, because
|
|
664
|
+
* fallback-authenticated traffic and already-queued backlog items can still
|
|
665
|
+
* depend on the cached normalized form to avoid re-fetching remote custom
|
|
666
|
+
* contexts during worker processing.
|
|
667
|
+
*
|
|
668
|
+
* This is optional for backward compatibility with messages that were
|
|
669
|
+
* queued by older Fedify versions or that were already in a queue before
|
|
670
|
+
* upgrading.
|
|
671
|
+
*
|
|
672
|
+
* Fedify keeps this on the queued message itself instead of an external
|
|
673
|
+
* sidecar because generic queue backends do not provide reliable lifecycle
|
|
674
|
+
* guarantees for auxiliary storage across retries and redeliveries.
|
|
675
|
+
*
|
|
676
|
+
* @internal
|
|
677
|
+
*/
|
|
678
|
+
readonly normalizedActivity?: unknown;
|
|
679
|
+
/**
|
|
680
|
+
* Whether the producer actually verified the Linked Data Signature before
|
|
681
|
+
* queueing this message. This lets workers distinguish verified LDS replay
|
|
682
|
+
* from other authenticated inbox traffic that merely happened to include a
|
|
683
|
+
* signature block. This provenance marker is separate from the optional
|
|
684
|
+
* normalizedActivity parse cache.
|
|
685
|
+
*
|
|
686
|
+
* `undefined` preserves backward compatibility with older queued messages
|
|
687
|
+
* that predate this marker.
|
|
688
|
+
*
|
|
689
|
+
* @internal
|
|
690
|
+
*/
|
|
691
|
+
readonly ldSignatureVerified?: boolean;
|
|
620
692
|
readonly started: string;
|
|
621
693
|
readonly attempt: number;
|
|
622
694
|
readonly identifier: string | null;
|
|
@@ -1137,6 +1209,18 @@ interface ActorCallbackSetters<TContextData> {
|
|
|
1137
1209
|
* @since 1.4.0
|
|
1138
1210
|
*/
|
|
1139
1211
|
mapAlias(mapper: ActorAliasMapper<TContextData>): ActorCallbackSetters<TContextData>;
|
|
1212
|
+
/**
|
|
1213
|
+
* Maps a fixed path to a sentinel identifier. It is useful for exposing
|
|
1214
|
+
* a single, instance-level actor at a fixed path, such as `/actor` for
|
|
1215
|
+
* a relay or `/bot` for a bot.
|
|
1216
|
+
* @param path The fixed path to map to the identifier.
|
|
1217
|
+
* @param identifier The sentinel identifier to map the path to.
|
|
1218
|
+
* @returns The setters object so that settings can be chained.
|
|
1219
|
+
* @throws {RouterError} If the provided path or identifier is invalid or fails
|
|
1220
|
+
* runtime validation.
|
|
1221
|
+
* @since 2.3.0
|
|
1222
|
+
*/
|
|
1223
|
+
mapActorAlias(path: `/${string}`, identifier: string): ActorCallbackSetters<TContextData>;
|
|
1140
1224
|
/**
|
|
1141
1225
|
* Specifies the conditions under which requests are authorized.
|
|
1142
1226
|
* @param predicate A callback that returns whether a request is authorized.
|
|
@@ -1495,6 +1579,11 @@ interface Context<TContextData> {
|
|
|
1495
1579
|
* @since 1.3.0
|
|
1496
1580
|
*/
|
|
1497
1581
|
readonly tracerProvider: TracerProvider;
|
|
1582
|
+
/**
|
|
1583
|
+
* The OpenTelemetry meter provider.
|
|
1584
|
+
* @since 2.3.0
|
|
1585
|
+
*/
|
|
1586
|
+
readonly meterProvider?: MeterProvider;
|
|
1498
1587
|
/**
|
|
1499
1588
|
* The document loader for loading remote JSON-LD documents.
|
|
1500
1589
|
*/
|
|
@@ -1993,9 +2082,12 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
1993
2082
|
* Forwards a received activity to the recipients' inboxes. The forwarded
|
|
1994
2083
|
* activity will be signed in HTTP Signatures by the forwarder, but its
|
|
1995
2084
|
* payload will not be modified, i.e., Linked Data Signatures and Object
|
|
1996
|
-
* Integrity Proofs will not be added.
|
|
1997
|
-
*
|
|
1998
|
-
*
|
|
2085
|
+
* Integrity Proofs will not be added. Even when Fedify internally
|
|
2086
|
+
* normalizes a Linked Data Signature activity for parsing, this method still
|
|
2087
|
+
* forwards the original received payload so the sender's signatures/proofs
|
|
2088
|
+
* are preserved as-is. Therefore, if the activity is not signed (i.e., it
|
|
2089
|
+
* has neither Linked Data Signatures nor Object Integrity Proofs), the
|
|
2090
|
+
* recipient probably will not trust the activity.
|
|
1999
2091
|
* @param forwarder The forwarder's identifier or the forwarder's username
|
|
2000
2092
|
* or the forwarder's key pair(s).
|
|
2001
2093
|
* @param recipients The recipients of the activity.
|
|
@@ -2011,9 +2103,12 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
2011
2103
|
* Forwards a received activity to the recipients' inboxes. The forwarded
|
|
2012
2104
|
* activity will be signed in HTTP Signatures by the forwarder, but its
|
|
2013
2105
|
* payload will not be modified, i.e., Linked Data Signatures and Object
|
|
2014
|
-
* Integrity Proofs will not be added.
|
|
2015
|
-
*
|
|
2016
|
-
*
|
|
2106
|
+
* Integrity Proofs will not be added. Even when Fedify internally
|
|
2107
|
+
* normalizes a Linked Data Signature activity for parsing, this method still
|
|
2108
|
+
* forwards the original received payload so the sender's signatures/proofs
|
|
2109
|
+
* are preserved as-is. Therefore, if the activity is not signed (i.e., it
|
|
2110
|
+
* has neither Linked Data Signatures nor Object Integrity Proofs), the
|
|
2111
|
+
* recipient probably will not trust the activity.
|
|
2017
2112
|
* @param forwarder The forwarder's identifier or the forwarder's username.
|
|
2018
2113
|
* @param recipients In this case, it must be `"followers"`.
|
|
2019
2114
|
* @param options Options for forwarding the activity.
|
|
@@ -2375,4 +2470,9 @@ declare function createOutboxContext<TContextData>(args: Partial<OutboxContext<T
|
|
|
2375
2470
|
federation: Federation<TContextData>;
|
|
2376
2471
|
}): OutboxContext<TContextData>;
|
|
2377
2472
|
//#endregion
|
|
2473
|
+
//#region ../fixture/dist/mod.d.ts
|
|
2474
|
+
//#endregion
|
|
2475
|
+
//#region src/test.d.ts
|
|
2476
|
+
declare const testDefinitions: Deno.TestDefinition[];
|
|
2477
|
+
//#endregion
|
|
2378
2478
|
export { createInboxContext, createOutboxContext, createRequestContext, testDefinitions };
|
package/dist/testing/mod.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as createOutboxContext, r as createRequestContext, t as createInboxContext } from "../context-
|
|
5
|
-
import { testDefinitions } from "@fedify/fixture";
|
|
4
|
+
import { i as testDefinitions, n as createOutboxContext, r as createRequestContext, t as createInboxContext } from "../context-DVoTs_wM.mjs";
|
|
6
5
|
export { createInboxContext, createOutboxContext, createRequestContext, testDefinitions };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "@js-temporal/polyfill";
|
|
2
|
-
import "urlpattern-polyfill";
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
import { getLogger } from "@logtape/logtape";
|
|
4
4
|
//#region src/compat/transformers.ts
|
|
5
5
|
const logger = getLogger([
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import "@js-temporal/polyfill";
|
|
2
|
-
import "urlpattern-polyfill";
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
import { getLogger } from "@logtape/logtape";
|
|
4
4
|
import { getUserAgent } from "@fedify/vocab-runtime";
|
|
5
5
|
//#region src/nodeinfo/client.ts
|