@fedify/fedify 2.5.0-dev.2420 → 2.5.0-dev.2432
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-Cwc3Eu59.mjs → builder-nME5sBeL.mjs} +2 -2
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-Dtwrhs1I.mjs → compound-proof-C-tPcb-r.mjs} +2 -2
- package/dist/{deno-D4J5fszd.mjs → deno-Cqkt-KD5.mjs} +1 -1
- package/dist/{docloader-ChK1DQkj.mjs → docloader-CGBUQXUP.mjs} +5 -3
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +3 -3
- package/dist/federation/handler-compound-proof.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +4 -4
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox-report.test.mjs +5 -5
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/keycache.test.mjs +20 -9
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +90 -9
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.js +1 -1
- package/dist/federation/outgoing-proof.test.mjs +4 -4
- package/dist/federation/portable-actor.test.mjs +3 -3
- package/dist/federation/portable-chain.test.mjs +3 -3
- package/dist/federation/portable-collection.test.mjs +4 -4
- package/dist/federation/portable-delivery.test.mjs +2 -2
- package/dist/federation/portable-gateway-keys.test.mjs +5 -5
- package/dist/federation/portable-inbox.test.mjs +4 -4
- package/dist/federation/portable-parse-uri.test.mjs +1 -1
- package/dist/federation/portable-route-activity.test.mjs +2 -2
- package/dist/federation/portable.test.mjs +3 -3
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/tasks/enqueue.test.mjs +1 -1
- package/dist/federation/tasks/tasks.test.mjs +2 -2
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-DxQI9dSY.cjs → federation-CM-zrOdz.cjs} +12 -5
- package/dist/{http-SBTDzPkh.cjs → http-C88K-3A8.cjs} +17 -3
- package/dist/{http-C8rIQ1pK.js → http-KKViNOVp.js} +17 -3
- package/dist/{http--kHQomKT.mjs → http-VRVl77qN.mjs} +4 -4
- package/dist/{inbox-BGD7K-Ra.mjs → inbox-Blrwn114.mjs} +2 -2
- package/dist/{keycache-D-MNltOk.mjs → keycache-N2opu4-3.mjs} +1 -1
- package/dist/{kv-cache-DSUypZWS.js → kv-cache-DBnYVLSn.js} +4 -2
- package/dist/{kv-cache-B8LMKVe8.mjs → kv-cache-Dt0qeX6M.mjs} +1 -1
- package/dist/{kv-cache-Dp_dDR1f.cjs → kv-cache-trql9zWb.cjs} +4 -2
- package/dist/{ld-BeBdBDAY.mjs → ld-C13upTHv.mjs} +18 -4
- package/dist/{metrics-Dtb81JxK.mjs → metrics-Ci3oTjhF.mjs} +1 -1
- package/dist/{middleware-DNjv5rBL.js → middleware-Ckc0daKd.js} +12 -5
- package/dist/{middleware-DhI-75xh.mjs → middleware-CzicgguP.mjs} +1 -1
- package/dist/{middleware-rQqAHzIo.mjs → middleware-Defzf-30.mjs} +23 -16
- package/dist/mod.cjs +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-u_-HQrgE.mjs → owner-BBB-PayE.mjs} +3 -3
- package/dist/{portable-collection-B-x4XwxP.cjs → portable-collection-Byajf90m.cjs} +1 -1
- package/dist/{portable-collection-BKkTJQTd.mjs → portable-collection-DKs8iX1J.mjs} +2 -2
- package/dist/{portable-collection-DReoGwZQ.js → portable-collection-sJBoBful.js} +1 -1
- package/dist/{portable-key-Bkm6sXJB.mjs → portable-key-zbE5iDhv.mjs} +1 -1
- package/dist/{proof-DOV4ZiAo.mjs → proof-DdI4I2Jg.mjs} +3 -3
- package/dist/{send-C_Fffu0I.mjs → send-DDSpf_ym.mjs} +3 -3
- package/dist/sig/compound-proof-discovery.test.mjs +1 -1
- package/dist/sig/compound-proof-producer.test.mjs +1 -1
- package/dist/sig/compound-proof-verification.test.mjs +2 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +3 -3
- package/dist/sig/key.test.mjs +196 -1
- package/dist/sig/ld.test.mjs +46 -1
- package/dist/sig/mitra-receive-interop.test.mjs +4 -4
- package/dist/sig/mitra-send-interop.test.mjs +3 -3
- 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/portable-collection.test.mjs +1 -1
- package/dist/sig/portable-interop.test.mjs +3 -3
- package/dist/sig/portable-key.test.mjs +6 -6
- package/dist/sig/proof.test.mjs +54 -3
- package/dist/sig/tootik-request-interop.test.mjs +4 -4
- package/dist/sig/tootik-send-interop.test.mjs +3 -3
- package/dist/sig/verification.test.mjs +3 -3
- package/dist/{temporal-BRgOZRRr.mjs → temporal-CGJWetE6.mjs} +1 -1
- package/dist/testing/kv.test.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
|
@@ -2,9 +2,9 @@ import "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { d as isPortableUri } from "./portable-key-id-Ca30-hOa.mjs";
|
|
5
|
-
import { n as version, t as name } from "./deno-
|
|
6
|
-
import { n as getDurationMs, r as getFederationMetrics } from "./metrics-
|
|
7
|
-
import { n as doubleKnock } from "./http
|
|
5
|
+
import { n as version, t as name } from "./deno-Cqkt-KD5.mjs";
|
|
6
|
+
import { n as getDurationMs, r as getFederationMetrics } from "./metrics-Ci3oTjhF.mjs";
|
|
7
|
+
import { n as doubleKnock } from "./http-VRVl77qN.mjs";
|
|
8
8
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
9
9
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
10
10
|
import { FetchError, UrlError, canonicalizePortableUri, getFe34Origin, isGatewayUrl, toCompatibleEf61Id, validatePublicUrl } from "@fedify/vocab-runtime";
|
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
|
-
import { a as inspectCompoundPortableObjectApplicability, n as discoverCompoundProofDocuments } from "../compound-proof-
|
|
6
|
+
import { a as inspectCompoundPortableObjectApplicability, n as discoverCompoundProofDocuments } from "../compound-proof-C-tPcb-r.mjs";
|
|
7
7
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/sig/compound-proof-discovery.test.ts
|
|
@@ -3,7 +3,7 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
|
-
import { a as inspectCompoundPortableObjectApplicability, i as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "../compound-proof-
|
|
6
|
+
import { a as inspectCompoundPortableObjectApplicability, i as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "../compound-proof-C-tPcb-r.mjs";
|
|
7
7
|
import { test } from "@fedify/fixture";
|
|
8
8
|
//#region src/sig/compound-proof-producer.test.ts
|
|
9
9
|
const portableId = "ap+ef61://did:key:z6MkAlice/objects/1";
|
|
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
|
-
import { s as verifyMapLocalProof, u as verifyPortableObjectProofPolicy } from "../proof-
|
|
7
|
+
import { s as verifyMapLocalProof, u as verifyPortableObjectProofPolicy } from "../proof-DdI4I2Jg.mjs";
|
|
8
8
|
import { n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
9
|
-
import { a as inspectCompoundPortableObjectApplicability, o as verifyCompoundPortableObjectProofs, s as verifyCompoundProofDocuments, t as containsCompoundPortableObject } from "../compound-proof-
|
|
9
|
+
import { a as inspectCompoundPortableObjectApplicability, o as verifyCompoundPortableObjectProofs, s as verifyCompoundProofDocuments, t as containsCompoundPortableObject } from "../compound-proof-C-tPcb-r.mjs";
|
|
10
10
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
11
11
|
import { t as map_local_context_conflict_default } from "../map-local-context-conflict-DOYEEJ3u.mjs";
|
|
12
12
|
import { CryptographicKey, Multikey, Person } from "@fedify/vocab";
|
|
@@ -6,9 +6,9 @@ import "../std__assert-DvMDRPes.mjs";
|
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
7
|
import { n as preloadedOnlyDocumentLoader } from "../public-audience--klBIOk1.mjs";
|
|
8
8
|
import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-4IJqPYos.mjs";
|
|
9
|
-
import { o as signObject, p as verifyProof } from "../proof-
|
|
9
|
+
import { o as signObject, p as verifyProof } from "../proof-DdI4I2Jg.mjs";
|
|
10
10
|
import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
|
|
11
|
-
import { s as verifyCompoundProofDocuments } from "../compound-proof-
|
|
11
|
+
import { s as verifyCompoundProofDocuments } from "../compound-proof-C-tPcb-r.mjs";
|
|
12
12
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
13
13
|
import { t as map_local_context_conflict_default } from "../map-local-context-conflict-DOYEEJ3u.mjs";
|
|
14
14
|
import { Create, DataIntegrityProof, Note, Question } from "@fedify/vocab";
|
package/dist/sig/http.test.mjs
CHANGED
|
@@ -12,10 +12,10 @@ import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
|
12
12
|
import "../std__assert-DvMDRPes.mjs";
|
|
13
13
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
14
14
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
15
|
-
import { y as exportJwk } from "../ld-
|
|
16
|
-
import { a as listRequestSignatures, c as selectRequestSignature, f as verifyRequest, i as formatRfc9421SignatureParameters, l as signRequest, n as doubleKnock, o as parseRfc9421Signature, p as verifyRequestDetailed, r as formatRfc9421Signature, s as parseRfc9421SignatureInput, t as createRfc9421SignatureBase, u as timingSafeEqual } from "../http
|
|
15
|
+
import { y as exportJwk } from "../ld-C13upTHv.mjs";
|
|
16
|
+
import { a as listRequestSignatures, c as selectRequestSignature, f as verifyRequest, i as formatRfc9421SignatureParameters, l as signRequest, n as doubleKnock, o as parseRfc9421Signature, p as verifyRequestDetailed, r as formatRfc9421Signature, s as parseRfc9421SignatureInput, t as createRfc9421SignatureBase, u as timingSafeEqual } from "../http-VRVl77qN.mjs";
|
|
17
17
|
import { a as rsaPrivateKey3, i as rsaPrivateKey2, l as rsaPublicKey5, n as ed25519PrivateKey, o as rsaPublicKey1, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
18
|
-
import { t as KvKeyCache } from "../keycache-
|
|
18
|
+
import { t as KvKeyCache } from "../keycache-N2opu4-3.mjs";
|
|
19
19
|
import { FetchError, UrlError, exportSpki, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
20
20
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
21
21
|
import { encodeBase64 } from "byte-encodings/base64";
|
package/dist/sig/key.test.mjs
CHANGED
|
@@ -2,12 +2,13 @@ import "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
|
+
import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
|
|
5
6
|
import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
6
7
|
import "../std__assert-DvMDRPes.mjs";
|
|
7
8
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
8
9
|
import { t as assertStrictEquals } from "../assert_strict_equals-CYvBmkpC.mjs";
|
|
9
10
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
10
|
-
import { C as generateCryptoKeyPair, S as fetchKeyDetailed, T as validateCryptoKey, _ as wrapContextLoaderForJsonLd, w as importJwk, x as fetchKey, y as exportJwk } from "../ld-
|
|
11
|
+
import { C as generateCryptoKeyPair, S as fetchKeyDetailed, T as validateCryptoKey, _ as wrapContextLoaderForJsonLd, w as importJwk, x as fetchKey, y as exportJwk } from "../ld-C13upTHv.mjs";
|
|
11
12
|
import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
12
13
|
import { CryptographicKey, Multikey, Person } from "@fedify/vocab";
|
|
13
14
|
import { FetchError, UrlError, exportDidKey, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -1051,5 +1052,199 @@ test("fetchKey() records the controller an actor document establishes", async ()
|
|
|
1051
1052
|
assertEquals(key?.controllerId, new URL(actorId));
|
|
1052
1053
|
assert(key?.publicKey != null);
|
|
1053
1054
|
});
|
|
1055
|
+
test("fetchKey() rejects a key whose owner redirects to another actor", async () => {
|
|
1056
|
+
const keyId = "https://evil.example/keys/1";
|
|
1057
|
+
const victim = "https://victim.example/users/alice";
|
|
1058
|
+
const mallory = "https://evil.example/users/mallory";
|
|
1059
|
+
const { publicKeyPem } = await rsaPublicKey3.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
1060
|
+
const cache = {};
|
|
1061
|
+
assertEquals(await fetchKey(keyId, CryptographicKey, {
|
|
1062
|
+
documentLoader(resource) {
|
|
1063
|
+
if (resource === keyId) return Promise.resolve({
|
|
1064
|
+
contextUrl: null,
|
|
1065
|
+
documentUrl: resource,
|
|
1066
|
+
document: {
|
|
1067
|
+
"@context": "https://w3id.org/security/v1",
|
|
1068
|
+
id: keyId,
|
|
1069
|
+
type: "CryptographicKey",
|
|
1070
|
+
owner: victim,
|
|
1071
|
+
publicKeyPem
|
|
1072
|
+
}
|
|
1073
|
+
});
|
|
1074
|
+
if (resource === victim || resource === mallory) return Promise.resolve({
|
|
1075
|
+
contextUrl: null,
|
|
1076
|
+
documentUrl: mallory,
|
|
1077
|
+
document: {
|
|
1078
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
|
|
1079
|
+
id: mallory,
|
|
1080
|
+
type: "Person",
|
|
1081
|
+
publicKey: keyId
|
|
1082
|
+
}
|
|
1083
|
+
});
|
|
1084
|
+
return mockDocumentLoader(resource);
|
|
1085
|
+
},
|
|
1086
|
+
contextLoader: mockDocumentLoader,
|
|
1087
|
+
keyCache: {
|
|
1088
|
+
get(keyId) {
|
|
1089
|
+
return Promise.resolve(cache[keyId.href]);
|
|
1090
|
+
},
|
|
1091
|
+
set(keyId, key) {
|
|
1092
|
+
cache[keyId.href] = key;
|
|
1093
|
+
return Promise.resolve();
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
}), {
|
|
1097
|
+
key: null,
|
|
1098
|
+
cached: false
|
|
1099
|
+
});
|
|
1100
|
+
assertEquals(cache, { [keyId]: null });
|
|
1101
|
+
});
|
|
1102
|
+
test("fetchKey() rejects a key whose owner resolves to another actor on the same origin", async () => {
|
|
1103
|
+
const keyId = "https://victim.example/keys/bob";
|
|
1104
|
+
const victim = "https://victim.example/users/alice";
|
|
1105
|
+
const bob = "https://victim.example/users/bob";
|
|
1106
|
+
const { publicKeyPem } = await rsaPublicKey3.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
1107
|
+
assertEquals(await fetchKey(keyId, CryptographicKey, {
|
|
1108
|
+
documentLoader(resource) {
|
|
1109
|
+
if (resource === keyId) return Promise.resolve({
|
|
1110
|
+
contextUrl: null,
|
|
1111
|
+
documentUrl: resource,
|
|
1112
|
+
document: {
|
|
1113
|
+
"@context": "https://w3id.org/security/v1",
|
|
1114
|
+
id: keyId,
|
|
1115
|
+
type: "CryptographicKey",
|
|
1116
|
+
owner: victim,
|
|
1117
|
+
publicKeyPem
|
|
1118
|
+
}
|
|
1119
|
+
});
|
|
1120
|
+
if (resource === victim || resource === bob) return Promise.resolve({
|
|
1121
|
+
contextUrl: null,
|
|
1122
|
+
documentUrl: resource,
|
|
1123
|
+
document: {
|
|
1124
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
|
|
1125
|
+
id: bob,
|
|
1126
|
+
type: "Person",
|
|
1127
|
+
publicKey: keyId
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
return mockDocumentLoader(resource);
|
|
1131
|
+
},
|
|
1132
|
+
contextLoader: mockDocumentLoader
|
|
1133
|
+
}), {
|
|
1134
|
+
key: null,
|
|
1135
|
+
cached: false
|
|
1136
|
+
});
|
|
1137
|
+
});
|
|
1138
|
+
test("fetchKey() rejects a Multikey whose controller redirects to another actor", async () => {
|
|
1139
|
+
const keyId = "https://evil.example/keys/ed25519";
|
|
1140
|
+
const victim = "https://victim.example/users/alice";
|
|
1141
|
+
const mallory = "https://evil.example/users/mallory";
|
|
1142
|
+
const multikeyDocument = await ed25519Multikey.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
1143
|
+
assertEquals(await fetchKey(keyId, Multikey, {
|
|
1144
|
+
documentLoader(resource) {
|
|
1145
|
+
if (resource === keyId) return Promise.resolve({
|
|
1146
|
+
contextUrl: null,
|
|
1147
|
+
documentUrl: resource,
|
|
1148
|
+
document: {
|
|
1149
|
+
...multikeyDocument,
|
|
1150
|
+
id: keyId,
|
|
1151
|
+
controller: victim
|
|
1152
|
+
}
|
|
1153
|
+
});
|
|
1154
|
+
if (resource === victim || resource === mallory) return Promise.resolve({
|
|
1155
|
+
contextUrl: null,
|
|
1156
|
+
documentUrl: mallory,
|
|
1157
|
+
document: {
|
|
1158
|
+
"@context": [
|
|
1159
|
+
"https://www.w3.org/ns/activitystreams",
|
|
1160
|
+
"https://w3id.org/security/v1",
|
|
1161
|
+
"https://w3id.org/security/multikey/v1",
|
|
1162
|
+
"https://w3id.org/security/data-integrity/v1",
|
|
1163
|
+
"https://www.w3.org/ns/did/v1"
|
|
1164
|
+
],
|
|
1165
|
+
id: mallory,
|
|
1166
|
+
type: "Person",
|
|
1167
|
+
assertionMethod: [keyId]
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
return mockDocumentLoader(resource);
|
|
1171
|
+
},
|
|
1172
|
+
contextLoader: mockDocumentLoader
|
|
1173
|
+
}), {
|
|
1174
|
+
key: null,
|
|
1175
|
+
cached: false
|
|
1176
|
+
});
|
|
1177
|
+
});
|
|
1178
|
+
test("fetchKey() accepts an owner whose document URL differs from its id", async () => {
|
|
1179
|
+
const keyId = "https://victim.example/keys/alice";
|
|
1180
|
+
const alice = "https://victim.example/users/alice";
|
|
1181
|
+
const { publicKeyPem } = await rsaPublicKey3.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
1182
|
+
const { key, cached } = await fetchKey(keyId, CryptographicKey, {
|
|
1183
|
+
documentLoader(resource) {
|
|
1184
|
+
if (resource === keyId) return Promise.resolve({
|
|
1185
|
+
contextUrl: null,
|
|
1186
|
+
documentUrl: resource,
|
|
1187
|
+
document: {
|
|
1188
|
+
"@context": "https://w3id.org/security/v1",
|
|
1189
|
+
id: keyId,
|
|
1190
|
+
type: "CryptographicKey",
|
|
1191
|
+
owner: alice,
|
|
1192
|
+
publicKeyPem
|
|
1193
|
+
}
|
|
1194
|
+
});
|
|
1195
|
+
if (resource === alice) return Promise.resolve({
|
|
1196
|
+
contextUrl: null,
|
|
1197
|
+
documentUrl: `${alice}.json`,
|
|
1198
|
+
document: {
|
|
1199
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
|
|
1200
|
+
id: alice,
|
|
1201
|
+
type: "Person",
|
|
1202
|
+
publicKey: keyId
|
|
1203
|
+
}
|
|
1204
|
+
});
|
|
1205
|
+
return mockDocumentLoader(resource);
|
|
1206
|
+
},
|
|
1207
|
+
contextLoader: mockDocumentLoader
|
|
1208
|
+
});
|
|
1209
|
+
assertFalse(cached);
|
|
1210
|
+
assertEquals(key?.id, new URL(keyId));
|
|
1211
|
+
assertEquals(key?.ownerId, new URL(alice));
|
|
1212
|
+
});
|
|
1213
|
+
test("fetchKey() rejects an owner reached through a normalization redirect", async () => {
|
|
1214
|
+
const keyId = "https://victim.example/keys/alice";
|
|
1215
|
+
const canonical = "https://victim.example/users/alice";
|
|
1216
|
+
const nonCanonical = "https://victim.example/users/Alice";
|
|
1217
|
+
const { publicKeyPem } = await rsaPublicKey3.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
1218
|
+
assertEquals(await fetchKey(keyId, CryptographicKey, {
|
|
1219
|
+
documentLoader(resource) {
|
|
1220
|
+
if (resource === keyId) return Promise.resolve({
|
|
1221
|
+
contextUrl: null,
|
|
1222
|
+
documentUrl: resource,
|
|
1223
|
+
document: {
|
|
1224
|
+
"@context": "https://w3id.org/security/v1",
|
|
1225
|
+
id: keyId,
|
|
1226
|
+
type: "CryptographicKey",
|
|
1227
|
+
owner: nonCanonical,
|
|
1228
|
+
publicKeyPem
|
|
1229
|
+
}
|
|
1230
|
+
});
|
|
1231
|
+
if (resource === canonical || resource === nonCanonical) return Promise.resolve({
|
|
1232
|
+
contextUrl: null,
|
|
1233
|
+
documentUrl: canonical,
|
|
1234
|
+
document: {
|
|
1235
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
|
|
1236
|
+
id: canonical,
|
|
1237
|
+
type: "Person",
|
|
1238
|
+
publicKey: keyId
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
return mockDocumentLoader(resource);
|
|
1242
|
+
},
|
|
1243
|
+
contextLoader: mockDocumentLoader
|
|
1244
|
+
}), {
|
|
1245
|
+
key: null,
|
|
1246
|
+
cached: false
|
|
1247
|
+
});
|
|
1248
|
+
});
|
|
1054
1249
|
//#endregion
|
|
1055
1250
|
export {};
|
package/dist/sig/ld.test.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { t as assertInstanceOf } from "../assert_instance_of-mrXWWNY-.mjs";
|
|
|
8
8
|
import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
9
9
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
10
10
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
11
|
-
import { C as generateCryptoKeyPair, 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-
|
|
11
|
+
import { C as generateCryptoKeyPair, 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-C13upTHv.mjs";
|
|
12
12
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
13
13
|
import { CryptographicKey } from "@fedify/vocab";
|
|
14
14
|
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -995,5 +995,50 @@ test("verifyJsonLd() rejects a key that claims a forged owner", async () => {
|
|
|
995
995
|
contextLoader: mockDocumentLoader
|
|
996
996
|
}));
|
|
997
997
|
});
|
|
998
|
+
test("verifyJsonLd() rejects a key whose owner redirects to another actor", async () => {
|
|
999
|
+
const keyId = new URL("https://evil.example/keys/1");
|
|
1000
|
+
const victim = "https://victim.example/users/alice";
|
|
1001
|
+
const mallory = "https://evil.example/users/mallory";
|
|
1002
|
+
const { publicKeyPem } = await rsaPublicKey3.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
1003
|
+
const signed = await signJsonLd({
|
|
1004
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
1005
|
+
id: "https://victim.example/activities/forged",
|
|
1006
|
+
type: "Create",
|
|
1007
|
+
actor: victim,
|
|
1008
|
+
object: {
|
|
1009
|
+
type: "Note",
|
|
1010
|
+
content: "forged"
|
|
1011
|
+
}
|
|
1012
|
+
}, rsaPrivateKey3, keyId, { contextLoader: mockDocumentLoader });
|
|
1013
|
+
const options = {
|
|
1014
|
+
documentLoader(resource) {
|
|
1015
|
+
if (resource === keyId.href) return Promise.resolve({
|
|
1016
|
+
contextUrl: null,
|
|
1017
|
+
documentUrl: resource,
|
|
1018
|
+
document: {
|
|
1019
|
+
"@context": "https://w3id.org/security/v1",
|
|
1020
|
+
id: keyId.href,
|
|
1021
|
+
type: "CryptographicKey",
|
|
1022
|
+
owner: victim,
|
|
1023
|
+
publicKeyPem
|
|
1024
|
+
}
|
|
1025
|
+
});
|
|
1026
|
+
if (resource === victim || resource === mallory) return Promise.resolve({
|
|
1027
|
+
contextUrl: null,
|
|
1028
|
+
documentUrl: mallory,
|
|
1029
|
+
document: {
|
|
1030
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/v1"],
|
|
1031
|
+
id: mallory,
|
|
1032
|
+
type: "Person",
|
|
1033
|
+
publicKey: keyId.href
|
|
1034
|
+
}
|
|
1035
|
+
});
|
|
1036
|
+
return mockDocumentLoader(resource);
|
|
1037
|
+
},
|
|
1038
|
+
contextLoader: mockDocumentLoader
|
|
1039
|
+
};
|
|
1040
|
+
assertEquals(await verifySignature(signed, options), null);
|
|
1041
|
+
assertFalse(await verifyJsonLd(signed, options));
|
|
1042
|
+
});
|
|
998
1043
|
//#endregion
|
|
999
1044
|
export {};
|
|
@@ -5,10 +5,10 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
6
6
|
import "../std__assert-DvMDRPes.mjs";
|
|
7
7
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
8
|
-
import { l as verifyPortableObjectProof } from "../proof-
|
|
9
|
-
import { p as verifyRequestDetailed } from "../http
|
|
10
|
-
import { o as createFederation } from "../middleware-
|
|
11
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
8
|
+
import { l as verifyPortableObjectProof } from "../proof-DdI4I2Jg.mjs";
|
|
9
|
+
import { p as verifyRequestDetailed } from "../http-VRVl77qN.mjs";
|
|
10
|
+
import { o as createFederation } from "../middleware-Defzf-30.mjs";
|
|
11
|
+
import { t as doesActorOwnKey } from "../owner-BBB-PayE.mjs";
|
|
12
12
|
import { Create, Person } from "@fedify/vocab";
|
|
13
13
|
import { canonicalizePortableUri, decodeMultibase, importDidKey } from "@fedify/vocab-runtime";
|
|
14
14
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
|
-
import { l as verifyPortableObjectProof } from "../proof-
|
|
8
|
-
import { p as verifyRequestDetailed } from "../http
|
|
9
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
7
|
+
import { l as verifyPortableObjectProof } from "../proof-DdI4I2Jg.mjs";
|
|
8
|
+
import { p as verifyRequestDetailed } from "../http-VRVl77qN.mjs";
|
|
9
|
+
import { t as doesActorOwnKey } from "../owner-BBB-PayE.mjs";
|
|
10
10
|
import { Create } from "@fedify/vocab";
|
|
11
11
|
import { canonicalizePortableUri, decodeMultibase, fromCompatibleEf61Id, importDidKey } from "@fedify/vocab-runtime";
|
|
12
12
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
package/dist/sig/mod.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_http = require("../http-
|
|
4
|
-
const require_portable_collection = require("../portable-collection-
|
|
3
|
+
const require_http = require("../http-C88K-3A8.cjs");
|
|
4
|
+
const require_portable_collection = require("../portable-collection-Byajf90m.cjs");
|
|
5
5
|
exports.attachSignature = require_http.attachSignature;
|
|
6
6
|
exports.createProof = require_http.createProof;
|
|
7
7
|
exports.createSignature = require_http.createSignature;
|
package/dist/sig/mod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { A as detachSignature, C as verifyProof, D as attachSignature, G as generateCryptoKeyPair, I as signJsonLd, K as importJwk, N as hasSignatureLike, R as verifyJsonLd, U as fetchKey, V as exportJwk, W as fetchKeyDetailed, _t as fulfillAcceptSignature, a as signRequest, c as verifyRequestDetailed, g as signObject, gt as formatAcceptSignature, k as createSignature, m as hasProofLike, p as createProof, s as verifyRequest, v as verifyObject, vt as parseAcceptSignature, y as verifyPortableObjectProof, yt as validateAcceptSignature, z as verifySignature } from "../http-
|
|
4
|
-
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "../portable-collection-
|
|
3
|
+
import { A as detachSignature, C as verifyProof, D as attachSignature, G as generateCryptoKeyPair, I as signJsonLd, K as importJwk, N as hasSignatureLike, R as verifyJsonLd, U as fetchKey, V as exportJwk, W as fetchKeyDetailed, _t as fulfillAcceptSignature, a as signRequest, c as verifyRequestDetailed, g as signObject, gt as formatAcceptSignature, k as createSignature, m as hasProofLike, p as createProof, s as verifyRequest, v as verifyObject, vt as parseAcceptSignature, y as verifyPortableObjectProof, yt as validateAcceptSignature, z as verifySignature } from "../http-KKViNOVp.js";
|
|
4
|
+
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "../portable-collection-sJBoBful.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, verifyPortableObject, verifyPortableObjectProof, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
package/dist/sig/owner.test.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
|
|
|
6
6
|
import "../std__assert-DvMDRPes.mjs";
|
|
7
7
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
8
8
|
import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
9
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-
|
|
9
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-BBB-PayE.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 {};
|
|
@@ -2,7 +2,7 @@ import "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
|
|
5
|
-
import { t as verifyPortableObject } from "../portable-collection-
|
|
5
|
+
import { t as verifyPortableObject } from "../portable-collection-DKs8iX1J.mjs";
|
|
6
6
|
import { Collection, CollectionPage, Note, OrderedCollection, Person, traverseCollection } from "@fedify/vocab";
|
|
7
7
|
import { FetchError, encodeMultibase, exportDidKey, preloadedContexts } from "@fedify/vocab-runtime";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
|
-
import { l as verifyPortableObjectProof, p as verifyProof } from "../proof-
|
|
8
|
-
import { n as getKeyOwner } from "../owner-
|
|
9
|
-
import { t as verifyPortableObject } from "../portable-collection-
|
|
7
|
+
import { l as verifyPortableObjectProof, p as verifyProof } from "../proof-DdI4I2Jg.mjs";
|
|
8
|
+
import { n as getKeyOwner } from "../owner-BBB-PayE.mjs";
|
|
9
|
+
import { t as verifyPortableObject } from "../portable-collection-DKs8iX1J.mjs";
|
|
10
10
|
import { Application, DataIntegrityProof, lookupObject } from "@fedify/vocab";
|
|
11
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
//#region test-vectors/fep-ef61/tootik-v0.25.4/actor.json
|
|
@@ -2,13 +2,13 @@ import { Temporal } from "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
5
|
-
import { S as fetchKeyDetailed, h as verifyJsonLd, p as signJsonLd, x as fetchKey } from "../ld-
|
|
6
|
-
import { p as verifyProof, r as createProof } from "../proof-
|
|
7
|
-
import { n as resolvePortableActorKey } from "../portable-key-
|
|
8
|
-
import { f as verifyRequest, l as signRequest, p as verifyRequestDetailed } from "../http
|
|
5
|
+
import { S as fetchKeyDetailed, h as verifyJsonLd, p as signJsonLd, x as fetchKey } from "../ld-C13upTHv.mjs";
|
|
6
|
+
import { p as verifyProof, r as createProof } from "../proof-DdI4I2Jg.mjs";
|
|
7
|
+
import { n as resolvePortableActorKey } from "../portable-key-zbE5iDhv.mjs";
|
|
8
|
+
import { f as verifyRequest, l as signRequest, p as verifyRequestDetailed } from "../http-VRVl77qN.mjs";
|
|
9
9
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
10
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-
|
|
11
|
-
import { t as KvKeyCache } from "../keycache-
|
|
10
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-BBB-PayE.mjs";
|
|
11
|
+
import { t as KvKeyCache } from "../keycache-N2opu4-3.mjs";
|
|
12
12
|
import { Create, CryptographicKey, Multikey, Note, Person } from "@fedify/vocab";
|
|
13
13
|
import { FetchError, encodeMultibase, exportDidKey, exportSpki, parseIri, preloadedContexts } from "@fedify/vocab-runtime";
|
|
14
14
|
import { test } from "@fedify/fixture";
|
package/dist/sig/proof.test.mjs
CHANGED
|
@@ -11,10 +11,10 @@ import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
|
11
11
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
12
12
|
import { a as verificationObservation } from "../verification-Dpfcw8ml.mjs";
|
|
13
13
|
import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-4IJqPYos.mjs";
|
|
14
|
-
import { c as verifyObject, i as hasProofLike, l as verifyPortableObjectProof, o as signObject, p as verifyProof, r as createProof, s as verifyMapLocalProof } from "../proof-
|
|
15
|
-
import { f as verifyRequest } from "../http
|
|
14
|
+
import { c as verifyObject, i as hasProofLike, l as verifyPortableObjectProof, o as signObject, p as verifyProof, r as createProof, s as verifyMapLocalProof } from "../proof-DdI4I2Jg.mjs";
|
|
15
|
+
import { f as verifyRequest } from "../http-VRVl77qN.mjs";
|
|
16
16
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
17
|
-
import { t as getAuthenticatedDocumentLoader } from "../docloader-
|
|
17
|
+
import { t as getAuthenticatedDocumentLoader } from "../docloader-CGBUQXUP.mjs";
|
|
18
18
|
import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place, Translation } from "@fedify/vocab";
|
|
19
19
|
import { decodeMultibase, encodeMultibase, exportDidKey, exportMultibaseKey, formatIri, importMultibaseKey, parseIri } from "@fedify/vocab-runtime";
|
|
20
20
|
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -2543,5 +2543,56 @@ test("getAuthenticatedDocumentLoader() signs portable object requests to gateway
|
|
|
2543
2543
|
esm_default.hardReset();
|
|
2544
2544
|
}
|
|
2545
2545
|
});
|
|
2546
|
+
test("verifyObject() rejects a key whose controller redirects to another actor", async () => {
|
|
2547
|
+
const keyId = new URL("https://evil.example/keys/ed25519");
|
|
2548
|
+
const victim = "https://victim.example/users/alice";
|
|
2549
|
+
const mallory = "https://evil.example/users/mallory";
|
|
2550
|
+
const multikeyDocument = await ed25519Multikey.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
2551
|
+
const signOptions = {
|
|
2552
|
+
format: "compact",
|
|
2553
|
+
contextLoader: mockDocumentLoader,
|
|
2554
|
+
documentLoader: mockDocumentLoader,
|
|
2555
|
+
context: ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"]
|
|
2556
|
+
};
|
|
2557
|
+
assertEquals(await verifyObject(Create, await (await signObject(new Create({
|
|
2558
|
+
id: new URL("https://victim.example/activities/forged"),
|
|
2559
|
+
actor: new URL(victim),
|
|
2560
|
+
object: new Note({
|
|
2561
|
+
id: new URL("https://victim.example/notes/forged"),
|
|
2562
|
+
attribution: new URL(victim),
|
|
2563
|
+
content: "forged"
|
|
2564
|
+
})
|
|
2565
|
+
}), ed25519PrivateKey, keyId, signOptions)).toJsonLd(signOptions), {
|
|
2566
|
+
documentLoader(resource) {
|
|
2567
|
+
if (resource === keyId.href) return Promise.resolve({
|
|
2568
|
+
contextUrl: null,
|
|
2569
|
+
documentUrl: resource,
|
|
2570
|
+
document: {
|
|
2571
|
+
...multikeyDocument,
|
|
2572
|
+
id: keyId.href,
|
|
2573
|
+
controller: victim
|
|
2574
|
+
}
|
|
2575
|
+
});
|
|
2576
|
+
if (resource === victim || resource === mallory) return Promise.resolve({
|
|
2577
|
+
contextUrl: null,
|
|
2578
|
+
documentUrl: mallory,
|
|
2579
|
+
document: {
|
|
2580
|
+
"@context": [
|
|
2581
|
+
"https://www.w3.org/ns/activitystreams",
|
|
2582
|
+
"https://w3id.org/security/v1",
|
|
2583
|
+
"https://w3id.org/security/multikey/v1",
|
|
2584
|
+
"https://w3id.org/security/data-integrity/v1",
|
|
2585
|
+
"https://www.w3.org/ns/did/v1"
|
|
2586
|
+
],
|
|
2587
|
+
id: mallory,
|
|
2588
|
+
type: "Person",
|
|
2589
|
+
assertionMethod: [keyId.href]
|
|
2590
|
+
}
|
|
2591
|
+
});
|
|
2592
|
+
return mockDocumentLoader(resource);
|
|
2593
|
+
},
|
|
2594
|
+
contextLoader: mockDocumentLoader
|
|
2595
|
+
}), null);
|
|
2596
|
+
});
|
|
2546
2597
|
//#endregion
|
|
2547
2598
|
export {};
|
|
@@ -5,10 +5,10 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
6
6
|
import "../std__assert-DvMDRPes.mjs";
|
|
7
7
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
8
|
-
import { l as verifyPortableObjectProof } from "../proof-
|
|
9
|
-
import { p as verifyRequestDetailed } from "../http
|
|
10
|
-
import { o as createFederation } from "../middleware-
|
|
11
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
8
|
+
import { l as verifyPortableObjectProof } from "../proof-DdI4I2Jg.mjs";
|
|
9
|
+
import { p as verifyRequestDetailed } from "../http-VRVl77qN.mjs";
|
|
10
|
+
import { o as createFederation } from "../middleware-Defzf-30.mjs";
|
|
11
|
+
import { t as doesActorOwnKey } from "../owner-BBB-PayE.mjs";
|
|
12
12
|
import { Follow, Person } from "@fedify/vocab";
|
|
13
13
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
14
14
|
import { encodeHex } from "byte-encodings/hex";
|
|
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
|
-
import { l as verifyPortableObjectProof } from "../proof-
|
|
8
|
-
import { p as verifyRequestDetailed } from "../http
|
|
9
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
7
|
+
import { l as verifyPortableObjectProof } from "../proof-DdI4I2Jg.mjs";
|
|
8
|
+
import { p as verifyRequestDetailed } from "../http-VRVl77qN.mjs";
|
|
9
|
+
import { t as doesActorOwnKey } from "../owner-BBB-PayE.mjs";
|
|
10
10
|
import { Create } from "@fedify/vocab";
|
|
11
11
|
import { decodeMultibase, importDidKey } from "@fedify/vocab-runtime";
|
|
12
12
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -2,9 +2,9 @@ import "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { a as verificationObservation } from "../verification-Dpfcw8ml.mjs";
|
|
5
|
-
import { h as verifyJsonLd, p as signJsonLd } from "../ld-
|
|
6
|
-
import { c as verifyObject, o as signObject } from "../proof-
|
|
7
|
-
import { l as signRequest, p as verifyRequestDetailed } from "../http
|
|
5
|
+
import { h as verifyJsonLd, p as signJsonLd } from "../ld-C13upTHv.mjs";
|
|
6
|
+
import { c as verifyObject, o as signObject } from "../proof-DdI4I2Jg.mjs";
|
|
7
|
+
import { l as signRequest, p as verifyRequestDetailed } from "../http-VRVl77qN.mjs";
|
|
8
8
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
9
9
|
import { Activity, Create, CryptographicKey, Multikey } from "@fedify/vocab";
|
|
10
10
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "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-C13upTHv.mjs";
|
|
5
5
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
6
6
|
//#region src/federation/temporal.ts
|
|
7
7
|
function isPlainObject(value) {
|