@fedify/fedify 2.3.13 → 2.3.14
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-BagNDcQw.mjs → builder-C6yXExXl.mjs} +2 -2
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{deno-XpcjbHwj.mjs → deno-y3L4Oa94.mjs} +1 -1
- package/dist/{docloader-QDpF5t9M.mjs → docloader-yuyzZC9a.mjs} +5 -3
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +5 -5
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/keycache.test.mjs +18 -7
- 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-BRrpIDS1.mjs → http-BCSf1KIY.mjs} +3 -3
- package/dist/{http-DwPnG87d.cjs → http-D77Wjrcg.cjs} +17 -3
- package/dist/{http-GHVGCeb5.js → http-DNM9KyIO.js} +17 -3
- package/dist/{inbox-BzOuCPLY.mjs → inbox-NObX26c9.mjs} +2 -2
- package/dist/{key-PdEu1lDF.mjs → key-APURZ0ky.mjs} +18 -4
- package/dist/{keycache-Dkc_sflV.mjs → keycache-BimEQucx.mjs} +1 -1
- package/dist/{kv-cache-poF6Tqnz.cjs → kv-cache-Bg4utAuv.cjs} +4 -2
- package/dist/{kv-cache-Clx3SwMp.mjs → kv-cache-C69dzgQi.mjs} +1 -1
- package/dist/{kv-cache-BmqdF048.js → kv-cache-LBCwHNLu.js} +4 -2
- package/dist/{ld-D6UlzNnG.mjs → ld-BoLqbDaL.mjs} +3 -3
- package/dist/{metrics-62qolVUY.mjs → metrics-DBSl8wEr.mjs} +1 -1
- package/dist/{middleware-DkrXqZO_.cjs → middleware-BQUQ0pPl.cjs} +4 -4
- package/dist/{middleware-xw9fBZoB.js → middleware-CRd1JmuL.js} +4 -4
- package/dist/{middleware-CfbFdEO-.mjs → middleware-CZ8tI1qL.mjs} +14 -14
- package/dist/{middleware-C3Q3CoR8.mjs → middleware-DAqo2eOY.mjs} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-DWnLg-vk.mjs → owner-DjKvngeb.mjs} +2 -2
- package/dist/{proof-DF6CU-SU.cjs → proof-CWTnYhjS.cjs} +1 -1
- package/dist/{proof-mf6h7n4_.mjs → proof-D2oFOdNA.mjs} +3 -3
- package/dist/{proof-CUSzBztF.js → proof-s9sy44kx.js} +1 -1
- package/dist/{send-LJUzNpVF.mjs → send-xDK5UnL-.mjs} +3 -3
- package/dist/sig/http.test.mjs +3 -3
- package/dist/sig/key.test.mjs +197 -3
- package/dist/sig/ld.test.mjs +47 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +46 -1
- package/dist/sig/proof.test.mjs +52 -1
- package/dist/{temporal-_3yIqdvy.mjs → temporal-C6icc5n9.mjs} +1 -1
- package/dist/utils/docloader.test.mjs +66 -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,27 +1,27 @@
|
|
|
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-y3L4Oa94.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-DBSl8wEr.mjs";
|
|
6
6
|
import { t as formatAcceptSignature } from "./accept-Dd__NiUL.mjs";
|
|
7
|
-
import { o as importJwk, s 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 { t as KvKeyCache } from "./keycache-
|
|
12
|
-
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-
|
|
13
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-
|
|
7
|
+
import { o as importJwk, s as validateCryptoKey, t as exportJwk } from "./key-APURZ0ky.mjs";
|
|
8
|
+
import { l as verifyRequest, o as parseRfc9421SignatureInput, u as verifyRequestDetailed } from "./http-BCSf1KIY.mjs";
|
|
9
|
+
import { t as getAuthenticatedDocumentLoader } from "./docloader-yuyzZC9a.mjs";
|
|
10
|
+
import { n as kvCache } from "./kv-cache-C69dzgQi.mjs";
|
|
11
|
+
import { t as KvKeyCache } from "./keycache-BimEQucx.mjs";
|
|
12
|
+
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-BoLqbDaL.mjs";
|
|
13
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-DjKvngeb.mjs";
|
|
14
14
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-D4iTv7uM.mjs";
|
|
15
|
-
import { i as verifyObject, n as hasProofLike, r as signObject } from "./proof-
|
|
15
|
+
import { i as verifyObject, n as hasProofLike, r as signObject } from "./proof-D2oFOdNA.mjs";
|
|
16
16
|
import { d as readBoundedText, l as BodyTooLargeError, t as getNodeInfo, u as MAX_BODY_SIZE } from "./client-1He2YuBF.mjs";
|
|
17
17
|
import { t as nodeInfoToJson } from "./types-J53Kw7so.mjs";
|
|
18
|
-
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-
|
|
19
|
-
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-
|
|
18
|
+
import { n as extractInboxes, r as sendActivity, t as SendActivityError } from "./send-xDK5UnL-.mjs";
|
|
19
|
+
import { n as FederationBuilderImpl, t as ACTOR_ALIAS_PREFIX } from "./builder-C6yXExXl.mjs";
|
|
20
20
|
import { t as CircuitBreaker } from "./circuit-breaker-D1fxthDI.mjs";
|
|
21
21
|
import { t as buildCollectionSynchronizationHeader } from "./collection-Cc3DVAhE.mjs";
|
|
22
|
-
import { n as routeActivity, t as actorsHaveSameOrigin } from "./inbox-
|
|
22
|
+
import { n as routeActivity, t as actorsHaveSameOrigin } from "./inbox-NObX26c9.mjs";
|
|
23
23
|
import { t as acceptsJsonLd } from "./negotiation-DDstyBvc.mjs";
|
|
24
|
-
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-
|
|
24
|
+
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-C6icc5n9.mjs";
|
|
25
25
|
import { t as createExponentialBackoffPolicy } from "./retry-CXg_MBI-.mjs";
|
|
26
26
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
27
27
|
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-
|
|
7
|
+
const require_http = require("./http-D77Wjrcg.cjs");
|
|
8
|
+
const require_middleware = require("./middleware-BQUQ0pPl.cjs");
|
|
9
9
|
const require_types = require("./types-DRPjmHVV.cjs");
|
|
10
|
-
const require_proof = require("./proof-
|
|
11
|
-
const require_kv_cache = require("./kv-cache-
|
|
10
|
+
const require_proof = require("./proof-CWTnYhjS.cjs");
|
|
11
|
+
const require_kv_cache = require("./kv-cache-Bg4utAuv.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 { F as validateAcceptSignature, M as formatAcceptSignature, N as fulfillAcceptSignature, P as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, i as verifyRequest, l as fetchKeyDetailed, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } 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-
|
|
6
|
+
import { F as validateAcceptSignature, M as formatAcceptSignature, N as fulfillAcceptSignature, P as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, i as verifyRequest, l as fetchKeyDetailed, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "./http-DNM9KyIO.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-CRd1JmuL.js";
|
|
8
8
|
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-miAYfiGO.js";
|
|
9
|
-
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-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
9
|
+
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-s9sy44kx.js";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-LBCwHNLu.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-CxbCIptr.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
6
6
|
import "../std__assert-BjJn2daJ.mjs";
|
|
7
7
|
import { t as MemoryKvStore } from "../kv-mI4Ix2EU.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-CZ8tI1qL.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 { c as verifyKeyOwnership, n as fetchActorDocument, t as exportJwk } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-y3L4Oa94.mjs";
|
|
5
|
+
import { c as verifyKeyOwnership, n as fetchActorDocument, t as exportJwk } from "./key-APURZ0ky.mjs";
|
|
6
6
|
import { getLogger } from "@logtape/logtape";
|
|
7
7
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
@@ -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-D77Wjrcg.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 { 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 { r as fetchKey, s as validateCryptoKey } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-y3L4Oa94.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-DBSl8wEr.mjs";
|
|
6
|
+
import { r as fetchKey, s as validateCryptoKey } from "./key-APURZ0ky.mjs";
|
|
7
7
|
import { n as preloadedOnlyDocumentLoader } from "./public-audience-Dp4ZScSr.mjs";
|
|
8
8
|
import { r as normalizeOutgoingActivityJsonLd } from "./outgoing-jsonld-D4iTv7uM.mjs";
|
|
9
9
|
import { getLogger } from "@logtape/logtape";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { I as name, L as version, c as fetchKey, f as validateCryptoKey, h as getFederationMetrics, m as getDurationMs, o as exportJwk, p as verifyKeyOwnership, s as fetchActorDocument, y as measureSignatureKeyFetch } from "./http-
|
|
3
|
+
import { I as name, L as version, c as fetchKey, f as validateCryptoKey, h as getFederationMetrics, m as getDurationMs, o as exportJwk, p as verifyKeyOwnership, s as fetchActorDocument, y as measureSignatureKeyFetch } from "./http-DNM9KyIO.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 "@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-y3L4Oa94.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics } from "./metrics-DBSl8wEr.mjs";
|
|
6
|
+
import { n as doubleKnock } from "./http-BCSf1KIY.mjs";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
9
9
|
import { FetchError, UrlError, validatePublicUrl } from "@fedify/vocab-runtime";
|
package/dist/sig/http.test.mjs
CHANGED
|
@@ -7,10 +7,10 @@ import { n as assertExists, t as assertStringIncludes } from "../std__assert-BjJ
|
|
|
7
7
|
import { r as assertFalse, t as assertThrows } from "../assert_throws-BbSMEFKo.mjs";
|
|
8
8
|
import { n as assertGreaterOrEqual, t as assertRejects } from "../assert_rejects-D1HYAik3.mjs";
|
|
9
9
|
import { t as assert } from "../assert-CEO06XCw.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-APURZ0ky.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-BCSf1KIY.mjs";
|
|
12
12
|
import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-BAK-tUlf.mjs";
|
|
13
|
-
import { t as KvKeyCache } from "../keycache-
|
|
13
|
+
import { t as KvKeyCache } from "../keycache-BimEQucx.mjs";
|
|
14
14
|
import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
|
|
15
15
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
16
16
|
import { FetchError, UrlError, exportSpki } from "@fedify/vocab-runtime";
|
package/dist/sig/key.test.mjs
CHANGED
|
@@ -3,13 +3,13 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
5
5
|
import "../std__assert-BjJn2daJ.mjs";
|
|
6
|
-
import { t as assertThrows } from "../assert_throws-BbSMEFKo.mjs";
|
|
6
|
+
import { r as assertFalse, t as assertThrows } from "../assert_throws-BbSMEFKo.mjs";
|
|
7
7
|
import { t as assertRejects } from "../assert_rejects-D1HYAik3.mjs";
|
|
8
8
|
import { t as assert } from "../assert-CEO06XCw.mjs";
|
|
9
9
|
import { t as assertStrictEquals } from "../assert_strict_equals-XEgZAlrj.mjs";
|
|
10
|
-
import { a as generateCryptoKeyPair, i as fetchKeyDetailed, o as importJwk, r as fetchKey, s as validateCryptoKey, t as exportJwk } from "../key-
|
|
10
|
+
import { a as generateCryptoKeyPair, i as fetchKeyDetailed, o as importJwk, r as fetchKey, s as validateCryptoKey, t as exportJwk } from "../key-APURZ0ky.mjs";
|
|
11
11
|
import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
12
|
-
import { _ as wrapContextLoaderForJsonLd } from "../ld-
|
|
12
|
+
import { _ as wrapContextLoaderForJsonLd } from "../ld-BoLqbDaL.mjs";
|
|
13
13
|
import { CryptographicKey, Multikey, Person } from "@fedify/vocab";
|
|
14
14
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
15
15
|
import { FetchError, UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -868,5 +868,199 @@ test("fetchKey() records the controller an actor document establishes", async ()
|
|
|
868
868
|
assertEquals(key?.controllerId, new URL(actorId));
|
|
869
869
|
assert(key?.publicKey != null);
|
|
870
870
|
});
|
|
871
|
+
test("fetchKey() rejects a key whose owner redirects to another actor", async () => {
|
|
872
|
+
const keyId = "https://evil.example/keys/1";
|
|
873
|
+
const victim = "https://victim.example/users/alice";
|
|
874
|
+
const mallory = "https://evil.example/users/mallory";
|
|
875
|
+
const { publicKeyPem } = await rsaPublicKey3.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
876
|
+
const cache = {};
|
|
877
|
+
assertEquals(await fetchKey(keyId, CryptographicKey, {
|
|
878
|
+
documentLoader(resource) {
|
|
879
|
+
if (resource === keyId) return Promise.resolve({
|
|
880
|
+
contextUrl: null,
|
|
881
|
+
documentUrl: resource,
|
|
882
|
+
document: {
|
|
883
|
+
"@context": "https://w3id.org/security/v1",
|
|
884
|
+
id: keyId,
|
|
885
|
+
type: "CryptographicKey",
|
|
886
|
+
owner: victim,
|
|
887
|
+
publicKeyPem
|
|
888
|
+
}
|
|
889
|
+
});
|
|
890
|
+
if (resource === victim || resource === mallory) return Promise.resolve({
|
|
891
|
+
contextUrl: null,
|
|
892
|
+
documentUrl: mallory,
|
|
893
|
+
document: {
|
|
894
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
|
|
895
|
+
id: mallory,
|
|
896
|
+
type: "Person",
|
|
897
|
+
publicKey: keyId
|
|
898
|
+
}
|
|
899
|
+
});
|
|
900
|
+
return mockDocumentLoader(resource);
|
|
901
|
+
},
|
|
902
|
+
contextLoader: mockDocumentLoader,
|
|
903
|
+
keyCache: {
|
|
904
|
+
get(keyId) {
|
|
905
|
+
return Promise.resolve(cache[keyId.href]);
|
|
906
|
+
},
|
|
907
|
+
set(keyId, key) {
|
|
908
|
+
cache[keyId.href] = key;
|
|
909
|
+
return Promise.resolve();
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
}), {
|
|
913
|
+
key: null,
|
|
914
|
+
cached: false
|
|
915
|
+
});
|
|
916
|
+
assertEquals(cache, { [keyId]: null });
|
|
917
|
+
});
|
|
918
|
+
test("fetchKey() rejects a key whose owner resolves to another actor on the same origin", async () => {
|
|
919
|
+
const keyId = "https://victim.example/keys/bob";
|
|
920
|
+
const victim = "https://victim.example/users/alice";
|
|
921
|
+
const bob = "https://victim.example/users/bob";
|
|
922
|
+
const { publicKeyPem } = await rsaPublicKey3.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
923
|
+
assertEquals(await fetchKey(keyId, CryptographicKey, {
|
|
924
|
+
documentLoader(resource) {
|
|
925
|
+
if (resource === keyId) return Promise.resolve({
|
|
926
|
+
contextUrl: null,
|
|
927
|
+
documentUrl: resource,
|
|
928
|
+
document: {
|
|
929
|
+
"@context": "https://w3id.org/security/v1",
|
|
930
|
+
id: keyId,
|
|
931
|
+
type: "CryptographicKey",
|
|
932
|
+
owner: victim,
|
|
933
|
+
publicKeyPem
|
|
934
|
+
}
|
|
935
|
+
});
|
|
936
|
+
if (resource === victim || resource === bob) return Promise.resolve({
|
|
937
|
+
contextUrl: null,
|
|
938
|
+
documentUrl: resource,
|
|
939
|
+
document: {
|
|
940
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
|
|
941
|
+
id: bob,
|
|
942
|
+
type: "Person",
|
|
943
|
+
publicKey: keyId
|
|
944
|
+
}
|
|
945
|
+
});
|
|
946
|
+
return mockDocumentLoader(resource);
|
|
947
|
+
},
|
|
948
|
+
contextLoader: mockDocumentLoader
|
|
949
|
+
}), {
|
|
950
|
+
key: null,
|
|
951
|
+
cached: false
|
|
952
|
+
});
|
|
953
|
+
});
|
|
954
|
+
test("fetchKey() rejects a Multikey whose controller redirects to another actor", async () => {
|
|
955
|
+
const keyId = "https://evil.example/keys/ed25519";
|
|
956
|
+
const victim = "https://victim.example/users/alice";
|
|
957
|
+
const mallory = "https://evil.example/users/mallory";
|
|
958
|
+
const multikeyDocument = await ed25519Multikey.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
959
|
+
assertEquals(await fetchKey(keyId, Multikey, {
|
|
960
|
+
documentLoader(resource) {
|
|
961
|
+
if (resource === keyId) return Promise.resolve({
|
|
962
|
+
contextUrl: null,
|
|
963
|
+
documentUrl: resource,
|
|
964
|
+
document: {
|
|
965
|
+
...multikeyDocument,
|
|
966
|
+
id: keyId,
|
|
967
|
+
controller: victim
|
|
968
|
+
}
|
|
969
|
+
});
|
|
970
|
+
if (resource === victim || resource === mallory) return Promise.resolve({
|
|
971
|
+
contextUrl: null,
|
|
972
|
+
documentUrl: mallory,
|
|
973
|
+
document: {
|
|
974
|
+
"@context": [
|
|
975
|
+
"https://www.w3.org/ns/activitystreams",
|
|
976
|
+
"https://w3id.org/security/v1",
|
|
977
|
+
"https://w3id.org/security/multikey/v1",
|
|
978
|
+
"https://w3id.org/security/data-integrity/v1",
|
|
979
|
+
"https://www.w3.org/ns/did/v1"
|
|
980
|
+
],
|
|
981
|
+
id: mallory,
|
|
982
|
+
type: "Person",
|
|
983
|
+
assertionMethod: [keyId]
|
|
984
|
+
}
|
|
985
|
+
});
|
|
986
|
+
return mockDocumentLoader(resource);
|
|
987
|
+
},
|
|
988
|
+
contextLoader: mockDocumentLoader
|
|
989
|
+
}), {
|
|
990
|
+
key: null,
|
|
991
|
+
cached: false
|
|
992
|
+
});
|
|
993
|
+
});
|
|
994
|
+
test("fetchKey() accepts an owner whose document URL differs from its id", async () => {
|
|
995
|
+
const keyId = "https://victim.example/keys/alice";
|
|
996
|
+
const alice = "https://victim.example/users/alice";
|
|
997
|
+
const { publicKeyPem } = await rsaPublicKey3.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
998
|
+
const { key, cached } = await fetchKey(keyId, CryptographicKey, {
|
|
999
|
+
documentLoader(resource) {
|
|
1000
|
+
if (resource === keyId) return Promise.resolve({
|
|
1001
|
+
contextUrl: null,
|
|
1002
|
+
documentUrl: resource,
|
|
1003
|
+
document: {
|
|
1004
|
+
"@context": "https://w3id.org/security/v1",
|
|
1005
|
+
id: keyId,
|
|
1006
|
+
type: "CryptographicKey",
|
|
1007
|
+
owner: alice,
|
|
1008
|
+
publicKeyPem
|
|
1009
|
+
}
|
|
1010
|
+
});
|
|
1011
|
+
if (resource === alice) return Promise.resolve({
|
|
1012
|
+
contextUrl: null,
|
|
1013
|
+
documentUrl: `${alice}.json`,
|
|
1014
|
+
document: {
|
|
1015
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
|
|
1016
|
+
id: alice,
|
|
1017
|
+
type: "Person",
|
|
1018
|
+
publicKey: keyId
|
|
1019
|
+
}
|
|
1020
|
+
});
|
|
1021
|
+
return mockDocumentLoader(resource);
|
|
1022
|
+
},
|
|
1023
|
+
contextLoader: mockDocumentLoader
|
|
1024
|
+
});
|
|
1025
|
+
assertFalse(cached);
|
|
1026
|
+
assertEquals(key?.id, new URL(keyId));
|
|
1027
|
+
assertEquals(key?.ownerId, new URL(alice));
|
|
1028
|
+
});
|
|
1029
|
+
test("fetchKey() rejects an owner reached through a normalization redirect", async () => {
|
|
1030
|
+
const keyId = "https://victim.example/keys/alice";
|
|
1031
|
+
const canonical = "https://victim.example/users/alice";
|
|
1032
|
+
const nonCanonical = "https://victim.example/users/Alice";
|
|
1033
|
+
const { publicKeyPem } = await rsaPublicKey3.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
1034
|
+
assertEquals(await fetchKey(keyId, CryptographicKey, {
|
|
1035
|
+
documentLoader(resource) {
|
|
1036
|
+
if (resource === keyId) return Promise.resolve({
|
|
1037
|
+
contextUrl: null,
|
|
1038
|
+
documentUrl: resource,
|
|
1039
|
+
document: {
|
|
1040
|
+
"@context": "https://w3id.org/security/v1",
|
|
1041
|
+
id: keyId,
|
|
1042
|
+
type: "CryptographicKey",
|
|
1043
|
+
owner: nonCanonical,
|
|
1044
|
+
publicKeyPem
|
|
1045
|
+
}
|
|
1046
|
+
});
|
|
1047
|
+
if (resource === canonical || resource === nonCanonical) return Promise.resolve({
|
|
1048
|
+
contextUrl: null,
|
|
1049
|
+
documentUrl: canonical,
|
|
1050
|
+
document: {
|
|
1051
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
|
|
1052
|
+
id: canonical,
|
|
1053
|
+
type: "Person",
|
|
1054
|
+
publicKey: keyId
|
|
1055
|
+
}
|
|
1056
|
+
});
|
|
1057
|
+
return mockDocumentLoader(resource);
|
|
1058
|
+
},
|
|
1059
|
+
contextLoader: mockDocumentLoader
|
|
1060
|
+
}), {
|
|
1061
|
+
key: null,
|
|
1062
|
+
cached: false
|
|
1063
|
+
});
|
|
1064
|
+
});
|
|
871
1065
|
//#endregion
|
|
872
1066
|
export {};
|
package/dist/sig/ld.test.mjs
CHANGED
|
@@ -5,9 +5,9 @@ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
|
5
5
|
import { r as assertFalse, t as assertThrows } from "../assert_throws-BbSMEFKo.mjs";
|
|
6
6
|
import { n as assertGreaterOrEqual, t as assertRejects } from "../assert_rejects-D1HYAik3.mjs";
|
|
7
7
|
import { n as assertInstanceOf, t as assert } from "../assert-CEO06XCw.mjs";
|
|
8
|
-
import { a as generateCryptoKeyPair } from "../key-
|
|
8
|
+
import { a as generateCryptoKeyPair } from "../key-APURZ0ky.mjs";
|
|
9
9
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.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-BoLqbDaL.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";
|
|
@@ -993,5 +993,50 @@ test("verifyJsonLd() rejects a key that claims a forged owner", async () => {
|
|
|
993
993
|
contextLoader: mockDocumentLoader
|
|
994
994
|
}));
|
|
995
995
|
});
|
|
996
|
+
test("verifyJsonLd() rejects a key whose owner redirects to another actor", async () => {
|
|
997
|
+
const keyId = new URL("https://evil.example/keys/1");
|
|
998
|
+
const victim = "https://victim.example/users/alice";
|
|
999
|
+
const mallory = "https://evil.example/users/mallory";
|
|
1000
|
+
const { publicKeyPem } = await rsaPublicKey3.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
1001
|
+
const signed = await signJsonLd({
|
|
1002
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
1003
|
+
id: "https://victim.example/activities/forged",
|
|
1004
|
+
type: "Create",
|
|
1005
|
+
actor: victim,
|
|
1006
|
+
object: {
|
|
1007
|
+
type: "Note",
|
|
1008
|
+
content: "forged"
|
|
1009
|
+
}
|
|
1010
|
+
}, rsaPrivateKey3, keyId, { contextLoader: mockDocumentLoader });
|
|
1011
|
+
const options = {
|
|
1012
|
+
documentLoader(resource) {
|
|
1013
|
+
if (resource === keyId.href) return Promise.resolve({
|
|
1014
|
+
contextUrl: null,
|
|
1015
|
+
documentUrl: resource,
|
|
1016
|
+
document: {
|
|
1017
|
+
"@context": "https://w3id.org/security/v1",
|
|
1018
|
+
id: keyId.href,
|
|
1019
|
+
type: "CryptographicKey",
|
|
1020
|
+
owner: victim,
|
|
1021
|
+
publicKeyPem
|
|
1022
|
+
}
|
|
1023
|
+
});
|
|
1024
|
+
if (resource === victim || resource === mallory) return Promise.resolve({
|
|
1025
|
+
contextUrl: null,
|
|
1026
|
+
documentUrl: mallory,
|
|
1027
|
+
document: {
|
|
1028
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
|
|
1029
|
+
id: mallory,
|
|
1030
|
+
type: "Person",
|
|
1031
|
+
publicKey: keyId.href
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
return mockDocumentLoader(resource);
|
|
1035
|
+
},
|
|
1036
|
+
contextLoader: mockDocumentLoader
|
|
1037
|
+
};
|
|
1038
|
+
assertEquals(await verifySignature(signed, options), null);
|
|
1039
|
+
assertFalse(await verifyJsonLd(signed, options));
|
|
1040
|
+
});
|
|
996
1041
|
//#endregion
|
|
997
1042
|
export {};
|
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-D77Wjrcg.cjs");
|
|
5
|
+
const require_proof = require("../proof-CWTnYhjS.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 { F as validateAcceptSignature, M as formatAcceptSignature, N as fulfillAcceptSignature, P as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, i as verifyRequest, l as fetchKeyDetailed, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } 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 { F as validateAcceptSignature, M as formatAcceptSignature, N as fulfillAcceptSignature, P as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, i as verifyRequest, l as fetchKeyDetailed, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "../http-DNM9KyIO.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-s9sy44kx.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-BjJn2daJ.mjs";
|
|
|
6
6
|
import { r as assertFalse } from "../assert_throws-BbSMEFKo.mjs";
|
|
7
7
|
import { t as assert } from "../assert-CEO06XCw.mjs";
|
|
8
8
|
import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-BAK-tUlf.mjs";
|
|
9
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-
|
|
9
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-DjKvngeb.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
|
|
@@ -153,5 +153,50 @@ test("doesActorOwnKey() matches a key that leaves its id implicit", async () =>
|
|
|
153
153
|
publicKey: rsaPublicKey2.publicKey
|
|
154
154
|
}), options));
|
|
155
155
|
});
|
|
156
|
+
test("doesActorOwnKey() rejects an actor ID that redirects to the key's owner", async () => {
|
|
157
|
+
const keyId = "https://evil.example/keys/1";
|
|
158
|
+
const victim = "https://victim.example/users/alice";
|
|
159
|
+
const mallory = "https://evil.example/users/mallory";
|
|
160
|
+
const { publicKeyPem } = await rsaPublicKey1.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
161
|
+
const serveKeyOwnedBy = (owner) => ({
|
|
162
|
+
documentLoader(resource) {
|
|
163
|
+
if (resource === keyId) return Promise.resolve({
|
|
164
|
+
contextUrl: null,
|
|
165
|
+
documentUrl: resource,
|
|
166
|
+
document: {
|
|
167
|
+
"@context": "https://w3id.org/security/v1",
|
|
168
|
+
id: keyId,
|
|
169
|
+
type: "CryptographicKey",
|
|
170
|
+
owner,
|
|
171
|
+
publicKeyPem
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
if (resource === victim || resource === mallory) return Promise.resolve({
|
|
175
|
+
contextUrl: null,
|
|
176
|
+
documentUrl: mallory,
|
|
177
|
+
document: {
|
|
178
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
|
|
179
|
+
id: mallory,
|
|
180
|
+
type: "Person",
|
|
181
|
+
publicKey: keyId
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
return mockDocumentLoader(resource);
|
|
185
|
+
},
|
|
186
|
+
contextLoader: mockDocumentLoader
|
|
187
|
+
});
|
|
188
|
+
const activity = new Create({ actor: new URL(victim) });
|
|
189
|
+
assertFalse(await doesActorOwnKey(activity, new CryptographicKey({
|
|
190
|
+
id: new URL(keyId),
|
|
191
|
+
owner: new URL(mallory),
|
|
192
|
+
publicKey: rsaPublicKey1.publicKey
|
|
193
|
+
}), serveKeyOwnedBy(mallory)));
|
|
194
|
+
assertFalse(await doesActorOwnKey(activity, new CryptographicKey({
|
|
195
|
+
id: new URL(keyId),
|
|
196
|
+
owner: new URL(victim),
|
|
197
|
+
publicKey: rsaPublicKey1.publicKey
|
|
198
|
+
}), serveKeyOwnedBy(victim)));
|
|
199
|
+
assertEquals(await getKeyOwner(new URL(keyId), serveKeyOwnedBy(victim)), null);
|
|
200
|
+
});
|
|
156
201
|
//#endregion
|
|
157
202
|
export {};
|
package/dist/sig/proof.test.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { n as assertGreaterOrEqual, t as assertRejects } from "../assert_rejects
|
|
|
8
8
|
import { n as assertInstanceOf, t as assert } from "../assert-CEO06XCw.mjs";
|
|
9
9
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
10
10
|
import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-D4iTv7uM.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-D2oFOdNA.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
14
|
import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
|
|
@@ -599,5 +599,56 @@ test("verifyObject() rejects a key that claims a forged controller", async () =>
|
|
|
599
599
|
contextLoader: mockDocumentLoader
|
|
600
600
|
}), null);
|
|
601
601
|
});
|
|
602
|
+
test("verifyObject() rejects a key whose controller redirects to another actor", async () => {
|
|
603
|
+
const keyId = new URL("https://evil.example/keys/ed25519");
|
|
604
|
+
const victim = "https://victim.example/users/alice";
|
|
605
|
+
const mallory = "https://evil.example/users/mallory";
|
|
606
|
+
const multikeyDocument = await ed25519Multikey.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
607
|
+
const signOptions = {
|
|
608
|
+
format: "compact",
|
|
609
|
+
contextLoader: mockDocumentLoader,
|
|
610
|
+
documentLoader: mockDocumentLoader,
|
|
611
|
+
context: ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"]
|
|
612
|
+
};
|
|
613
|
+
assertEquals(await verifyObject(Create, await (await signObject(new Create({
|
|
614
|
+
id: new URL("https://victim.example/activities/forged"),
|
|
615
|
+
actor: new URL(victim),
|
|
616
|
+
object: new Note({
|
|
617
|
+
id: new URL("https://victim.example/notes/forged"),
|
|
618
|
+
attribution: new URL(victim),
|
|
619
|
+
content: "forged"
|
|
620
|
+
})
|
|
621
|
+
}), ed25519PrivateKey, keyId, signOptions)).toJsonLd(signOptions), {
|
|
622
|
+
documentLoader(resource) {
|
|
623
|
+
if (resource === keyId.href) return Promise.resolve({
|
|
624
|
+
contextUrl: null,
|
|
625
|
+
documentUrl: resource,
|
|
626
|
+
document: {
|
|
627
|
+
...multikeyDocument,
|
|
628
|
+
id: keyId.href,
|
|
629
|
+
controller: victim
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
if (resource === victim || resource === mallory) return Promise.resolve({
|
|
633
|
+
contextUrl: null,
|
|
634
|
+
documentUrl: mallory,
|
|
635
|
+
document: {
|
|
636
|
+
"@context": [
|
|
637
|
+
"https://www.w3.org/ns/activitystreams",
|
|
638
|
+
"https://w3id.org/security/v1",
|
|
639
|
+
"https://w3id.org/security/multikey/v1",
|
|
640
|
+
"https://w3id.org/security/data-integrity/v1",
|
|
641
|
+
"https://www.w3.org/ns/did/v1"
|
|
642
|
+
],
|
|
643
|
+
id: mallory,
|
|
644
|
+
type: "Person",
|
|
645
|
+
assertionMethod: [keyId.href]
|
|
646
|
+
}
|
|
647
|
+
});
|
|
648
|
+
return mockDocumentLoader(resource);
|
|
649
|
+
},
|
|
650
|
+
contextLoader: mockDocumentLoader
|
|
651
|
+
}), null);
|
|
652
|
+
});
|
|
602
653
|
//#endregion
|
|
603
654
|
export {};
|
|
@@ -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-BoLqbDaL.mjs";
|
|
5
5
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
6
6
|
//#region src/federation/temporal.ts
|
|
7
7
|
function isPlainObject(value) {
|