@fedify/fedify 2.3.16-dev.2841 → 2.3.16
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-BlfpZlWF.mjs +16 -0
- package/dist/{builder-G4wSHQX-.mjs → builder-D4GE1Gmi.mjs} +3 -3
- package/dist/callback-kR_sx2zZ.d.mts +2661 -0
- package/dist/{client-BIBzqEIp.d.cts → client-9DPcy_Yx.d.ts} +16 -0
- package/dist/{client-jE7oGvRh.d.ts → client-B3ruDgWg.d.cts} +16 -0
- package/dist/{client-DpUNYKla.mjs → client-DFgYVbUA.mjs} +86 -11
- package/dist/compat/attachment-arrays.test.d.mts +2 -0
- package/dist/compat/attachment-arrays.test.mjs +255 -0
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/outgoing-jsonld.test.mjs +1 -1
- package/dist/compat/public-audience.test.mjs +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{context-CE_Tj_Oc.d.cts → context-CEE8vl-b.d.cts} +31 -14
- package/dist/{context-H_5tZXg-.d.ts → context-CTJwXHRu.d.ts} +31 -14
- package/dist/{deno-DmDVx5sE.mjs → deno-FtdqgHJA.mjs} +1 -1
- package/dist/{docloader-0fjyUmvI.mjs → docloader-B9iU4DP2.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/circuit-breaker.test.mjs +2 -2
- 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 +288 -0
- package/dist/federation/handler.test.mjs +208 -16
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +2 -2
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +1191 -16
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +2 -2
- package/dist/federation/mod.d.ts +2 -2
- 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 +293 -3
- package/dist/federation/temporal.test.mjs +25 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{http-CKX94hfh.cjs → http-2RyDQ0tE.cjs} +6 -4
- package/dist/{http-DmP0sr2l.d.ts → http-Bs5mXWlH.d.ts} +3 -3
- package/dist/{http-CZPYFK3b.d.cts → http-D8DgRhHU.d.cts} +3 -3
- package/dist/{http-DCK-QQfE.mjs → http-D8tiOrZf.mjs} +7 -5
- package/dist/{http-DwIMsxu9.js → http-mLeLYFj-.js} +6 -4
- package/dist/{inbox-Bx6PCMeE.mjs → inbox-Dy8awbi8.mjs} +2 -2
- package/dist/{key-SkLDUmPM.mjs → key-o1SmN5s0.mjs} +4 -3
- package/dist/{kv-cache-BaJOO6O3.mjs → kv-cache-BwUrzCVO.mjs} +1 -1
- package/dist/{kv-cache-BnZ4KLMY.cjs → kv-cache-CI6Z0WiS.cjs} +1 -1
- package/dist/{kv-cache-xIexNacM.js → kv-cache-Dsq8C8D8.js} +1 -1
- package/dist/{ld-DUG6cq9q.mjs → ld-DCKrqj9y.mjs} +155 -22
- package/dist/ld-signature-Dgz_b89j.mjs +23 -0
- package/dist/{metrics-D3OnAgfj.mjs → metrics-CaoYRhNH.mjs} +1 -1
- package/dist/{middleware-CUwjLKp3.mjs → middleware-4p3opEMT.mjs} +1 -1
- package/dist/{middleware-C9RexCTx.cjs → middleware-CP-8P7kk.cjs} +492 -117
- package/dist/{middleware-DU2jy5eY.js → middleware-Cce0nLDw.js} +491 -117
- package/dist/{middleware-zEy-wJYI.mjs → middleware-D31fNcY4.mjs} +399 -109
- package/dist/{mod-C_gFmeNq.d.cts → mod-BD0-_vya.d.ts} +31 -13
- package/dist/{mod-HQXFvOHs.d.ts → mod-BMX6nsHP.d.cts} +31 -13
- package/dist/{mod-CDFFESfL.d.ts → mod-BTvP5Hva.d.ts} +1 -1
- package/dist/{mod-DMjhnFbg.d.ts → mod-DgMTlwUO.d.ts} +3 -3
- package/dist/{mod-DDVkmZ_h.d.cts → mod-Q1Fo3FJk.d.cts} +3 -3
- package/dist/{mod-DDjtbkZO.d.cts → mod-n51LED4J.d.cts} +1 -1
- package/dist/mod.cjs +5 -5
- package/dist/mod.d.cts +8 -8
- package/dist/mod.d.ts +8 -8
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/client.test.mjs +432 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/nodeinfo/mod.cjs +1 -1
- package/dist/nodeinfo/mod.d.cts +1 -1
- package/dist/nodeinfo/mod.d.ts +1 -1
- package/dist/nodeinfo/mod.js +1 -1
- package/dist/nodeinfo/types.test.mjs +1 -1
- package/dist/{outgoing-jsonld-D4iTv7uM.mjs → outgoing-jsonld-BZEAVK_Q.mjs} +38 -8
- package/dist/{owner-Baf_LRb2.mjs → owner-Bdj0nHhf.mjs} +2 -2
- package/dist/{proof-CNGy7TJL.js → proof-B9XJiyz-.js} +1030 -858
- package/dist/{proof-BdAFbOFg.cjs → proof-CmcP8yqP.cjs} +1243 -1059
- package/dist/{proof-LTsbjXnQ.mjs → proof-DrbjYma9.mjs} +41 -16
- package/dist/{send-DOf5y1nB.mjs → send-VD_WG3dN.mjs} +100 -22
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key-types.test.d.mts +218 -0
- package/dist/sig/key-types.test.mjs +8 -0
- package/dist/sig/key.test.mjs +2 -2
- package/dist/sig/ld.test.mjs +573 -8
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +3 -3
- package/dist/sig/mod.d.ts +3 -3
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +96 -4
- package/dist/{temporal-fl4sM1Gs.mjs → temporal-CMvoB-vD.mjs} +3 -5
- package/dist/testing/mod.d.mts +2 -2476
- package/dist/{types-DOvyymM4.cjs → types-BWx7zw3Y.cjs} +85 -10
- package/dist/{types-B1_pRFE_.js → types-Dx_w2JSM.js} +86 -11
- 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/{activity-listener-tztVvlNb.mjs → activity-listener-BeTGV3wc.mjs} +0 -0
- /package/dist/{circuit-breaker-D1fxthDI.mjs → circuit-breaker-B1fLHmg2.mjs} +0 -0
- /package/dist/{circuit-breaker-test-utils-CAdwjgMi.mjs → circuit-breaker-test-utils-BGHm_MsT.mjs} +0 -0
- /package/dist/{collection-Cc3DVAhE.mjs → collection-Dp5ky45w.mjs} +0 -0
- /package/dist/{negotiation-DDstyBvc.mjs → negotiation-DC8nG6J_.mjs} +0 -0
- /package/dist/{public-audience-Dp4ZScSr.mjs → public-audience-rnYUGj8a.mjs} +0 -0
- /package/dist/{retry-CXg_MBI-.mjs → retry-C4G_vIgv.mjs} +0 -0
- /package/dist/{types-J53Kw7so.mjs → types-BFowWFTT.mjs} +0 -0
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-Bs5mXWlH.js";
|
|
3
3
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-CiBPcC6F.js";
|
|
4
|
-
import { _ as
|
|
5
|
-
export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, 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, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
|
4
|
+
import { S as verifySignature, _ as createSignature, a as VerifyObjectOptions, b as signJsonLd, c as hasProofLike, d as verifyProof, f as CreateSignatureOptions, g as attachSignature, h as VerifySignatureOptions, i as SignObjectOptions, l as signObject, m as VerifyJsonLdOptions, n as CryptoKeyPairLike, o as VerifyProofOptions, p as SignJsonLdOptions, r as CreateProofOptions, s as createProof, t as CryptoKeyLike, u as verifyObject, v as detachSignature, x as verifyJsonLd, y as hasSignatureLike } from "../mod-BD0-_vya.js";
|
|
5
|
+
export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, CryptoKeyLike, CryptoKeyPairLike, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, 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, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
package/dist/sig/mod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import { F as validateAcceptSignature, M as formatAcceptSignature, N as fulfillAcceptSignature, P as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, i as verifyRequest, l as fetchKeyDetailed, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "../http-
|
|
4
|
-
import { C as verifySignature, S as verifyJsonLd,
|
|
3
|
+
import { F as validateAcceptSignature, M as formatAcceptSignature, N as fulfillAcceptSignature, P as parseAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, i as verifyRequest, l as fetchKeyDetailed, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "../http-mLeLYFj-.js";
|
|
4
|
+
import { C as verifySignature, S as verifyJsonLd, a as verifyProof, b as signJsonLd, f as createSignature, g as hasSignatureLike, i as verifyObject, m as detachSignature, n as hasProofLike, o as doesActorOwnKey, r as signObject, s as getKeyOwner, t as createProof, u as attachSignature } from "../proof-B9XJiyz-.js";
|
|
5
5
|
export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, hasProofLike, hasSignatureLike, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
package/dist/sig/owner.test.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import "../std__assert-BjJn2daJ.mjs";
|
|
|
6
6
|
import { r as assertFalse } from "../assert_throws-BbSMEFKo.mjs";
|
|
7
7
|
import { t as assert } from "../assert-CEO06XCw.mjs";
|
|
8
8
|
import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-BAK-tUlf.mjs";
|
|
9
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-
|
|
9
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-Bdj0nHhf.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
|
package/dist/sig/proof.test.mjs
CHANGED
|
@@ -7,9 +7,10 @@ import { r as assertFalse } from "../assert_throws-BbSMEFKo.mjs";
|
|
|
7
7
|
import { n as assertGreaterOrEqual, t as assertRejects } from "../assert_rejects-D1HYAik3.mjs";
|
|
8
8
|
import { n as assertInstanceOf, t as assert } from "../assert-CEO06XCw.mjs";
|
|
9
9
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
10
|
+
import { c as detachSignature, h as signJsonLd, v as verifySignature } from "../ld-DCKrqj9y.mjs";
|
|
11
|
+
import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-BZEAVK_Q.mjs";
|
|
12
|
+
import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-DrbjYma9.mjs";
|
|
13
|
+
import { Create, DataIntegrityProof, Document, Multikey, Note, OrderedCollectionPage, PUBLIC_COLLECTION, Place } from "@fedify/vocab";
|
|
13
14
|
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
14
15
|
import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
|
|
15
16
|
import { decodeHex } from "byte-encodings/hex";
|
|
@@ -49,7 +50,7 @@ test("createProof()", async () => {
|
|
|
49
50
|
assertEquals(proof.cryptosuite, "eddsa-jcs-2022");
|
|
50
51
|
assertEquals(proof.verificationMethodId, ed25519PublicKey.id);
|
|
51
52
|
assertEquals(proof.proofPurpose, "assertionMethod");
|
|
52
|
-
assertEquals(proof.proofValue, decodeHex("
|
|
53
|
+
assertEquals(proof.proofValue, decodeHex("471e7aefd4ce4be462d1d7e1194ccfe3c177e10986740e47b60330e1655a0242202e47d3fa6599a83bf9f989c05a1507907e3bbea44c6391243a8e5c29d8ba00"));
|
|
53
54
|
assertEquals(proof.created, created);
|
|
54
55
|
assertEquals(await verifyProof(await create.toJsonLd({
|
|
55
56
|
format: "compact",
|
|
@@ -237,6 +238,71 @@ test("hasProofLike()", () => {
|
|
|
237
238
|
proofPurpose: "assertionMethod"
|
|
238
239
|
} }));
|
|
239
240
|
});
|
|
241
|
+
test("collection serialization preserves cached object integrity proofs", async () => {
|
|
242
|
+
const options = {
|
|
243
|
+
documentLoader: mockDocumentLoader,
|
|
244
|
+
contextLoader: mockDocumentLoader
|
|
245
|
+
};
|
|
246
|
+
const source = await (await signObject(fep8b32TestVectorActivity, fep8b32TestVectorPrivateKey, fep8b32TestVectorKeyId, {
|
|
247
|
+
...options,
|
|
248
|
+
created: Temporal.Instant.from("2023-02-24T23:36:38Z")
|
|
249
|
+
})).toJsonLd(options);
|
|
250
|
+
assertInstanceOf(await verifyObject(Create, source, options), Create);
|
|
251
|
+
const cached = await Create.fromJsonLd(source, options);
|
|
252
|
+
const json = await new OrderedCollectionPage({
|
|
253
|
+
id: new URL("https://server.example/outbox?page=1"),
|
|
254
|
+
items: [cached]
|
|
255
|
+
}).toJsonLd(options);
|
|
256
|
+
assertEquals(json.orderedItems[0], source);
|
|
257
|
+
assertEquals(await cached.toJsonLd(), source);
|
|
258
|
+
assertInstanceOf(await verifyObject(Create, json.orderedItems[0], options), Create);
|
|
259
|
+
const restored = await OrderedCollectionPage.fromJsonLd(json, options);
|
|
260
|
+
const items = await Array.fromAsync(restored.getItems(options));
|
|
261
|
+
assertEquals(items.length, 1);
|
|
262
|
+
assertEquals(await items[0].toJsonLd(), source);
|
|
263
|
+
});
|
|
264
|
+
test("signObject() migrates proofs from an older context", async () => {
|
|
265
|
+
const oldContext = [
|
|
266
|
+
"https://w3id.org/identity/v1",
|
|
267
|
+
"https://www.w3.org/ns/activitystreams",
|
|
268
|
+
"https://w3id.org/security/data-integrity/v1"
|
|
269
|
+
];
|
|
270
|
+
const oldJson = await (await signObject(new Create({
|
|
271
|
+
id: new URL("https://example.com/activities/1"),
|
|
272
|
+
actor: new URL("https://example.com/users/alice")
|
|
273
|
+
}), ed25519PrivateKey, ed25519Multikey.id, {
|
|
274
|
+
contextLoader: mockDocumentLoader,
|
|
275
|
+
context: oldContext
|
|
276
|
+
})).toJsonLd({
|
|
277
|
+
format: "compact",
|
|
278
|
+
contextLoader: mockDocumentLoader,
|
|
279
|
+
context: oldContext
|
|
280
|
+
});
|
|
281
|
+
const json = await (await signObject(await Create.fromJsonLd(oldJson, {
|
|
282
|
+
contextLoader: mockDocumentLoader,
|
|
283
|
+
documentLoader: mockDocumentLoader
|
|
284
|
+
}), ed25519PrivateKey, ed25519Multikey.id, { contextLoader: mockDocumentLoader })).toJsonLd({
|
|
285
|
+
format: "compact",
|
|
286
|
+
contextLoader: mockDocumentLoader
|
|
287
|
+
});
|
|
288
|
+
const proofs = Array.isArray(json.proof) ? json.proof : [json.proof];
|
|
289
|
+
assertEquals(proofs.length, 1);
|
|
290
|
+
assertEquals(proofs[0].verificationMethod, ed25519Multikey.id.href);
|
|
291
|
+
});
|
|
292
|
+
test("signObject() skips context comparison for proofless objects", async () => {
|
|
293
|
+
const activity = new Create({
|
|
294
|
+
id: new URL("https://example.com/activities/1"),
|
|
295
|
+
actor: new URL("https://example.com/users/alice")
|
|
296
|
+
});
|
|
297
|
+
let unformattedSerializations = 0;
|
|
298
|
+
const originalToJsonLd = activity.toJsonLd.bind(activity);
|
|
299
|
+
Object.defineProperty(activity, "toJsonLd", { value: async (options) => {
|
|
300
|
+
if (options?.format == null) unformattedSerializations++;
|
|
301
|
+
return await originalToJsonLd(options);
|
|
302
|
+
} });
|
|
303
|
+
await signObject(activity, ed25519PrivateKey, ed25519Multikey.id, { contextLoader: mockDocumentLoader });
|
|
304
|
+
assertEquals(unformattedSerializations, 0);
|
|
305
|
+
});
|
|
240
306
|
test("verifyProof()", async () => {
|
|
241
307
|
const cache = {};
|
|
242
308
|
const options = {
|
|
@@ -487,6 +553,32 @@ test("verifyProof() records verification duration metric", async (t) => {
|
|
|
487
553
|
assertFalse("object_integrity_proofs.cryptosuite" in measurements[0].attributes);
|
|
488
554
|
});
|
|
489
555
|
});
|
|
556
|
+
test("signJsonLd() does not invalidate an existing proof", async () => {
|
|
557
|
+
const options = {
|
|
558
|
+
documentLoader: mockDocumentLoader,
|
|
559
|
+
contextLoader: mockDocumentLoader
|
|
560
|
+
};
|
|
561
|
+
const note = new Note({
|
|
562
|
+
id: new URL("https://example.com/notes/1"),
|
|
563
|
+
attribution: new URL("https://example.com/users/alice"),
|
|
564
|
+
content: "Hello"
|
|
565
|
+
});
|
|
566
|
+
const proof = await createProof(note, ed25519PrivateKey, ed25519PublicKey.id, options);
|
|
567
|
+
const withProof = {
|
|
568
|
+
...await note.toJsonLd({
|
|
569
|
+
format: "compact",
|
|
570
|
+
contextLoader: mockDocumentLoader
|
|
571
|
+
}),
|
|
572
|
+
proof: await proof.toJsonLd({
|
|
573
|
+
format: "compact",
|
|
574
|
+
contextLoader: mockDocumentLoader
|
|
575
|
+
})
|
|
576
|
+
};
|
|
577
|
+
const signed = await signJsonLd(withProof, rsaPrivateKey2, rsaPublicKey2.id, options);
|
|
578
|
+
assertEquals(signed["@context"], withProof["@context"]);
|
|
579
|
+
assertEquals(await verifyProof(detachSignature(signed), proof, options), ed25519Multikey);
|
|
580
|
+
assertEquals(await verifySignature(signed, options), rsaPublicKey2);
|
|
581
|
+
});
|
|
490
582
|
test("verifyObject()", async () => {
|
|
491
583
|
const options = {
|
|
492
584
|
documentLoader: mockDocumentLoader,
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import {
|
|
4
|
+
import { l as getNormalizationContextLoader } from "./ld-DCKrqj9y.mjs";
|
|
5
5
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
6
|
+
import { normalizeDateTimeLiteral } from "@fedify/vocab-runtime/temporal";
|
|
6
7
|
//#region src/federation/temporal.ts
|
|
7
8
|
function isPlainObject(value) {
|
|
8
9
|
return typeof value === "object" && value != null && !Array.isArray(value);
|
|
9
10
|
}
|
|
10
|
-
function normalizeDateTimeLiteral(value) {
|
|
11
|
-
return value.substring(19).match(/[Z+-]/) ? value : value + "Z";
|
|
12
|
-
}
|
|
13
11
|
function isMalformedDateTimeLiteral(value) {
|
|
14
12
|
if (typeof value !== "string") return false;
|
|
15
13
|
try {
|
|
@@ -51,7 +49,7 @@ function hasMalformedExpandedQuestionClosedLiteral(value) {
|
|
|
51
49
|
if (typeof literal === "boolean") return false;
|
|
52
50
|
if (typeof literal !== "string") return false;
|
|
53
51
|
if (value["@type"] !== XSD_DATE_TIME_IRI) return false;
|
|
54
|
-
if (new Date(literal).toString() === "Invalid Date") return false;
|
|
52
|
+
if (new Date(literal).toString() === "Invalid Date" && new Date(normalizeDateTimeLiteral(literal)).toString() === "Invalid Date") return false;
|
|
55
53
|
return isMalformedDateTimeLiteral(literal);
|
|
56
54
|
}
|
|
57
55
|
function hasMalformedExpandedDurationLiteral(value) {
|