@fedify/fedify 2.4.0-dev.1564 → 2.4.0-dev.1567
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-DQrTY2uR.mjs → builder-DGWCUaNQ.mjs} +2 -2
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{deno-0Q35TVjL.mjs → deno-Dho0TW0X.mjs} +1 -1
- package/dist/{docloader-DnNi7FT5.mjs → docloader-DCQSgDOg.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +3 -3
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +7 -7
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.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 +1 -1
- package/dist/{http-ZYObKFyR.mjs → http-Bf8YhWOi.mjs} +3 -3
- package/dist/{http-Blx3a-we.cjs → http-C7Lot0it.cjs} +75 -9
- package/dist/{http-BjTMQwgu.js → http-sngIMb9S.js} +77 -11
- package/dist/{key-By86iSF1.mjs → key-3rYgSl9f.mjs} +76 -10
- package/dist/{kv-cache-3GvEiOJJ.js → kv-cache-B0siRaoZ.js} +1 -1
- package/dist/{kv-cache-BB6kQbPO.cjs → kv-cache-CO2IaDJu.cjs} +1 -1
- package/dist/{kv-cache-W72QYEvy.mjs → kv-cache-P3scUO6t.mjs} +1 -1
- package/dist/{ld-uNPJsHf9.mjs → ld-CCOPy-Co.mjs} +3 -3
- package/dist/{metrics-D7atQvAx.mjs → metrics-CR4UD_gF.mjs} +3 -3
- package/dist/{middleware-ICGLZUHG.js → middleware-BoNiH9CQ.js} +3 -3
- package/dist/{middleware-DYaez_JC.mjs → middleware-CIteB8IS.mjs} +1 -1
- package/dist/{middleware-DM5XOWG5.cjs → middleware-DUelXs9h.cjs} +3 -3
- package/dist/{middleware-B3XvOhoB.mjs → middleware-DfBPuuvp.mjs} +12 -12
- package/dist/mod.cjs +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-C1IdnJbE.mjs → owner-TUz_H-M9.mjs} +2 -2
- package/dist/{proof-hzw73GGW.js → proof-C5i7MhbD.js} +1 -1
- package/dist/{proof-3th48TRO.mjs → proof-CrI3UpuA.mjs} +3 -3
- package/dist/{proof-B0wYpR4P.cjs → proof-DzKUmE7R.cjs} +1 -1
- package/dist/{send-BqPEr21p.mjs → send-BBs_erdP.mjs} +3 -3
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +187 -3
- 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 +62 -2
- package/dist/{temporal-C7NUQ3nU.mjs → temporal-bBIy2G-F.mjs} +1 -1
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +6 -6
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "@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-Dho0TW0X.mjs";
|
|
5
5
|
import { metrics } from "@opentelemetry/api";
|
|
6
6
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
7
7
|
//#region src/federation/metrics.ts
|
|
@@ -167,11 +167,11 @@ var FederationMetrics = class {
|
|
|
167
167
|
unit: "{change}"
|
|
168
168
|
});
|
|
169
169
|
this.keyLookup = meter.createCounter("activitypub.key.lookup", {
|
|
170
|
-
description: "Public-key lookup attempts performed by Fedify, including
|
|
170
|
+
description: "Public-key lookup attempts performed by Fedify, including cache hits, local resolutions, and remote fetches.",
|
|
171
171
|
unit: "{lookup}"
|
|
172
172
|
});
|
|
173
173
|
this.keyLookupDuration = meter.createHistogram("activitypub.key.lookup.duration", {
|
|
174
|
-
description: "Duration of public-key lookups performed by Fedify, including any remote fetch.",
|
|
174
|
+
description: "Duration of public-key lookups performed by Fedify, including cache hits, local resolutions, and any remote fetch.",
|
|
175
175
|
unit: "ms",
|
|
176
176
|
advice: { explicitBucketBoundaries: [
|
|
177
177
|
5,
|
|
@@ -2,10 +2,10 @@ import { Temporal } from "@js-temporal/polyfill";
|
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
import { t as __exportAll } from "./chunk-CRNNMoPX.js";
|
|
4
4
|
import { r as getDefaultActivityTransformers } from "./transformers-BGMIq1cs.js";
|
|
5
|
-
import { A as formatAcceptSignature, D as recordOutboxEnqueue, E as recordOutboxActivity, F as version, O as recordWebFingerHandle, P as name, S as recordCollectionTotalItems, T as recordInboxActivity, a as verifyRequestDetailed, b as recordCollectionPageItems, d as validateCryptoKey, f as getDurationMs, g as isAbortError, h as instrumentDocumentLoader, i as verifyRequest, k as registerQueueDepthGauge, m as getRemoteHost, n as parseRfc9421SignatureInput, o as exportJwk, p as getFederationMetrics, t as doubleKnock, u as importJwk, v as recordCircuitBreakerStateChange, w as recordFanoutRecipients, x as recordCollectionRequest, y as recordCollectionDispatchDuration } from "./http-
|
|
6
|
-
import { _ as hasSignatureLike, b as signJsonLd, c as getKeyOwner, f as compactJsonLd, g as hasSignature, h as getNormalizationContextLoader, i as verifyObject, l as InvalidContextReferenceError, m as detachSignature, n as hasProofLike, o as normalizeOutgoingActivityJsonLd, r as signObject, s as doesActorOwnKey, u as assertSafeJsonLd, v as isClearlyMalformedContextReference, w as wrapContextLoaderForJsonLd, x as verifyCompactJsonLd, y as isInvalidUrlTypeError } from "./proof-
|
|
5
|
+
import { A as formatAcceptSignature, D as recordOutboxEnqueue, E as recordOutboxActivity, F as version, O as recordWebFingerHandle, P as name, S as recordCollectionTotalItems, T as recordInboxActivity, a as verifyRequestDetailed, b as recordCollectionPageItems, d as validateCryptoKey, f as getDurationMs, g as isAbortError, h as instrumentDocumentLoader, i as verifyRequest, k as registerQueueDepthGauge, m as getRemoteHost, n as parseRfc9421SignatureInput, o as exportJwk, p as getFederationMetrics, t as doubleKnock, u as importJwk, v as recordCircuitBreakerStateChange, w as recordFanoutRecipients, x as recordCollectionRequest, y as recordCollectionDispatchDuration } from "./http-sngIMb9S.js";
|
|
6
|
+
import { _ as hasSignatureLike, b as signJsonLd, c as getKeyOwner, f as compactJsonLd, g as hasSignature, h as getNormalizationContextLoader, i as verifyObject, l as InvalidContextReferenceError, m as detachSignature, n as hasProofLike, o as normalizeOutgoingActivityJsonLd, r as signObject, s as doesActorOwnKey, u as assertSafeJsonLd, v as isClearlyMalformedContextReference, w as wrapContextLoaderForJsonLd, x as verifyCompactJsonLd, y as isInvalidUrlTypeError } from "./proof-C5i7MhbD.js";
|
|
7
7
|
import { n as getNodeInfo, t as nodeInfoToJson } from "./types-CAY3OdLq.js";
|
|
8
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
8
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-B0siRaoZ.js";
|
|
9
9
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
10
10
|
import { Router, RouterError, assertPath } from "@fedify/uri-template";
|
|
11
11
|
import { Activity, Collection, CollectionPage, CryptographicKey, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, Tombstone, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
@@ -2,10 +2,10 @@ const { Temporal } = require("@js-temporal/polyfill");
|
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
const require_chunk = require("./chunk-DDcVe30Y.cjs");
|
|
4
4
|
const require_transformers = require("./transformers-NeAONrAq.cjs");
|
|
5
|
-
const require_http = require("./http-
|
|
6
|
-
const require_proof = require("./proof-
|
|
5
|
+
const require_http = require("./http-C7Lot0it.cjs");
|
|
6
|
+
const require_proof = require("./proof-DzKUmE7R.cjs");
|
|
7
7
|
const require_types = require("./types-KC4QAoxe.cjs");
|
|
8
|
-
const require_kv_cache = require("./kv-cache-
|
|
8
|
+
const require_kv_cache = require("./kv-cache-CO2IaDJu.cjs");
|
|
9
9
|
let _logtape_logtape = require("@logtape/logtape");
|
|
10
10
|
let _fedify_uri_template = require("@fedify/uri-template");
|
|
11
11
|
let _fedify_vocab = require("@fedify/vocab");
|
|
@@ -1,26 +1,26 @@
|
|
|
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-
|
|
5
|
-
import { a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, n as getDurationMs, o as isAbortError, r as getFederationMetrics, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "./metrics-
|
|
4
|
+
import { n as version, t as name } from "./deno-Dho0TW0X.mjs";
|
|
5
|
+
import { a as instrumentDocumentLoader, b as recordWebFingerHandle, c as recordCircuitBreakerStateChange, d as recordCollectionRequest, f as recordCollectionTotalItems, g as recordInboxActivity, h as recordFanoutRecipients, i as getRemoteHost, l as recordCollectionDispatchDuration, n as getDurationMs, o as isAbortError, r as getFederationMetrics, u as recordCollectionPageItems, v as recordOutboxActivity, x as registerQueueDepthGauge, y as recordOutboxEnqueue } from "./metrics-CR4UD_gF.mjs";
|
|
6
6
|
import { t as formatAcceptSignature } from "./accept-CPkZzmGN.mjs";
|
|
7
|
-
import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-
|
|
8
|
-
import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-
|
|
9
|
-
import { t as getAuthenticatedDocumentLoader } from "./docloader-
|
|
10
|
-
import { n as kvCache } from "./kv-cache-
|
|
11
|
-
import { _ as wrapContextLoaderForJsonLd, a as compactJsonLd, c as getNormalizationContextLoader, d as isClearlyMalformedContextReference, f as isInvalidUrlTypeError, l as hasSignature, m as verifyCompactJsonLd, p as signJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as hasSignatureLike } from "./ld-
|
|
12
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-
|
|
7
|
+
import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-3rYgSl9f.mjs";
|
|
8
|
+
import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-Bf8YhWOi.mjs";
|
|
9
|
+
import { t as getAuthenticatedDocumentLoader } from "./docloader-DCQSgDOg.mjs";
|
|
10
|
+
import { n as kvCache } from "./kv-cache-P3scUO6t.mjs";
|
|
11
|
+
import { _ as wrapContextLoaderForJsonLd, a as compactJsonLd, c as getNormalizationContextLoader, d as isClearlyMalformedContextReference, f as isInvalidUrlTypeError, l as hasSignature, m as verifyCompactJsonLd, p as signJsonLd, r as assertSafeJsonLd, s as detachSignature, t as InvalidContextReferenceError, u as hasSignatureLike } from "./ld-CCOPy-Co.mjs";
|
|
12
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-TUz_H-M9.mjs";
|
|
13
13
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-L_DbOaFe.mjs";
|
|
14
|
-
import { i as verifyObject, n as hasProofLike, r as signObject } from "./proof-
|
|
14
|
+
import { i as verifyObject, n as hasProofLike, r as signObject } from "./proof-CrI3UpuA.mjs";
|
|
15
15
|
import { t as getNodeInfo } from "./client-ByXmQhYD.mjs";
|
|
16
16
|
import { t as nodeInfoToJson } from "./types-J53Kw7so.mjs";
|
|
17
|
-
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-
|
|
18
|
-
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-
|
|
17
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-BBs_erdP.mjs";
|
|
18
|
+
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-DGWCUaNQ.mjs";
|
|
19
19
|
import { t as CircuitBreaker } from "./circuit-breaker-CSWsyoef.mjs";
|
|
20
20
|
import { t as buildCollectionSynchronizationHeader } from "./collection-Cc3DVAhE.mjs";
|
|
21
21
|
import { t as KvKeyCache } from "./keycache-BeU0LCII.mjs";
|
|
22
22
|
import { t as acceptsJsonLd } from "./negotiation-DDstyBvc.mjs";
|
|
23
|
-
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-
|
|
23
|
+
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-bBIy2G-F.mjs";
|
|
24
24
|
import { t as createExponentialBackoffPolicy } from "./retry-CXg_MBI-.mjs";
|
|
25
25
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
26
26
|
import { RouterError } from "@fedify/uri-template";
|
package/dist/mod.cjs
CHANGED
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
require("./chunk-DDcVe30Y.cjs");
|
|
5
5
|
const require_transformers = require("./transformers-NeAONrAq.cjs");
|
|
6
6
|
require("./compat/mod.cjs");
|
|
7
|
-
const require_http = require("./http-
|
|
8
|
-
const require_middleware = require("./middleware-
|
|
9
|
-
const require_proof = require("./proof-
|
|
7
|
+
const require_http = require("./http-C7Lot0it.cjs");
|
|
8
|
+
const require_middleware = require("./middleware-DUelXs9h.cjs");
|
|
9
|
+
const require_proof = require("./proof-DzKUmE7R.cjs");
|
|
10
10
|
const require_types = require("./types-KC4QAoxe.cjs");
|
|
11
|
-
const require_kv_cache = require("./kv-cache-
|
|
11
|
+
const require_kv_cache = require("./kv-cache-CO2IaDJu.cjs");
|
|
12
12
|
const require_federation_mod = require("./federation/mod.cjs");
|
|
13
13
|
require("./nodeinfo/mod.cjs");
|
|
14
14
|
require("./runtime/mod.cjs");
|
package/dist/mod.js
CHANGED
|
@@ -3,11 +3,11 @@ import { URLPattern } from "urlpattern-polyfill";
|
|
|
3
3
|
import "./chunk-CRNNMoPX.js";
|
|
4
4
|
import { n as autoIdAssigner, r as getDefaultActivityTransformers, t as actorDehydrator } from "./transformers-BGMIq1cs.js";
|
|
5
5
|
import "./compat/mod.js";
|
|
6
|
-
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-
|
|
7
|
-
import { a as SendActivityError, c as buildCollectionSynchronizationHeader, d as normalizeCircuitBreakerOptions, f as parseCircuitBreakerKvState, i as createExponentialBackoffPolicy, l as digest, o as respondWithObject, p as createFederationBuilder, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as CircuitBreaker } from "./middleware-
|
|
8
|
-
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-
|
|
6
|
+
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-sngIMb9S.js";
|
|
7
|
+
import { a as SendActivityError, c as buildCollectionSynchronizationHeader, d as normalizeCircuitBreakerOptions, f as parseCircuitBreakerKvState, i as createExponentialBackoffPolicy, l as digest, o as respondWithObject, p as createFederationBuilder, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as CircuitBreaker } from "./middleware-BoNiH9CQ.js";
|
|
8
|
+
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-C5i7MhbD.js";
|
|
9
9
|
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-CAY3OdLq.js";
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-B0siRaoZ.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-DVoTs_wM.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
6
6
|
import "../std__assert-BBjXFNOb.mjs";
|
|
7
7
|
import { t as MemoryKvStore } from "../kv-rV3vodCc.mjs";
|
|
8
|
-
import { _ as handleNodeInfo, o as createFederation, v as handleNodeInfoJrd } from "../middleware-
|
|
8
|
+
import { _ as handleNodeInfo, o as createFederation, v as handleNodeInfoJrd } from "../middleware-DfBPuuvp.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
//#region src/nodeinfo/handler.test.ts
|
|
11
11
|
test("handleNodeInfo()", async () => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as version, t as name } from "./deno-
|
|
5
|
-
import "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-Dho0TW0X.mjs";
|
|
5
|
+
import "./key-3rYgSl9f.mjs";
|
|
6
6
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
7
7
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { F as version, P as name, _ as measureSignatureKeyFetch, d as validateCryptoKey, f as getDurationMs, p as getFederationMetrics, s as fetchKey } from "./http-
|
|
3
|
+
import { F as version, P as name, _ as measureSignatureKeyFetch, d as validateCryptoKey, f as getDurationMs, p as getFederationMetrics, s as fetchKey } from "./http-sngIMb9S.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, PUBLIC_COLLECTION, getTypeId, isActor } from "@fedify/vocab";
|
|
6
6
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -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-
|
|
5
|
-
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-
|
|
6
|
-
import { n as fetchKey, o as validateCryptoKey } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-Dho0TW0X.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-CR4UD_gF.mjs";
|
|
6
|
+
import { n as fetchKey, o as validateCryptoKey } from "./key-3rYgSl9f.mjs";
|
|
7
7
|
import { n as preloadedOnlyDocumentLoader } from "./public-audience-Cvbr2Gzt.mjs";
|
|
8
8
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-L_DbOaFe.mjs";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
const require_chunk = require("./chunk-DDcVe30Y.cjs");
|
|
4
|
-
const require_http = require("./http-
|
|
4
|
+
const require_http = require("./http-C7Lot0it.cjs");
|
|
5
5
|
let _logtape_logtape = require("@logtape/logtape");
|
|
6
6
|
let _fedify_vocab = require("@fedify/vocab");
|
|
7
7
|
let _opentelemetry_api = require("@opentelemetry/api");
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "@js-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-Dho0TW0X.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics } from "./metrics-CR4UD_gF.mjs";
|
|
6
|
+
import { n as doubleKnock } from "./http-Bf8YhWOi.mjs";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
import { FetchError } from "@fedify/vocab-runtime";
|
package/dist/sig/http.test.mjs
CHANGED
|
@@ -7,8 +7,8 @@ import { r as assertExists, t as assertStringIncludes } from "../std__assert-BBj
|
|
|
7
7
|
import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
|
|
8
8
|
import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
|
|
9
9
|
import { t as assert } from "../assert-OguE97r2.mjs";
|
|
10
|
-
import { t as exportJwk } from "../key-
|
|
11
|
-
import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase, u as verifyRequestDetailed } from "../http-
|
|
10
|
+
import { t as exportJwk } from "../key-3rYgSl9f.mjs";
|
|
11
|
+
import { a as parseRfc9421Signature, c as timingSafeEqual, i as formatRfc9421SignatureParameters, l as verifyRequest, n as doubleKnock, o as parseRfc9421SignatureInput, r as formatRfc9421Signature, s as signRequest, t as createRfc9421SignatureBase, u as verifyRequestDetailed } from "../http-Bf8YhWOi.mjs";
|
|
12
12
|
import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DGu1NFwu.mjs";
|
|
13
13
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
14
14
|
import { FetchError, exportSpki } from "@fedify/vocab-runtime";
|
package/dist/sig/key.test.mjs
CHANGED
|
@@ -5,11 +5,11 @@ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
|
5
5
|
import "../std__assert-BBjXFNOb.mjs";
|
|
6
6
|
import { t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
|
|
7
7
|
import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
|
|
8
|
-
import { a as importJwk, i as generateCryptoKeyPair, n as fetchKey, o as validateCryptoKey, r as fetchKeyDetailed, t as exportJwk } from "../key-
|
|
9
|
-
import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DGu1NFwu.mjs";
|
|
8
|
+
import { a as importJwk, i as generateCryptoKeyPair, n as fetchKey, o as validateCryptoKey, r as fetchKeyDetailed, t as exportJwk } from "../key-3rYgSl9f.mjs";
|
|
9
|
+
import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DGu1NFwu.mjs";
|
|
10
10
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
11
11
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
|
-
import { FetchError } from "@fedify/vocab-runtime";
|
|
12
|
+
import { FetchError, exportDidKey } from "@fedify/vocab-runtime";
|
|
13
13
|
//#region src/sig/key.test.ts
|
|
14
14
|
test("validateCryptoKey()", async () => {
|
|
15
15
|
const pkcs1v15 = await crypto.subtle.generateKey({
|
|
@@ -303,6 +303,190 @@ test("fetchKeyDetailed() returns detailed fetch errors", async () => {
|
|
|
303
303
|
if (detailedError == null || !("error" in detailedError)) throw new Error("Expected non-HTTP fetch error details.");
|
|
304
304
|
assertEquals(detailedError.error, failure);
|
|
305
305
|
});
|
|
306
|
+
test("fetchKey() resolves did:key Multikeys without document loading", async () => {
|
|
307
|
+
const did = await exportDidKey(ed25519PublicKey.publicKey);
|
|
308
|
+
const keyId = `${did}#${did.slice(8)}`;
|
|
309
|
+
const expectedKey = new Multikey({
|
|
310
|
+
id: new URL(keyId),
|
|
311
|
+
controller: new URL(did),
|
|
312
|
+
publicKey: ed25519PublicKey.publicKey
|
|
313
|
+
});
|
|
314
|
+
const cache = { [keyId]: null };
|
|
315
|
+
let documentLoaderCalls = 0;
|
|
316
|
+
const options = {
|
|
317
|
+
documentLoader() {
|
|
318
|
+
documentLoaderCalls++;
|
|
319
|
+
throw new TypeError("did:key must not use the document loader");
|
|
320
|
+
},
|
|
321
|
+
contextLoader: mockDocumentLoader,
|
|
322
|
+
keyCache: {
|
|
323
|
+
get(keyId) {
|
|
324
|
+
return Promise.resolve(cache[keyId.href]);
|
|
325
|
+
},
|
|
326
|
+
set(keyId, key) {
|
|
327
|
+
cache[keyId.href] = key;
|
|
328
|
+
return Promise.resolve();
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
};
|
|
332
|
+
assertEquals(await fetchKey(keyId, Multikey, options), {
|
|
333
|
+
key: expectedKey,
|
|
334
|
+
cached: false
|
|
335
|
+
});
|
|
336
|
+
assertEquals(documentLoaderCalls, 0);
|
|
337
|
+
assertEquals(cache[keyId], expectedKey);
|
|
338
|
+
assertEquals(await fetchKey(keyId, Multikey, options), {
|
|
339
|
+
key: expectedKey,
|
|
340
|
+
cached: true
|
|
341
|
+
});
|
|
342
|
+
assertEquals(documentLoaderCalls, 0);
|
|
343
|
+
});
|
|
344
|
+
test("fetchKey() validates cached did:key Multikeys", async () => {
|
|
345
|
+
const did = await exportDidKey(ed25519PublicKey.publicKey);
|
|
346
|
+
const keyId = `${did}#${did.slice(8)}`;
|
|
347
|
+
const wrongKeyPair = await generateCryptoKeyPair("Ed25519");
|
|
348
|
+
const cachedKey = new Multikey({
|
|
349
|
+
id: new URL(keyId),
|
|
350
|
+
controller: new URL(did),
|
|
351
|
+
publicKey: wrongKeyPair.publicKey
|
|
352
|
+
});
|
|
353
|
+
const expectedKey = new Multikey({
|
|
354
|
+
id: new URL(keyId),
|
|
355
|
+
controller: new URL(did),
|
|
356
|
+
publicKey: ed25519PublicKey.publicKey
|
|
357
|
+
});
|
|
358
|
+
const cache = { [keyId]: cachedKey };
|
|
359
|
+
let documentLoaderCalls = 0;
|
|
360
|
+
assertEquals(await fetchKey(keyId, Multikey, {
|
|
361
|
+
documentLoader() {
|
|
362
|
+
documentLoaderCalls++;
|
|
363
|
+
throw new TypeError("did:key must not use the document loader");
|
|
364
|
+
},
|
|
365
|
+
contextLoader: mockDocumentLoader,
|
|
366
|
+
keyCache: {
|
|
367
|
+
get(keyId) {
|
|
368
|
+
return Promise.resolve(cache[keyId.href]);
|
|
369
|
+
},
|
|
370
|
+
set(keyId, key) {
|
|
371
|
+
cache[keyId.href] = key;
|
|
372
|
+
return Promise.resolve();
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
}), {
|
|
376
|
+
key: expectedKey,
|
|
377
|
+
cached: false
|
|
378
|
+
});
|
|
379
|
+
assertEquals(documentLoaderCalls, 0);
|
|
380
|
+
assertEquals(cache[keyId], expectedKey);
|
|
381
|
+
});
|
|
382
|
+
test("fetchKey() rejects unsupported did:key values locally", async () => {
|
|
383
|
+
const invalidKeyId = "did:key:z6MksHj1MJnidCtDiyYW9ugNFftoX9fLK4bornTxmMZ6X7vq#z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK";
|
|
384
|
+
const cache = {};
|
|
385
|
+
let documentLoaderCalls = 0;
|
|
386
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
387
|
+
assertEquals(await fetchKey(invalidKeyId, Multikey, {
|
|
388
|
+
documentLoader() {
|
|
389
|
+
documentLoaderCalls++;
|
|
390
|
+
throw new TypeError("did:key must not use the document loader");
|
|
391
|
+
},
|
|
392
|
+
contextLoader: mockDocumentLoader,
|
|
393
|
+
meterProvider,
|
|
394
|
+
keyCache: {
|
|
395
|
+
get(keyId) {
|
|
396
|
+
return Promise.resolve(cache[keyId.href]);
|
|
397
|
+
},
|
|
398
|
+
set(keyId, key) {
|
|
399
|
+
cache[keyId.href] = key;
|
|
400
|
+
return Promise.resolve();
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}), {
|
|
404
|
+
key: null,
|
|
405
|
+
cached: false
|
|
406
|
+
});
|
|
407
|
+
assertEquals(documentLoaderCalls, 0);
|
|
408
|
+
assertEquals(cache, {});
|
|
409
|
+
assertEquals(recorder.getMeasurement("activitypub.key.lookup")?.attributes["activitypub.lookup.result"], "invalid");
|
|
410
|
+
});
|
|
411
|
+
test("fetchKeyDetailed() resolves did:key without fetchError", async () => {
|
|
412
|
+
const did = await exportDidKey(ed25519PublicKey.publicKey);
|
|
413
|
+
const result = await fetchKeyDetailed(`${did}#${did.slice(8)}`, Multikey, {
|
|
414
|
+
documentLoader() {
|
|
415
|
+
throw new TypeError("did:key must not use the document loader");
|
|
416
|
+
},
|
|
417
|
+
contextLoader: mockDocumentLoader
|
|
418
|
+
});
|
|
419
|
+
assertEquals(result.key instanceof Multikey, true);
|
|
420
|
+
assertEquals(result.cached, false);
|
|
421
|
+
assertEquals(result.fetchError, void 0);
|
|
422
|
+
});
|
|
423
|
+
test("fetchKeyDetailed() rejects invalid did:key without fetchError", async () => {
|
|
424
|
+
const invalidKeyId = "did:key:z6MksHj1MJnidCtDiyYW9ugNFftoX9fLK4bornTxmMZ6X7vq#z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK";
|
|
425
|
+
const cache = {};
|
|
426
|
+
let documentLoaderCalls = 0;
|
|
427
|
+
const result = await fetchKeyDetailed(invalidKeyId, Multikey, {
|
|
428
|
+
documentLoader() {
|
|
429
|
+
documentLoaderCalls++;
|
|
430
|
+
throw new TypeError("did:key must not use the document loader");
|
|
431
|
+
},
|
|
432
|
+
contextLoader: mockDocumentLoader,
|
|
433
|
+
keyCache: {
|
|
434
|
+
get(keyId) {
|
|
435
|
+
return Promise.resolve(cache[keyId.href]);
|
|
436
|
+
},
|
|
437
|
+
set(keyId, key) {
|
|
438
|
+
cache[keyId.href] = key;
|
|
439
|
+
return Promise.resolve();
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
});
|
|
443
|
+
assertEquals(result.key, null);
|
|
444
|
+
assertEquals(result.cached, false);
|
|
445
|
+
assertEquals(result.fetchError, void 0);
|
|
446
|
+
assertEquals(documentLoaderCalls, 0);
|
|
447
|
+
assertEquals(cache, {});
|
|
448
|
+
});
|
|
449
|
+
test("fetchKey() does not resolve did:key as CryptographicKey", async () => {
|
|
450
|
+
const did = await exportDidKey(ed25519PublicKey.publicKey);
|
|
451
|
+
const keyId = `${did}#${did.slice(8)}`;
|
|
452
|
+
let cacheGets = 0;
|
|
453
|
+
let documentLoaderCalls = 0;
|
|
454
|
+
assertEquals(await fetchKey(keyId, CryptographicKey, {
|
|
455
|
+
documentLoader() {
|
|
456
|
+
documentLoaderCalls++;
|
|
457
|
+
throw new TypeError("did:key must not use the document loader");
|
|
458
|
+
},
|
|
459
|
+
contextLoader: mockDocumentLoader,
|
|
460
|
+
keyCache: {
|
|
461
|
+
get() {
|
|
462
|
+
cacheGets++;
|
|
463
|
+
throw new TypeError("did:key must not check the cache");
|
|
464
|
+
},
|
|
465
|
+
set() {
|
|
466
|
+
throw new TypeError("did:key must not write to the cache");
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}), {
|
|
470
|
+
key: null,
|
|
471
|
+
cached: false
|
|
472
|
+
});
|
|
473
|
+
assertEquals(cacheGets, 0);
|
|
474
|
+
assertEquals(documentLoaderCalls, 0);
|
|
475
|
+
});
|
|
476
|
+
test("fetchKey() records did:key lookup metrics", async () => {
|
|
477
|
+
const did = await exportDidKey(ed25519PublicKey.publicKey);
|
|
478
|
+
const keyId = `${did}#${did.slice(8)}`;
|
|
479
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
480
|
+
assertEquals((await fetchKey(keyId, Multikey, {
|
|
481
|
+
documentLoader: mockDocumentLoader,
|
|
482
|
+
contextLoader: mockDocumentLoader,
|
|
483
|
+
meterProvider
|
|
484
|
+
})).cached, false);
|
|
485
|
+
const counter = recorder.getMeasurement("activitypub.key.lookup");
|
|
486
|
+
assertEquals(counter?.attributes["activitypub.lookup.result"], "fetched");
|
|
487
|
+
assertEquals(counter?.attributes["activitypub.cache.enabled"], false);
|
|
488
|
+
assertEquals(counter?.attributes["activitypub.remote.host"], "");
|
|
489
|
+
});
|
|
306
490
|
test("fetchKey() records activitypub.key.lookup with hit on cached key", async () => {
|
|
307
491
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
308
492
|
const cache = {};
|
package/dist/sig/ld.test.mjs
CHANGED
|
@@ -5,9 +5,9 @@ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
|
5
5
|
import { n as assertGreaterOrEqual, r as assertFalse, t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
|
|
6
6
|
import { t as assertThrows } from "../assert_throws-BOkhLGYc.mjs";
|
|
7
7
|
import { t as assert } from "../assert-OguE97r2.mjs";
|
|
8
|
-
import { i as generateCryptoKeyPair } from "../key-
|
|
8
|
+
import { i as generateCryptoKeyPair } from "../key-3rYgSl9f.mjs";
|
|
9
9
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DGu1NFwu.mjs";
|
|
10
|
-
import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-
|
|
10
|
+
import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-CCOPy-Co.mjs";
|
|
11
11
|
import { CryptographicKey } from "@fedify/vocab";
|
|
12
12
|
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
13
13
|
import { encodeBase64 } from "byte-encodings/base64";
|
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-C7Lot0it.cjs");
|
|
5
|
+
const require_proof = require("../proof-DzKUmE7R.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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
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-
|
|
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-
|
|
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-sngIMb9S.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-C5i7MhbD.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
|
@@ -6,7 +6,7 @@ import "../std__assert-BBjXFNOb.mjs";
|
|
|
6
6
|
import { r as assertFalse } from "../assert_rejects-DN60FHPX.mjs";
|
|
7
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-
|
|
9
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-TUz_H-M9.mjs";
|
|
10
10
|
import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
|
|
11
11
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
//#region src/sig/owner.test.ts
|
package/dist/sig/proof.test.mjs
CHANGED
|
@@ -8,10 +8,10 @@ import { t as assertInstanceOf } from "../assert_instance_of-DBC5X09g.mjs";
|
|
|
8
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
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-
|
|
11
|
+
import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-CrI3UpuA.mjs";
|
|
12
12
|
import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place } from "@fedify/vocab";
|
|
13
13
|
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
14
|
-
import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
|
|
14
|
+
import { decodeMultibase, exportDidKey, exportMultibaseKey, importMultibaseKey, parseIri } from "@fedify/vocab-runtime";
|
|
15
15
|
import { decodeHex } from "byte-encodings/hex";
|
|
16
16
|
//#region src/sig/proof.test.ts
|
|
17
17
|
const fep8b32TestVectorPrivateKey = await crypto.subtle.importKey("jwk", {
|
|
@@ -326,6 +326,66 @@ test("verifyProof()", async () => {
|
|
|
326
326
|
}), null);
|
|
327
327
|
assertFalse(contextLoaderCalls.includes("https://attacker.example/ctx"));
|
|
328
328
|
});
|
|
329
|
+
test("verifyProof() resolves did:key verification methods locally", async () => {
|
|
330
|
+
const multibaseKey = (await exportDidKey(ed25519PublicKey.publicKey)).slice(8);
|
|
331
|
+
const did = `did:key:${multibaseKey}`;
|
|
332
|
+
const keyId = new URL(`${did}#${multibaseKey}`);
|
|
333
|
+
const created = Temporal.Instant.from("2023-02-24T23:36:38Z");
|
|
334
|
+
const note = new Note({
|
|
335
|
+
id: parseIri(`ap://did:key:${multibaseKey}/objects/1`),
|
|
336
|
+
attribution: parseIri(`ap://did:key:${multibaseKey}/actor`),
|
|
337
|
+
content: "Portable hello"
|
|
338
|
+
});
|
|
339
|
+
const proof = await createProof(note, ed25519PrivateKey, keyId, {
|
|
340
|
+
created,
|
|
341
|
+
contextLoader: mockDocumentLoader,
|
|
342
|
+
context: ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"]
|
|
343
|
+
});
|
|
344
|
+
const jsonLd = await note.toJsonLd({
|
|
345
|
+
format: "compact",
|
|
346
|
+
contextLoader: mockDocumentLoader,
|
|
347
|
+
context: ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"]
|
|
348
|
+
});
|
|
349
|
+
let documentLoaderCalls = 0;
|
|
350
|
+
assertEquals(await verifyProof(jsonLd, proof, {
|
|
351
|
+
contextLoader: mockDocumentLoader,
|
|
352
|
+
documentLoader() {
|
|
353
|
+
documentLoaderCalls++;
|
|
354
|
+
throw new TypeError("did:key must not use the document loader");
|
|
355
|
+
}
|
|
356
|
+
}), new Multikey({
|
|
357
|
+
id: keyId,
|
|
358
|
+
controller: new URL(did),
|
|
359
|
+
publicKey: ed25519PublicKey.publicKey
|
|
360
|
+
}));
|
|
361
|
+
assertEquals(documentLoaderCalls, 0);
|
|
362
|
+
const tampered = { ...jsonLd };
|
|
363
|
+
tampered.content = "Portable goodbye";
|
|
364
|
+
assertEquals(await verifyProof(tampered, proof, {
|
|
365
|
+
contextLoader: mockDocumentLoader,
|
|
366
|
+
documentLoader() {
|
|
367
|
+
throw new TypeError("did:key must not use the document loader");
|
|
368
|
+
}
|
|
369
|
+
}), null);
|
|
370
|
+
assertEquals(await verifyProof(jsonLd, proof.clone({ verificationMethod: new URL(`${did}#z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK`) }), {
|
|
371
|
+
contextLoader: mockDocumentLoader,
|
|
372
|
+
documentLoader() {
|
|
373
|
+
throw new TypeError("did:key must not use the document loader");
|
|
374
|
+
}
|
|
375
|
+
}), null);
|
|
376
|
+
const unsupportedMultibaseKey = await exportMultibaseKey(rsaPublicKey2.publicKey);
|
|
377
|
+
const unsupportedDid = `did:key:${unsupportedMultibaseKey}`;
|
|
378
|
+
const unsupportedProof = proof.clone({ verificationMethod: new URL(`${unsupportedDid}#${unsupportedMultibaseKey}`) });
|
|
379
|
+
let unsupportedDocumentLoaderCalls = 0;
|
|
380
|
+
assertEquals(await verifyProof(jsonLd, unsupportedProof, {
|
|
381
|
+
contextLoader: mockDocumentLoader,
|
|
382
|
+
documentLoader() {
|
|
383
|
+
unsupportedDocumentLoaderCalls++;
|
|
384
|
+
throw new TypeError("did:key must not use the document loader");
|
|
385
|
+
}
|
|
386
|
+
}), null);
|
|
387
|
+
assertEquals(unsupportedDocumentLoaderCalls, 0);
|
|
388
|
+
});
|
|
329
389
|
test("verifyProof() records verification duration metric", async (t) => {
|
|
330
390
|
const jsonLd = {
|
|
331
391
|
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { c as getNormalizationContextLoader } from "./ld-
|
|
4
|
+
import { c as getNormalizationContextLoader } from "./ld-CCOPy-Co.mjs";
|
|
5
5
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
6
6
|
//#region src/federation/temporal.ts
|
|
7
7
|
function isPlainObject(value) {
|
|
@@ -5,9 +5,9 @@ import { t as esm_default } from "../esm-vrlUxr60.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
6
6
|
import "../std__assert-BBjXFNOb.mjs";
|
|
7
7
|
import { t as assertRejects } from "../assert_rejects-DN60FHPX.mjs";
|
|
8
|
-
import { l as verifyRequest } from "../http-
|
|
8
|
+
import { l as verifyRequest } from "../http-Bf8YhWOi.mjs";
|
|
9
9
|
import { i as rsaPrivateKey2 } from "../keys-DGu1NFwu.mjs";
|
|
10
|
-
import { t as getAuthenticatedDocumentLoader } from "../docloader-
|
|
10
|
+
import { t as getAuthenticatedDocumentLoader } from "../docloader-DCQSgDOg.mjs";
|
|
11
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
import { UrlError } from "@fedify/vocab-runtime";
|
|
13
13
|
//#region src/utils/docloader.test.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as kvCache, t as MockKvStore } from "../kv-cache-
|
|
4
|
+
import { n as kvCache, t as MockKvStore } from "../kv-cache-P3scUO6t.mjs";
|
|
5
5
|
import { deepStrictEqual, throws } from "node:assert";
|
|
6
6
|
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
7
7
|
import { preloadedContexts } from "@fedify/vocab-runtime";
|
package/dist/utils/mod.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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_kv_cache = require("../kv-cache-
|
|
4
|
+
const require_kv_cache = require("../kv-cache-CO2IaDJu.cjs");
|
|
5
5
|
exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
|
|
6
6
|
exports.kvCache = require_kv_cache.kvCache;
|
package/dist/utils/mod.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-
|
|
3
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-B0siRaoZ.js";
|
|
4
4
|
export { getAuthenticatedDocumentLoader, kvCache };
|