@fedify/fedify 2.1.30 → 2.1.32
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-DZ4JHJD8.mjs +111 -0
- package/dist/{builder-CTpfuuVp.mjs → builder--sc-rozj.mjs} +3 -3
- package/dist/callback-BARPujV7.d.mts +2388 -0
- package/dist/{client-CAM_bQXx.d.cts → client-9DPcy_Yx.d.ts} +16 -1
- package/dist/{client-CSddvgWN.d.ts → client-B3ruDgWg.d.cts} +16 -1
- package/dist/{client-CjDMsn4a.mjs → client-cpPaW7Ww.mjs} +189 -65
- package/dist/compat/attachment-arrays.test.d.mts +2 -0
- package/dist/compat/attachment-arrays.test.mjs +254 -0
- 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/{context-DLLaDau8.d.ts → context-DE2YrQwM.d.ts} +56 -13
- package/dist/{context-BNwv9Q1v.d.cts → context-y6ZUQCMf.d.cts} +56 -13
- package/dist/{deno-BATJ1hq6.mjs → deno-L23b3Hba.mjs} +1 -1
- package/dist/docloader-DUXr9k_O.mjs +124 -0
- 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 +208 -16
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +1559 -26
- 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 +723 -68
- package/dist/federation/temporal.test.mjs +25 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{http-CK3efjgM.js → http-BtbMAgTA.js} +176 -105
- package/dist/{http-Dl00HXr4.d.ts → http-C8qLHs_Z.d.cts} +3 -4
- package/dist/{http-BoR1M3W7.cjs → http-D5woFKA_.cjs} +177 -106
- package/dist/{http-DqZhyEso.d.cts → http-D8WmcRAF.d.ts} +3 -4
- package/dist/{http-Bjd6I92u.mjs → http-HX6wVyJh.mjs} +198 -98
- package/dist/{inbox-9MlBGgs9.mjs → inbox-CL7A0HXT.mjs} +1 -1
- package/dist/{key-ClQh9Qqh.mjs → key-Dai3f5yI.mjs} +3 -2
- package/dist/{kv-cache-BxSx_Iyp.cjs → kv-cache-B0V_e231.cjs} +59 -17
- package/dist/{kv-cache-ImApO425.js → kv-cache-BsDg-cT8.js} +60 -18
- package/dist/{ld-Crg0Xmwr.mjs → ld-DN6x1iZ8.mjs} +153 -21
- package/dist/ld-signature-DoZcbsZR.mjs +23 -0
- package/dist/{middleware-jL9p9V9G.cjs → middleware-Cl6k5Hrm.cjs} +1 -1
- package/dist/{middleware-CmD3lpy4.cjs → middleware-CrfRuKCf.cjs} +728 -143
- package/dist/{middleware-CE0b69gj.mjs → middleware-DiquMgtt.mjs} +444 -115
- package/dist/{middleware-C2AJFk8W.js → middleware-DunNtbo9.js} +727 -143
- package/dist/{middleware-Bi5D6DBT.mjs → middleware-SnQS8eIb.mjs} +1 -1
- package/dist/{mod-DiuFTYUt.d.cts → mod-CehHJOV4.d.cts} +30 -13
- package/dist/{mod-CWJNbyju.d.ts → mod-DLJpnqdw.d.ts} +1 -1
- package/dist/{mod-BLDHhuW0.d.ts → mod-Mh3oIuRK.d.ts} +30 -13
- package/dist/{mod-DNEgTI8M.d.ts → mod-REfljt0T.d.ts} +4 -9
- package/dist/{mod-Cn9GJ5ex.d.cts → mod-UvIGUHqW.d.cts} +4 -9
- package/dist/{mod-BmlfRBmU.d.cts → mod-sTa1Zzxk.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 +764 -19
- 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/otel/exporter.test.mjs +292 -30
- package/dist/otel/mod.cjs +36 -30
- package/dist/otel/mod.d.cts +13 -0
- package/dist/otel/mod.d.ts +13 -0
- package/dist/otel/mod.js +36 -30
- package/dist/{owner-BRoKojK1.mjs → owner-DwyDorZI.mjs} +2 -2
- package/dist/{proof-CHXVlsH_.cjs → proof-Be-4K4jn.cjs} +193 -46
- package/dist/{proof-DMIAezxz.mjs → proof-DYjmyrHh.mjs} +38 -13
- package/dist/{proof-7R4s10TJ.js → proof-Du4-5SHY.js} +187 -46
- package/dist/send-BGSfQkIK.mjs +416 -0
- package/dist/sig/http.test.mjs +506 -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 +95 -3
- package/dist/{temporal-DR0JahMu.mjs → temporal-CNCchWly.mjs} +3 -5
- package/dist/testing/mod.d.mts +1 -2177
- package/dist/{types-DRPjmHVV.cjs → types-B5wRhemi.cjs} +187 -63
- package/dist/{types-miAYfiGO.js → types-CXy2lRVU.js} +188 -64
- package/dist/utils/docloader.test.mjs +316 -32
- 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/docloader-OLWc7P2D.mjs +0 -82
- package/dist/send-BHIt_8ia.mjs +0 -260
- /package/dist/{collection-BD6-SZ6O.mjs → collection-DnoYNwBC.mjs} +0 -0
- /package/dist/{negotiation-BehA2uul.mjs → negotiation-xb0QR3u_.mjs} +0 -0
- /package/dist/{retry-B_E3V_Dx.mjs → retry-CI1flGDD.mjs} +0 -0
- /package/dist/{types-DCP0WLdt.mjs → types-s4mCTGkT.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-D8WmcRAF.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, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
|
4
|
+
import { _ as detachSignature, a as VerifyObjectOptions, b as verifySignature, c as signObject, d as CreateSignatureOptions, f as SignJsonLdOptions, g as createSignature, h as attachSignature, i as SignObjectOptions, l as verifyObject, m as VerifySignatureOptions, n as CryptoKeyPairLike, o as VerifyProofOptions, p as VerifyJsonLdOptions, r as CreateProofOptions, s as createProof, t as CryptoKeyLike, u as verifyProof, v as signJsonLd, y as verifyJsonLd } from "../mod-Mh3oIuRK.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, 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 { _ as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, g as parseAcceptSignature, h as fulfillAcceptSignature, i as verifyRequest, l as fetchKeyDetailed, m as formatAcceptSignature, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "../http-
|
|
4
|
-
import {
|
|
3
|
+
import { _ as validateAcceptSignature, a as verifyRequestDetailed, c as fetchKey, d as importJwk, g as parseAcceptSignature, h as fulfillAcceptSignature, i as verifyRequest, l as fetchKeyDetailed, m as formatAcceptSignature, o as exportJwk, r as signRequest, u as generateCryptoKeyPair } from "../http-BtbMAgTA.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-Du4-5SHY.js";
|
|
5
5
|
export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, 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-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-CtZLJq76.mjs";
|
|
9
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-
|
|
9
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-DwyDorZI.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,9 +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-CtZLJq76.mjs";
|
|
9
|
-
import {
|
|
9
|
+
import { _ as verifySignature, c as detachSignature, m as signJsonLd } from "../ld-DN6x1iZ8.mjs";
|
|
10
|
+
import { i as verifyProof, n as signObject, r as verifyObject, t as createProof } from "../proof-DYjmyrHh.mjs";
|
|
10
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
11
|
-
import { Create, DataIntegrityProof, Multikey, Note, Place } from "@fedify/vocab";
|
|
12
|
+
import { Create, DataIntegrityProof, Multikey, Note, OrderedCollectionPage, Place } from "@fedify/vocab";
|
|
12
13
|
import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
|
|
13
14
|
import { decodeHex, encodeHex } from "byte-encodings/hex";
|
|
14
15
|
//#region src/sig/proof.test.ts
|
|
@@ -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("61ebc804b4e12259d7a9a19b244071eaeed8e662150cbdd8005175492eeb9d78216a31c0aa458d8da66c868ba71c8a4da9f56d547499df7a97a4edc975e7840f"));
|
|
52
53
|
assertEquals(proof.created, created);
|
|
53
54
|
assertEquals(await verifyProof(await create.toJsonLd({
|
|
54
55
|
format: "compact",
|
|
@@ -152,6 +153,71 @@ test("signObject()", async () => {
|
|
|
152
153
|
contextLoader: mockDocumentLoader
|
|
153
154
|
}), TypeError, "Unsupported algorithm");
|
|
154
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
|
+
});
|
|
179
|
+
test("signObject() migrates proofs from an older context", async () => {
|
|
180
|
+
const oldContext = [
|
|
181
|
+
"https://w3id.org/identity/v1",
|
|
182
|
+
"https://www.w3.org/ns/activitystreams",
|
|
183
|
+
"https://w3id.org/security/data-integrity/v1"
|
|
184
|
+
];
|
|
185
|
+
const oldJson = await (await signObject(new Create({
|
|
186
|
+
id: new URL("https://example.com/activities/1"),
|
|
187
|
+
actor: new URL("https://example.com/users/alice")
|
|
188
|
+
}), ed25519PrivateKey, ed25519Multikey.id, {
|
|
189
|
+
contextLoader: mockDocumentLoader,
|
|
190
|
+
context: oldContext
|
|
191
|
+
})).toJsonLd({
|
|
192
|
+
format: "compact",
|
|
193
|
+
contextLoader: mockDocumentLoader,
|
|
194
|
+
context: oldContext
|
|
195
|
+
});
|
|
196
|
+
const json = await (await signObject(await Create.fromJsonLd(oldJson, {
|
|
197
|
+
contextLoader: mockDocumentLoader,
|
|
198
|
+
documentLoader: mockDocumentLoader
|
|
199
|
+
}), ed25519PrivateKey, ed25519Multikey.id, { contextLoader: mockDocumentLoader })).toJsonLd({
|
|
200
|
+
format: "compact",
|
|
201
|
+
contextLoader: mockDocumentLoader
|
|
202
|
+
});
|
|
203
|
+
const proofs = Array.isArray(json.proof) ? json.proof : [json.proof];
|
|
204
|
+
assertEquals(proofs.length, 1);
|
|
205
|
+
assertEquals(proofs[0].verificationMethod, ed25519Multikey.id.href);
|
|
206
|
+
});
|
|
207
|
+
test("signObject() skips context comparison for proofless objects", async () => {
|
|
208
|
+
const activity = new Create({
|
|
209
|
+
id: new URL("https://example.com/activities/1"),
|
|
210
|
+
actor: new URL("https://example.com/users/alice")
|
|
211
|
+
});
|
|
212
|
+
let unformattedSerializations = 0;
|
|
213
|
+
const originalToJsonLd = activity.toJsonLd.bind(activity);
|
|
214
|
+
Object.defineProperty(activity, "toJsonLd", { value: async (options) => {
|
|
215
|
+
if (options?.format == null) unformattedSerializations++;
|
|
216
|
+
return await originalToJsonLd(options);
|
|
217
|
+
} });
|
|
218
|
+
await signObject(activity, ed25519PrivateKey, ed25519Multikey.id, { contextLoader: mockDocumentLoader });
|
|
219
|
+
assertEquals(unformattedSerializations, 0);
|
|
220
|
+
});
|
|
155
221
|
test("verifyProof()", async () => {
|
|
156
222
|
const cache = {};
|
|
157
223
|
const options = {
|
|
@@ -210,6 +276,32 @@ test("verifyProof()", async () => {
|
|
|
210
276
|
}, proof, options), null);
|
|
211
277
|
assertEquals(await verifyProof(jsonLd, proof.clone({ created: Temporal.Now.instant() }), options), null);
|
|
212
278
|
});
|
|
279
|
+
test("signJsonLd() does not invalidate an existing proof", async () => {
|
|
280
|
+
const options = {
|
|
281
|
+
documentLoader: mockDocumentLoader,
|
|
282
|
+
contextLoader: mockDocumentLoader
|
|
283
|
+
};
|
|
284
|
+
const note = new Note({
|
|
285
|
+
id: new URL("https://example.com/notes/1"),
|
|
286
|
+
attribution: new URL("https://example.com/users/alice"),
|
|
287
|
+
content: "Hello"
|
|
288
|
+
});
|
|
289
|
+
const proof = await createProof(note, ed25519PrivateKey, ed25519PublicKey.id, options);
|
|
290
|
+
const withProof = {
|
|
291
|
+
...await note.toJsonLd({
|
|
292
|
+
format: "compact",
|
|
293
|
+
contextLoader: mockDocumentLoader
|
|
294
|
+
}),
|
|
295
|
+
proof: await proof.toJsonLd({
|
|
296
|
+
format: "compact",
|
|
297
|
+
contextLoader: mockDocumentLoader
|
|
298
|
+
})
|
|
299
|
+
};
|
|
300
|
+
const signed = await signJsonLd(withProof, rsaPrivateKey2, rsaPublicKey2.id, options);
|
|
301
|
+
assertEquals(signed["@context"], withProof["@context"]);
|
|
302
|
+
assertEquals(await verifyProof(detachSignature(signed), proof, options), ed25519Multikey);
|
|
303
|
+
assertEquals(await verifySignature(signed, options), rsaPublicKey2);
|
|
304
|
+
});
|
|
213
305
|
test("verifyObject()", async () => {
|
|
214
306
|
const options = {
|
|
215
307
|
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-DN6x1iZ8.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) {
|