@fedify/fedify 2.0.36-dev.2746 → 2.0.36-dev.2779
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/attachment-arrays-D43igPLB.mjs +111 -0
- package/dist/{builder-CnyFdlUn.mjs → builder-UXDfZSno.mjs} +3 -3
- package/dist/compat/attachment-arrays.test.d.mts +2 -0
- package/dist/compat/attachment-arrays.test.mjs +254 -0
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{deno-DCXndlEx.mjs → deno-Bwn7hAXr.mjs} +1 -1
- package/dist/{docloader-7M06kit4.mjs → docloader-DSQXpyiJ.mjs} +2 -2
- package/dist/federation/attachment-responses.test.d.mts +2 -0
- package/dist/federation/attachment-responses.test.mjs +182 -0
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/collection.test.mjs +1 -1
- package/dist/federation/delivery-attachments.test.d.mts +2 -0
- package/dist/federation/delivery-attachments.test.mjs +280 -0
- package/dist/federation/handler.test.mjs +43 -14
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/keycache.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/negotiation.test.mjs +1 -1
- package/dist/federation/retry.test.mjs +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-hjoPA7jZ.js → http-C-P8JP1h.js} +1 -1
- package/dist/{http-hi5IS6qw.mjs → http-DuIId6ul.mjs} +2 -2
- package/dist/{http-BhaAN2KG.cjs → http-aVfiO4CG.cjs} +1 -1
- package/dist/{inbox-Bygi511A.mjs → inbox-Cq4_-nPi.mjs} +1 -1
- package/dist/{key-DYyRTxPH.mjs → key-BMJlknME.mjs} +1 -1
- package/dist/{kv-cache-Bjnv9p9e.cjs → kv-cache-C6BYEp2D.cjs} +1 -1
- package/dist/{kv-cache-YZ2bpa_P.js → kv-cache-PAsTBkxX.js} +1 -1
- package/dist/{ld-CKUnk1Ps.mjs → ld-oemavcUi.mjs} +2 -2
- package/dist/{middleware-D5uql06B.js → middleware-BSMUxoX2.js} +259 -32
- package/dist/{middleware-dYPOyDLN.mjs → middleware-Bw59VTh0.mjs} +1 -1
- package/dist/{middleware-C_4rWloR.cjs → middleware-CjwdngG9.cjs} +260 -32
- package/dist/{middleware-yx080dbw.mjs → middleware-D8Hh8RSu.mjs} +170 -45
- package/dist/{middleware-BDCfPddM.cjs → middleware-sDUMisQG.cjs} +1 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/nodeinfo/types.test.mjs +1 -1
- package/dist/{owner-CqHBbNXl.mjs → owner-CYTWux20.mjs} +2 -2
- package/dist/{proof-CDalRU9r.mjs → proof-B7pdOJb5.mjs} +2 -2
- package/dist/{proof-D2RNLHHt.js → proof-DWny6g-g.js} +2 -2
- package/dist/{proof-DLqGjdaL.cjs → proof-DXp_5fqW.cjs} +3 -3
- package/dist/{send-XHpoZpxW.mjs → send-7rTXYfE8.mjs} +2 -2
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key-types.test.d.mts +1 -1
- package/dist/sig/key.test.mjs +2 -2
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +26 -3
- package/dist/{temporal-D3yEsvvS.mjs → temporal-CxaXuWOi.mjs} +1 -1
- package/dist/testing/mod.d.mts +1 -1
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +6 -6
- /package/dist/{callback-BFMEE_9V.d.mts → callback-ySj5p3Ml.d.mts} +0 -0
- /package/dist/{collection-ChgDTHLz.mjs → collection-BD6-SZ6O.mjs} +0 -0
- /package/dist/{keycache-crDMn2HK.mjs → keycache-BhLorx33.mjs} +0 -0
- /package/dist/{negotiation-BehA2uul.mjs → negotiation-DnsfFF8I.mjs} +0 -0
- /package/dist/{retry-B_E3V_Dx.mjs → retry-CJL0poaU.mjs} +0 -0
- /package/dist/{types-C37hquWI.mjs → types-DCP0WLdt.mjs} +0 -0
|
@@ -2,32 +2,131 @@ import { Temporal } from "@js-temporal/polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { n as RouterError } from "./router-CrMLXoOr.mjs";
|
|
5
|
-
import { n as version, t as name } from "./deno-
|
|
6
|
-
import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-
|
|
7
|
-
import { u as verifyRequest } from "./http-
|
|
8
|
-
import { n as getAuthenticatedDocumentLoader } from "./docloader-
|
|
5
|
+
import { n as version, t as name } from "./deno-Bwn7hAXr.mjs";
|
|
6
|
+
import { a as importJwk, o as validateCryptoKey, t as exportJwk } from "./key-BMJlknME.mjs";
|
|
7
|
+
import { u as verifyRequest } from "./http-DuIId6ul.mjs";
|
|
8
|
+
import { n as getAuthenticatedDocumentLoader } from "./docloader-DSQXpyiJ.mjs";
|
|
9
9
|
import { n as kvCache } from "./kv-cache-BrjuJue8.mjs";
|
|
10
|
-
import { a as compactJsonLd, c as detachSignature, d as hasVerifiableSignature, f as isClearlyMalformedContextReference, h as verifyCompactJsonLd, l as getNormalizationContextLoader, m as signJsonLd, p as isInvalidUrlTypeError, r as assertSafeJsonLd, s as describeSignatureShape, t as InvalidContextReferenceError, v as wrapContextLoaderForJsonLd } from "./ld-
|
|
11
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-
|
|
12
|
-
import { n as signObject, r as verifyObject } from "./proof-
|
|
10
|
+
import { a as compactJsonLd, c as detachSignature, d as hasVerifiableSignature, f as isClearlyMalformedContextReference, h as verifyCompactJsonLd, l as getNormalizationContextLoader, m as signJsonLd, p as isInvalidUrlTypeError, r as assertSafeJsonLd, s as describeSignatureShape, t as InvalidContextReferenceError, v as wrapContextLoaderForJsonLd } from "./ld-oemavcUi.mjs";
|
|
11
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "./owner-CYTWux20.mjs";
|
|
12
|
+
import { n as signObject, r as verifyObject } from "./proof-B7pdOJb5.mjs";
|
|
13
13
|
import { d as MAX_BODY_SIZE, f as readBoundedText, t as getNodeInfo, u as BodyTooLargeError } from "./client-DLAWT9ep.mjs";
|
|
14
|
-
import { t as
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import { t as
|
|
18
|
-
import { t as
|
|
19
|
-
import { t as
|
|
20
|
-
import { t as
|
|
21
|
-
import { t as
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
14
|
+
import { t as normalizeAttachmentArrays } from "./attachment-arrays-D43igPLB.mjs";
|
|
15
|
+
import { t as nodeInfoToJson } from "./types-DCP0WLdt.mjs";
|
|
16
|
+
import { n as actorsHaveSameOrigin, r as routeActivity } from "./inbox-Cq4_-nPi.mjs";
|
|
17
|
+
import { t as FederationBuilderImpl } from "./builder-UXDfZSno.mjs";
|
|
18
|
+
import { t as buildCollectionSynchronizationHeader } from "./collection-BD6-SZ6O.mjs";
|
|
19
|
+
import { t as KvKeyCache } from "./keycache-BhLorx33.mjs";
|
|
20
|
+
import { t as acceptsJsonLd } from "./negotiation-DnsfFF8I.mjs";
|
|
21
|
+
import { t as hasMalformedKnownTemporalLiteral } from "./temporal-CxaXuWOi.mjs";
|
|
22
|
+
import { t as createExponentialBackoffPolicy } from "./retry-CJL0poaU.mjs";
|
|
23
|
+
import { i as sendActivity, n as extractInboxes, t as SendActivityError } from "./send-7rTXYfE8.mjs";
|
|
24
|
+
import { Activity, Collection, CollectionPage, CryptographicKey, DataIntegrityProof, Link, Multikey, Object as Object$1, OrderedCollection, OrderedCollectionPage, getTypeId, lookupObject, traverseCollection } from "@fedify/vocab";
|
|
24
25
|
import { lookupWebFinger } from "@fedify/webfinger";
|
|
25
26
|
import { SpanKind, SpanStatusCode, context, propagation, trace } from "@opentelemetry/api";
|
|
26
|
-
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
27
|
+
import { encodeMultibase, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
27
28
|
import { asCryptoKey } from "@fedify/vocab-runtime/internal";
|
|
28
29
|
import { getLogger, withContext } from "@logtape/logtape";
|
|
29
30
|
import { ATTR_HTTP_REQUEST_HEADER, ATTR_HTTP_REQUEST_METHOD, ATTR_HTTP_RESPONSE_HEADER, ATTR_HTTP_RESPONSE_STATUS_CODE, ATTR_URL_FULL } from "@opentelemetry/semantic-conventions";
|
|
31
|
+
import { encodeHex } from "byte-encodings/hex";
|
|
32
|
+
import serialize from "json-canon";
|
|
30
33
|
import { domainToASCII } from "node:url";
|
|
34
|
+
//#region src/sig/proof-creation.ts
|
|
35
|
+
/** Signs the exact serialized message supplied by an internal producer. */
|
|
36
|
+
async function createProofForJsonLd(jsonLd, privateKey, keyId, created) {
|
|
37
|
+
validateCryptoKey(privateKey, "private");
|
|
38
|
+
if (privateKey.algorithm.name !== "Ed25519") throw new TypeError("Unsupported algorithm: " + privateKey.algorithm.name);
|
|
39
|
+
const encoder = new TextEncoder();
|
|
40
|
+
const msgDigest = await crypto.subtle.digest("SHA-256", encoder.encode(serialize(jsonLd)));
|
|
41
|
+
created ??= Temporal.Now.instant();
|
|
42
|
+
const proofConfig = {
|
|
43
|
+
"@context": jsonLd["@context"],
|
|
44
|
+
type: "DataIntegrityProof",
|
|
45
|
+
cryptosuite: "eddsa-jcs-2022",
|
|
46
|
+
verificationMethod: keyId.href,
|
|
47
|
+
proofPurpose: "assertionMethod",
|
|
48
|
+
created: created.toString()
|
|
49
|
+
};
|
|
50
|
+
const proofDigest = await crypto.subtle.digest("SHA-256", encoder.encode(serialize(proofConfig)));
|
|
51
|
+
const digest = new Uint8Array(proofDigest.byteLength + msgDigest.byteLength);
|
|
52
|
+
digest.set(new Uint8Array(proofDigest), 0);
|
|
53
|
+
digest.set(new Uint8Array(msgDigest), proofDigest.byteLength);
|
|
54
|
+
const sig = await crypto.subtle.sign("Ed25519", asCryptoKey(privateKey), digest);
|
|
55
|
+
return new DataIntegrityProof({
|
|
56
|
+
cryptosuite: "eddsa-jcs-2022",
|
|
57
|
+
verificationMethod: keyId,
|
|
58
|
+
proofPurpose: "assertionMethod",
|
|
59
|
+
created,
|
|
60
|
+
proofValue: new Uint8Array(sig)
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
//#region src/compat/delivery-jsonld.ts
|
|
65
|
+
/**
|
|
66
|
+
* Returns changed attachment JSON only; unchanged documents keep the existing
|
|
67
|
+
* delivery signing path. This uses ordinary vocabulary serialization, without
|
|
68
|
+
* retaining or repairing independently signed child representations.
|
|
69
|
+
*/
|
|
70
|
+
async function prepareActivityJsonLd(activity, contextLoader) {
|
|
71
|
+
if (activity.proofIds.length > 0) return void 0;
|
|
72
|
+
for await (const _ of activity.getProofs({ contextLoader })) return void 0;
|
|
73
|
+
const source = await activity.clone().toJsonLd({
|
|
74
|
+
format: "compact",
|
|
75
|
+
contextLoader
|
|
76
|
+
});
|
|
77
|
+
const prepared = await normalizeAttachmentArrays(source, contextLoader);
|
|
78
|
+
return prepared !== source && typeof prepared === "object" && prepared != null && !Array.isArray(prepared) ? prepared : void 0;
|
|
79
|
+
}
|
|
80
|
+
/** Signs a changed, proof-free delivery map without serializing it again. */
|
|
81
|
+
async function signActivityJsonLd(activity, unsigned, keys, options) {
|
|
82
|
+
const proofs = [];
|
|
83
|
+
const serializedProofs = [];
|
|
84
|
+
const tracer = (options.tracerProvider ?? trace.getTracerProvider()).getTracer(name, version);
|
|
85
|
+
for (const { privateKey, keyId } of keys) {
|
|
86
|
+
const proof = await tracer.startActiveSpan("object_integrity_proofs.sign", { attributes: { "activitypub.object.type": getTypeId(activity).href } }, async (span) => {
|
|
87
|
+
try {
|
|
88
|
+
if (activity.id != null) span.setAttribute("activitypub.object.id", activity.id.href);
|
|
89
|
+
const proof = await createProofForJsonLd(unsigned, privateKey, keyId);
|
|
90
|
+
if (span.isRecording()) {
|
|
91
|
+
span.setAttribute("object_integrity_proofs.cryptosuite", "eddsa-jcs-2022");
|
|
92
|
+
span.setAttribute("object_integrity_proofs.key_id", keyId.href);
|
|
93
|
+
span.setAttribute("object_integrity_proofs.signature", encodeHex(proof.proofValue));
|
|
94
|
+
}
|
|
95
|
+
return proof;
|
|
96
|
+
} catch (error) {
|
|
97
|
+
span.setStatus({
|
|
98
|
+
code: SpanStatusCode.ERROR,
|
|
99
|
+
message: String(error)
|
|
100
|
+
});
|
|
101
|
+
throw error;
|
|
102
|
+
} finally {
|
|
103
|
+
span.end();
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
proofs.push(proof);
|
|
107
|
+
serializedProofs.push({
|
|
108
|
+
"@context": unsigned["@context"],
|
|
109
|
+
type: "DataIntegrityProof",
|
|
110
|
+
cryptosuite: proof.cryptosuite,
|
|
111
|
+
verificationMethod: keyId.href,
|
|
112
|
+
proofPurpose: "assertionMethod",
|
|
113
|
+
created: proof.created.toString(),
|
|
114
|
+
proofValue: new TextDecoder().decode(encodeMultibase("base58btc", proof.proofValue))
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
if (proofs.length === 0) return {
|
|
118
|
+
activity,
|
|
119
|
+
jsonLd: unsigned
|
|
120
|
+
};
|
|
121
|
+
return {
|
|
122
|
+
activity: activity.clone({ proofs }),
|
|
123
|
+
jsonLd: {
|
|
124
|
+
...unsigned,
|
|
125
|
+
proof: serializedProofs.length === 1 ? serializedProofs[0] : serializedProofs
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
//#endregion
|
|
31
130
|
//#region src/compat/transformers.ts
|
|
32
131
|
const logger$1 = getLogger([
|
|
33
132
|
"fedify",
|
|
@@ -206,7 +305,7 @@ async function handleActor(request, { identifier, context, actorDispatcher, auth
|
|
|
206
305
|
if (authorizePredicate != null) {
|
|
207
306
|
if (!await authorizePredicate(context, identifier)) return await onUnauthorized(request);
|
|
208
307
|
}
|
|
209
|
-
const jsonLd = await actor
|
|
308
|
+
const jsonLd = await serializeForResponse(actor, context);
|
|
210
309
|
return new Response(JSON.stringify(jsonLd), { headers: {
|
|
211
310
|
"Content-Type": "application/activity+json",
|
|
212
311
|
Vary: "Accept"
|
|
@@ -226,7 +325,7 @@ async function handleObject(request, { values, context, objectDispatcher, author
|
|
|
226
325
|
if (authorizePredicate != null) {
|
|
227
326
|
if (!await authorizePredicate(context, values)) return await onUnauthorized(request);
|
|
228
327
|
}
|
|
229
|
-
const jsonLd = await object
|
|
328
|
+
const jsonLd = await serializeForResponse(object, context);
|
|
230
329
|
return new Response(JSON.stringify(jsonLd), { headers: {
|
|
231
330
|
"Content-Type": "application/activity+json",
|
|
232
331
|
Vary: "Accept"
|
|
@@ -357,7 +456,7 @@ async function handleCollection(request, { name: name$1, identifier, uriGetter,
|
|
|
357
456
|
if (collectionCallbacks.authorizePredicate != null) {
|
|
358
457
|
if (!await collectionCallbacks.authorizePredicate(context, identifier)) return await onUnauthorized(request);
|
|
359
458
|
}
|
|
360
|
-
const jsonLd = await collection
|
|
459
|
+
const jsonLd = await serializeForResponse(collection, context);
|
|
361
460
|
return new Response(JSON.stringify(jsonLd), { headers: {
|
|
362
461
|
"Content-Type": "application/activity+json",
|
|
363
462
|
Vary: "Accept"
|
|
@@ -917,7 +1016,7 @@ var CustomCollectionHandler = class {
|
|
|
917
1016
|
* @returns A promise that resolves to the JSON-LD representation.
|
|
918
1017
|
*/
|
|
919
1018
|
async toJsonLd() {
|
|
920
|
-
return (await this.collection
|
|
1019
|
+
return serializeForResponse(await this.collection, this.context);
|
|
921
1020
|
}
|
|
922
1021
|
/**
|
|
923
1022
|
* Fetches the collection with optional cursor for pagination.
|
|
@@ -1220,7 +1319,7 @@ var UnauthorizedError = class extends HandlerError {
|
|
|
1220
1319
|
* @since 0.3.0
|
|
1221
1320
|
*/
|
|
1222
1321
|
async function respondWithObject(object, options) {
|
|
1223
|
-
const jsonLd = await object
|
|
1322
|
+
const jsonLd = await serializeForResponse(object, options);
|
|
1224
1323
|
return new Response(JSON.stringify(jsonLd), { headers: { "Content-Type": "application/activity+json" } });
|
|
1225
1324
|
}
|
|
1226
1325
|
/**
|
|
@@ -1238,6 +1337,10 @@ async function respondWithObjectIfAcceptable(object, request, options) {
|
|
|
1238
1337
|
response.headers.set("Vary", "Accept");
|
|
1239
1338
|
return response;
|
|
1240
1339
|
}
|
|
1340
|
+
/** Applies compatibility changes only after ordinary vocabulary serialization. */
|
|
1341
|
+
async function serializeForResponse(object, options) {
|
|
1342
|
+
return await normalizeAttachmentArrays(await object.toJsonLd(options), options?.contextLoader);
|
|
1343
|
+
}
|
|
1241
1344
|
//#endregion
|
|
1242
1345
|
//#region src/federation/webfinger.ts
|
|
1243
1346
|
const logger = getLogger([
|
|
@@ -2104,19 +2207,29 @@ var FederationImpl = class extends FederationBuilderImpl {
|
|
|
2104
2207
|
proofCreated = true;
|
|
2105
2208
|
break;
|
|
2106
2209
|
}
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2210
|
+
const prepared = !proofCreated && options.activityJsonLd == null ? await prepareActivityJsonLd(activity, contextLoader) : void 0;
|
|
2211
|
+
let jsonLd;
|
|
2212
|
+
if (prepared != null) {
|
|
2213
|
+
const signingKeys = keys.filter(({ privateKey }) => privateKey.algorithm.name === "Ed25519");
|
|
2214
|
+
const signed = await signActivityJsonLd(activity, prepared, signingKeys, { tracerProvider: this.tracerProvider });
|
|
2215
|
+
activity = signed.activity;
|
|
2216
|
+
jsonLd = signed.jsonLd;
|
|
2217
|
+
proofCreated = signingKeys.length > 0;
|
|
2218
|
+
} else {
|
|
2219
|
+
if (!proofCreated) {
|
|
2220
|
+
for (const { keyId, privateKey } of keys) if (privateKey.algorithm.name === "Ed25519") {
|
|
2221
|
+
activity = await signObject(activity, privateKey, keyId, {
|
|
2222
|
+
contextLoader,
|
|
2223
|
+
tracerProvider: this.tracerProvider
|
|
2224
|
+
});
|
|
2225
|
+
proofCreated = true;
|
|
2226
|
+
}
|
|
2114
2227
|
}
|
|
2228
|
+
jsonLd = options.activityJsonLd != null ? detachSignature(options.activityJsonLd) : await activity.toJsonLd({
|
|
2229
|
+
format: "compact",
|
|
2230
|
+
contextLoader
|
|
2231
|
+
});
|
|
2115
2232
|
}
|
|
2116
|
-
let jsonLd = options.activityJsonLd != null ? detachSignature(options.activityJsonLd) : await activity.toJsonLd({
|
|
2117
|
-
format: "compact",
|
|
2118
|
-
contextLoader
|
|
2119
|
-
});
|
|
2120
2233
|
if (rsaKey == null) logger.warn("No supported key found to create a Linked Data signature for the activity {activityId}. The activity will be sent without a Linked Data signature. In order to create a Linked Data signature, at least one RSASSA-PKCS1-v1_5 key must be provided.", {
|
|
2121
2234
|
activityId,
|
|
2122
2235
|
keys: keys.map((pair) => ({
|
|
@@ -2955,19 +3068,31 @@ var ContextImpl = class ContextImpl {
|
|
|
2955
3068
|
}
|
|
2956
3069
|
if (actorKeyPairs != null) {
|
|
2957
3070
|
const contextLoader = this.contextLoader;
|
|
2958
|
-
|
|
3071
|
+
const willSign = actorKeyPairs.some((kp) => kp.privateKey.algorithm.name === "Ed25519" && kp.multikey.id != null);
|
|
3072
|
+
if (willSign) {
|
|
2959
3073
|
if (activityJsonLd != null && !contextMatches) activity = activity.clone({ proofs: [] });
|
|
2960
3074
|
}
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
});
|
|
2968
|
-
|
|
3075
|
+
const prepared = willSign ? await prepareActivityJsonLd(activity, contextLoader) : void 0;
|
|
3076
|
+
if (prepared != null) {
|
|
3077
|
+
const signingKeys = actorKeyPairs.flatMap((kp) => kp.privateKey.algorithm.name === "Ed25519" && kp.multikey.id != null ? [{
|
|
3078
|
+
privateKey: kp.privateKey,
|
|
3079
|
+
keyId: kp.multikey.id
|
|
3080
|
+
}] : []);
|
|
3081
|
+
const signed = await signActivityJsonLd(activity, prepared, signingKeys, { tracerProvider: this.tracerProvider });
|
|
3082
|
+
activity = signed.activity;
|
|
3083
|
+
activityJsonLd = signed.jsonLd;
|
|
3084
|
+
} else {
|
|
3085
|
+
let proofAdded = false;
|
|
3086
|
+
for (const kp of actorKeyPairs) {
|
|
3087
|
+
if (kp.privateKey.algorithm.name !== "Ed25519" || kp.multikey.id == null) continue;
|
|
3088
|
+
activity = await signObject(activity, kp.privateKey, kp.multikey.id, {
|
|
3089
|
+
contextLoader,
|
|
3090
|
+
tracerProvider: this.tracerProvider
|
|
3091
|
+
});
|
|
3092
|
+
proofAdded = true;
|
|
3093
|
+
}
|
|
3094
|
+
if (proofAdded) activityJsonLd = void 0;
|
|
2969
3095
|
}
|
|
2970
|
-
if (proofAdded) activityJsonLd = void 0;
|
|
2971
3096
|
}
|
|
2972
3097
|
const opts = {
|
|
2973
3098
|
context: this,
|
|
@@ -3593,4 +3718,4 @@ function getRequestId(request) {
|
|
|
3593
3718
|
return `req_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 8)}`;
|
|
3594
3719
|
}
|
|
3595
3720
|
//#endregion
|
|
3596
|
-
export { autoIdAssigner as _, createFederation as a, handleCollection as c, handleObject as d, respondWithObject as f, actorDehydrator as g, handleNodeInfoJrd as h, KvSpecDeterminer as i, handleCustomCollection as l, handleNodeInfo as m, FederationImpl as n, handleWebFinger as o, respondWithObjectIfAcceptable as p, InboxContextImpl as r, handleActor as s, ContextImpl as t, handleInbox as u };
|
|
3721
|
+
export { autoIdAssigner as _, createFederation as a, handleCollection as c, handleObject as d, respondWithObject as f, actorDehydrator as g, handleNodeInfoJrd as h, KvSpecDeterminer as i, handleCustomCollection as l, handleNodeInfo as m, FederationImpl as n, handleWebFinger as o, respondWithObjectIfAcceptable as p, InboxContextImpl as r, handleActor as s, ContextImpl as t, handleInbox as u, prepareActivityJsonLd as v };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
|
-
const require_middleware = require("./middleware-
|
|
3
|
+
const require_middleware = require("./middleware-CjwdngG9.cjs");
|
|
4
4
|
exports.FederationImpl = require_middleware.FederationImpl;
|
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-aVfiO4CG.cjs");
|
|
8
|
+
const require_middleware = require("./middleware-CjwdngG9.cjs");
|
|
9
9
|
const require_types = require("./types-DOvyymM4.cjs");
|
|
10
|
-
const require_proof = require("./proof-
|
|
11
|
-
const require_kv_cache = require("./kv-cache-
|
|
10
|
+
const require_proof = require("./proof-DXp_5fqW.cjs");
|
|
11
|
+
const require_kv_cache = require("./kv-cache-C6BYEp2D.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 { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "./http-
|
|
7
|
-
import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "./middleware-
|
|
6
|
+
import { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "./http-C-P8JP1h.js";
|
|
7
|
+
import { a as createExponentialBackoffPolicy, c as buildCollectionSynchronizationHeader, d as Router, f as RouterError, i as SendActivityError, l as digest, o as respondWithObject, r as handleWebFinger, s as respondWithObjectIfAcceptable, t as createFederation, u as createFederationBuilder } from "./middleware-BSMUxoX2.js";
|
|
8
8
|
import { n as getNodeInfo, r as parseNodeInfo, t as nodeInfoToJson } from "./types-B1_pRFE_.js";
|
|
9
|
-
import { a as doesActorOwnKey, b as verifyJsonLd, d as createSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, p as detachSignature, r as verifyObject, t as createProof, v as signJsonLd, x as verifySignature } from "./proof-
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-
|
|
9
|
+
import { a as doesActorOwnKey, b as verifyJsonLd, d as createSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, p as detachSignature, r as verifyObject, t as createProof, v as signJsonLd, x as verifySignature } from "./proof-DWny6g-g.js";
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "./kv-cache-PAsTBkxX.js";
|
|
11
11
|
import { InProcessMessageQueue, MemoryKvStore, ParallelMessageQueue } from "./federation/mod.js";
|
|
12
12
|
import "./nodeinfo/mod.js";
|
|
13
13
|
import "./runtime/mod.js";
|
|
@@ -5,7 +5,7 @@ import { n as createRequestContext } from "../context-Juj6bdHC.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
6
|
import "../std__assert-DflMZha5.mjs";
|
|
7
7
|
import { t as MemoryKvStore } from "../kv-BrZHNugx.mjs";
|
|
8
|
-
import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-
|
|
8
|
+
import { a as createFederation, h as handleNodeInfoJrd, m as handleNodeInfo } from "../middleware-D8Hh8RSu.mjs";
|
|
9
9
|
import { test } from "@fedify/fixture";
|
|
10
10
|
//#region src/nodeinfo/handler.test.ts
|
|
11
11
|
test("handleNodeInfo()", async () => {
|
|
@@ -4,7 +4,7 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import "../std__assert-DflMZha5.mjs";
|
|
6
6
|
import { t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
|
|
7
|
-
import { t as nodeInfoToJson } from "../types-
|
|
7
|
+
import { t as nodeInfoToJson } from "../types-DCP0WLdt.mjs";
|
|
8
8
|
import { test } from "@fedify/fixture";
|
|
9
9
|
//#region src/nodeinfo/types.test.ts
|
|
10
10
|
test("nodeInfoToJson()", () => {
|
|
@@ -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 { n as fetchActorDocument, s as verifyKeyOwnership, t as exportJwk } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-Bwn7hAXr.mjs";
|
|
5
|
+
import { n as fetchActorDocument, s as verifyKeyOwnership, t as exportJwk } from "./key-BMJlknME.mjs";
|
|
6
6
|
import { CryptographicKey, Object as Object$1, isActor } from "@fedify/vocab";
|
|
7
7
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
import { getDocumentLoader } from "@fedify/vocab-runtime";
|
|
@@ -1,8 +1,8 @@
|
|
|
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 { o as validateCryptoKey, r as fetchKey } from "./key-
|
|
4
|
+
import { n as version, t as name } from "./deno-Bwn7hAXr.mjs";
|
|
5
|
+
import { o as validateCryptoKey, r as fetchKey } from "./key-BMJlknME.mjs";
|
|
6
6
|
import { Activity, DataIntegrityProof, Multikey, getTypeId } from "@fedify/vocab";
|
|
7
7
|
import { SpanStatusCode, trace } from "@opentelemetry/api";
|
|
8
8
|
import { asCryptoKey } from "@fedify/vocab-runtime/internal";
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { a as fetchActorDocument, d as name, f as version, i as exportJwk, l as validateCryptoKey, o as fetchKey, u as verifyKeyOwnership } from "./http-
|
|
3
|
+
import { a as fetchActorDocument, d as name, f as version, i as exportJwk, l as validateCryptoKey, o as fetchKey, u as verifyKeyOwnership } from "./http-C-P8JP1h.js";
|
|
4
4
|
import { getLogger } from "@logtape/logtape";
|
|
5
5
|
import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, getTypeId, isActor } from "@fedify/vocab";
|
|
6
6
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
7
7
|
import { encodeHex } from "byte-encodings/hex";
|
|
8
8
|
import { getDocumentLoader, preloadedContexts } from "@fedify/vocab-runtime";
|
|
9
|
+
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
9
10
|
import { asCryptoKey } from "@fedify/vocab-runtime/internal";
|
|
10
11
|
import { decodeBase64, encodeBase64 } from "byte-encodings/base64";
|
|
11
|
-
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
12
12
|
import serialize from "json-canon";
|
|
13
13
|
//#region src/sig/ld.ts
|
|
14
14
|
const logger$2 = getLogger([
|
|
@@ -1,16 +1,16 @@
|
|
|
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-aVfiO4CG.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");
|
|
8
8
|
let byte_encodings_hex = require("byte-encodings/hex");
|
|
9
9
|
let _fedify_vocab_runtime = require("@fedify/vocab-runtime");
|
|
10
|
-
let _fedify_vocab_runtime_internal = require("@fedify/vocab-runtime/internal");
|
|
11
|
-
let byte_encodings_base64 = require("byte-encodings/base64");
|
|
12
10
|
let _fedify_vocab_runtime_jsonld = require("@fedify/vocab-runtime/jsonld");
|
|
13
11
|
_fedify_vocab_runtime_jsonld = require_chunk.__toESM(_fedify_vocab_runtime_jsonld);
|
|
12
|
+
let _fedify_vocab_runtime_internal = require("@fedify/vocab-runtime/internal");
|
|
13
|
+
let byte_encodings_base64 = require("byte-encodings/base64");
|
|
14
14
|
let json_canon = require("json-canon");
|
|
15
15
|
json_canon = require_chunk.__toESM(json_canon);
|
|
16
16
|
//#region src/sig/ld.ts
|
|
@@ -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 { r as doubleKnockScoped } from "./http-
|
|
4
|
+
import { n as version, t as name } from "./deno-Bwn7hAXr.mjs";
|
|
5
|
+
import { r as doubleKnockScoped } from "./http-DuIId6ul.mjs";
|
|
6
6
|
import { SpanKind, SpanStatusCode, trace } from "@opentelemetry/api";
|
|
7
7
|
import { FetchError, UrlError } from "@fedify/vocab-runtime";
|
|
8
8
|
import { openDirectFetch, openPublicFetch } from "@fedify/vocab-runtime/internal";
|
package/dist/sig/http.test.mjs
CHANGED
|
@@ -7,8 +7,8 @@ import { i as assertExists, t as assertStringIncludes } from "../std__assert-Dfl
|
|
|
7
7
|
import { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
|
|
8
8
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
9
9
|
import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
|
|
10
|
-
import { t as exportJwk } from "../key-
|
|
11
|
-
import { a as formatRfc9421SignatureParameters, c as signRequest, i as formatRfc9421Signature, l as timingSafeEqual, n as doubleKnock, o as parseRfc9421Signature, r as doubleKnockScoped, s as parseRfc9421SignatureInput, t as createRfc9421SignatureBase, u as verifyRequest } from "../http-
|
|
10
|
+
import { t as exportJwk } from "../key-BMJlknME.mjs";
|
|
11
|
+
import { a as formatRfc9421SignatureParameters, c as signRequest, i as formatRfc9421Signature, l as timingSafeEqual, n as doubleKnock, o as parseRfc9421Signature, r as doubleKnockScoped, s as parseRfc9421SignatureInput, t as createRfc9421SignatureBase, u as verifyRequest } from "../http-DuIId6ul.mjs";
|
|
12
12
|
import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-CCxRJhWa.mjs";
|
|
13
13
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
14
14
|
import { FetchError, exportSpki } from "@fedify/vocab-runtime";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { a as ActorCallbackSetters, c as SenderKeyPair, d as exportJwk, l as HttpMessageSignaturesSpecDeterminer, n as Context, r as InboxContext, s as InboxListenerSetters, t as ActorKeyPairsDispatcher, u as signRequest } from "../callback-
|
|
3
|
+
import { a as ActorCallbackSetters, c as SenderKeyPair, d as exportJwk, l as HttpMessageSignaturesSpecDeterminer, n as Context, r as InboxContext, s as InboxListenerSetters, t as ActorKeyPairsDispatcher, u as signRequest } from "../callback-ySj5p3Ml.mjs";
|
|
4
4
|
import { Activity, CryptographicKey, DataIntegrityProof, Multikey, Object as Object$1, Recipient } from "@fedify/vocab";
|
|
5
5
|
import { TracerProvider } from "@opentelemetry/api";
|
|
6
6
|
import { AuthenticatedDocumentLoaderFactory, CryptoKeyLike, CryptoKeyPairLike, DocumentLoader, DocumentLoaderFactoryOptions, exportMultibaseKey, exportSpki } from "@fedify/vocab-runtime";
|
package/dist/sig/key.test.mjs
CHANGED
|
@@ -6,9 +6,9 @@ import { n as assertStrictEquals } from "../std__assert-DflMZha5.mjs";
|
|
|
6
6
|
import { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
|
|
7
7
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
8
8
|
import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
|
|
9
|
-
import { a as importJwk, i as generateCryptoKeyPair, o as validateCryptoKey, r as fetchKey, t as exportJwk } from "../key-
|
|
9
|
+
import { a as importJwk, i as generateCryptoKeyPair, o as validateCryptoKey, r as fetchKey, t as exportJwk } from "../key-BMJlknME.mjs";
|
|
10
10
|
import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
|
|
11
|
-
import { v as wrapContextLoaderForJsonLd } from "../ld-
|
|
11
|
+
import { v as wrapContextLoaderForJsonLd } from "../ld-oemavcUi.mjs";
|
|
12
12
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
13
13
|
import { CryptographicKey, Multikey, Person } from "@fedify/vocab";
|
|
14
14
|
import { FetchError, UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
|
package/dist/sig/ld.test.mjs
CHANGED
|
@@ -5,9 +5,9 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
|
5
5
|
import { r as assertFalse, t as assertThrows } from "../assert_throws-D4DNWrux.mjs";
|
|
6
6
|
import { n as assertInstanceOf, t as assert } from "../assert-BhQd8QHP.mjs";
|
|
7
7
|
import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
|
|
8
|
-
import { i as generateCryptoKeyPair } from "../key-
|
|
8
|
+
import { i as generateCryptoKeyPair } from "../key-BMJlknME.mjs";
|
|
9
9
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
|
|
10
|
-
import { _ as verifySignature, a as compactJsonLd, c as detachSignature, d as hasVerifiableSignature, g as verifyJsonLd, i as attachSignature, m as signJsonLd, n as UnsafeJsonLdError, o as createSignature, p as isInvalidUrlTypeError, s as describeSignatureShape, u as hasSignature } from "../ld-
|
|
10
|
+
import { _ as verifySignature, a as compactJsonLd, c as detachSignature, d as hasVerifiableSignature, g as verifyJsonLd, i as attachSignature, m as signJsonLd, n as UnsafeJsonLdError, o as createSignature, p as isInvalidUrlTypeError, s as describeSignatureShape, u as hasSignature } from "../ld-oemavcUi.mjs";
|
|
11
11
|
import { t as ldSignatureWithoutCreated } from "../ld-signature-_KYhPsqt.mjs";
|
|
12
12
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
13
13
|
import { Create, CryptographicKey, Note } from "@fedify/vocab";
|
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-aVfiO4CG.cjs");
|
|
5
|
+
const require_proof = require("../proof-DXp_5fqW.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 { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "../http-
|
|
4
|
-
import { a as doesActorOwnKey, b as verifyJsonLd, d as createSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, p as detachSignature, r as verifyObject, t as createProof, v as signJsonLd, x as verifySignature } from "../proof-
|
|
3
|
+
import { c as importJwk, i as exportJwk, n as signRequest, o as fetchKey, r as verifyRequest, s as generateCryptoKeyPair } from "../http-C-P8JP1h.js";
|
|
4
|
+
import { a as doesActorOwnKey, b as verifyJsonLd, d as createSignature, i as verifyProof, l as attachSignature, n as signObject, o as getKeyOwner, p as detachSignature, r as verifyObject, t as createProof, v as signJsonLd, x as verifySignature } from "../proof-DWny6g-g.js";
|
|
5
5
|
export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, generateCryptoKeyPair, getKeyOwner, importJwk, signJsonLd, signObject, signRequest, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifySignature };
|
package/dist/sig/owner.test.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import "../std__assert-DflMZha5.mjs";
|
|
|
6
6
|
import { r as assertFalse } from "../assert_throws-D4DNWrux.mjs";
|
|
7
7
|
import { t as assert } from "../assert-BhQd8QHP.mjs";
|
|
8
8
|
import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-CCxRJhWa.mjs";
|
|
9
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-
|
|
9
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-CYTWux20.mjs";
|
|
10
10
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
11
11
|
import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
|
|
12
12
|
//#region src/sig/owner.test.ts
|
package/dist/sig/proof.test.mjs
CHANGED
|
@@ -6,10 +6,10 @@ import "../std__assert-DflMZha5.mjs";
|
|
|
6
6
|
import { n as assertInstanceOf } from "../assert-BhQd8QHP.mjs";
|
|
7
7
|
import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
|
|
8
8
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-CCxRJhWa.mjs";
|
|
9
|
-
import { _ as verifySignature, c as detachSignature, m as signJsonLd } from "../ld-
|
|
10
|
-
import { i as verifyProof, n as signObject, r as verifyObject, t as createProof } from "../proof-
|
|
9
|
+
import { _ as verifySignature, c as detachSignature, m as signJsonLd } from "../ld-oemavcUi.mjs";
|
|
10
|
+
import { i as verifyProof, n as signObject, r as verifyObject, t as createProof } from "../proof-B7pdOJb5.mjs";
|
|
11
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
|
-
import { Create, DataIntegrityProof, Multikey, Note, Place } from "@fedify/vocab";
|
|
12
|
+
import { Create, DataIntegrityProof, Multikey, Note, OrderedCollectionPage, Place } from "@fedify/vocab";
|
|
13
13
|
import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
|
|
14
14
|
import { decodeHex, encodeHex } from "byte-encodings/hex";
|
|
15
15
|
//#region src/sig/proof.test.ts
|
|
@@ -153,6 +153,29 @@ test("signObject()", async () => {
|
|
|
153
153
|
contextLoader: mockDocumentLoader
|
|
154
154
|
}), TypeError, "Unsupported algorithm");
|
|
155
155
|
});
|
|
156
|
+
test("collection serialization preserves cached object integrity proofs", async () => {
|
|
157
|
+
const options = {
|
|
158
|
+
documentLoader: mockDocumentLoader,
|
|
159
|
+
contextLoader: mockDocumentLoader
|
|
160
|
+
};
|
|
161
|
+
const source = await (await signObject(fep8b32TestVectorActivity, fep8b32TestVectorPrivateKey, fep8b32TestVectorKeyId, {
|
|
162
|
+
...options,
|
|
163
|
+
created: Temporal.Instant.from("2023-02-24T23:36:38Z")
|
|
164
|
+
})).toJsonLd(options);
|
|
165
|
+
assertInstanceOf(await verifyObject(Create, source, options), Create);
|
|
166
|
+
const cached = await Create.fromJsonLd(source, options);
|
|
167
|
+
const json = await new OrderedCollectionPage({
|
|
168
|
+
id: new URL("https://server.example/outbox?page=1"),
|
|
169
|
+
items: [cached]
|
|
170
|
+
}).toJsonLd(options);
|
|
171
|
+
assertEquals(json.orderedItems[0], source);
|
|
172
|
+
assertEquals(await cached.toJsonLd(), source);
|
|
173
|
+
assertInstanceOf(await verifyObject(Create, json.orderedItems[0], options), Create);
|
|
174
|
+
const restored = await OrderedCollectionPage.fromJsonLd(json, options);
|
|
175
|
+
const items = await Array.fromAsync(restored.getItems(options));
|
|
176
|
+
assertEquals(items.length, 1);
|
|
177
|
+
assertEquals(await items[0].toJsonLd(), source);
|
|
178
|
+
});
|
|
156
179
|
test("signObject() migrates proofs from an older context", async () => {
|
|
157
180
|
const oldContext = [
|
|
158
181
|
"https://w3id.org/identity/v1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { l as getNormalizationContextLoader } from "./ld-
|
|
4
|
+
import { l as getNormalizationContextLoader } from "./ld-oemavcUi.mjs";
|
|
5
5
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
6
6
|
import { normalizeDateTimeLiteral } from "@fedify/vocab-runtime/temporal";
|
|
7
7
|
//#region src/federation/temporal.ts
|
package/dist/testing/mod.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { i as RequestContext, o as Federation, r as InboxContext } from "../callback-
|
|
3
|
+
import { i as RequestContext, o as Federation, r as InboxContext } from "../callback-ySj5p3Ml.mjs";
|
|
4
4
|
import { testDefinitions } from "@fedify/fixture";
|
|
5
5
|
|
|
6
6
|
//#region src/testing/context.d.ts
|
|
@@ -5,9 +5,9 @@ import { t as esm_default } from "../esm-DVILvP5e.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
6
|
import "../std__assert-DflMZha5.mjs";
|
|
7
7
|
import { t as assertRejects } from "../assert_rejects-WyYSTDDX.mjs";
|
|
8
|
-
import { u as verifyRequest } from "../http-
|
|
8
|
+
import { u as verifyRequest } from "../http-DuIId6ul.mjs";
|
|
9
9
|
import { i as rsaPrivateKey2 } from "../keys-CCxRJhWa.mjs";
|
|
10
|
-
import { n as getAuthenticatedDocumentLoader, t as createAuthenticatedDocumentLoader } from "../docloader-
|
|
10
|
+
import { n as getAuthenticatedDocumentLoader, t as createAuthenticatedDocumentLoader } from "../docloader-DSQXpyiJ.mjs";
|
|
11
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
import { FetchError, UrlError } from "@fedify/vocab-runtime";
|
|
13
13
|
import { openDirectFetch, openPublicFetch } from "@fedify/vocab-runtime/internal";
|
package/dist/utils/mod.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const require_kv_cache = require("../kv-cache-
|
|
4
|
+
const require_kv_cache = require("../kv-cache-C6BYEp2D.cjs");
|
|
5
5
|
exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
|
|
6
6
|
exports.kvCache = require_kv_cache.kvCache;
|
package/dist/utils/mod.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-
|
|
3
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-PAsTBkxX.js";
|
|
4
4
|
export { getAuthenticatedDocumentLoader, kvCache };
|