@fedify/fedify 2.0.36-dev.2530 → 2.0.36-dev.2598
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-BBdPdHYx.mjs → builder-B5hI5Xsn.mjs} +3 -3
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{deno-CtG6TwTB.mjs → deno--OYa_lxj.mjs} +1 -1
- package/dist/{docloader-BxW_P_Rq.mjs → docloader-BXR2f83H.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +8 -8
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +381 -8
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.js +1 -1
- package/dist/federation/send.test.mjs +3 -3
- package/dist/federation/temporal.test.mjs +2 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{http-CUOxcDgn.mjs → http-C3d2DXwF.mjs} +2 -2
- package/dist/{http-DMRapH1d.cjs → http-CO_IVq7x.cjs} +1 -1
- package/dist/{http-YAfhvSad.js → http-CfyVeGgF.js} +1 -1
- package/dist/{inbox-DtThTl1D.mjs → inbox-huUE3IP8.mjs} +1 -1
- package/dist/{key-QamJxksu.mjs → key-D5e9c_yV.mjs} +1 -1
- package/dist/{kv-cache-Di_SbH_3.cjs → kv-cache-BMlo_kyv.cjs} +1 -1
- package/dist/{kv-cache-C0MyXzft.js → kv-cache-Zw0soD-7.js} +1 -1
- package/dist/{ld-B0eNy8WK.mjs → ld-9qfz9rP_.mjs} +99 -10
- package/dist/{middleware-D3omYPtg.cjs → middleware-Ad6kTSBf.cjs} +1 -1
- package/dist/{middleware-D1zogq17.js → middleware-BKs_a9P1.js} +111 -15
- package/dist/{middleware-II_yrP7N.mjs → middleware-BhYpLGA_.mjs} +119 -23
- package/dist/{middleware-BKECCXIs.mjs → middleware-CT1Lbohd.mjs} +1 -1
- package/dist/{middleware-CUFw4tT0.cjs → middleware-CXoG7ZAW.cjs} +112 -16
- package/dist/{mod-DVPS4yam.d.cts → mod-BA6vqC2S.d.cts} +19 -7
- package/dist/{mod-BS-jg3Wx.d.ts → mod-CL9Ep0uo.d.ts} +19 -7
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +1 -1
- package/dist/mod.d.ts +1 -1
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-lqq4KXYV.mjs → owner-R4ffU9Ht.mjs} +2 -2
- package/dist/{proof-CqOINd75.cjs → proof-BrreJTRF.cjs} +131 -18
- package/dist/{proof-DMYwiD7d.js → proof-CE8nwTF6.js} +132 -19
- package/dist/{proof-Bf8rYD7r.mjs → proof-CiBs9Q4l.mjs} +36 -12
- package/dist/{send-1tVKmxvT.mjs → send-DpvZgVSA.mjs} +2 -2
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +2 -2
- package/dist/sig/ld.test.mjs +198 -4
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +1 -1
- package/dist/sig/mod.d.ts +1 -1
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +71 -2
- package/dist/{temporal-D6JQXNOJ.mjs → temporal-Dd-J410Z.mjs} +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 +5 -5
package/dist/sig/proof.test.mjs
CHANGED
|
@@ -6,7 +6,8 @@ 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 {
|
|
9
|
+
import { f as signJsonLd, h as verifySignature, s as detachSignature } from "../ld-9qfz9rP_.mjs";
|
|
10
|
+
import { i as verifyProof, n as signObject, r as verifyObject, t as createProof } from "../proof-CiBs9Q4l.mjs";
|
|
10
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
11
12
|
import { Create, DataIntegrityProof, Multikey, Note, Place } from "@fedify/vocab";
|
|
12
13
|
import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
|
|
@@ -48,7 +49,7 @@ test("createProof()", async () => {
|
|
|
48
49
|
assertEquals(proof.verificationMethodId, ed25519PublicKey.id);
|
|
49
50
|
assertEquals(proof.proofPurpose, "assertionMethod");
|
|
50
51
|
console.log(encodeHex(proof.proofValue));
|
|
51
|
-
assertEquals(proof.proofValue, decodeHex("
|
|
52
|
+
assertEquals(proof.proofValue, decodeHex("22c2d53f7ac073d2e4ee74c8ccec2bf01984740729e8e13d2b02e185e2d490abf82f809fa7347fce78e564a166d78beccd819e1a78414c7fd8aed59fa7aaa90d"));
|
|
52
53
|
assertEquals(proof.created, created);
|
|
53
54
|
assertEquals(await verifyProof(await create.toJsonLd({
|
|
54
55
|
format: "compact",
|
|
@@ -152,6 +153,48 @@ test("signObject()", async () => {
|
|
|
152
153
|
contextLoader: mockDocumentLoader
|
|
153
154
|
}), TypeError, "Unsupported algorithm");
|
|
154
155
|
});
|
|
156
|
+
test("signObject() migrates proofs from an older context", async () => {
|
|
157
|
+
const oldContext = [
|
|
158
|
+
"https://w3id.org/identity/v1",
|
|
159
|
+
"https://www.w3.org/ns/activitystreams",
|
|
160
|
+
"https://w3id.org/security/data-integrity/v1"
|
|
161
|
+
];
|
|
162
|
+
const oldJson = await (await signObject(new Create({
|
|
163
|
+
id: new URL("https://example.com/activities/1"),
|
|
164
|
+
actor: new URL("https://example.com/users/alice")
|
|
165
|
+
}), ed25519PrivateKey, ed25519Multikey.id, {
|
|
166
|
+
contextLoader: mockDocumentLoader,
|
|
167
|
+
context: oldContext
|
|
168
|
+
})).toJsonLd({
|
|
169
|
+
format: "compact",
|
|
170
|
+
contextLoader: mockDocumentLoader,
|
|
171
|
+
context: oldContext
|
|
172
|
+
});
|
|
173
|
+
const json = await (await signObject(await Create.fromJsonLd(oldJson, {
|
|
174
|
+
contextLoader: mockDocumentLoader,
|
|
175
|
+
documentLoader: mockDocumentLoader
|
|
176
|
+
}), ed25519PrivateKey, ed25519Multikey.id, { contextLoader: mockDocumentLoader })).toJsonLd({
|
|
177
|
+
format: "compact",
|
|
178
|
+
contextLoader: mockDocumentLoader
|
|
179
|
+
});
|
|
180
|
+
const proofs = Array.isArray(json.proof) ? json.proof : [json.proof];
|
|
181
|
+
assertEquals(proofs.length, 1);
|
|
182
|
+
assertEquals(proofs[0].verificationMethod, ed25519Multikey.id.href);
|
|
183
|
+
});
|
|
184
|
+
test("signObject() skips context comparison for proofless objects", async () => {
|
|
185
|
+
const activity = new Create({
|
|
186
|
+
id: new URL("https://example.com/activities/1"),
|
|
187
|
+
actor: new URL("https://example.com/users/alice")
|
|
188
|
+
});
|
|
189
|
+
let unformattedSerializations = 0;
|
|
190
|
+
const originalToJsonLd = activity.toJsonLd.bind(activity);
|
|
191
|
+
Object.defineProperty(activity, "toJsonLd", { value: async (options) => {
|
|
192
|
+
if (options?.format == null) unformattedSerializations++;
|
|
193
|
+
return await originalToJsonLd(options);
|
|
194
|
+
} });
|
|
195
|
+
await signObject(activity, ed25519PrivateKey, ed25519Multikey.id, { contextLoader: mockDocumentLoader });
|
|
196
|
+
assertEquals(unformattedSerializations, 0);
|
|
197
|
+
});
|
|
155
198
|
test("verifyProof()", async () => {
|
|
156
199
|
const cache = {};
|
|
157
200
|
const options = {
|
|
@@ -210,6 +253,32 @@ test("verifyProof()", async () => {
|
|
|
210
253
|
}, proof, options), null);
|
|
211
254
|
assertEquals(await verifyProof(jsonLd, proof.clone({ created: Temporal.Now.instant() }), options), null);
|
|
212
255
|
});
|
|
256
|
+
test("signJsonLd() does not invalidate an existing proof", async () => {
|
|
257
|
+
const options = {
|
|
258
|
+
documentLoader: mockDocumentLoader,
|
|
259
|
+
contextLoader: mockDocumentLoader
|
|
260
|
+
};
|
|
261
|
+
const note = new Note({
|
|
262
|
+
id: new URL("https://example.com/notes/1"),
|
|
263
|
+
attribution: new URL("https://example.com/users/alice"),
|
|
264
|
+
content: "Hello"
|
|
265
|
+
});
|
|
266
|
+
const proof = await createProof(note, ed25519PrivateKey, ed25519PublicKey.id, options);
|
|
267
|
+
const withProof = {
|
|
268
|
+
...await note.toJsonLd({
|
|
269
|
+
format: "compact",
|
|
270
|
+
contextLoader: mockDocumentLoader
|
|
271
|
+
}),
|
|
272
|
+
proof: await proof.toJsonLd({
|
|
273
|
+
format: "compact",
|
|
274
|
+
contextLoader: mockDocumentLoader
|
|
275
|
+
})
|
|
276
|
+
};
|
|
277
|
+
const signed = await signJsonLd(withProof, rsaPrivateKey2, rsaPublicKey2.id, options);
|
|
278
|
+
assertEquals(signed["@context"], withProof["@context"]);
|
|
279
|
+
assertEquals(await verifyProof(detachSignature(signed), proof, options), ed25519Multikey);
|
|
280
|
+
assertEquals(await verifySignature(signed, options), rsaPublicKey2);
|
|
281
|
+
});
|
|
213
282
|
test("verifyObject()", async () => {
|
|
214
283
|
const options = {
|
|
215
284
|
documentLoader: mockDocumentLoader,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { c as getNormalizationContextLoader } from "./ld-
|
|
4
|
+
import { c as getNormalizationContextLoader } from "./ld-9qfz9rP_.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
|
|
@@ -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-C3d2DXwF.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-BXR2f83H.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-BMlo_kyv.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-Zw0soD-7.js";
|
|
4
4
|
export { getAuthenticatedDocumentLoader, kvCache };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/fedify",
|
|
3
|
-
"version": "2.0.36-dev.
|
|
3
|
+
"version": "2.0.36-dev.2598+90504ae2",
|
|
4
4
|
"description": "An ActivityPub server framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ActivityPub",
|
|
@@ -144,9 +144,9 @@
|
|
|
144
144
|
"uri-template-router": "^1.0.0",
|
|
145
145
|
"url-template": "^3.1.1",
|
|
146
146
|
"urlpattern-polyfill": "^10.1.0",
|
|
147
|
-
"@fedify/vocab
|
|
148
|
-
"@fedify/vocab": "2.0.36-dev.
|
|
149
|
-
"@fedify/webfinger": "2.0.36-dev.
|
|
147
|
+
"@fedify/vocab": "2.0.36-dev.2598+90504ae2",
|
|
148
|
+
"@fedify/vocab-runtime": "2.0.36-dev.2598+90504ae2",
|
|
149
|
+
"@fedify/webfinger": "2.0.36-dev.2598+90504ae2"
|
|
150
150
|
},
|
|
151
151
|
"devDependencies": {
|
|
152
152
|
"@std/assert": "npm:@jsr/std__assert@^0.226.0",
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
"typescript": "^6.0.0",
|
|
160
160
|
"wrangler": "^4.17.0",
|
|
161
161
|
"@fedify/fixture": "2.0.0",
|
|
162
|
-
"@fedify/vocab-tools": "^2.0.36-dev.
|
|
162
|
+
"@fedify/vocab-tools": "^2.0.36-dev.2598+90504ae2"
|
|
163
163
|
},
|
|
164
164
|
"scripts": {
|
|
165
165
|
"build:self": "tsdown",
|