@fedify/fedify 2.4.0-dev.2063 → 2.4.0-dev.2071
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-BzS4brdy.mjs → builder-DVQ0yhKJ.mjs} +6 -2
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{compound-proof-BrSXP5so.mjs → compound-proof-KmXDfWFp.mjs} +1 -1
- package/dist/{context-b36TpPoG.d.cts → context-DijrgHDe.d.cts} +45 -2
- package/dist/{context-D_gg4M0n.d.ts → context-DsB9kF6q.d.ts} +45 -2
- package/dist/{deno-CVZgG4sc.mjs → deno-B-NtYZVW.mjs} +1 -1
- package/dist/{docloader-DBb8z7_l.mjs → docloader-C6yOVoaF.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +4 -4
- package/dist/federation/handler-compound-proof.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +5 -5
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +8 -8
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +1 -1
- package/dist/federation/outgoing-proof.test.mjs +6 -6
- package/dist/federation/portable-gateway-keys.test.d.mts +2 -0
- package/dist/federation/portable-gateway-keys.test.mjs +363 -0
- 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-BrsIzNK5.cjs → federation-CUiHc7dP.cjs} +182 -76
- package/dist/http-BoWBwC0g.js +5087 -0
- package/dist/{http-CVjwUCCu.cjs → http-CuLWIJdf.cjs} +2684 -48
- package/dist/{http-znjq5j6a.mjs → http-DKWi8RjI.mjs} +20 -5
- package/dist/{http-65PYi9jY.d.ts → http-n2v6DPxu.d.ts} +52 -2
- package/dist/{http-CP-7OdSq.d.cts → http-xlG-jRdB.d.cts} +52 -2
- package/dist/{key-BnMA6vpl.mjs → key-lfcx_NaE.mjs} +147 -7
- package/dist/{kv-cache-aijDx_jN.js → kv-cache-BdnmnAVc.js} +1 -1
- package/dist/{kv-cache-D2O0JspA.cjs → kv-cache-DE8kSNQU.cjs} +1 -1
- package/dist/{kv-cache--REpvHgG.mjs → kv-cache-d8EjO29d.mjs} +1 -1
- package/dist/{ld-BBVP8ock.mjs → ld-jyjdrWjG.mjs} +3 -3
- package/dist/{metrics-B5spFq82.mjs → metrics-B5Rei-HC.mjs} +1 -1
- package/dist/{middleware-CzYM4cJI.js → middleware-CAObohey.js} +149 -43
- package/dist/{middleware-Cw8EWwAT.mjs → middleware-CPx4ZWwt.mjs} +155 -53
- package/dist/{middleware-ClrGS1xy.mjs → middleware-CdVnCDXD.mjs} +1 -1
- package/dist/{mod-Dhm7SqyE.d.ts → mod-C9WSpZWm.d.ts} +1 -1
- package/dist/{mod-C0BYc0OU.d.ts → mod-CVZrXSdm.d.ts} +1 -1
- package/dist/{mod-BhMvsgdF.d.ts → mod-DMkflQdF.d.ts} +1 -1
- package/dist/{mod-Bfenkg_c.d.cts → mod-DTAaBwiY.d.cts} +1 -1
- package/dist/{mod-pLbeNwcC.d.cts → mod-HDSvS-ww.d.cts} +1 -1
- package/dist/{mod-CyiSjRkk.d.cts → mod-xGFCHqq_.d.cts} +1 -1
- package/dist/mod.cjs +18 -18
- package/dist/mod.d.cts +7 -7
- package/dist/mod.d.ts +7 -7
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/owner-1TFakcTF.js +215 -0
- package/dist/owner-BXufwAzm.cjs +225 -0
- package/dist/{owner-Hc0hvbbX.mjs → owner-ByqNQVaa.mjs} +45 -2
- package/dist/portable-key-Cw_ow5vn.mjs +194 -0
- package/dist/{proof-B69bJaSn.mjs → proof-B6gwdhN5.mjs} +5 -5
- package/dist/{send-BB5rBhvN.mjs → send-DsK7xevO.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 +3 -3
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +16 -16
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +3 -3
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/portable-collection.test.mjs +76 -3
- package/dist/sig/portable-key.test.d.mts +2 -0
- package/dist/sig/portable-key.test.mjs +275 -0
- package/dist/sig/proof.test.mjs +4 -4
- package/dist/{sig-B8WDBV-h.js → sig-BR_Z6mpY.js} +2 -2
- package/dist/{sig-dut4BzEW.cjs → sig-TTn9wYrE.cjs} +4 -4
- package/dist/{temporal-CcRkOx3C.mjs → temporal-Bw5jtrBY.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/testing/mod.d.mts +43 -0
- 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.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +7 -7
- package/dist/http-99KVDtMr.js +0 -2647
- package/dist/owner-CHBQ0sSj.cjs +0 -2446
- package/dist/owner-Cu_KMvQN.js +0 -2276
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import "temporal-polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { h as isSamePublicKey, l as getCanonicalPortableId, p as isPortableActorDocument } from "./key-lfcx_NaE.mjs";
|
|
5
|
+
import { c as verifyPortableObjectProofWithRoot } from "./proof-B6gwdhN5.mjs";
|
|
6
|
+
import { getLogger } from "@logtape/logtape";
|
|
7
|
+
import { CryptographicKey, Multikey, Object as Object$1 } from "@fedify/vocab";
|
|
8
|
+
import { getDocumentLoader, isGatewayUrl } from "@fedify/vocab-runtime";
|
|
9
|
+
//#region src/sig/portable-key.ts
|
|
10
|
+
const logger = getLogger([
|
|
11
|
+
"fedify",
|
|
12
|
+
"sig",
|
|
13
|
+
"key"
|
|
14
|
+
]);
|
|
15
|
+
const SEC = "https://w3id.org/security#";
|
|
16
|
+
/**
|
|
17
|
+
* Verifies that the signed document of a portable actor vouches for
|
|
18
|
+
* the gateway key with the given ID.
|
|
19
|
+
*
|
|
20
|
+
* A gateway key is accepted only if:
|
|
21
|
+
*
|
|
22
|
+
* - the document is an actor whose portable ID is the one the key ID is
|
|
23
|
+
* the compatible identifier of;
|
|
24
|
+
* - the document has a valid [FEP-8b32] Object Integrity Proof made by
|
|
25
|
+
* the DID of its ID, i.e., it satisfies the [FEP-ef61] proof policy;
|
|
26
|
+
* - the document embeds a `Multikey` with that ID in its `assertionMethod`,
|
|
27
|
+
* whose `controller` is the actor, as [FEP-521a] requires; a key
|
|
28
|
+
* embedded in its `publicKey` with the same ID must agree with it; and
|
|
29
|
+
* - the key ID's origin is one of the actor's `gateways`.
|
|
30
|
+
*
|
|
31
|
+
* [FEP-8b32]: https://w3id.org/fep/8b32
|
|
32
|
+
* [FEP-ef61]: https://w3id.org/fep/ef61
|
|
33
|
+
* [FEP-521a]: https://w3id.org/fep/521a
|
|
34
|
+
*
|
|
35
|
+
* @param document The raw JSON-LD document served at the key ID.
|
|
36
|
+
* @param actor The parsed document, which must be a portable actor.
|
|
37
|
+
* @param keyId The key ID, which must be a compatible key ID.
|
|
38
|
+
* @param options Loaders and telemetry providers.
|
|
39
|
+
* @returns The verification result, which is never `legacy`.
|
|
40
|
+
* @internal
|
|
41
|
+
*/
|
|
42
|
+
async function verifyPortableGatewayKeyDocument(document, actor, keyId, options = {}) {
|
|
43
|
+
const reject = (reason) => {
|
|
44
|
+
logger.debug("Failed to verify gateway key {keyId} of the portable actor {actorId}: {reason}", {
|
|
45
|
+
keyId: keyId.href,
|
|
46
|
+
actorId: actor.id?.href,
|
|
47
|
+
reason
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
type: "rejected",
|
|
51
|
+
reason
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
const keyBase = new URL(keyId.href);
|
|
55
|
+
keyBase.hash = "";
|
|
56
|
+
const claimedActorId = getCanonicalPortableId(keyBase);
|
|
57
|
+
const actorId = actor.id == null ? null : getCanonicalPortableId(actor.id);
|
|
58
|
+
if (claimedActorId == null || actorId == null) return reject("The key ID or the actor ID is not a valid portable ID.");
|
|
59
|
+
if (claimedActorId !== actorId) return reject("The key ID is not a compatible identifier of the actor it dereferences to.");
|
|
60
|
+
let verification;
|
|
61
|
+
try {
|
|
62
|
+
verification = await verifyPortableObjectProofWithRoot(document, {
|
|
63
|
+
documentLoader: options.documentLoader,
|
|
64
|
+
contextLoader: options.contextLoader,
|
|
65
|
+
keyCache: options.keyCache,
|
|
66
|
+
tracerProvider: options.tracerProvider,
|
|
67
|
+
meterProvider: options.meterProvider
|
|
68
|
+
});
|
|
69
|
+
} catch (error) {
|
|
70
|
+
if (!(error instanceof TypeError)) throw error;
|
|
71
|
+
return reject(`The actor document is malformed: ${error.message}`);
|
|
72
|
+
}
|
|
73
|
+
const { result, root } = verification;
|
|
74
|
+
if (!result.verified) return reject("The actor document does not satisfy the FEP-ef61 proof policy: " + result.reason.type);
|
|
75
|
+
if (root == null) return reject("The actor document could not be expanded.");
|
|
76
|
+
const refuse = (url) => Promise.reject(/* @__PURE__ */ new Error(`Refusing to fetch ${url}.`));
|
|
77
|
+
let verifiedActor;
|
|
78
|
+
try {
|
|
79
|
+
verifiedActor = await Object$1.fromJsonLd(root, {
|
|
80
|
+
documentLoader: refuse,
|
|
81
|
+
contextLoader: options.contextLoader,
|
|
82
|
+
tracerProvider: options.tracerProvider
|
|
83
|
+
});
|
|
84
|
+
} catch (error) {
|
|
85
|
+
if (!(error instanceof TypeError)) throw error;
|
|
86
|
+
return reject("The verified actor document is malformed.");
|
|
87
|
+
}
|
|
88
|
+
if (!isPortableActorDocument(verifiedActor) || getCanonicalPortableId(verifiedActor.id) !== claimedActorId) return reject("The key ID is not a compatible identifier of the actor whose document is signed.");
|
|
89
|
+
actor = verifiedActor;
|
|
90
|
+
const multikeyNode = findEmbeddedNode(root[`${SEC}assertionMethod`], keyId);
|
|
91
|
+
if (multikeyNode == null) return reject("The actor document does not embed the key in its assertionMethod.");
|
|
92
|
+
let multikey;
|
|
93
|
+
try {
|
|
94
|
+
multikey = await Multikey.fromJsonLd(multikeyNode, {
|
|
95
|
+
documentLoader: refuse,
|
|
96
|
+
contextLoader: options.contextLoader,
|
|
97
|
+
tracerProvider: options.tracerProvider
|
|
98
|
+
});
|
|
99
|
+
} catch (error) {
|
|
100
|
+
if (!(error instanceof TypeError)) throw error;
|
|
101
|
+
return reject("The key in the assertionMethod is malformed.");
|
|
102
|
+
}
|
|
103
|
+
if (multikey.publicKey == null) return reject("The key in the assertionMethod has no public key.");
|
|
104
|
+
if (multikey.controllerId == null || getCanonicalPortableId(multikey.controllerId) !== actorId) return reject("The controller of the key is not the actor.");
|
|
105
|
+
const publicKeyNode = findEmbeddedNode(root[`${SEC}publicKey`], keyId);
|
|
106
|
+
if (publicKeyNode != null) {
|
|
107
|
+
let publicKey;
|
|
108
|
+
try {
|
|
109
|
+
publicKey = await CryptographicKey.fromJsonLd(publicKeyNode, {
|
|
110
|
+
documentLoader: refuse,
|
|
111
|
+
contextLoader: options.contextLoader,
|
|
112
|
+
tracerProvider: options.tracerProvider
|
|
113
|
+
});
|
|
114
|
+
} catch (error) {
|
|
115
|
+
if (!(error instanceof TypeError)) throw error;
|
|
116
|
+
return reject("The key in the publicKey is malformed.");
|
|
117
|
+
}
|
|
118
|
+
if (publicKey.publicKey == null || !await isSamePublicKey(publicKey.publicKey, multikey.publicKey) || publicKey.ownerId != null && getCanonicalPortableId(publicKey.ownerId) !== actorId) return reject("The key in the publicKey does not agree with the one in the assertionMethod.");
|
|
119
|
+
}
|
|
120
|
+
if (!actor.gateways.some((gateway) => isGatewayUrl(gateway) && gateway.origin === keyId.origin)) return reject(`The gateway ${keyId.origin} is not listed in the actor's gateways.`);
|
|
121
|
+
const key = new CryptographicKey({
|
|
122
|
+
id: keyId,
|
|
123
|
+
owner: actor.id,
|
|
124
|
+
publicKey: multikey.publicKey
|
|
125
|
+
});
|
|
126
|
+
return {
|
|
127
|
+
type: "verified",
|
|
128
|
+
actor,
|
|
129
|
+
key
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Fetches the document at a compatible key ID, and resolves the key as
|
|
134
|
+
* a gateway key if the document is a portable actor.
|
|
135
|
+
*
|
|
136
|
+
* @param keyId The key ID, which must be a compatible key ID.
|
|
137
|
+
* @param options Loaders and telemetry providers.
|
|
138
|
+
* @returns `legacy` if the document cannot be fetched or is not a portable
|
|
139
|
+
* actor, which leaves the key to the usual resolution; otherwise,
|
|
140
|
+
* the result of {@link verifyPortableGatewayKeyDocument}.
|
|
141
|
+
* @internal
|
|
142
|
+
*/
|
|
143
|
+
async function fetchPortableGatewayKey(keyId, options = {}) {
|
|
144
|
+
const documentLoader = options.documentLoader ?? getDocumentLoader();
|
|
145
|
+
const contextLoader = options.contextLoader ?? getDocumentLoader();
|
|
146
|
+
let remoteDocument;
|
|
147
|
+
try {
|
|
148
|
+
remoteDocument = await documentLoader(keyId.href);
|
|
149
|
+
} catch (error) {
|
|
150
|
+
logger.debug("Failed to fetch key {keyId}: {error}", {
|
|
151
|
+
keyId: keyId.href,
|
|
152
|
+
error
|
|
153
|
+
});
|
|
154
|
+
return { type: "legacy" };
|
|
155
|
+
}
|
|
156
|
+
let object;
|
|
157
|
+
try {
|
|
158
|
+
object = await Object$1.fromJsonLd(remoteDocument.document, {
|
|
159
|
+
documentLoader,
|
|
160
|
+
contextLoader,
|
|
161
|
+
tracerProvider: options.tracerProvider
|
|
162
|
+
});
|
|
163
|
+
} catch (error) {
|
|
164
|
+
if (!(error instanceof TypeError)) throw error;
|
|
165
|
+
return { type: "legacy" };
|
|
166
|
+
}
|
|
167
|
+
if (!isPortableActorDocument(object)) return { type: "legacy" };
|
|
168
|
+
return await verifyPortableGatewayKeyDocument(remoteDocument.document, object, keyId, {
|
|
169
|
+
...options,
|
|
170
|
+
documentLoader,
|
|
171
|
+
contextLoader
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function findEmbeddedNode(values, id) {
|
|
175
|
+
if (!Array.isArray(values)) return null;
|
|
176
|
+
for (const value of values) {
|
|
177
|
+
if (value == null || typeof value !== "object" || Array.isArray(value)) continue;
|
|
178
|
+
const node = value;
|
|
179
|
+
const nodeId = node["@id"];
|
|
180
|
+
if (typeof nodeId !== "string") continue;
|
|
181
|
+
let parsed;
|
|
182
|
+
try {
|
|
183
|
+
parsed = new URL(nodeId);
|
|
184
|
+
} catch {
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
if (parsed.href !== id.href) continue;
|
|
188
|
+
if (Object.keys(node).every((key) => key === "@id")) continue;
|
|
189
|
+
return node;
|
|
190
|
+
}
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
//#endregion
|
|
194
|
+
export { verifyPortableGatewayKeyDocument as n, fetchPortableGatewayKey as t };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { Temporal } from "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-B-NtYZVW.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics, s as measureSignatureKeyFetch } from "./metrics-B5Rei-HC.mjs";
|
|
6
|
+
import { r as fetchKey, s as validateCryptoKey } from "./key-lfcx_NaE.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 { c as getNormalizationContextLoader } from "./ld-
|
|
9
|
+
import { c as getNormalizationContextLoader } from "./ld-jyjdrWjG.mjs";
|
|
10
10
|
import { getLogger } from "@logtape/logtape";
|
|
11
11
|
import { Activity, DataIntegrityProof, Multikey, getTypeId } from "@fedify/vocab";
|
|
12
12
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
13
13
|
import { encodeMultibase, formatIri, getDocumentLoader, getFe34Origin, haveSameFe34Origin, parseIri } from "@fedify/vocab-runtime";
|
|
14
14
|
import { encodeHex } from "byte-encodings/hex";
|
|
15
|
-
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
16
15
|
import { isPlainJsonTree, retainSignedRepresentation } from "@fedify/vocab-runtime/internal/signed-representation";
|
|
16
|
+
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
17
17
|
import serialize from "json-canon";
|
|
18
18
|
//#region src/sig/proof.ts
|
|
19
19
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import "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-B-NtYZVW.mjs";
|
|
5
|
+
import { n as getDurationMs, r as getFederationMetrics } from "./metrics-B5Rei-HC.mjs";
|
|
6
|
+
import { n as doubleKnock } from "./http-DKWi8RjI.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";
|
|
@@ -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 { i as inspectCompoundPortableObjectApplicability, n as discoverCompoundProofDocuments } from "../compound-proof-
|
|
6
|
+
import { i as inspectCompoundPortableObjectApplicability, n as discoverCompoundProofDocuments } from "../compound-proof-KmXDfWFp.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 { i as inspectCompoundPortableObjectApplicability, r as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "../compound-proof-
|
|
6
|
+
import { i as inspectCompoundPortableObjectApplicability, r as findUnsupportedCompoundProofShape, t as containsCompoundPortableObject } from "../compound-proof-KmXDfWFp.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,8 +4,8 @@ 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 { i as verifyMapLocalProof, s as verifyPortableObjectProofPolicy } from "../proof-
|
|
8
|
-
import { a as verifyCompoundPortableObjectProofs, o as verifyCompoundProofDocuments } from "../compound-proof-
|
|
7
|
+
import { i as verifyMapLocalProof, s as verifyPortableObjectProofPolicy } from "../proof-B6gwdhN5.mjs";
|
|
8
|
+
import { a as verifyCompoundPortableObjectProofs, o as verifyCompoundProofDocuments } from "../compound-proof-KmXDfWFp.mjs";
|
|
9
9
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
10
10
|
import { t as map_local_context_conflict_default } from "../map-local-context-conflict-DOYEEJ3u.mjs";
|
|
11
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -4,11 +4,11 @@ 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 { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
|
|
8
7
|
import { n as preloadedOnlyDocumentLoader } from "../public-audience--klBIOk1.mjs";
|
|
9
8
|
import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-4IJqPYos.mjs";
|
|
10
|
-
import { l as verifyProof, r as signObject } from "../proof-
|
|
11
|
-
import {
|
|
9
|
+
import { l as verifyProof, r as signObject } from "../proof-B6gwdhN5.mjs";
|
|
10
|
+
import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
|
|
11
|
+
import { o as verifyCompoundProofDocuments } from "../compound-proof-KmXDfWFp.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
|
@@ -11,8 +11,8 @@ import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
|
11
11
|
import "../std__assert-DvMDRPes.mjs";
|
|
12
12
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
13
13
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
14
|
-
import { t as exportJwk } from "../key-
|
|
15
|
-
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-
|
|
14
|
+
import { t as exportJwk } from "../key-lfcx_NaE.mjs";
|
|
15
|
+
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-DKWi8RjI.mjs";
|
|
16
16
|
import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
17
17
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
18
18
|
import { FetchError, exportSpki } from "@fedify/vocab-runtime";
|
package/dist/sig/key.test.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
|
6
6
|
import "../std__assert-DvMDRPes.mjs";
|
|
7
7
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
8
8
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
9
|
-
import { a as generateCryptoKeyPair, i as fetchKeyDetailed, o as importJwk, r as fetchKey, s as validateCryptoKey, t as exportJwk } from "../key-
|
|
9
|
+
import { a as generateCryptoKeyPair, i as fetchKeyDetailed, o as importJwk, r as fetchKey, s as validateCryptoKey, t as exportJwk } from "../key-lfcx_NaE.mjs";
|
|
10
10
|
import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
11
11
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
12
12
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
package/dist/sig/ld.test.mjs
CHANGED
|
@@ -8,9 +8,9 @@ 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 { a as generateCryptoKeyPair } from "../key-
|
|
11
|
+
import { a as generateCryptoKeyPair } from "../key-lfcx_NaE.mjs";
|
|
12
|
+
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-jyjdrWjG.mjs";
|
|
12
13
|
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
|
-
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-BBVP8ock.mjs";
|
|
14
14
|
import { CryptographicKey } from "@fedify/vocab";
|
|
15
15
|
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
16
16
|
import { encodeBase64 } from "byte-encodings/base64";
|
package/dist/sig/mod.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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_owner = require("../owner-
|
|
5
|
-
const require_sig = require("../sig-
|
|
6
|
-
exports.attachSignature =
|
|
7
|
-
exports.createProof =
|
|
8
|
-
exports.createSignature =
|
|
9
|
-
exports.detachSignature =
|
|
3
|
+
const require_http = require("../http-CuLWIJdf.cjs");
|
|
4
|
+
const require_owner = require("../owner-BXufwAzm.cjs");
|
|
5
|
+
const require_sig = require("../sig-TTn9wYrE.cjs");
|
|
6
|
+
exports.attachSignature = require_http.attachSignature;
|
|
7
|
+
exports.createProof = require_http.createProof;
|
|
8
|
+
exports.createSignature = require_http.createSignature;
|
|
9
|
+
exports.detachSignature = require_http.detachSignature;
|
|
10
10
|
exports.doesActorOwnKey = require_owner.doesActorOwnKey;
|
|
11
11
|
exports.exportJwk = require_http.exportJwk;
|
|
12
12
|
exports.fetchKey = require_http.fetchKey;
|
|
@@ -15,19 +15,19 @@ exports.formatAcceptSignature = require_http.formatAcceptSignature;
|
|
|
15
15
|
exports.fulfillAcceptSignature = require_http.fulfillAcceptSignature;
|
|
16
16
|
exports.generateCryptoKeyPair = require_http.generateCryptoKeyPair;
|
|
17
17
|
exports.getKeyOwner = require_owner.getKeyOwner;
|
|
18
|
-
exports.hasProofLike =
|
|
19
|
-
exports.hasSignatureLike =
|
|
18
|
+
exports.hasProofLike = require_http.hasProofLike;
|
|
19
|
+
exports.hasSignatureLike = require_http.hasSignatureLike;
|
|
20
20
|
exports.importJwk = require_http.importJwk;
|
|
21
21
|
exports.parseAcceptSignature = require_http.parseAcceptSignature;
|
|
22
|
-
exports.signJsonLd =
|
|
23
|
-
exports.signObject =
|
|
22
|
+
exports.signJsonLd = require_http.signJsonLd;
|
|
23
|
+
exports.signObject = require_http.signObject;
|
|
24
24
|
exports.signRequest = require_http.signRequest;
|
|
25
25
|
exports.validateAcceptSignature = require_http.validateAcceptSignature;
|
|
26
|
-
exports.verifyJsonLd =
|
|
27
|
-
exports.verifyObject =
|
|
26
|
+
exports.verifyJsonLd = require_http.verifyJsonLd;
|
|
27
|
+
exports.verifyObject = require_http.verifyObject;
|
|
28
28
|
exports.verifyPortableObject = require_sig.verifyPortableObject;
|
|
29
|
-
exports.verifyPortableObjectProof =
|
|
30
|
-
exports.verifyProof =
|
|
29
|
+
exports.verifyPortableObjectProof = require_http.verifyPortableObjectProof;
|
|
30
|
+
exports.verifyProof = require_http.verifyProof;
|
|
31
31
|
exports.verifyRequest = require_http.verifyRequest;
|
|
32
32
|
exports.verifyRequestDetailed = require_http.verifyRequestDetailed;
|
|
33
|
-
exports.verifySignature =
|
|
33
|
+
exports.verifySignature = require_http.verifySignature;
|
package/dist/sig/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-
|
|
2
|
+
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-xlG-jRdB.cjs";
|
|
3
3
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-BF0L9cMt.cjs";
|
|
4
|
-
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "../mod-
|
|
4
|
+
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "../mod-HDSvS-ww.cjs";
|
|
5
5
|
export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyPortableObjectFailureReason, VerifyPortableObjectOptions, VerifyPortableObjectProofFailureReason, VerifyPortableObjectProofOptions, VerifyPortableObjectProofResult, VerifyPortableObjectResult, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyPortableObject, verifyPortableObjectProof, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
package/dist/sig/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-
|
|
2
|
+
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-n2v6DPxu.js";
|
|
3
3
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-BSzr5-I8.js";
|
|
4
|
-
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "../mod-
|
|
4
|
+
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "../mod-C9WSpZWm.js";
|
|
5
5
|
export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyPortableObjectFailureReason, VerifyPortableObjectOptions, VerifyPortableObjectProofFailureReason, VerifyPortableObjectProofOptions, VerifyPortableObjectProofResult, VerifyPortableObjectResult, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyPortableObject, verifyPortableObjectProof, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
package/dist/sig/mod.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { F as
|
|
4
|
-
import {
|
|
5
|
-
import { t as verifyPortableObject } from "../sig-
|
|
3
|
+
import { A as verifySignature, D as signJsonLd, F as fetchKeyDetailed, I as generateCryptoKeyPair, L as importJwk, M as exportJwk, P as fetchKey, a as verifyRequestDetailed, b as createSignature, c as hasProofLike, d as verifyObject, dt as fulfillAcceptSignature, f as verifyPortableObjectProof, ft as parseAcceptSignature, h as verifyProof, i as verifyRequest, k as verifyJsonLd, l as signObject, pt as validateAcceptSignature, r as signRequest, s as createProof, ut as formatAcceptSignature, v as attachSignature, w as hasSignatureLike, x as detachSignature } from "../http-BoWBwC0g.js";
|
|
4
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-1TFakcTF.js";
|
|
5
|
+
import { t as verifyPortableObject } from "../sig-BR_Z6mpY.js";
|
|
6
6
|
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-ByqNQVaa.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
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import "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-B-NtYZVW.mjs";
|
|
5
|
+
import { c as verifyPortableObjectProofWithRoot, o as verifyPortableObjectProof } from "../proof-B6gwdhN5.mjs";
|
|
5
6
|
import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
|
|
6
|
-
import { c as verifyPortableObjectProofWithRoot, o as verifyPortableObjectProof } from "../proof-B69bJaSn.mjs";
|
|
7
7
|
import { getLogger } from "@logtape/logtape";
|
|
8
8
|
import { Collection, CollectionPage, Note, Object as Object$1, OrderedCollection, Person, isActor, traverseCollection } from "@fedify/vocab";
|
|
9
9
|
import { trace } from "@opentelemetry/api";
|
|
10
10
|
import { test } from "@fedify/fixture";
|
|
11
11
|
import { FetchError, canonicalizePortableUri, encodeMultibase, exportDidKey, formatIri, fromCompatibleEf61Id, getDocumentLoader, getFe34Origin, parseIri, preloadedContexts } from "@fedify/vocab-runtime";
|
|
12
|
-
import { deepStrictEqual, ok, strictEqual } from "node:assert/strict";
|
|
13
12
|
import serialize from "json-canon";
|
|
13
|
+
import { deepStrictEqual, ok, strictEqual } from "node:assert/strict";
|
|
14
14
|
import { dereferencePortableIri, getPortableGatewayCandidates } from "@fedify/vocab-runtime/internal/portable-dereference";
|
|
15
15
|
//#region src/sig/portable-collection.ts
|
|
16
16
|
const logger = getLogger([
|
|
@@ -967,5 +967,78 @@ test("verifyPortableObject() fetches the owner through attributedTo hints", asyn
|
|
|
967
967
|
strictEqual(result.method, "gateway");
|
|
968
968
|
deepStrictEqual(documentLoader.fetched, [gatewayUrl(gw2, actorId)]);
|
|
969
969
|
});
|
|
970
|
+
test("verifyPortableObject() applies to compatible identifiers in accessors", async (t) => {
|
|
971
|
+
const noteId = `ap://${did}/notes/1`;
|
|
972
|
+
const signedNote = await sign({
|
|
973
|
+
"@context": context$1,
|
|
974
|
+
id: noteId,
|
|
975
|
+
type: "Note",
|
|
976
|
+
attributedTo: actorId,
|
|
977
|
+
content: "Hello"
|
|
978
|
+
});
|
|
979
|
+
const forgedNote = {
|
|
980
|
+
"@context": context$1,
|
|
981
|
+
id: noteId,
|
|
982
|
+
type: "Note",
|
|
983
|
+
attributedTo: actorId,
|
|
984
|
+
content: "Forged"
|
|
985
|
+
};
|
|
986
|
+
const collection = (items) => Collection.fromJsonLd({
|
|
987
|
+
"@context": context$1,
|
|
988
|
+
id: "https://example.com/collection",
|
|
989
|
+
type: "Collection",
|
|
990
|
+
items
|
|
991
|
+
}, { contextLoader });
|
|
992
|
+
const getItems = async (items, documentLoader) => await Array.fromAsync((await collection(items)).getItems({
|
|
993
|
+
documentLoader,
|
|
994
|
+
contextLoader,
|
|
995
|
+
verifyPortableObject
|
|
996
|
+
}));
|
|
997
|
+
await t.step("signed objects", async () => {
|
|
998
|
+
const documentLoader = createLoader({ [gatewayUrl(gw1, noteId)]: signedNote });
|
|
999
|
+
deepStrictEqual((await getItems([gatewayUrl(gw1, noteId)], documentLoader)).map((item) => item instanceof Note ? item.content : null), ["Hello"]);
|
|
1000
|
+
});
|
|
1001
|
+
await t.step("forged objects", async () => {
|
|
1002
|
+
const documentLoader = createLoader({
|
|
1003
|
+
[gatewayUrl(evil, noteId)]: forgedNote,
|
|
1004
|
+
[gatewayUrl(evil, `ap://${did}/notes/2`)]: {
|
|
1005
|
+
...forgedNote,
|
|
1006
|
+
id: gatewayUrl(evil, `ap://${did}/notes/2`),
|
|
1007
|
+
attributedTo: gatewayUrl(evil, actorId)
|
|
1008
|
+
},
|
|
1009
|
+
"https://evil.example/notes/1": { redirect: gatewayUrl(evil, noteId) },
|
|
1010
|
+
[gatewayUrl("https://example.com", noteId)]: forgedNote
|
|
1011
|
+
});
|
|
1012
|
+
deepStrictEqual(await getItems([
|
|
1013
|
+
gatewayUrl(evil, noteId),
|
|
1014
|
+
gatewayUrl(evil, `ap://${did}/notes/2`),
|
|
1015
|
+
"https://evil.example/notes/1",
|
|
1016
|
+
{
|
|
1017
|
+
id: gatewayUrl("https://example.com", noteId),
|
|
1018
|
+
type: "Note",
|
|
1019
|
+
content: "Forged"
|
|
1020
|
+
}
|
|
1021
|
+
], documentLoader), []);
|
|
1022
|
+
});
|
|
1023
|
+
await t.step("unsecured collections", async () => {
|
|
1024
|
+
const unsecured = outbox({ attributedTo: actorId });
|
|
1025
|
+
const documentLoader = createLoader({
|
|
1026
|
+
[gatewayUrl(gw1, actorId)]: signedActor,
|
|
1027
|
+
[gatewayUrl(gw1, outboxId)]: unsecured,
|
|
1028
|
+
[gatewayUrl(evil, actorId)]: signedActor,
|
|
1029
|
+
[gatewayUrl(evil, outboxId)]: unsecured
|
|
1030
|
+
});
|
|
1031
|
+
const items = await getItems([gatewayUrl(gw1, outboxId)], documentLoader);
|
|
1032
|
+
strictEqual(items.length, 1);
|
|
1033
|
+
ok(items[0] instanceof OrderedCollection);
|
|
1034
|
+
deepStrictEqual(documentLoader.fetched, [gatewayUrl(gw1, outboxId), gatewayUrl(gw1, actorId)]);
|
|
1035
|
+
deepStrictEqual(await getItems([gatewayUrl(evil, outboxId)], documentLoader), []);
|
|
1036
|
+
deepStrictEqual(await getItems([gatewayUrl(gw1, outboxId)], createLoader({
|
|
1037
|
+
[gatewayUrl(gw1, actorId)]: signedActor,
|
|
1038
|
+
[gatewayUrl(gw1, outboxId)]: { redirect: gatewayUrl(evil, outboxId) },
|
|
1039
|
+
[gatewayUrl(evil, outboxId)]: unsecured
|
|
1040
|
+
})), []);
|
|
1041
|
+
});
|
|
1042
|
+
});
|
|
970
1043
|
//#endregion
|
|
971
1044
|
export {};
|