@fedify/fedify 2.3.14 → 2.3.15
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-C6yXExXl.mjs → builder-B6vSXYxn.mjs} +2 -2
- package/dist/{client-CAM_bQXx.d.cts → client-BIBzqEIp.d.cts} +0 -1
- package/dist/{client-1He2YuBF.mjs → client-DpUNYKla.mjs} +113 -64
- package/dist/{client-CSddvgWN.d.ts → client-jE7oGvRh.d.ts} +0 -1
- 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-MOrCC7yl.d.cts → context-CE_Tj_Oc.d.cts} +28 -2
- package/dist/{context-BWbdE_MZ.d.ts → context-H_5tZXg-.d.ts} +28 -2
- package/dist/{deno-y3L4Oa94.mjs → deno-BCuL3mid.mjs} +1 -1
- package/dist/docloader-D2dr1_6B.mjs +125 -0
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/handler.test.mjs +5 -5
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +455 -29
- 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/send.test.mjs +498 -88
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{http-DNM9KyIO.js → http-BkjxY3U0.js} +172 -103
- package/dist/{http-BCSf1KIY.mjs → http-CSDcThvz.mjs} +196 -98
- package/dist/{http-DQmNpfym.d.ts → http-CZPYFK3b.d.cts} +1 -2
- package/dist/{http-DiWQB8Mr.d.cts → http-DmP0sr2l.d.ts} +1 -2
- package/dist/{http-D77Wjrcg.cjs → http-gOkAiIe1.cjs} +173 -104
- package/dist/{inbox-NObX26c9.mjs → inbox-BHxez4d5.mjs} +2 -2
- package/dist/{key-APURZ0ky.mjs → key-D8IMQ72M.mjs} +2 -2
- package/dist/{kv-cache-Bg4utAuv.cjs → kv-cache-Alm5UmJa.cjs} +59 -17
- package/dist/{kv-cache-C69dzgQi.mjs → kv-cache-Blr9nDDp.mjs} +1 -1
- package/dist/{kv-cache-LBCwHNLu.js → kv-cache-CkXgU-ak.js} +60 -18
- package/dist/{ld-BoLqbDaL.mjs → ld-CVxxE1Pp.mjs} +3 -3
- package/dist/{metrics-DBSl8wEr.mjs → metrics-SYIZHFf_.mjs} +1 -1
- package/dist/{middleware-BQUQ0pPl.cjs → middleware-4yPyyoF5.cjs} +237 -99
- package/dist/{middleware-CZ8tI1qL.mjs → middleware-CfskJGfV.mjs} +81 -41
- package/dist/{middleware-DAqo2eOY.mjs → middleware-D3JWfiCu.mjs} +1 -1
- package/dist/{middleware-CRd1JmuL.js → middleware-DhN7c65B.js} +238 -100
- package/dist/{mod-LmD03uRA.d.ts → mod-CDFFESfL.d.ts} +1 -1
- package/dist/{mod-Bid79LFU.d.cts → mod-C_gFmeNq.d.cts} +1 -1
- package/dist/{mod-Co1M3Ux0.d.cts → mod-DDVkmZ_h.d.cts} +2 -8
- package/dist/{mod-B6PwkUMU.d.cts → mod-DDjtbkZO.d.cts} +1 -1
- package/dist/{mod-Br8yJNcE.d.ts → mod-DMjhnFbg.d.ts} +2 -8
- package/dist/{mod-TLEvgT1i.d.ts → mod-HQXFvOHs.d.ts} +1 -1
- package/dist/mod.cjs +5 -5
- package/dist/mod.d.cts +6 -6
- package/dist/mod.d.ts +6 -6
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/client.test.mjs +337 -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/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-DjKvngeb.mjs → owner-BluLVPf0.mjs} +2 -2
- package/dist/{proof-CWTnYhjS.cjs → proof-CR-HwI0l.cjs} +1 -1
- package/dist/{proof-D2oFOdNA.mjs → proof-Co6nQBVR.mjs} +3 -3
- package/dist/{proof-s9sy44kx.js → proof-Dg0d9QBo.js} +1 -1
- package/dist/{send-xDK5UnL-.mjs → send-D_DnqOFA.mjs} +171 -73
- package/dist/sig/http.test.mjs +528 -2
- package/dist/sig/key.test.mjs +2 -2
- package/dist/sig/ld.test.mjs +2 -2
- package/dist/sig/mod.cjs +2 -2
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +2 -2
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +1 -1
- package/dist/{temporal-C6icc5n9.mjs → temporal-B8FUNkXB.mjs} +1 -1
- package/dist/testing/mod.d.mts +26 -0
- package/dist/{types-miAYfiGO.js → types-B1_pRFE_.js} +112 -63
- package/dist/{types-DRPjmHVV.cjs → types-DOvyymM4.cjs} +111 -62
- package/dist/utils/docloader.test.mjs +318 -34
- 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 +8 -8
- package/dist/docloader-yuyzZC9a.mjs +0 -83
package/dist/sig/http.test.mjs
CHANGED
|
@@ -7,13 +7,15 @@ import { n as assertExists, t as assertStringIncludes } from "../std__assert-BjJ
|
|
|
7
7
|
import { r as assertFalse, t as assertThrows } from "../assert_throws-BbSMEFKo.mjs";
|
|
8
8
|
import { n as assertGreaterOrEqual, t as assertRejects } from "../assert_rejects-D1HYAik3.mjs";
|
|
9
9
|
import { t as assert } from "../assert-CEO06XCw.mjs";
|
|
10
|
-
import { t as exportJwk } from "../key-
|
|
11
|
-
import { a as
|
|
10
|
+
import { t as exportJwk } from "../key-D8IMQ72M.mjs";
|
|
11
|
+
import { a as formatRfc9421SignatureParameters, c as signRequest, d as verifyRequestDetailed, i as formatRfc9421Signature, l as timingSafeEqual, n as doubleKnock, o as parseRfc9421Signature, r as doubleKnockScoped, s as parseRfc9421SignatureInput, t as createRfc9421SignatureBase, u as verifyRequest } from "../http-CSDcThvz.mjs";
|
|
12
12
|
import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-BAK-tUlf.mjs";
|
|
13
13
|
import { t as KvKeyCache } from "../keycache-BimEQucx.mjs";
|
|
14
14
|
import { t as MemoryKvStore } from "../kv-mI4Ix2EU.mjs";
|
|
15
|
+
import { configure, reset } from "@logtape/logtape";
|
|
15
16
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
16
17
|
import { FetchError, UrlError, exportSpki } from "@fedify/vocab-runtime";
|
|
18
|
+
import { openDirectFetch } from "@fedify/vocab-runtime/internal";
|
|
17
19
|
import { encodeBase64 } from "byte-encodings/base64";
|
|
18
20
|
//#region src/sig/http.test.ts
|
|
19
21
|
test("signRequest() [draft-cavage]", async () => {
|
|
@@ -1464,6 +1466,447 @@ test("doubleKnock() async specDeterminer test", async () => {
|
|
|
1464
1466
|
assertEquals(specUsed, "draft-cavage-http-signatures-12", "Should use spec from async determiner");
|
|
1465
1467
|
esm_default.hardReset();
|
|
1466
1468
|
});
|
|
1469
|
+
const lifecycleIdentity = {
|
|
1470
|
+
keyId: rsaPublicKey2.id,
|
|
1471
|
+
privateKey: rsaPrivateKey2
|
|
1472
|
+
};
|
|
1473
|
+
test("doubleKnockScoped() keeps challenge retries and fallback in the validated hop", async () => {
|
|
1474
|
+
const url = "https://example.com/lifecycle/challenge-fallback";
|
|
1475
|
+
const hops = recordHops((_, index) => index === 1 ? {
|
|
1476
|
+
status: 401,
|
|
1477
|
+
headers: { "Accept-Signature": "challenge=(\"@method\");nonce=\"challenge-nonce\"" },
|
|
1478
|
+
body: "Challenge"
|
|
1479
|
+
} : index === 2 ? {
|
|
1480
|
+
status: 401,
|
|
1481
|
+
body: "Unauthorized"
|
|
1482
|
+
} : {
|
|
1483
|
+
status: 202,
|
|
1484
|
+
body: "Accepted"
|
|
1485
|
+
});
|
|
1486
|
+
assertEquals(await doubleKnockScoped(new Request(url, {
|
|
1487
|
+
method: "POST",
|
|
1488
|
+
body: "activity"
|
|
1489
|
+
}), lifecycleIdentity, {}, hops.openHop, (response) => response.text()), "Accepted");
|
|
1490
|
+
assertEquals(hops.events, [
|
|
1491
|
+
`open ${url}`,
|
|
1492
|
+
`fetch #1 ${url}`,
|
|
1493
|
+
"cancel #1",
|
|
1494
|
+
`fetch #2 ${url}`,
|
|
1495
|
+
"cancel #2",
|
|
1496
|
+
`fetch #3 ${url}`,
|
|
1497
|
+
"consumed #3",
|
|
1498
|
+
`close ${url}`
|
|
1499
|
+
]);
|
|
1500
|
+
assertStringIncludes(hops.requests[1].headers.get("Signature-Input"), "nonce=\"challenge-nonce\"");
|
|
1501
|
+
assertFalse(hops.requests[2].headers.has("Signature-Input"));
|
|
1502
|
+
hops.assertInvariants();
|
|
1503
|
+
});
|
|
1504
|
+
test("doubleKnockScoped() reopens the session after challenge redirects", async () => {
|
|
1505
|
+
const url = "https://example.com/lifecycle/challenge-redirect";
|
|
1506
|
+
const next = "https://other.example/lifecycle/final";
|
|
1507
|
+
const validated = [];
|
|
1508
|
+
const hops = recordHops((_, index) => index === 1 ? {
|
|
1509
|
+
status: 401,
|
|
1510
|
+
headers: { "Accept-Signature": "challenge=(\"@method\");created" },
|
|
1511
|
+
body: "Challenge"
|
|
1512
|
+
} : index === 2 ? {
|
|
1513
|
+
status: 307,
|
|
1514
|
+
headers: { Location: next },
|
|
1515
|
+
body: "Redirect"
|
|
1516
|
+
} : {
|
|
1517
|
+
status: 200,
|
|
1518
|
+
body: "Done"
|
|
1519
|
+
});
|
|
1520
|
+
assertEquals(await doubleKnockScoped(new Request(url, {
|
|
1521
|
+
method: "POST",
|
|
1522
|
+
body: "activity"
|
|
1523
|
+
}), lifecycleIdentity, { validateRedirect: (target) => {
|
|
1524
|
+
validated.push(target);
|
|
1525
|
+
} }, hops.openHop, (response) => response.text()), "Done");
|
|
1526
|
+
assertEquals(validated, [next]);
|
|
1527
|
+
assertEquals(hops.events, [
|
|
1528
|
+
`open ${url}`,
|
|
1529
|
+
`fetch #1 ${url}`,
|
|
1530
|
+
"cancel #1",
|
|
1531
|
+
`fetch #2 ${url}`,
|
|
1532
|
+
"cancel #2",
|
|
1533
|
+
`close ${url}`,
|
|
1534
|
+
`open ${next}`,
|
|
1535
|
+
`fetch #3 ${next}`,
|
|
1536
|
+
"consumed #3",
|
|
1537
|
+
`close ${next}`
|
|
1538
|
+
]);
|
|
1539
|
+
assertEquals(await hops.requests[2].text(), "activity");
|
|
1540
|
+
hops.assertInvariants();
|
|
1541
|
+
});
|
|
1542
|
+
test("doubleKnockScoped() preserves maxRedirection across challenge redirects", async (t) => {
|
|
1543
|
+
for (const maxRedirection of [0, 1]) await t.step(`limit ${maxRedirection}`, async () => {
|
|
1544
|
+
const url = "https://example.com/lifecycle/challenge-limit";
|
|
1545
|
+
const hops = recordHops((request, index) => index % 2 === 1 ? {
|
|
1546
|
+
status: 401,
|
|
1547
|
+
headers: { "Accept-Signature": "challenge=(\"@method\");created" },
|
|
1548
|
+
body: "Challenge"
|
|
1549
|
+
} : {
|
|
1550
|
+
status: 307,
|
|
1551
|
+
headers: { Location: `${request.url}/next` },
|
|
1552
|
+
body: "Redirect"
|
|
1553
|
+
});
|
|
1554
|
+
await assertRejects(() => doubleKnockScoped(new Request(url, {
|
|
1555
|
+
method: "POST",
|
|
1556
|
+
body: "activity"
|
|
1557
|
+
}), lifecycleIdentity, { maxRedirection }, hops.openHop, (response) => response.text()), FetchError, `Too many redirections (${maxRedirection + 1})`);
|
|
1558
|
+
assertEquals(hops.requests.length, 2 * (maxRedirection + 1));
|
|
1559
|
+
assertEquals(hops.events.filter((event) => event.startsWith("open ")).length, maxRedirection + 1);
|
|
1560
|
+
assertEquals(hops.events.filter((event) => event.startsWith("cancel #")).length, hops.requests.length);
|
|
1561
|
+
hops.assertInvariants();
|
|
1562
|
+
});
|
|
1563
|
+
});
|
|
1564
|
+
test("doubleKnockScoped() detects loops after challenge redirects", async () => {
|
|
1565
|
+
const url = "https://example.com/lifecycle/challenge-loop";
|
|
1566
|
+
const hops = recordHops((_, index) => index === 1 ? {
|
|
1567
|
+
status: 401,
|
|
1568
|
+
headers: { "Accept-Signature": "challenge=(\"@method\");created" },
|
|
1569
|
+
body: "Challenge"
|
|
1570
|
+
} : {
|
|
1571
|
+
status: 307,
|
|
1572
|
+
headers: { Location: url },
|
|
1573
|
+
body: "Redirect"
|
|
1574
|
+
});
|
|
1575
|
+
await assertRejects(() => doubleKnockScoped(new Request(url, {
|
|
1576
|
+
method: "POST",
|
|
1577
|
+
body: "activity"
|
|
1578
|
+
}), lifecycleIdentity, {}, hops.openHop, (response) => response.text()), FetchError, "Redirect loop detected");
|
|
1579
|
+
assertEquals(hops.requests.length, 2);
|
|
1580
|
+
assertEquals(hops.events, [
|
|
1581
|
+
`open ${url}`,
|
|
1582
|
+
`fetch #1 ${url}`,
|
|
1583
|
+
"cancel #1",
|
|
1584
|
+
`fetch #2 ${url}`,
|
|
1585
|
+
"cancel #2",
|
|
1586
|
+
`close ${url}`
|
|
1587
|
+
]);
|
|
1588
|
+
hops.assertInvariants();
|
|
1589
|
+
});
|
|
1590
|
+
test("doubleKnockScoped() retries another spec on the same hop", async () => {
|
|
1591
|
+
const url = "https://example.com/lifecycle/retry";
|
|
1592
|
+
const hops = recordHops((_, index) => index === 1 ? {
|
|
1593
|
+
status: 401,
|
|
1594
|
+
body: "Unauthorized"
|
|
1595
|
+
} : {
|
|
1596
|
+
status: 202,
|
|
1597
|
+
body: "Accepted"
|
|
1598
|
+
});
|
|
1599
|
+
assertEquals(await doubleKnockScoped(new Request(url, {
|
|
1600
|
+
method: "POST",
|
|
1601
|
+
body: "activity"
|
|
1602
|
+
}), lifecycleIdentity, {}, hops.openHop, (response) => response.text()), "Accepted");
|
|
1603
|
+
assertEquals(hops.events, [
|
|
1604
|
+
`open ${url}`,
|
|
1605
|
+
`fetch #1 ${url}`,
|
|
1606
|
+
"cancel #1",
|
|
1607
|
+
`fetch #2 ${url}`,
|
|
1608
|
+
"consumed #2",
|
|
1609
|
+
`close ${url}`
|
|
1610
|
+
]);
|
|
1611
|
+
assertEquals(hops.requests.map((r) => r.headers.has("Signature-Input")), [true, false]);
|
|
1612
|
+
hops.assertInvariants();
|
|
1613
|
+
});
|
|
1614
|
+
test("doubleKnockScoped() closes the retried hop before a redirect", async () => {
|
|
1615
|
+
const url = "https://example.com/lifecycle/retry-redirect";
|
|
1616
|
+
const next = "https://example.com/lifecycle/final";
|
|
1617
|
+
const hops = recordHops((_, index) => index === 1 ? {
|
|
1618
|
+
status: 401,
|
|
1619
|
+
body: "Unauthorized"
|
|
1620
|
+
} : index === 2 ? {
|
|
1621
|
+
status: 302,
|
|
1622
|
+
headers: { Location: next },
|
|
1623
|
+
body: "Found"
|
|
1624
|
+
} : {
|
|
1625
|
+
status: 200,
|
|
1626
|
+
body: "Done"
|
|
1627
|
+
});
|
|
1628
|
+
assertEquals(await doubleKnockScoped(new Request(url, {
|
|
1629
|
+
method: "POST",
|
|
1630
|
+
body: "activity"
|
|
1631
|
+
}), lifecycleIdentity, {}, hops.openHop, (response) => response.text()), "Done");
|
|
1632
|
+
assertEquals(hops.events, [
|
|
1633
|
+
`open ${url}`,
|
|
1634
|
+
`fetch #1 ${url}`,
|
|
1635
|
+
"cancel #1",
|
|
1636
|
+
`fetch #2 ${url}`,
|
|
1637
|
+
"cancel #2",
|
|
1638
|
+
`close ${url}`,
|
|
1639
|
+
`open ${next}`,
|
|
1640
|
+
`fetch #3 ${next}`,
|
|
1641
|
+
"consumed #3",
|
|
1642
|
+
`close ${next}`
|
|
1643
|
+
]);
|
|
1644
|
+
assertEquals(await hops.requests[2].text(), "activity");
|
|
1645
|
+
hops.assertInvariants();
|
|
1646
|
+
});
|
|
1647
|
+
test("doubleKnockScoped() retries transport errors on the same hop", async (t) => {
|
|
1648
|
+
await t.step("GET", async () => {
|
|
1649
|
+
const url = "https://example.com/lifecycle/flaky";
|
|
1650
|
+
const hops = recordHops((_, index) => {
|
|
1651
|
+
if (index === 1) throw new TypeError("connection reset");
|
|
1652
|
+
return { body: "Success" };
|
|
1653
|
+
});
|
|
1654
|
+
assertEquals(await doubleKnockScoped(new Request(url), lifecycleIdentity, {}, hops.openHop, (response) => response.text()), "Success");
|
|
1655
|
+
assertEquals(hops.events, [
|
|
1656
|
+
`open ${url}`,
|
|
1657
|
+
`fetch #1 ${url}`,
|
|
1658
|
+
`fetch #2 ${url}`,
|
|
1659
|
+
"consumed #2",
|
|
1660
|
+
`close ${url}`
|
|
1661
|
+
]);
|
|
1662
|
+
hops.assertInvariants();
|
|
1663
|
+
});
|
|
1664
|
+
await t.step("POST", async () => {
|
|
1665
|
+
const url = "https://example.com/lifecycle/flaky-inbox";
|
|
1666
|
+
const hops = recordHops(() => {
|
|
1667
|
+
throw new TypeError("connection reset");
|
|
1668
|
+
});
|
|
1669
|
+
await assertRejects(() => doubleKnockScoped(new Request(url, {
|
|
1670
|
+
method: "POST",
|
|
1671
|
+
body: "activity"
|
|
1672
|
+
}), lifecycleIdentity, {}, hops.openHop, (response) => response.text()), FetchError);
|
|
1673
|
+
assertEquals(hops.events, [
|
|
1674
|
+
`open ${url}`,
|
|
1675
|
+
`fetch #1 ${url}`,
|
|
1676
|
+
`close ${url}`
|
|
1677
|
+
]);
|
|
1678
|
+
hops.assertInvariants();
|
|
1679
|
+
});
|
|
1680
|
+
});
|
|
1681
|
+
async function captureLogs(fn) {
|
|
1682
|
+
const records = [];
|
|
1683
|
+
await configure({
|
|
1684
|
+
sinks: { buffer: (record) => records.push(record) },
|
|
1685
|
+
loggers: [{
|
|
1686
|
+
category: "fedify",
|
|
1687
|
+
sinks: ["buffer"],
|
|
1688
|
+
lowestLevel: "debug"
|
|
1689
|
+
}, {
|
|
1690
|
+
category: ["logtape", "meta"],
|
|
1691
|
+
sinks: []
|
|
1692
|
+
}],
|
|
1693
|
+
reset: true
|
|
1694
|
+
});
|
|
1695
|
+
try {
|
|
1696
|
+
await fn();
|
|
1697
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
1698
|
+
} finally {
|
|
1699
|
+
await reset();
|
|
1700
|
+
}
|
|
1701
|
+
return records;
|
|
1702
|
+
}
|
|
1703
|
+
test("doubleKnockScoped() logs a redirect body failing to cancel and follows the redirect", async () => {
|
|
1704
|
+
const url = "https://example.com/lifecycle/cancel-failure";
|
|
1705
|
+
const next = "https://example.com/lifecycle/cancel-failure-final";
|
|
1706
|
+
const hops = recordHops((_, index) => index === 1 ? {
|
|
1707
|
+
status: 302,
|
|
1708
|
+
headers: { Location: next },
|
|
1709
|
+
body: "Found",
|
|
1710
|
+
failCancel: true
|
|
1711
|
+
} : {
|
|
1712
|
+
status: 200,
|
|
1713
|
+
body: "Done"
|
|
1714
|
+
});
|
|
1715
|
+
let result;
|
|
1716
|
+
const records = await captureLogs(async () => {
|
|
1717
|
+
result = await doubleKnockScoped(new Request(url), lifecycleIdentity, {}, hops.openHop, (response) => response.text());
|
|
1718
|
+
});
|
|
1719
|
+
assertEquals(result, "Done");
|
|
1720
|
+
assertEquals(hops.events, [
|
|
1721
|
+
`open ${url}`,
|
|
1722
|
+
`fetch #1 ${url}`,
|
|
1723
|
+
"cancel #1",
|
|
1724
|
+
`close ${url}`,
|
|
1725
|
+
`open ${next}`,
|
|
1726
|
+
`fetch #2 ${next}`,
|
|
1727
|
+
"consumed #2",
|
|
1728
|
+
`close ${next}`
|
|
1729
|
+
]);
|
|
1730
|
+
const failures = records.filter((r) => r.rawMessage === "Failed to cancel the response body from {url}: {error}");
|
|
1731
|
+
assertEquals(failures.map((r) => [r.level, r.properties.url]), [["debug", url]]);
|
|
1732
|
+
assertEquals(failures[0].properties.error.message, "cancel #1 failed");
|
|
1733
|
+
hops.assertInvariants();
|
|
1734
|
+
});
|
|
1735
|
+
test("doubleKnockScoped() is not blocked by a body cancellation that never settles", async () => {
|
|
1736
|
+
const url = "https://example.com/lifecycle/hanging-cancel";
|
|
1737
|
+
const next = "https://example.com/lifecycle/hanging-cancel-final";
|
|
1738
|
+
const hops = recordHops((_, index) => index === 1 ? {
|
|
1739
|
+
status: 401,
|
|
1740
|
+
body: "Unauthorized",
|
|
1741
|
+
hangCancel: true
|
|
1742
|
+
} : index === 2 ? {
|
|
1743
|
+
status: 302,
|
|
1744
|
+
headers: { Location: next },
|
|
1745
|
+
body: "Found",
|
|
1746
|
+
hangCancel: true
|
|
1747
|
+
} : {
|
|
1748
|
+
status: 200,
|
|
1749
|
+
body: "Done",
|
|
1750
|
+
hangCancel: true
|
|
1751
|
+
});
|
|
1752
|
+
assertEquals(await doubleKnockScoped(new Request(url, {
|
|
1753
|
+
method: "POST",
|
|
1754
|
+
body: "activity"
|
|
1755
|
+
}), lifecycleIdentity, {}, hops.openHop, (response) => Promise.resolve(response.status)), 200);
|
|
1756
|
+
assertEquals(hops.events, [
|
|
1757
|
+
`open ${url}`,
|
|
1758
|
+
`fetch #1 ${url}`,
|
|
1759
|
+
"cancel #1",
|
|
1760
|
+
`fetch #2 ${url}`,
|
|
1761
|
+
"cancel #2",
|
|
1762
|
+
`close ${url}`,
|
|
1763
|
+
`open ${next}`,
|
|
1764
|
+
`fetch #3 ${next}`,
|
|
1765
|
+
"cancel #3 by close",
|
|
1766
|
+
`close ${next}`
|
|
1767
|
+
]);
|
|
1768
|
+
hops.assertInvariants();
|
|
1769
|
+
});
|
|
1770
|
+
test("doubleKnockScoped() completes with responses cloned by fetch-mock", async () => {
|
|
1771
|
+
esm_default.spyGlobal();
|
|
1772
|
+
try {
|
|
1773
|
+
let attempts = 0;
|
|
1774
|
+
esm_default.post("https://example.com/tee/redirect", () => {
|
|
1775
|
+
attempts++;
|
|
1776
|
+
return attempts === 1 ? new Response("Unauthorized", { status: 401 }) : new Response("Found", {
|
|
1777
|
+
status: 302,
|
|
1778
|
+
headers: { Location: "https://example.com/tee/final" }
|
|
1779
|
+
});
|
|
1780
|
+
});
|
|
1781
|
+
esm_default.post("https://example.com/tee/final", () => new Response("Accepted", { status: 202 }));
|
|
1782
|
+
const request = () => new Request("https://example.com/tee/redirect", {
|
|
1783
|
+
method: "POST",
|
|
1784
|
+
body: "activity"
|
|
1785
|
+
});
|
|
1786
|
+
assertEquals(await doubleKnockScoped(request(), lifecycleIdentity, {}, openDirectFetch, (response) => Promise.resolve(response.status)), 202);
|
|
1787
|
+
assertEquals(attempts, 2);
|
|
1788
|
+
attempts = 0;
|
|
1789
|
+
const response = await doubleKnock(request(), lifecycleIdentity);
|
|
1790
|
+
assertEquals(response.status, 202);
|
|
1791
|
+
assertEquals(await response.text(), "Accepted");
|
|
1792
|
+
assertEquals(attempts, 2);
|
|
1793
|
+
} finally {
|
|
1794
|
+
esm_default.hardReset();
|
|
1795
|
+
}
|
|
1796
|
+
});
|
|
1797
|
+
test("doubleKnockScoped() closes the session when consuming fails", async (t) => {
|
|
1798
|
+
const url = "https://example.com/lifecycle/consume";
|
|
1799
|
+
await t.step("exception", async () => {
|
|
1800
|
+
const hops = recordHops(() => ({ body: "x".repeat(1024) }));
|
|
1801
|
+
const error = /* @__PURE__ */ new Error("consume failed");
|
|
1802
|
+
await assertRejects(() => doubleKnockScoped(new Request(url), lifecycleIdentity, {}, hops.openHop, async (response) => {
|
|
1803
|
+
const reader = response.body.getReader();
|
|
1804
|
+
await reader.read();
|
|
1805
|
+
reader.releaseLock();
|
|
1806
|
+
throw error;
|
|
1807
|
+
}), Error, "consume failed");
|
|
1808
|
+
assertEquals(hops.events, [
|
|
1809
|
+
`open ${url}`,
|
|
1810
|
+
`fetch #1 ${url}`,
|
|
1811
|
+
"cancel #1 by close",
|
|
1812
|
+
`close ${url}`
|
|
1813
|
+
]);
|
|
1814
|
+
hops.assertInvariants();
|
|
1815
|
+
});
|
|
1816
|
+
await t.step("abort", async () => {
|
|
1817
|
+
const hops = recordHops(() => ({ body: "Success" }));
|
|
1818
|
+
const controller = new AbortController();
|
|
1819
|
+
const reason = /* @__PURE__ */ new Error("aborted while consuming");
|
|
1820
|
+
assert(await assertRejects(() => doubleKnockScoped(new Request(url), lifecycleIdentity, { signal: controller.signal }, hops.openHop, () => {
|
|
1821
|
+
controller.abort(reason);
|
|
1822
|
+
controller.signal.throwIfAborted();
|
|
1823
|
+
return Promise.resolve();
|
|
1824
|
+
})) === reason);
|
|
1825
|
+
assertEquals(hops.events, [
|
|
1826
|
+
`open ${url}`,
|
|
1827
|
+
`fetch #1 ${url}`,
|
|
1828
|
+
"cancel #1 by close",
|
|
1829
|
+
`close ${url}`
|
|
1830
|
+
]);
|
|
1831
|
+
hops.assertInvariants();
|
|
1832
|
+
});
|
|
1833
|
+
});
|
|
1834
|
+
test("doubleKnock() returns the final response without cancelling its body", async () => {
|
|
1835
|
+
const url = "https://example.com/lifecycle/public";
|
|
1836
|
+
const next = "https://example.com/lifecycle/public-final";
|
|
1837
|
+
const events = [];
|
|
1838
|
+
const responses = [];
|
|
1839
|
+
const originalFetch = globalThis.fetch;
|
|
1840
|
+
globalThis.fetch = ((input) => {
|
|
1841
|
+
const requestUrl = input instanceof Request ? input.url : String(input);
|
|
1842
|
+
const index = responses.length + 1;
|
|
1843
|
+
events.push(`fetch #${index} ${requestUrl}`);
|
|
1844
|
+
const recorded = createRecordedResponse(events, index, requestUrl === url ? {
|
|
1845
|
+
status: 302,
|
|
1846
|
+
headers: { Location: next },
|
|
1847
|
+
body: "Found"
|
|
1848
|
+
} : {
|
|
1849
|
+
status: 200,
|
|
1850
|
+
body: "Done"
|
|
1851
|
+
});
|
|
1852
|
+
responses.push(recorded);
|
|
1853
|
+
return Promise.resolve(recorded.response);
|
|
1854
|
+
});
|
|
1855
|
+
try {
|
|
1856
|
+
const response = await doubleKnock(new Request(url), lifecycleIdentity);
|
|
1857
|
+
assertEquals(events, [
|
|
1858
|
+
`fetch #1 ${url}`,
|
|
1859
|
+
"cancel #1",
|
|
1860
|
+
`fetch #2 ${next}`
|
|
1861
|
+
]);
|
|
1862
|
+
assertFalse(responses[1].settled());
|
|
1863
|
+
assertEquals(await response.text(), "Done");
|
|
1864
|
+
assertEquals(events.at(-1), "consumed #2");
|
|
1865
|
+
} finally {
|
|
1866
|
+
globalThis.fetch = originalFetch;
|
|
1867
|
+
}
|
|
1868
|
+
});
|
|
1869
|
+
test("doubleKnock() is not blocked by a body cancellation that never settles", async () => {
|
|
1870
|
+
const url = "https://example.com/lifecycle/public-hanging";
|
|
1871
|
+
const next = "https://example.com/lifecycle/public-hanging-final";
|
|
1872
|
+
const events = [];
|
|
1873
|
+
const originalFetch = globalThis.fetch;
|
|
1874
|
+
let index = 0;
|
|
1875
|
+
globalThis.fetch = ((input) => {
|
|
1876
|
+
const requestUrl = input instanceof Request ? input.url : String(input);
|
|
1877
|
+
index++;
|
|
1878
|
+
events.push(`fetch #${index} ${requestUrl}`);
|
|
1879
|
+
return Promise.resolve(createRecordedResponse(events, index, index === 1 ? {
|
|
1880
|
+
status: 401,
|
|
1881
|
+
body: "Unauthorized",
|
|
1882
|
+
hangCancel: true
|
|
1883
|
+
} : index === 2 ? {
|
|
1884
|
+
status: 302,
|
|
1885
|
+
headers: { Location: next },
|
|
1886
|
+
body: "Found",
|
|
1887
|
+
hangCancel: true
|
|
1888
|
+
} : {
|
|
1889
|
+
status: 200,
|
|
1890
|
+
body: "Done"
|
|
1891
|
+
}).response);
|
|
1892
|
+
});
|
|
1893
|
+
try {
|
|
1894
|
+
const response = await doubleKnock(new Request(url, {
|
|
1895
|
+
method: "POST",
|
|
1896
|
+
body: "activity"
|
|
1897
|
+
}), lifecycleIdentity);
|
|
1898
|
+
assertEquals(events, [
|
|
1899
|
+
`fetch #1 ${url}`,
|
|
1900
|
+
"cancel #1",
|
|
1901
|
+
`fetch #2 ${url}`,
|
|
1902
|
+
"cancel #2",
|
|
1903
|
+
`fetch #3 ${next}`
|
|
1904
|
+
]);
|
|
1905
|
+
assertEquals(await response.text(), "Done");
|
|
1906
|
+
} finally {
|
|
1907
|
+
globalThis.fetch = originalFetch;
|
|
1908
|
+
}
|
|
1909
|
+
});
|
|
1467
1910
|
test("timingSafeEqual()", async (t) => {
|
|
1468
1911
|
await t.step("should return true for equal empty arrays", () => {
|
|
1469
1912
|
assert(timingSafeEqual(new Uint8Array([]), new Uint8Array([])));
|
|
@@ -2170,5 +2613,88 @@ test("doubleKnock(): Accept-Signature with multiple compatible entries fulfills
|
|
|
2170
2613
|
assertEquals(requestCount, 2);
|
|
2171
2614
|
esm_default.hardReset();
|
|
2172
2615
|
});
|
|
2616
|
+
function createRecordedResponse(events, index, init, cancelSuffix = () => "") {
|
|
2617
|
+
const bytes = new TextEncoder().encode(init.body ?? "");
|
|
2618
|
+
const chunkSize = init.chunkSize ?? 256;
|
|
2619
|
+
let offset = 0;
|
|
2620
|
+
let settled = false;
|
|
2621
|
+
const body = new ReadableStream({
|
|
2622
|
+
pull(controller) {
|
|
2623
|
+
if (offset >= bytes.length) {
|
|
2624
|
+
settled = true;
|
|
2625
|
+
events.push(`consumed #${index}`);
|
|
2626
|
+
controller.close();
|
|
2627
|
+
return;
|
|
2628
|
+
}
|
|
2629
|
+
controller.enqueue(bytes.slice(offset, offset + chunkSize));
|
|
2630
|
+
offset += chunkSize;
|
|
2631
|
+
},
|
|
2632
|
+
cancel() {
|
|
2633
|
+
settled = true;
|
|
2634
|
+
events.push(`cancel #${index}${cancelSuffix()}`);
|
|
2635
|
+
if (init.failCancel) throw new Error(`cancel #${index} failed`);
|
|
2636
|
+
if (init.hangCancel) return new Promise(() => {});
|
|
2637
|
+
}
|
|
2638
|
+
}, { highWaterMark: 0 });
|
|
2639
|
+
return {
|
|
2640
|
+
response: new Response(body, {
|
|
2641
|
+
status: init.status ?? 200,
|
|
2642
|
+
headers: init.headers
|
|
2643
|
+
}),
|
|
2644
|
+
settled: () => settled
|
|
2645
|
+
};
|
|
2646
|
+
}
|
|
2647
|
+
function recordHops(respond) {
|
|
2648
|
+
const events = [];
|
|
2649
|
+
const requests = [];
|
|
2650
|
+
const unsettledAtClose = [];
|
|
2651
|
+
let opens = 0;
|
|
2652
|
+
let closes = 0;
|
|
2653
|
+
let fetches = 0;
|
|
2654
|
+
return {
|
|
2655
|
+
events,
|
|
2656
|
+
requests,
|
|
2657
|
+
openHop(url) {
|
|
2658
|
+
opens++;
|
|
2659
|
+
events.push(`open ${url}`);
|
|
2660
|
+
const tracked = [];
|
|
2661
|
+
let closed = false;
|
|
2662
|
+
let closing = false;
|
|
2663
|
+
return Promise.resolve({
|
|
2664
|
+
url: new URL(url),
|
|
2665
|
+
async fetch(input, init) {
|
|
2666
|
+
if (closed) throw new TypeError("The session is closed.");
|
|
2667
|
+
const request = new Request(input instanceof Request ? input.clone() : input, init);
|
|
2668
|
+
const index = ++fetches;
|
|
2669
|
+
requests.push(request);
|
|
2670
|
+
events.push(`fetch #${index} ${request.url}`);
|
|
2671
|
+
const recorded = createRecordedResponse(events, index, await respond(request, index), () => closing ? " by close" : "");
|
|
2672
|
+
tracked.push({
|
|
2673
|
+
...recorded,
|
|
2674
|
+
index
|
|
2675
|
+
});
|
|
2676
|
+
return recorded.response;
|
|
2677
|
+
},
|
|
2678
|
+
close() {
|
|
2679
|
+
if (closed) return Promise.resolve();
|
|
2680
|
+
closed = true;
|
|
2681
|
+
closes++;
|
|
2682
|
+
closing = true;
|
|
2683
|
+
for (const { response, settled, index } of tracked) {
|
|
2684
|
+
if (settled()) continue;
|
|
2685
|
+
if (response.body?.locked) unsettledAtClose.push(index);
|
|
2686
|
+
else response.body?.cancel().catch(() => {});
|
|
2687
|
+
}
|
|
2688
|
+
events.push(`close ${url}`);
|
|
2689
|
+
return Promise.resolve();
|
|
2690
|
+
}
|
|
2691
|
+
});
|
|
2692
|
+
},
|
|
2693
|
+
assertInvariants() {
|
|
2694
|
+
assertEquals(opens, closes);
|
|
2695
|
+
assertEquals(unsettledAtClose, []);
|
|
2696
|
+
}
|
|
2697
|
+
};
|
|
2698
|
+
}
|
|
2173
2699
|
//#endregion
|
|
2174
2700
|
export {};
|
package/dist/sig/key.test.mjs
CHANGED
|
@@ -7,9 +7,9 @@ import { r as assertFalse, t as assertThrows } from "../assert_throws-BbSMEFKo.m
|
|
|
7
7
|
import { t as assertRejects } from "../assert_rejects-D1HYAik3.mjs";
|
|
8
8
|
import { t as assert } from "../assert-CEO06XCw.mjs";
|
|
9
9
|
import { t as assertStrictEquals } from "../assert_strict_equals-XEgZAlrj.mjs";
|
|
10
|
-
import { a as generateCryptoKeyPair, i as fetchKeyDetailed, o as importJwk, r as fetchKey, s as validateCryptoKey, t as exportJwk } from "../key-
|
|
10
|
+
import { a as generateCryptoKeyPair, i as fetchKeyDetailed, o as importJwk, r as fetchKey, s as validateCryptoKey, t as exportJwk } from "../key-D8IMQ72M.mjs";
|
|
11
11
|
import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
12
|
-
import { _ as wrapContextLoaderForJsonLd } from "../ld-
|
|
12
|
+
import { _ as wrapContextLoaderForJsonLd } from "../ld-CVxxE1Pp.mjs";
|
|
13
13
|
import { CryptographicKey, Multikey, Person } from "@fedify/vocab";
|
|
14
14
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
15
15
|
import { FetchError, UrlError, getDocumentLoader } from "@fedify/vocab-runtime";
|
package/dist/sig/ld.test.mjs
CHANGED
|
@@ -5,9 +5,9 @@ import { t as assertEquals } from "../assert_equals-C-ZRDbaf.mjs";
|
|
|
5
5
|
import { r as assertFalse, t as assertThrows } from "../assert_throws-BbSMEFKo.mjs";
|
|
6
6
|
import { n as assertGreaterOrEqual, t as assertRejects } from "../assert_rejects-D1HYAik3.mjs";
|
|
7
7
|
import { n as assertInstanceOf, t as assert } from "../assert-CEO06XCw.mjs";
|
|
8
|
-
import { a as generateCryptoKeyPair } from "../key-
|
|
8
|
+
import { a as generateCryptoKeyPair } from "../key-D8IMQ72M.mjs";
|
|
9
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 compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-
|
|
10
|
+
import { a as compactJsonLd, f as isInvalidUrlTypeError, g as verifySignature, h as verifyJsonLd, i as attachSignature, n as UnsafeJsonLdError, o as createSignature, p as signJsonLd, s as detachSignature, u as hasSignatureLike } from "../ld-CVxxE1Pp.mjs";
|
|
11
11
|
import { CryptographicKey } from "@fedify/vocab";
|
|
12
12
|
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
13
13
|
import { encodeBase64 } from "byte-encodings/base64";
|
package/dist/sig/mod.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const require_http = require("../http-
|
|
5
|
-
const require_proof = require("../proof-
|
|
4
|
+
const require_http = require("../http-gOkAiIe1.cjs");
|
|
5
|
+
const require_proof = require("../proof-CR-HwI0l.cjs");
|
|
6
6
|
exports.attachSignature = require_proof.attachSignature;
|
|
7
7
|
exports.createProof = require_proof.createProof;
|
|
8
8
|
exports.createSignature = require_proof.createSignature;
|
package/dist/sig/mod.d.cts
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-CZPYFK3b.cjs";
|
|
3
3
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-B3hNQCG8.cjs";
|
|
4
|
-
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-
|
|
4
|
+
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-C_gFmeNq.cjs";
|
|
5
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 };
|
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-DmP0sr2l.js";
|
|
3
3
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-CiBPcC6F.js";
|
|
4
|
-
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-
|
|
4
|
+
import { _ as hasSignatureLike, a as createProof, b as verifySignature, c as verifyObject, d as SignJsonLdOptions, f as VerifyJsonLdOptions, g as detachSignature, h as createSignature, i as VerifyProofOptions, l as verifyProof, m as attachSignature, n as SignObjectOptions, o as hasProofLike, p as VerifySignatureOptions, r as VerifyObjectOptions, s as signObject, t as CreateProofOptions, u as CreateSignatureOptions, v as signJsonLd, y as verifyJsonLd } from "../mod-HQXFvOHs.js";
|
|
5
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 };
|
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, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "../proof-
|
|
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-BkjxY3U0.js";
|
|
4
|
+
import { C as verifySignature, S as verifyJsonLd, _ as hasSignatureLike, a as verifyProof, b as signJsonLd, c as getKeyOwner, d as attachSignature, i as verifyObject, m as detachSignature, n as hasProofLike, p as createSignature, r as signObject, s as doesActorOwnKey, t as createProof } from "../proof-Dg0d9QBo.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-BluLVPf0.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
|
@@ -8,7 +8,7 @@ import { n as assertGreaterOrEqual, t as assertRejects } from "../assert_rejects
|
|
|
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
10
|
import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-D4iTv7uM.mjs";
|
|
11
|
-
import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-
|
|
11
|
+
import { a as verifyProof, i as verifyObject, n as hasProofLike, r as signObject, t as createProof } from "../proof-Co6nQBVR.mjs";
|
|
12
12
|
import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place } from "@fedify/vocab";
|
|
13
13
|
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
14
14
|
import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
|
|
@@ -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-CVxxE1Pp.mjs";
|
|
5
5
|
import jsonld from "@fedify/vocab-runtime/jsonld";
|
|
6
6
|
//#region src/federation/temporal.ts
|
|
7
7
|
function isPlainObject(value) {
|