@fedify/fedify 2.2.0-dev.613 → 2.2.0-dev.622
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/{accept-D7sAxyNa.js → accept-Dd__NiUL.mjs} +10 -8
- package/dist/{assert-MZs1qjMx.js → assert-ddO5KLpe.mjs} +5 -9
- package/dist/{assert_equals-DSbWqCm3.js → assert_equals-Ew3jOFa3.mjs} +55 -69
- package/dist/{assert_instance_of-DHz7EHNU.js → assert_instance_of-C4Ri6VuN.mjs} +5 -9
- package/dist/{assert_not_equals-f3m3epl3.js → assert_not_equals--wG9hV7u.mjs} +6 -13
- package/dist/{assert_rejects-0h7I2Esa.js → assert_rejects-B-qJtC9Z.mjs} +6 -11
- package/dist/{assert_throws-rjdMBf31.js → assert_throws-4NwKEy2q.mjs} +5 -10
- package/dist/{builder-OscY92PK.js → builder-DcSpny3g.mjs} +32 -41
- package/dist/{chunk-CGaQZ11T.cjs → chunk-DDcVe30Y.cjs} +23 -24
- package/dist/{chunk-DJNbSFdH.js → chunk-nlSIicah.js} +8 -8
- package/dist/{client-BxMZiQaD.d.ts → client-AtlibPOU.d.ts} +1 -1
- package/dist/{client-CoCIaTNO.js → client-DEpOVgY1.mjs} +9 -13
- package/dist/{client-C97KOq3x.d.cts → client-z-8dc-e1.d.cts} +1 -1
- package/dist/{collection-CSzG2j1P.js → collection-BD6-SZ6O.mjs} +7 -12
- package/dist/compat/mod.cjs +5 -8
- package/dist/compat/mod.d.cts +78 -6
- package/dist/compat/mod.d.ts +78 -6
- package/dist/compat/mod.js +4 -8
- package/dist/compat/transformers.test.mjs +62 -0
- package/dist/{context-DyJjQQ_H.d.ts → context-BOiMZBu5.d.ts} +9 -18
- package/dist/{context-BcqA-0BL.d.cts → context-BhZVy7RB.d.cts} +9 -18
- package/dist/{context-Aqenou7c.js → context-Juj6bdHC.mjs} +7 -11
- package/dist/deno-D682wzlW.mjs +8 -0
- package/dist/{docloader-JiZmL7BP.js → docloader-CCWf4tNV.mjs} +8 -14
- package/dist/{esm-nLm00z9V.js → esm-DVILvP5e.mjs} +50 -89
- package/dist/federation/builder.test.d.mts +2 -0
- package/dist/federation/{builder.test.js → builder.test.mjs} +21 -44
- package/dist/federation/collection.test.d.mts +2 -0
- package/dist/federation/collection.test.mjs +21 -0
- package/dist/federation/handler.test.d.mts +2 -0
- package/dist/federation/{handler.test.js → handler.test.mjs} +69 -131
- package/dist/federation/idempotency.test.d.mts +2 -0
- package/dist/federation/{idempotency.test.js → idempotency.test.mjs} +31 -63
- package/dist/federation/inbox.test.d.mts +2 -0
- package/dist/federation/{inbox.test.js → inbox.test.mjs} +8 -12
- package/dist/federation/keycache.test.d.mts +2 -0
- package/dist/federation/{keycache.test.js → keycache.test.mjs} +13 -19
- package/dist/federation/kv.test.d.mts +2 -0
- package/dist/federation/{kv.test.js → kv.test.mjs} +11 -22
- package/dist/federation/middleware.test.d.mts +2 -0
- package/dist/federation/{middleware.test.js → middleware.test.mjs} +173 -262
- package/dist/federation/mod.cjs +327 -16
- package/dist/federation/mod.d.cts +3 -6
- package/dist/federation/mod.d.ts +3 -6
- package/dist/federation/mod.js +322 -13
- package/dist/federation/mq.test.d.mts +2 -0
- package/dist/federation/{mq.test.js → mq.test.mjs} +21 -35
- package/dist/federation/negotiation.test.d.mts +2 -0
- package/dist/federation/{negotiation.test.js → negotiation.test.mjs} +9 -16
- package/dist/federation/retry.test.d.mts +2 -0
- package/dist/federation/{retry.test.js → retry.test.mjs} +8 -11
- package/dist/federation/router.test.d.mts +2 -0
- package/dist/federation/{router.test.js → router.test.mjs} +11 -16
- package/dist/federation/send.test.d.mts +2 -0
- package/dist/federation/{send.test.js → send.test.mjs} +22 -30
- package/dist/federation/webfinger.test.d.mts +2 -0
- package/dist/federation/{webfinger.test.js → webfinger.test.mjs} +22 -56
- package/dist/{http-BnsR906R.cjs → http-BQccxQlj.cjs} +177 -302
- package/dist/{http-CKaqhjvP.js → http-CNsnyqrO.mjs} +23 -43
- package/dist/{http-BudnHZE2.d.cts → http-CrGuipxe.d.cts} +1 -6
- package/dist/{http-IFqEftoZ.js → http-DhwEMhtv.js} +53 -184
- package/dist/{http-Dax_FIBo.d.ts → http-aQzN9Ayi.d.ts} +1 -6
- package/dist/{inbox-Bd91CVJP.js → inbox-DegXbbbS.mjs} +18 -26
- package/dist/{key-DFLFXKER.js → key-vL60OvqM.mjs} +29 -37
- package/dist/{keycache-CpGWAUbj.js → keycache-CCSwkQcY.mjs} +5 -10
- package/dist/{keys-BFve7QQv.js → keys-BAK-tUlf.mjs} +5 -9
- package/dist/{kv-BL4nlICN.d.cts → kv-CbLNp3zQ.d.cts} +1 -1
- package/dist/{kv-DXEUEP6z.d.ts → kv-GFYnFoOl.d.ts} +1 -1
- package/dist/{kv-cache-Bw2F2ABq.js → kv-cache-B01V7s3h.mjs} +4 -8
- package/dist/{kv-cache-Drlz6O_Y.js → kv-cache-CTj3iCix.js} +6 -13
- package/dist/{kv-cache-BLXcQvyb.cjs → kv-cache-DxdXJNbj.cjs} +27 -34
- package/dist/{kv-QzKcOQgP.js → kv-tL2TOE9X.mjs} +6 -10
- package/dist/{ld-CGGXZJK0.js → ld-C3CO00YY.mjs} +17 -31
- package/dist/{middleware-DcpBikad.js → middleware-BmsVSOeS.js} +335 -382
- package/dist/middleware-C7shNcsp.cjs +4 -0
- package/dist/{middleware-B51dB75z.cjs → middleware-Cx0Ny6_7.cjs} +532 -587
- package/dist/middleware-DqVGYk56.mjs +5 -0
- package/dist/{middleware-B53r4pdM.js → middleware-Du-vh7I_.mjs} +282 -317
- package/dist/{mod-em2Il1eD.d.cts → mod-Bp_CzKd4.d.cts} +2 -2
- package/dist/{mod-DCbh1JQ5.d.ts → mod-CLgIXe9w.d.ts} +3 -3
- package/dist/{mod-jfnweK2w.d.cts → mod-CMEbIaNh.d.cts} +3 -3
- package/dist/{mod-D6MdymW7.d.ts → mod-DKOAow7a.d.ts} +2 -2
- package/dist/{mod-Coe7KEgX.d.cts → mod-DoJBjjnO.d.cts} +2 -2
- package/dist/{mod-D6dOd--H.d.ts → mod-DvxszxXC.d.ts} +2 -2
- package/dist/mod.cjs +29 -74
- package/dist/mod.d.cts +11 -14
- package/dist/mod.d.ts +11 -15
- package/dist/mod.js +17 -71
- package/dist/{negotiation-BlAuS_nr.js → negotiation-DnsfFF8I.mjs} +7 -11
- package/dist/nodeinfo/client.test.d.mts +2 -0
- package/dist/nodeinfo/{client.test.js → client.test.mjs} +22 -40
- package/dist/nodeinfo/handler.test.d.mts +2 -0
- package/dist/nodeinfo/{handler.test.js → handler.test.mjs} +13 -43
- package/dist/nodeinfo/mod.cjs +5 -8
- package/dist/nodeinfo/mod.d.cts +2 -3
- package/dist/nodeinfo/mod.d.ts +2 -3
- package/dist/nodeinfo/mod.js +4 -8
- package/dist/nodeinfo/types.test.d.mts +2 -0
- package/dist/nodeinfo/{types.test.js → types.test.mjs} +9 -16
- package/dist/otel/exporter.test.d.mts +2 -0
- package/dist/otel/{exporter.test.js → exporter.test.mjs} +124 -178
- package/dist/otel/mod.cjs +15 -20
- package/dist/otel/mod.d.cts +2 -2
- package/dist/otel/mod.d.ts +2 -2
- package/dist/otel/mod.js +8 -14
- package/dist/{owner-gd0Q9FuU.d.ts → owner-74ARJ5TL.d.ts} +1 -1
- package/dist/{owner-1AbPBOOZ.d.cts → owner-CptqhsOy.d.cts} +1 -1
- package/dist/{owner-Cye0yQB_.js → owner-DF320w6K.mjs} +11 -16
- package/dist/{proof-DdGGXVWM.js → proof-BCWk5oas.js} +32 -58
- package/dist/{proof-DV5lC_Bw.js → proof-IyDwwmzL.mjs} +21 -33
- package/dist/{proof-CN5iR1tW.cjs → proof-WhNxSv_N.cjs} +133 -157
- package/dist/{retry-mqLf4b-R.js → retry-B_E3V_Dx.mjs} +4 -7
- package/dist/{router-D9eI0s4b.js → router-CrMLXoOr.mjs} +4 -8
- package/dist/runtime/mod.cjs +11 -13
- package/dist/runtime/mod.d.cts +6 -2
- package/dist/runtime/mod.d.ts +0 -1
- package/dist/runtime/mod.js +4 -7
- package/dist/{send-C2a_3YAF.js → send-CJQubr5t.mjs} +8 -13
- package/dist/sig/accept.test.d.mts +2 -0
- package/dist/sig/{accept.test.js → accept.test.mjs} +35 -70
- package/dist/sig/http.test.d.mts +2 -0
- package/dist/sig/{http.test.js → http.test.mjs} +166 -280
- package/dist/sig/key.test.d.mts +2 -0
- package/dist/sig/{key.test.js → key.test.mjs} +11 -18
- package/dist/sig/ld.test.d.mts +2 -0
- package/dist/sig/{ld.test.js → ld.test.mjs} +22 -35
- package/dist/sig/mod.cjs +6 -9
- package/dist/sig/mod.d.cts +3 -3
- package/dist/sig/mod.d.ts +3 -3
- package/dist/sig/mod.js +5 -9
- package/dist/sig/owner.test.d.mts +2 -0
- package/dist/sig/{owner.test.js → owner.test.mjs} +19 -34
- package/dist/sig/proof.test.d.mts +2 -0
- package/dist/sig/{proof.test.js → proof.test.mjs} +16 -27
- package/dist/{std__assert-X-_kMxKM.js → std__assert-Duiq_YC9.mjs} +12 -24
- package/dist/testing/{mod.d.ts → mod.d.mts} +26 -90
- package/dist/testing/mod.mjs +6 -0
- package/dist/{transformers-3g8GZwkZ.cjs → transformers-NeAONrAq.cjs} +20 -25
- package/dist/{transformers-C3FLHUd6.js → transformers-ve6e2xcg.js} +3 -7
- package/dist/{types-CPz01LGH.js → types-DCP0WLdt.mjs} +4 -7
- package/dist/{types-Cd_hszr_.cjs → types-KC4QAoxe.cjs} +29 -34
- package/dist/{types-C93Ob9cU.js → types-hvL8ElAs.js} +8 -13
- package/dist/utils/docloader.test.d.mts +2 -0
- package/dist/utils/{docloader.test.js → docloader.test.mjs} +14 -25
- package/dist/utils/kv-cache.test.d.mts +2 -0
- package/dist/utils/{kv-cache.test.js → kv-cache.test.mjs} +25 -40
- package/dist/utils/mod.cjs +5 -9
- package/dist/utils/mod.d.cts +1 -3
- package/dist/utils/mod.d.ts +1 -3
- package/dist/utils/mod.js +4 -9
- package/dist/vocab/cjs.test.d.mts +2 -0
- package/dist/vocab/cjs.test.mjs +14 -0
- package/dist/vocab/mod.cjs +10 -12
- package/dist/vocab/mod.js +3 -5
- package/package.json +8 -8
- package/dist/compat/transformers.test.d.ts +0 -3
- package/dist/compat/transformers.test.js +0 -88
- package/dist/compat-Bb4NuTUO.js +0 -4
- package/dist/compat-DmDDELst.cjs +0 -4
- package/dist/deno-CnMqla6T.js +0 -121
- package/dist/federation/builder.test.d.ts +0 -3
- package/dist/federation/collection.test.d.ts +0 -3
- package/dist/federation/collection.test.js +0 -32
- package/dist/federation/handler.test.d.ts +0 -3
- package/dist/federation/idempotency.test.d.ts +0 -3
- package/dist/federation/inbox.test.d.ts +0 -3
- package/dist/federation/keycache.test.d.ts +0 -3
- package/dist/federation/kv.test.d.ts +0 -3
- package/dist/federation/middleware.test.d.ts +0 -3
- package/dist/federation/mq.test.d.ts +0 -3
- package/dist/federation/negotiation.test.d.ts +0 -3
- package/dist/federation/retry.test.d.ts +0 -3
- package/dist/federation/router.test.d.ts +0 -3
- package/dist/federation/send.test.d.ts +0 -3
- package/dist/federation/webfinger.test.d.ts +0 -3
- package/dist/federation-Bp3HI26G.cjs +0 -350
- package/dist/federation-DaMfqRm4.js +0 -332
- package/dist/middleware-B0kNQMO0.js +0 -27
- package/dist/middleware-BYQL9cdV.js +0 -12
- package/dist/middleware-DfNqksSs.cjs +0 -12
- package/dist/mod-B7QkWzrL.d.cts +0 -80
- package/dist/mod-Bh8mqlYw.d.cts +0 -9
- package/dist/mod-D6HodEq7.d.ts +0 -7
- package/dist/mod-SMHOMNpZ.d.ts +0 -82
- package/dist/mod-gq_Xfdz8.d.cts +0 -1
- package/dist/nodeinfo/client.test.d.ts +0 -3
- package/dist/nodeinfo/handler.test.d.ts +0 -3
- package/dist/nodeinfo/types.test.d.ts +0 -3
- package/dist/nodeinfo-DoESQxq5.js +0 -4
- package/dist/nodeinfo-DuMYTpbZ.cjs +0 -4
- package/dist/otel/exporter.test.d.ts +0 -3
- package/dist/runtime-c2Njxsry.cjs +0 -17
- package/dist/runtime-poamPCMb.js +0 -13
- package/dist/sig/accept.test.d.ts +0 -3
- package/dist/sig/http.test.d.ts +0 -3
- package/dist/sig/key.test.d.ts +0 -3
- package/dist/sig/ld.test.d.ts +0 -3
- package/dist/sig/owner.test.d.ts +0 -3
- package/dist/sig/proof.test.d.ts +0 -3
- package/dist/sig-BNhspNOf.js +0 -4
- package/dist/sig-vX39WyWI.cjs +0 -4
- package/dist/testing/mod.js +0 -10
- package/dist/utils/docloader.test.d.ts +0 -3
- package/dist/utils/kv-cache.test.d.ts +0 -3
- package/dist/utils-BQ9KqEK9.cjs +0 -4
- package/dist/utils-Dn5OPdSW.js +0 -4
- /package/dist/{mod-AGjRfPjT.d.ts → compat/transformers.test.d.mts} +0 -0
|
@@ -1,22 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import "../
|
|
8
|
-
import "../
|
|
9
|
-
import "../
|
|
10
|
-
import { exportJwk, fetchKey, fetchKeyDetailed, generateCryptoKeyPair, importJwk, validateCryptoKey } from "../key-DFLFXKER.js";
|
|
11
|
-
import "../std__assert-X-_kMxKM.js";
|
|
12
|
-
import { assertRejects } from "../assert_rejects-0h7I2Esa.js";
|
|
13
|
-
import { assertThrows } from "../assert_throws-rjdMBf31.js";
|
|
14
|
-
import "../assert_not_equals-f3m3epl3.js";
|
|
15
|
-
import { ed25519Multikey, rsaPrivateKey2, rsaPublicKey1, rsaPublicKey2, rsaPublicKey3 } from "../keys-BFve7QQv.js";
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
+
import "../std__assert-Duiq_YC9.mjs";
|
|
6
|
+
import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
|
|
7
|
+
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
8
|
+
import { a as importJwk, i as generateCryptoKeyPair, n as fetchKey, o as validateCryptoKey, r as fetchKeyDetailed, t as exportJwk } from "../key-vL60OvqM.mjs";
|
|
9
|
+
import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
16
10
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
17
11
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
18
12
|
import { FetchError } from "@fedify/vocab-runtime";
|
|
19
|
-
|
|
20
13
|
//#region src/sig/key.test.ts
|
|
21
14
|
test("validateCryptoKey()", async () => {
|
|
22
15
|
const pkcs1v15 = await crypto.subtle.generateKey({
|
|
@@ -310,5 +303,5 @@ test("fetchKeyDetailed() returns detailed fetch errors", async () => {
|
|
|
310
303
|
if (detailedError == null || !("error" in detailedError)) throw new Error("Expected non-HTTP fetch error details.");
|
|
311
304
|
assertEquals(detailedError.error, failure);
|
|
312
305
|
});
|
|
313
|
-
|
|
314
|
-
|
|
306
|
+
//#endregion
|
|
307
|
+
export {};
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import { assert } from "../assert-
|
|
8
|
-
import "../
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { assertFalse, assertRejects } from "../assert_rejects-0h7I2Esa.js";
|
|
12
|
-
import { assertThrows } from "../assert_throws-rjdMBf31.js";
|
|
13
|
-
import { ed25519Multikey, ed25519PrivateKey, rsaPrivateKey2, rsaPrivateKey3, rsaPublicKey2, rsaPublicKey3 } from "../keys-BFve7QQv.js";
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
+
import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
|
|
6
|
+
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
7
|
+
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
8
|
+
import { i as generateCryptoKeyPair } from "../key-vL60OvqM.mjs";
|
|
9
|
+
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
10
|
+
import { a as signJsonLd, n as createSignature, o as verifyJsonLd, r as detachSignature, s as verifySignature, t as attachSignature } from "../ld-C3CO00YY.mjs";
|
|
14
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
15
12
|
import { CryptographicKey } from "@fedify/vocab";
|
|
16
13
|
import { encodeBase64 } from "byte-encodings/base64";
|
|
17
|
-
|
|
18
14
|
//#region src/sig/ld.test.ts
|
|
19
15
|
test("attachSignature()", () => {
|
|
20
16
|
const sig = {
|
|
@@ -41,28 +37,23 @@ test("createSignature()", async () => {
|
|
|
41
37
|
id: "https://example.com/1",
|
|
42
38
|
type: "Create"
|
|
43
39
|
};
|
|
44
|
-
|
|
45
|
-
const key = await verifySignature(attachSignature(doc, sig), {
|
|
40
|
+
assertEquals(await verifySignature(attachSignature(doc, await createSignature(doc, rsaPrivateKey2, rsaPublicKey2.id, { contextLoader: mockDocumentLoader })), {
|
|
46
41
|
documentLoader: mockDocumentLoader,
|
|
47
42
|
contextLoader: mockDocumentLoader
|
|
48
|
-
});
|
|
49
|
-
assertEquals(key, rsaPublicKey2);
|
|
43
|
+
}), rsaPublicKey2);
|
|
50
44
|
assertRejects(() => createSignature(doc, rsaPublicKey2.publicKey, rsaPublicKey2.id, { contextLoader: mockDocumentLoader }), TypeError);
|
|
51
45
|
assertRejects(() => createSignature(doc, ed25519PrivateKey, ed25519Multikey.id, { contextLoader: mockDocumentLoader }), TypeError);
|
|
52
46
|
});
|
|
53
47
|
test("signJsonLd()", async () => {
|
|
54
|
-
|
|
48
|
+
assert(await verifyJsonLd(await signJsonLd({
|
|
55
49
|
"@context": "https://www.w3.org/ns/activitystreams",
|
|
56
50
|
id: "https://example.com/1",
|
|
57
51
|
type: "Create",
|
|
58
52
|
actor: "https://example.com/person2"
|
|
59
|
-
}
|
|
60
|
-
const signed = await signJsonLd(doc, rsaPrivateKey3, rsaPublicKey3.id, { contextLoader: mockDocumentLoader });
|
|
61
|
-
const verified = await verifyJsonLd(signed, {
|
|
53
|
+
}, rsaPrivateKey3, rsaPublicKey3.id, { contextLoader: mockDocumentLoader }), {
|
|
62
54
|
documentLoader: mockDocumentLoader,
|
|
63
55
|
contextLoader: mockDocumentLoader
|
|
64
|
-
});
|
|
65
|
-
assert(verified);
|
|
56
|
+
}));
|
|
66
57
|
});
|
|
67
58
|
const document = {
|
|
68
59
|
"@context": ["https://www.w3.org/ns/activitystreams", {
|
|
@@ -202,23 +193,19 @@ test("verifySignature()", async () => {
|
|
|
202
193
|
assertEquals(key4, key);
|
|
203
194
|
});
|
|
204
195
|
test("verifyJsonLd()", async () => {
|
|
205
|
-
|
|
196
|
+
assert(await verifyJsonLd(testVector, {
|
|
206
197
|
documentLoader: mockDocumentLoader,
|
|
207
198
|
contextLoader: mockDocumentLoader
|
|
208
|
-
});
|
|
209
|
-
|
|
210
|
-
const doc = {
|
|
199
|
+
}));
|
|
200
|
+
assertFalse(await verifyJsonLd(await signJsonLd({
|
|
211
201
|
"@context": "https://www.w3.org/ns/activitystreams",
|
|
212
202
|
id: "https://example.com/1",
|
|
213
203
|
type: "Create",
|
|
214
204
|
actor: "https://example.com/person2"
|
|
215
|
-
}
|
|
216
|
-
const signed = await signJsonLd(doc, rsaPrivateKey2, rsaPublicKey2.id, { contextLoader: mockDocumentLoader });
|
|
217
|
-
const verified2 = await verifyJsonLd(signed, {
|
|
205
|
+
}, rsaPrivateKey2, rsaPublicKey2.id, { contextLoader: mockDocumentLoader }), {
|
|
218
206
|
documentLoader: mockDocumentLoader,
|
|
219
207
|
contextLoader: mockDocumentLoader
|
|
220
|
-
});
|
|
221
|
-
assertFalse(verified2);
|
|
208
|
+
}));
|
|
222
209
|
});
|
|
223
|
-
|
|
224
|
-
|
|
210
|
+
//#endregion
|
|
211
|
+
export {};
|
package/dist/sig/mod.cjs
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
const require_proof = require('../proof-CN5iR1tW.cjs');
|
|
7
|
-
require('../sig-vX39WyWI.cjs');
|
|
8
|
-
|
|
1
|
+
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
|
+
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const require_http = require("../http-BQccxQlj.cjs");
|
|
5
|
+
const require_proof = require("../proof-WhNxSv_N.cjs");
|
|
9
6
|
exports.attachSignature = require_proof.attachSignature;
|
|
10
7
|
exports.createProof = require_proof.createProof;
|
|
11
8
|
exports.createSignature = require_proof.createSignature;
|
|
@@ -29,4 +26,4 @@ exports.verifyObject = require_proof.verifyObject;
|
|
|
29
26
|
exports.verifyProof = require_proof.verifyProof;
|
|
30
27
|
exports.verifyRequest = require_http.verifyRequest;
|
|
31
28
|
exports.verifyRequestDetailed = require_http.verifyRequestDetailed;
|
|
32
|
-
exports.verifySignature = require_proof.verifySignature;
|
|
29
|
+
exports.verifySignature = require_proof.verifySignature;
|
package/dist/sig/mod.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
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-CrGuipxe.cjs";
|
|
2
|
+
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-CptqhsOy.cjs";
|
|
3
|
+
import { _ as verifyJsonLd, a as createProof, c as verifyProof, d as VerifyJsonLdOptions, f as VerifySignatureOptions, g as signJsonLd, h as detachSignature, i as VerifyProofOptions, l as CreateSignatureOptions, m as createSignature, n as SignObjectOptions, o as signObject, p as attachSignature, r as VerifyObjectOptions, s as verifyObject, t as CreateProofOptions, u as SignJsonLdOptions, v as verifySignature } from "../mod-DoJBjjnO.cjs";
|
|
4
4
|
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 };
|
package/dist/sig/mod.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Temporal } from "@js-temporal/polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
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-aQzN9Ayi.js";
|
|
4
|
+
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-74ARJ5TL.js";
|
|
5
|
+
import { _ as verifyJsonLd, a as createProof, c as verifyProof, d as VerifyJsonLdOptions, f as VerifySignatureOptions, g as signJsonLd, h as detachSignature, i as VerifyProofOptions, l as CreateSignatureOptions, m as createSignature, n as SignObjectOptions, o as signObject, p as attachSignature, r as VerifyObjectOptions, s as verifyObject, t as CreateProofOptions, u as SignJsonLdOptions, v as verifySignature } from "../mod-DvxszxXC.js";
|
|
6
6
|
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 };
|
package/dist/sig/mod.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, getKeyOwner, signJsonLd, signObject, verifyJsonLd, verifyObject, verifyProof, verifySignature } from "../proof-DdGGXVWM.js";
|
|
7
|
-
import "../sig-BNhspNOf.js";
|
|
8
|
-
|
|
9
|
-
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 };
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
import { a as verifyRequestDetailed, c as fetchKeyDetailed, f as formatAcceptSignature, h as validateAcceptSignature, i as verifyRequest, l as generateCryptoKeyPair, m as parseAcceptSignature, o as exportJwk, p as fulfillAcceptSignature, r as signRequest, s as fetchKey, u as importJwk } from "../http-DhwEMhtv.js";
|
|
4
|
+
import { a as doesActorOwnKey, c as createSignature, d as signJsonLd, f as verifyJsonLd, i as verifyProof, l as detachSignature, n as signObject, o as getKeyOwner, p as verifySignature, r as verifyObject, s as attachSignature, t as createProof } from "../proof-BCWk5oas.js";
|
|
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 };
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import { assert } from "../assert-
|
|
8
|
-
import "../
|
|
9
|
-
import "../
|
|
10
|
-
import "../key-DFLFXKER.js";
|
|
11
|
-
import { doesActorOwnKey, getKeyOwner } from "../owner-Cye0yQB_.js";
|
|
12
|
-
import "../std__assert-X-_kMxKM.js";
|
|
13
|
-
import { assertFalse } from "../assert_rejects-0h7I2Esa.js";
|
|
14
|
-
import "../assert_throws-rjdMBf31.js";
|
|
15
|
-
import "../assert_not_equals-f3m3epl3.js";
|
|
16
|
-
import { rsaPublicKey1, rsaPublicKey2 } from "../keys-BFve7QQv.js";
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
+
import "../std__assert-Duiq_YC9.mjs";
|
|
6
|
+
import { n as assertFalse } from "../assert_rejects-B-qJtC9Z.mjs";
|
|
7
|
+
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
8
|
+
import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-BAK-tUlf.mjs";
|
|
9
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-DF320w6K.mjs";
|
|
17
10
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
18
11
|
import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
|
|
19
|
-
|
|
20
12
|
//#region src/sig/owner.test.ts
|
|
21
13
|
test("doesActorOwnKey()", async () => {
|
|
22
14
|
const options = {
|
|
@@ -35,32 +27,25 @@ test("getKeyOwner()", async () => {
|
|
|
35
27
|
documentLoader: mockDocumentLoader,
|
|
36
28
|
contextLoader: mockDocumentLoader
|
|
37
29
|
};
|
|
38
|
-
|
|
39
|
-
assertEquals(owner, await lookupObject("https://example.com/users/handle", options));
|
|
30
|
+
assertEquals(await getKeyOwner(new URL("https://example.com/users/handle#main-key"), options), await lookupObject("https://example.com/users/handle", options));
|
|
40
31
|
const owner2 = await getKeyOwner(new URL("https://example.com/key"), options);
|
|
41
32
|
assertEquals(owner2, await lookupObject("https://example.com/person", options));
|
|
42
|
-
|
|
43
|
-
assertEquals(
|
|
44
|
-
|
|
45
|
-
assertEquals(noOwner, null);
|
|
46
|
-
const noOwner2 = await getKeyOwner(new URL("https://example.com/object"), options);
|
|
47
|
-
assertEquals(noOwner2, null);
|
|
33
|
+
assertEquals(await getKeyOwner(rsaPublicKey1, options), owner2);
|
|
34
|
+
assertEquals(await getKeyOwner(new URL("https://example.com/key2"), options), null);
|
|
35
|
+
assertEquals(await getKeyOwner(new URL("https://example.com/object"), options), null);
|
|
48
36
|
});
|
|
49
37
|
test("doesActorOwnKey() records OpenTelemetry span", async () => {
|
|
50
38
|
const [tracerProvider, exporter] = createTestTracerProvider();
|
|
51
|
-
|
|
39
|
+
assert(await doesActorOwnKey(new Create({
|
|
52
40
|
id: new URL("https://example.com/activity"),
|
|
53
41
|
actor: new URL("https://example.com/person")
|
|
54
|
-
})
|
|
55
|
-
const key = new CryptographicKey({
|
|
42
|
+
}), new CryptographicKey({
|
|
56
43
|
id: new URL("https://example.com/person#key"),
|
|
57
44
|
owner: new URL("https://example.com/person")
|
|
58
|
-
})
|
|
59
|
-
const result = await doesActorOwnKey(activity, key, {
|
|
45
|
+
}), {
|
|
60
46
|
documentLoader: mockDocumentLoader,
|
|
61
47
|
tracerProvider
|
|
62
|
-
});
|
|
63
|
-
assert(result);
|
|
48
|
+
}));
|
|
64
49
|
const spans = exporter.getSpans("activitypub.verify_key_ownership");
|
|
65
50
|
assertEquals(spans.length, 1);
|
|
66
51
|
const span = spans[0];
|
|
@@ -69,5 +54,5 @@ test("doesActorOwnKey() records OpenTelemetry span", async () => {
|
|
|
69
54
|
assertEquals(span.attributes["activitypub.key_ownership.verified"], true);
|
|
70
55
|
assertEquals(span.attributes["activitypub.key_ownership.method"], "owner_id");
|
|
71
56
|
});
|
|
72
|
-
|
|
73
|
-
|
|
57
|
+
//#endregion
|
|
58
|
+
export {};
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import "../
|
|
8
|
-
import {
|
|
9
|
-
import "../
|
|
10
|
-
import "../key-DFLFXKER.js";
|
|
11
|
-
import { createProof, signObject, verifyObject, verifyProof } from "../proof-DV5lC_Bw.js";
|
|
12
|
-
import "../std__assert-X-_kMxKM.js";
|
|
13
|
-
import { assertRejects } from "../assert_rejects-0h7I2Esa.js";
|
|
14
|
-
import "../assert_throws-rjdMBf31.js";
|
|
15
|
-
import "../assert_not_equals-f3m3epl3.js";
|
|
16
|
-
import { ed25519Multikey, ed25519PrivateKey, ed25519PublicKey, rsaPrivateKey2, rsaPublicKey2 } from "../keys-BFve7QQv.js";
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
|
+
import "../std__assert-Duiq_YC9.mjs";
|
|
6
|
+
import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
|
|
7
|
+
import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
|
|
8
|
+
import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
9
|
+
import { i as verifyProof, n as signObject, r as verifyObject, t as createProof } from "../proof-IyDwwmzL.mjs";
|
|
17
10
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
18
11
|
import { Create, DataIntegrityProof, Multikey, Note, Place } from "@fedify/vocab";
|
|
19
12
|
import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
|
|
20
13
|
import { decodeHex, encodeHex } from "byte-encodings/hex";
|
|
21
|
-
|
|
22
14
|
//#region src/sig/proof.test.ts
|
|
23
15
|
const fep8b32TestVectorPrivateKey = await crypto.subtle.importKey("jwk", {
|
|
24
16
|
"kty": "OKP",
|
|
@@ -118,11 +110,10 @@ test("signObject()", async () => {
|
|
|
118
110
|
created: "2023-02-24T23:36:38Z"
|
|
119
111
|
}
|
|
120
112
|
});
|
|
121
|
-
|
|
113
|
+
assertEquals(await (await signObject(signedObject, ed25519PrivateKey, ed25519Multikey.id, {
|
|
122
114
|
...options,
|
|
123
115
|
created
|
|
124
|
-
})
|
|
125
|
-
assertEquals(await signedObject2.toJsonLd(options), {
|
|
116
|
+
})).toJsonLd(options), {
|
|
126
117
|
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"],
|
|
127
118
|
id: "https://server.example/activities/1",
|
|
128
119
|
type: "Create",
|
|
@@ -210,16 +201,14 @@ test("verifyProof()", async () => {
|
|
|
210
201
|
cache["https://server.example/users/alice#ed25519-key"] = ed25519Multikey;
|
|
211
202
|
assertEquals(await verifyProof(jsonLd, proof, options), expectedKey);
|
|
212
203
|
assertEquals(cache["https://server.example/users/alice#ed25519-key"], expectedKey);
|
|
213
|
-
|
|
204
|
+
assertEquals(await verifyProof({
|
|
214
205
|
...jsonLd,
|
|
215
206
|
object: {
|
|
216
207
|
...jsonLd.object,
|
|
217
208
|
content: "bye"
|
|
218
209
|
}
|
|
219
|
-
};
|
|
220
|
-
assertEquals(await verifyProof(
|
|
221
|
-
const wrongProof = proof.clone({ created: Temporal.Now.instant() });
|
|
222
|
-
assertEquals(await verifyProof(jsonLd, wrongProof, options), null);
|
|
210
|
+
}, proof, options), null);
|
|
211
|
+
assertEquals(await verifyProof(jsonLd, proof.clone({ created: Temporal.Now.instant() }), options), null);
|
|
223
212
|
});
|
|
224
213
|
test("verifyObject()", async () => {
|
|
225
214
|
const options = {
|
|
@@ -264,5 +253,5 @@ test("verifyObject()", async () => {
|
|
|
264
253
|
assertInstanceOf(note, Note);
|
|
265
254
|
assertEquals(note.content, "Hello world");
|
|
266
255
|
});
|
|
267
|
-
|
|
268
|
-
|
|
256
|
+
//#endregion
|
|
257
|
+
export {};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import
|
|
7
|
-
|
|
1
|
+
import "@js-temporal/polyfill";
|
|
2
|
+
import "urlpattern-polyfill";
|
|
3
|
+
globalThis.addEventListener = () => {};
|
|
4
|
+
import { a as red, i as buildMessage, l as AssertionError, n as diffStr, r as diff, s as format } from "./assert_equals-Ew3jOFa3.mjs";
|
|
5
|
+
import "./assert_rejects-B-qJtC9Z.mjs";
|
|
6
|
+
import "./assert_throws-4NwKEy2q.mjs";
|
|
8
7
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_exists.js
|
|
9
8
|
/**
|
|
10
9
|
* Make an assertion that actual is not null or undefined.
|
|
@@ -23,12 +22,10 @@ import { AssertionError, buildMessage, diff, diffStr, format, red } from "./asse
|
|
|
23
22
|
* @param msg The optional message to include in the error if the assertion fails.
|
|
24
23
|
*/ function assertExists(actual, msg) {
|
|
25
24
|
if (actual === void 0 || actual === null) {
|
|
26
|
-
|
|
27
|
-
msg = `Expected actual: "${actual}" to not be null or undefined${msgSuffix}`;
|
|
25
|
+
msg = `Expected actual: "${actual}" to not be null or undefined${msg ? `: ${msg}` : "."}`;
|
|
28
26
|
throw new AssertionError(msg);
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
|
-
|
|
32
29
|
//#endregion
|
|
33
30
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_greater_or_equal.js
|
|
34
31
|
/**
|
|
@@ -54,7 +51,6 @@ import { AssertionError, buildMessage, diff, diffStr, format, red } from "./asse
|
|
|
54
51
|
const expectedString = format(expected);
|
|
55
52
|
throw new AssertionError(msg ?? `Expect ${actualString} >= ${expectedString}`);
|
|
56
53
|
}
|
|
57
|
-
|
|
58
54
|
//#endregion
|
|
59
55
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_greater.js
|
|
60
56
|
/**
|
|
@@ -80,7 +76,6 @@ import { AssertionError, buildMessage, diff, diffStr, format, red } from "./asse
|
|
|
80
76
|
const expectedString = format(expected);
|
|
81
77
|
throw new AssertionError(msg ?? `Expect ${actualString} > ${expectedString}`);
|
|
82
78
|
}
|
|
83
|
-
|
|
84
79
|
//#endregion
|
|
85
80
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_strict_equals.js
|
|
86
81
|
/**
|
|
@@ -110,18 +105,13 @@ import { AssertionError, buildMessage, diff, diffStr, format, red } from "./asse
|
|
|
110
105
|
let message;
|
|
111
106
|
const actualString = format(actual);
|
|
112
107
|
const expectedString = format(expected);
|
|
113
|
-
if (actualString === expectedString) {
|
|
114
|
-
|
|
115
|
-
message = `Values have the same structure but are not reference-equal${msgSuffix}\n\n${red(withOffset)}\n`;
|
|
116
|
-
} else {
|
|
108
|
+
if (actualString === expectedString) message = `Values have the same structure but are not reference-equal${msgSuffix}\n\n${red(actualString.split("\n").map((l) => ` ${l}`).join("\n"))}\n`;
|
|
109
|
+
else {
|
|
117
110
|
const stringDiff = typeof actual === "string" && typeof expected === "string";
|
|
118
|
-
|
|
119
|
-
const diffMsg = buildMessage(diffResult, { stringDiff }).join("\n");
|
|
120
|
-
message = `Values are not strictly equal${msgSuffix}\n${diffMsg}`;
|
|
111
|
+
message = `Values are not strictly equal${msgSuffix}\n${buildMessage(stringDiff ? diffStr(actual, expected) : diff(actualString.split("\n"), expectedString.split("\n")), { stringDiff }).join("\n")}`;
|
|
121
112
|
}
|
|
122
113
|
throw new AssertionError(message);
|
|
123
114
|
}
|
|
124
|
-
|
|
125
115
|
//#endregion
|
|
126
116
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_string_includes.js
|
|
127
117
|
/**
|
|
@@ -141,11 +131,9 @@ import { AssertionError, buildMessage, diff, diffStr, format, red } from "./asse
|
|
|
141
131
|
* @param msg The optional message to display if the assertion fails.
|
|
142
132
|
*/ function assertStringIncludes(actual, expected, msg) {
|
|
143
133
|
if (!actual.includes(expected)) {
|
|
144
|
-
|
|
145
|
-
msg = `Expected actual: "${actual}" to contain: "${expected}"${msgSuffix}`;
|
|
134
|
+
msg = `Expected actual: "${actual}" to contain: "${expected}"${msg ? `: ${msg}` : "."}`;
|
|
146
135
|
throw new AssertionError(msg);
|
|
147
136
|
}
|
|
148
137
|
}
|
|
149
|
-
|
|
150
138
|
//#endregion
|
|
151
|
-
export { assertExists
|
|
139
|
+
export { assertExists as a, assertGreaterOrEqual as i, assertStrictEquals as n, assertGreater as r, assertStringIncludes as t };
|