@fedify/fedify 2.5.0-dev.2448 → 2.5.0-dev.2492
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/README.md +3 -0
- package/dist/{builder-DbC8bn6k.mjs → builder-DphK9v7f.mjs} +2 -2
- package/dist/{client-D-XP_Ccb.d.cts → client-3InDZbba.d.cts} +0 -1
- package/dist/{client-D-XP_Ccb.d.ts → client-3InDZbba.d.ts} +0 -1
- package/dist/{client-CEnNz8O7.mjs → client-5SIFzW3q.mjs} +113 -64
- 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/{compound-proof-heeXW2_A.mjs → compound-proof-cYtvlTgF.mjs} +2 -2
- package/dist/{context-GlHrzdSP.d.ts → context-DQJE9YfH.d.ts} +29 -3
- package/dist/{context-BazwQrHn.d.cts → context-DSuL3YWx.d.cts} +29 -3
- package/dist/{deno-Dpewt_jJ.mjs → deno-iOAA7iRN.mjs} +1 -1
- package/dist/docloader-DCZkiTeF.mjs +136 -0
- package/dist/{exporter-DThFfe7P.mjs → exporter-DVG68ozH.mjs} +36 -30
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/compound-fanout.test.mjs +6 -3
- package/dist/federation/handler-compound-proof.test.mjs +3 -3
- package/dist/federation/handler.test.mjs +5 -5
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox-actorless.test.mjs +5 -5
- package/dist/federation/inbox-report.test.mjs +5 -5
- package/dist/federation/inbox-view.test.mjs +1 -1
- package/dist/federation/inbox.test.mjs +1 -1
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +468 -33
- package/dist/federation/mod.cjs +1 -1
- package/dist/federation/mod.d.cts +3 -3
- package/dist/federation/mod.d.ts +3 -3
- package/dist/federation/mod.js +1 -1
- package/dist/federation/mq.test.mjs +1 -1
- package/dist/federation/outgoing-proof.test.mjs +9 -6
- package/dist/federation/portable-actor.test.mjs +3 -3
- package/dist/federation/portable-chain.test.mjs +3 -3
- package/dist/federation/portable-collection.test.mjs +4 -4
- package/dist/federation/portable-delivery.test.mjs +2 -2
- package/dist/federation/portable-gateway-keys.test.mjs +11 -5
- package/dist/federation/portable-inbox.test.mjs +4 -4
- package/dist/federation/portable-parse-uri.test.mjs +1 -1
- package/dist/federation/portable-route-activity.test.mjs +2 -2
- package/dist/federation/portable.test.mjs +3 -3
- package/dist/federation/send.test.mjs +502 -93
- package/dist/federation/tasks/enqueue.test.mjs +1 -1
- package/dist/federation/tasks/tasks.test.mjs +2 -2
- package/dist/federation/temporal.test.mjs +1 -1
- package/dist/federation/webfinger.test.mjs +1 -1
- package/dist/{federation-D8YexkP1.cjs → federation-D0AZw_aw.cjs} +246 -108
- package/dist/{http-BZkyQIkb.mjs → http-BoJCMnjY.mjs} +204 -106
- package/dist/{http-BBr-VLil.js → http-ChXUU_3c.js} +178 -109
- package/dist/{http-CAl7Num5.cjs → http-kv1LZw-r.cjs} +179 -110
- package/dist/{inbox-wDuMKaFW.mjs → inbox-BjihTKLo.mjs} +2 -2
- package/dist/{inbox-view-NE9wXdLo.mjs → inbox-view-D-skypg-.mjs} +1 -1
- package/dist/{key-nYGY4QB9.d.cts → key-DbLNT-vA.d.ts} +1 -2
- package/dist/{key-DhsBxxZN.d.ts → key-DlHT4R6k.d.cts} +1 -2
- package/dist/{kv-cache-CTQSfkmp.mjs → kv-cache-Cmsyke4d.mjs} +1 -1
- package/dist/{kv-cache-U7uz5nx4.js → kv-cache-DQcte7ES.js} +73 -28
- package/dist/{kv-cache-CjgCOz3i.cjs → kv-cache-Ddh5sMxH.cjs} +72 -27
- package/dist/{ld-Cel1RRZ5.d.cts → ld-CWVpo_NM.d.cts} +1 -1
- package/dist/{ld-CQFuiah9.mjs → ld-CdvcOEXQ.mjs} +2 -2
- package/dist/{ld-CcuZ4NZa.d.ts → ld-Inagww4R.d.ts} +1 -1
- package/dist/{metrics-B-QxRSSR.mjs → metrics-CpxvUrBz.mjs} +1 -1
- package/dist/{middleware-P-AZEQMn.js → middleware-BHb5toqA.js} +247 -109
- package/dist/{middleware-BdlNa8BD.mjs → middleware-BKs2DLUF.mjs} +1 -1
- package/dist/{middleware-CuVa0UuS.mjs → middleware-CoBLrTKX.mjs} +89 -49
- package/dist/{mod-DvWOv2Ho.d.cts → mod-6TQ4UQZb.d.cts} +1 -1
- package/dist/{mod-BHQE-7WQ.d.ts → mod-B4kBw1-8.d.ts} +1 -1
- package/dist/{mod-DkhfZC1u.d.ts → mod-B7j30IQf.d.ts} +2 -9
- package/dist/{mod-B2783_3v.d.cts → mod-C1nT74IG.d.cts} +1 -1
- package/dist/{mod-DjZfJj9R.d.ts → mod-CIeBgsOC.d.ts} +1 -1
- package/dist/{mod-B5-wdzmJ.d.cts → mod-YvA4Rk8J.d.cts} +2 -9
- package/dist/mod.cjs +5 -5
- package/dist/mod.d.cts +7 -7
- package/dist/mod.d.ts +7 -7
- 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 +257 -1
- 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-ccKkQOAf.mjs → owner-DTnVpUKA.mjs} +3 -3
- package/dist/{portable-collection-CndnpXfo.mjs → portable-collection-CJeYTL61.mjs} +2 -2
- package/dist/{portable-collection-TC-kvkVI.cjs → portable-collection-DciwBIia.cjs} +1 -1
- package/dist/{portable-collection-DUlQ3s2M.js → portable-collection-TmtpzD4E.js} +1 -1
- package/dist/{portable-key-D5tFOoV-.mjs → portable-key-DcYok4ki.mjs} +1 -1
- package/dist/{proof-DPoF06nz.mjs → proof-GH7Poos_.mjs} +3 -3
- package/dist/{send-CF44O1Df.mjs → send-BgGJh6pv.mjs} +174 -76
- package/dist/sig/compound-proof-discovery.test.mjs +1 -1
- package/dist/sig/compound-proof-producer.test.mjs +1 -1
- package/dist/sig/compound-proof-verification.test.mjs +2 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +553 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +1 -1
- package/dist/sig/mitra-receive-interop.test.mjs +4 -4
- package/dist/sig/mitra-send-interop.test.mjs +3 -3
- 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/portable-collection.test.mjs +1 -1
- package/dist/sig/portable-interop.test.mjs +3 -3
- package/dist/sig/portable-key.test.mjs +5 -5
- package/dist/sig/proof.test.mjs +4 -4
- package/dist/sig/tootik-request-interop.test.mjs +4 -4
- package/dist/sig/tootik-send-interop.test.mjs +3 -3
- package/dist/sig/verification.test.mjs +3 -3
- package/dist/{temporal-XlZ4Wb94.mjs → temporal-gJINzcL4.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/testing/mod.d.mts +26 -0
- package/dist/{types-_S2_MeLF.js → types-DUjZb4i6.js} +112 -63
- package/dist/{types-poIao40f.cjs → types-hKCCjii0.cjs} +111 -62
- package/dist/utils/docloader.test.mjs +344 -36
- 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-CpsDyqVN.mjs +0 -91
package/dist/sig/http.test.mjs
CHANGED
|
@@ -12,12 +12,14 @@ import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
|
12
12
|
import "../std__assert-DvMDRPes.mjs";
|
|
13
13
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
14
14
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
15
|
-
import { x as exportJwk } from "../ld-
|
|
16
|
-
import { a as
|
|
15
|
+
import { x as exportJwk } from "../ld-CdvcOEXQ.mjs";
|
|
16
|
+
import { a as formatRfc9421SignatureParameters, c as parseRfc9421SignatureInput, d as timingSafeEqual, i as formatRfc9421Signature, l as selectRequestSignature, m as verifyRequestDetailed, n as doubleKnock, o as listRequestSignatures, p as verifyRequest, r as doubleKnockScoped, s as parseRfc9421Signature, t as createRfc9421SignatureBase, u as signRequest } from "../http-BoJCMnjY.mjs";
|
|
17
17
|
import { a as rsaPrivateKey3, i as rsaPrivateKey2, l as rsaPublicKey5, n as ed25519PrivateKey, o as rsaPublicKey1, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
18
18
|
import { t as KvKeyCache } from "../keycache-N2opu4-3.mjs";
|
|
19
|
+
import { configure, reset } from "@logtape/logtape";
|
|
19
20
|
import { FetchError, UrlError, exportSpki, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
20
21
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
22
|
+
import { openDirectFetch } from "@fedify/vocab-runtime/internal";
|
|
21
23
|
import { encodeBase64 } from "byte-encodings/base64";
|
|
22
24
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_string_includes.js
|
|
23
25
|
/**
|
|
@@ -1878,6 +1880,472 @@ test("doubleKnock() async specDeterminer test", async () => {
|
|
|
1878
1880
|
assertEquals(specUsed, "draft-cavage-http-signatures-12", "Should use spec from async determiner");
|
|
1879
1881
|
esm_default.hardReset();
|
|
1880
1882
|
});
|
|
1883
|
+
const lifecycleIdentity = {
|
|
1884
|
+
keyId: rsaPublicKey2.id,
|
|
1885
|
+
privateKey: rsaPrivateKey2
|
|
1886
|
+
};
|
|
1887
|
+
test("doubleKnockScoped() keeps challenge retries and fallback in the validated hop", async () => {
|
|
1888
|
+
const url = "https://example.com/lifecycle/challenge-fallback";
|
|
1889
|
+
const hops = recordHops((_, index) => index === 1 ? {
|
|
1890
|
+
status: 401,
|
|
1891
|
+
headers: { "Accept-Signature": "challenge=(\"@method\");nonce=\"challenge-nonce\"" },
|
|
1892
|
+
body: "Challenge"
|
|
1893
|
+
} : index === 2 ? {
|
|
1894
|
+
status: 401,
|
|
1895
|
+
body: "Unauthorized"
|
|
1896
|
+
} : {
|
|
1897
|
+
status: 202,
|
|
1898
|
+
body: "Accepted"
|
|
1899
|
+
});
|
|
1900
|
+
assertEquals(await doubleKnockScoped(new Request(url, {
|
|
1901
|
+
method: "POST",
|
|
1902
|
+
body: "activity"
|
|
1903
|
+
}), lifecycleIdentity, {}, hops.openHop, (response) => response.text()), "Accepted");
|
|
1904
|
+
assertEquals(hops.events, [
|
|
1905
|
+
`open ${url}`,
|
|
1906
|
+
`fetch #1 ${url}`,
|
|
1907
|
+
"cancel #1",
|
|
1908
|
+
`fetch #2 ${url}`,
|
|
1909
|
+
"cancel #2",
|
|
1910
|
+
`fetch #3 ${url}`,
|
|
1911
|
+
"consumed #3",
|
|
1912
|
+
`close ${url}`
|
|
1913
|
+
]);
|
|
1914
|
+
assertStringIncludes(hops.requests[1].headers.get("Signature-Input"), "nonce=\"challenge-nonce\"");
|
|
1915
|
+
assertFalse(hops.requests[2].headers.has("Signature-Input"));
|
|
1916
|
+
hops.assertInvariants();
|
|
1917
|
+
});
|
|
1918
|
+
test("doubleKnockScoped() reopens the session after challenge redirects", async () => {
|
|
1919
|
+
const url = "https://example.com/lifecycle/challenge-redirect";
|
|
1920
|
+
const next = "https://other.example/lifecycle/final";
|
|
1921
|
+
const validated = [];
|
|
1922
|
+
const hops = recordHops((_, index) => index === 1 ? {
|
|
1923
|
+
status: 401,
|
|
1924
|
+
headers: { "Accept-Signature": "challenge=(\"@method\");created" },
|
|
1925
|
+
body: "Challenge"
|
|
1926
|
+
} : index === 2 ? {
|
|
1927
|
+
status: 307,
|
|
1928
|
+
headers: { Location: next },
|
|
1929
|
+
body: "Redirect"
|
|
1930
|
+
} : {
|
|
1931
|
+
status: 200,
|
|
1932
|
+
body: "Done"
|
|
1933
|
+
});
|
|
1934
|
+
assertEquals(await doubleKnockScoped(new Request(url, {
|
|
1935
|
+
method: "POST",
|
|
1936
|
+
body: "activity"
|
|
1937
|
+
}), lifecycleIdentity, { validateRedirect: (target) => {
|
|
1938
|
+
validated.push(target);
|
|
1939
|
+
} }, hops.openHop, (response) => response.text()), "Done");
|
|
1940
|
+
assertEquals(validated, [next]);
|
|
1941
|
+
assertEquals(hops.events, [
|
|
1942
|
+
`open ${url}`,
|
|
1943
|
+
`fetch #1 ${url}`,
|
|
1944
|
+
"cancel #1",
|
|
1945
|
+
`fetch #2 ${url}`,
|
|
1946
|
+
"cancel #2",
|
|
1947
|
+
`close ${url}`,
|
|
1948
|
+
`open ${next}`,
|
|
1949
|
+
`fetch #3 ${next}`,
|
|
1950
|
+
"consumed #3",
|
|
1951
|
+
`close ${next}`
|
|
1952
|
+
]);
|
|
1953
|
+
assertEquals(await hops.requests[2].text(), "activity");
|
|
1954
|
+
hops.assertInvariants();
|
|
1955
|
+
});
|
|
1956
|
+
test("doubleKnockScoped() preserves maxRedirection across challenge redirects", async (t) => {
|
|
1957
|
+
for (const maxRedirection of [0, 1]) await t.step(`limit ${maxRedirection}`, async () => {
|
|
1958
|
+
const url = "https://example.com/lifecycle/challenge-limit";
|
|
1959
|
+
const hops = recordHops((request, index) => index % 2 === 1 ? {
|
|
1960
|
+
status: 401,
|
|
1961
|
+
headers: { "Accept-Signature": "challenge=(\"@method\");created" },
|
|
1962
|
+
body: "Challenge"
|
|
1963
|
+
} : {
|
|
1964
|
+
status: 307,
|
|
1965
|
+
headers: { Location: `${request.url}/next` },
|
|
1966
|
+
body: "Redirect"
|
|
1967
|
+
});
|
|
1968
|
+
await assertRejects(() => doubleKnockScoped(new Request(url, {
|
|
1969
|
+
method: "POST",
|
|
1970
|
+
body: "activity"
|
|
1971
|
+
}), lifecycleIdentity, { maxRedirection }, hops.openHop, (response) => response.text()), FetchError, `Too many redirections (${maxRedirection + 1})`);
|
|
1972
|
+
assertEquals(hops.requests.length, 2 * (maxRedirection + 1));
|
|
1973
|
+
assertEquals(hops.events.filter((event) => event.startsWith("open ")).length, maxRedirection + 1);
|
|
1974
|
+
assertEquals(hops.events.filter((event) => event.startsWith("cancel #")).length, hops.requests.length);
|
|
1975
|
+
hops.assertInvariants();
|
|
1976
|
+
});
|
|
1977
|
+
});
|
|
1978
|
+
test("doubleKnockScoped() detects loops after challenge redirects", async () => {
|
|
1979
|
+
const url = "https://example.com/lifecycle/challenge-loop";
|
|
1980
|
+
const hops = recordHops((_, index) => index === 1 ? {
|
|
1981
|
+
status: 401,
|
|
1982
|
+
headers: { "Accept-Signature": "challenge=(\"@method\");created" },
|
|
1983
|
+
body: "Challenge"
|
|
1984
|
+
} : {
|
|
1985
|
+
status: 307,
|
|
1986
|
+
headers: { Location: url },
|
|
1987
|
+
body: "Redirect"
|
|
1988
|
+
});
|
|
1989
|
+
await assertRejects(() => doubleKnockScoped(new Request(url, {
|
|
1990
|
+
method: "POST",
|
|
1991
|
+
body: "activity"
|
|
1992
|
+
}), lifecycleIdentity, {}, hops.openHop, (response) => response.text()), FetchError, "Redirect loop detected");
|
|
1993
|
+
assertEquals(hops.requests.length, 2);
|
|
1994
|
+
assertEquals(hops.events, [
|
|
1995
|
+
`open ${url}`,
|
|
1996
|
+
`fetch #1 ${url}`,
|
|
1997
|
+
"cancel #1",
|
|
1998
|
+
`fetch #2 ${url}`,
|
|
1999
|
+
"cancel #2",
|
|
2000
|
+
`close ${url}`
|
|
2001
|
+
]);
|
|
2002
|
+
hops.assertInvariants();
|
|
2003
|
+
});
|
|
2004
|
+
test("doubleKnockScoped() closes the session when aborted while determining the spec", async () => {
|
|
2005
|
+
const url = "https://example.com/lifecycle/aborted-spec";
|
|
2006
|
+
const hops = recordHops(() => ({
|
|
2007
|
+
status: 202,
|
|
2008
|
+
body: "Accepted"
|
|
2009
|
+
}));
|
|
2010
|
+
const controller = new AbortController();
|
|
2011
|
+
const reason = /* @__PURE__ */ new Error("spec determination aborted");
|
|
2012
|
+
assertEquals(await assertRejects(() => doubleKnockScoped(new Request(url, {
|
|
2013
|
+
method: "POST",
|
|
2014
|
+
body: "activity"
|
|
2015
|
+
}), lifecycleIdentity, {
|
|
2016
|
+
signal: controller.signal,
|
|
2017
|
+
specDeterminer: {
|
|
2018
|
+
determineSpec() {
|
|
2019
|
+
controller.abort(reason);
|
|
2020
|
+
return Promise.resolve("rfc9421");
|
|
2021
|
+
},
|
|
2022
|
+
rememberSpec: () => Promise.resolve()
|
|
2023
|
+
}
|
|
2024
|
+
}, hops.openHop, (response) => response.text()), Error, "spec determination aborted"), reason);
|
|
2025
|
+
assertEquals(hops.events, [`open ${url}`, `close ${url}`]);
|
|
2026
|
+
assertEquals(hops.requests, []);
|
|
2027
|
+
hops.assertInvariants();
|
|
2028
|
+
});
|
|
2029
|
+
test("doubleKnockScoped() retries another spec on the same hop", async () => {
|
|
2030
|
+
const url = "https://example.com/lifecycle/retry";
|
|
2031
|
+
const hops = recordHops((_, index) => index === 1 ? {
|
|
2032
|
+
status: 401,
|
|
2033
|
+
body: "Unauthorized"
|
|
2034
|
+
} : {
|
|
2035
|
+
status: 202,
|
|
2036
|
+
body: "Accepted"
|
|
2037
|
+
});
|
|
2038
|
+
assertEquals(await doubleKnockScoped(new Request(url, {
|
|
2039
|
+
method: "POST",
|
|
2040
|
+
body: "activity"
|
|
2041
|
+
}), lifecycleIdentity, {}, hops.openHop, (response) => response.text()), "Accepted");
|
|
2042
|
+
assertEquals(hops.events, [
|
|
2043
|
+
`open ${url}`,
|
|
2044
|
+
`fetch #1 ${url}`,
|
|
2045
|
+
"cancel #1",
|
|
2046
|
+
`fetch #2 ${url}`,
|
|
2047
|
+
"consumed #2",
|
|
2048
|
+
`close ${url}`
|
|
2049
|
+
]);
|
|
2050
|
+
assertEquals(hops.requests.map((r) => r.headers.has("Signature-Input")), [true, false]);
|
|
2051
|
+
hops.assertInvariants();
|
|
2052
|
+
});
|
|
2053
|
+
test("doubleKnockScoped() closes the retried hop before a redirect", async () => {
|
|
2054
|
+
const url = "https://example.com/lifecycle/retry-redirect";
|
|
2055
|
+
const next = "https://example.com/lifecycle/final";
|
|
2056
|
+
const hops = recordHops((_, index) => index === 1 ? {
|
|
2057
|
+
status: 401,
|
|
2058
|
+
body: "Unauthorized"
|
|
2059
|
+
} : index === 2 ? {
|
|
2060
|
+
status: 302,
|
|
2061
|
+
headers: { Location: next },
|
|
2062
|
+
body: "Found"
|
|
2063
|
+
} : {
|
|
2064
|
+
status: 200,
|
|
2065
|
+
body: "Done"
|
|
2066
|
+
});
|
|
2067
|
+
assertEquals(await doubleKnockScoped(new Request(url, {
|
|
2068
|
+
method: "POST",
|
|
2069
|
+
body: "activity"
|
|
2070
|
+
}), lifecycleIdentity, {}, hops.openHop, (response) => response.text()), "Done");
|
|
2071
|
+
assertEquals(hops.events, [
|
|
2072
|
+
`open ${url}`,
|
|
2073
|
+
`fetch #1 ${url}`,
|
|
2074
|
+
"cancel #1",
|
|
2075
|
+
`fetch #2 ${url}`,
|
|
2076
|
+
"cancel #2",
|
|
2077
|
+
`close ${url}`,
|
|
2078
|
+
`open ${next}`,
|
|
2079
|
+
`fetch #3 ${next}`,
|
|
2080
|
+
"consumed #3",
|
|
2081
|
+
`close ${next}`
|
|
2082
|
+
]);
|
|
2083
|
+
assertEquals(await hops.requests[2].text(), "activity");
|
|
2084
|
+
hops.assertInvariants();
|
|
2085
|
+
});
|
|
2086
|
+
test("doubleKnockScoped() retries transport errors on the same hop", async (t) => {
|
|
2087
|
+
await t.step("GET", async () => {
|
|
2088
|
+
const url = "https://example.com/lifecycle/flaky";
|
|
2089
|
+
const hops = recordHops((_, index) => {
|
|
2090
|
+
if (index === 1) throw new TypeError("connection reset");
|
|
2091
|
+
return { body: "Success" };
|
|
2092
|
+
});
|
|
2093
|
+
assertEquals(await doubleKnockScoped(new Request(url), lifecycleIdentity, {}, hops.openHop, (response) => response.text()), "Success");
|
|
2094
|
+
assertEquals(hops.events, [
|
|
2095
|
+
`open ${url}`,
|
|
2096
|
+
`fetch #1 ${url}`,
|
|
2097
|
+
`fetch #2 ${url}`,
|
|
2098
|
+
"consumed #2",
|
|
2099
|
+
`close ${url}`
|
|
2100
|
+
]);
|
|
2101
|
+
hops.assertInvariants();
|
|
2102
|
+
});
|
|
2103
|
+
await t.step("POST", async () => {
|
|
2104
|
+
const url = "https://example.com/lifecycle/flaky-inbox";
|
|
2105
|
+
const hops = recordHops(() => {
|
|
2106
|
+
throw new TypeError("connection reset");
|
|
2107
|
+
});
|
|
2108
|
+
await assertRejects(() => doubleKnockScoped(new Request(url, {
|
|
2109
|
+
method: "POST",
|
|
2110
|
+
body: "activity"
|
|
2111
|
+
}), lifecycleIdentity, {}, hops.openHop, (response) => response.text()), FetchError);
|
|
2112
|
+
assertEquals(hops.events, [
|
|
2113
|
+
`open ${url}`,
|
|
2114
|
+
`fetch #1 ${url}`,
|
|
2115
|
+
`close ${url}`
|
|
2116
|
+
]);
|
|
2117
|
+
hops.assertInvariants();
|
|
2118
|
+
});
|
|
2119
|
+
});
|
|
2120
|
+
async function captureLogs(fn) {
|
|
2121
|
+
const records = [];
|
|
2122
|
+
await configure({
|
|
2123
|
+
sinks: { buffer: (record) => records.push(record) },
|
|
2124
|
+
loggers: [{
|
|
2125
|
+
category: "fedify",
|
|
2126
|
+
sinks: ["buffer"],
|
|
2127
|
+
lowestLevel: "debug"
|
|
2128
|
+
}, {
|
|
2129
|
+
category: ["logtape", "meta"],
|
|
2130
|
+
sinks: []
|
|
2131
|
+
}],
|
|
2132
|
+
reset: true
|
|
2133
|
+
});
|
|
2134
|
+
try {
|
|
2135
|
+
await fn();
|
|
2136
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
2137
|
+
} finally {
|
|
2138
|
+
await reset();
|
|
2139
|
+
}
|
|
2140
|
+
return records;
|
|
2141
|
+
}
|
|
2142
|
+
test("doubleKnockScoped() logs a redirect body failing to cancel and follows the redirect", async () => {
|
|
2143
|
+
const url = "https://example.com/lifecycle/cancel-failure";
|
|
2144
|
+
const next = "https://example.com/lifecycle/cancel-failure-final";
|
|
2145
|
+
const hops = recordHops((_, index) => index === 1 ? {
|
|
2146
|
+
status: 302,
|
|
2147
|
+
headers: { Location: next },
|
|
2148
|
+
body: "Found",
|
|
2149
|
+
failCancel: true
|
|
2150
|
+
} : {
|
|
2151
|
+
status: 200,
|
|
2152
|
+
body: "Done"
|
|
2153
|
+
});
|
|
2154
|
+
let result;
|
|
2155
|
+
const records = await captureLogs(async () => {
|
|
2156
|
+
result = await doubleKnockScoped(new Request(url), lifecycleIdentity, {}, hops.openHop, (response) => response.text());
|
|
2157
|
+
});
|
|
2158
|
+
assertEquals(result, "Done");
|
|
2159
|
+
assertEquals(hops.events, [
|
|
2160
|
+
`open ${url}`,
|
|
2161
|
+
`fetch #1 ${url}`,
|
|
2162
|
+
"cancel #1",
|
|
2163
|
+
`close ${url}`,
|
|
2164
|
+
`open ${next}`,
|
|
2165
|
+
`fetch #2 ${next}`,
|
|
2166
|
+
"consumed #2",
|
|
2167
|
+
`close ${next}`
|
|
2168
|
+
]);
|
|
2169
|
+
const failures = records.filter((r) => r.rawMessage === "Failed to cancel the response body from {url}: {error}");
|
|
2170
|
+
assertEquals(failures.map((r) => [r.level, r.properties.url]), [["debug", url]]);
|
|
2171
|
+
assertEquals(failures[0].properties.error.message, "cancel #1 failed");
|
|
2172
|
+
hops.assertInvariants();
|
|
2173
|
+
});
|
|
2174
|
+
test("doubleKnockScoped() is not blocked by a body cancellation that never settles", async () => {
|
|
2175
|
+
const url = "https://example.com/lifecycle/hanging-cancel";
|
|
2176
|
+
const next = "https://example.com/lifecycle/hanging-cancel-final";
|
|
2177
|
+
const hops = recordHops((_, index) => index === 1 ? {
|
|
2178
|
+
status: 401,
|
|
2179
|
+
body: "Unauthorized",
|
|
2180
|
+
hangCancel: true
|
|
2181
|
+
} : index === 2 ? {
|
|
2182
|
+
status: 302,
|
|
2183
|
+
headers: { Location: next },
|
|
2184
|
+
body: "Found",
|
|
2185
|
+
hangCancel: true
|
|
2186
|
+
} : {
|
|
2187
|
+
status: 200,
|
|
2188
|
+
body: "Done",
|
|
2189
|
+
hangCancel: true
|
|
2190
|
+
});
|
|
2191
|
+
assertEquals(await doubleKnockScoped(new Request(url, {
|
|
2192
|
+
method: "POST",
|
|
2193
|
+
body: "activity"
|
|
2194
|
+
}), lifecycleIdentity, {}, hops.openHop, (response) => Promise.resolve(response.status)), 200);
|
|
2195
|
+
assertEquals(hops.events, [
|
|
2196
|
+
`open ${url}`,
|
|
2197
|
+
`fetch #1 ${url}`,
|
|
2198
|
+
"cancel #1",
|
|
2199
|
+
`fetch #2 ${url}`,
|
|
2200
|
+
"cancel #2",
|
|
2201
|
+
`close ${url}`,
|
|
2202
|
+
`open ${next}`,
|
|
2203
|
+
`fetch #3 ${next}`,
|
|
2204
|
+
"cancel #3 by close",
|
|
2205
|
+
`close ${next}`
|
|
2206
|
+
]);
|
|
2207
|
+
hops.assertInvariants();
|
|
2208
|
+
});
|
|
2209
|
+
test("doubleKnockScoped() completes with responses cloned by fetch-mock", async () => {
|
|
2210
|
+
esm_default.spyGlobal();
|
|
2211
|
+
try {
|
|
2212
|
+
let attempts = 0;
|
|
2213
|
+
esm_default.post("https://example.com/tee/redirect", () => {
|
|
2214
|
+
attempts++;
|
|
2215
|
+
return attempts === 1 ? new Response("Unauthorized", { status: 401 }) : new Response("Found", {
|
|
2216
|
+
status: 302,
|
|
2217
|
+
headers: { Location: "https://example.com/tee/final" }
|
|
2218
|
+
});
|
|
2219
|
+
});
|
|
2220
|
+
esm_default.post("https://example.com/tee/final", () => new Response("Accepted", { status: 202 }));
|
|
2221
|
+
const request = () => new Request("https://example.com/tee/redirect", {
|
|
2222
|
+
method: "POST",
|
|
2223
|
+
body: "activity"
|
|
2224
|
+
});
|
|
2225
|
+
assertEquals(await doubleKnockScoped(request(), lifecycleIdentity, {}, openDirectFetch, (response) => Promise.resolve(response.status)), 202);
|
|
2226
|
+
assertEquals(attempts, 2);
|
|
2227
|
+
attempts = 0;
|
|
2228
|
+
const response = await doubleKnock(request(), lifecycleIdentity);
|
|
2229
|
+
assertEquals(response.status, 202);
|
|
2230
|
+
assertEquals(await response.text(), "Accepted");
|
|
2231
|
+
assertEquals(attempts, 2);
|
|
2232
|
+
} finally {
|
|
2233
|
+
esm_default.hardReset();
|
|
2234
|
+
}
|
|
2235
|
+
});
|
|
2236
|
+
test("doubleKnockScoped() closes the session when consuming fails", async (t) => {
|
|
2237
|
+
const url = "https://example.com/lifecycle/consume";
|
|
2238
|
+
await t.step("exception", async () => {
|
|
2239
|
+
const hops = recordHops(() => ({ body: "x".repeat(1024) }));
|
|
2240
|
+
const error = /* @__PURE__ */ new Error("consume failed");
|
|
2241
|
+
await assertRejects(() => doubleKnockScoped(new Request(url), lifecycleIdentity, {}, hops.openHop, async (response) => {
|
|
2242
|
+
const reader = response.body.getReader();
|
|
2243
|
+
await reader.read();
|
|
2244
|
+
reader.releaseLock();
|
|
2245
|
+
throw error;
|
|
2246
|
+
}), Error, "consume failed");
|
|
2247
|
+
assertEquals(hops.events, [
|
|
2248
|
+
`open ${url}`,
|
|
2249
|
+
`fetch #1 ${url}`,
|
|
2250
|
+
"cancel #1 by close",
|
|
2251
|
+
`close ${url}`
|
|
2252
|
+
]);
|
|
2253
|
+
hops.assertInvariants();
|
|
2254
|
+
});
|
|
2255
|
+
await t.step("abort", async () => {
|
|
2256
|
+
const hops = recordHops(() => ({ body: "Success" }));
|
|
2257
|
+
const controller = new AbortController();
|
|
2258
|
+
const reason = /* @__PURE__ */ new Error("aborted while consuming");
|
|
2259
|
+
assert(await assertRejects(() => doubleKnockScoped(new Request(url), lifecycleIdentity, { signal: controller.signal }, hops.openHop, () => {
|
|
2260
|
+
controller.abort(reason);
|
|
2261
|
+
controller.signal.throwIfAborted();
|
|
2262
|
+
return Promise.resolve();
|
|
2263
|
+
})) === reason);
|
|
2264
|
+
assertEquals(hops.events, [
|
|
2265
|
+
`open ${url}`,
|
|
2266
|
+
`fetch #1 ${url}`,
|
|
2267
|
+
"cancel #1 by close",
|
|
2268
|
+
`close ${url}`
|
|
2269
|
+
]);
|
|
2270
|
+
hops.assertInvariants();
|
|
2271
|
+
});
|
|
2272
|
+
});
|
|
2273
|
+
test("doubleKnock() returns the final response without cancelling its body", async () => {
|
|
2274
|
+
const url = "https://example.com/lifecycle/public";
|
|
2275
|
+
const next = "https://example.com/lifecycle/public-final";
|
|
2276
|
+
const events = [];
|
|
2277
|
+
const responses = [];
|
|
2278
|
+
const originalFetch = globalThis.fetch;
|
|
2279
|
+
globalThis.fetch = ((input) => {
|
|
2280
|
+
const requestUrl = input instanceof Request ? input.url : String(input);
|
|
2281
|
+
const index = responses.length + 1;
|
|
2282
|
+
events.push(`fetch #${index} ${requestUrl}`);
|
|
2283
|
+
const recorded = createRecordedResponse(events, index, requestUrl === url ? {
|
|
2284
|
+
status: 302,
|
|
2285
|
+
headers: { Location: next },
|
|
2286
|
+
body: "Found"
|
|
2287
|
+
} : {
|
|
2288
|
+
status: 200,
|
|
2289
|
+
body: "Done"
|
|
2290
|
+
});
|
|
2291
|
+
responses.push(recorded);
|
|
2292
|
+
return Promise.resolve(recorded.response);
|
|
2293
|
+
});
|
|
2294
|
+
try {
|
|
2295
|
+
const response = await doubleKnock(new Request(url), lifecycleIdentity);
|
|
2296
|
+
assertEquals(events, [
|
|
2297
|
+
`fetch #1 ${url}`,
|
|
2298
|
+
"cancel #1",
|
|
2299
|
+
`fetch #2 ${next}`
|
|
2300
|
+
]);
|
|
2301
|
+
assertFalse(responses[1].settled());
|
|
2302
|
+
assertEquals(await response.text(), "Done");
|
|
2303
|
+
assertEquals(events.at(-1), "consumed #2");
|
|
2304
|
+
} finally {
|
|
2305
|
+
globalThis.fetch = originalFetch;
|
|
2306
|
+
}
|
|
2307
|
+
});
|
|
2308
|
+
test("doubleKnock() is not blocked by a body cancellation that never settles", async () => {
|
|
2309
|
+
const url = "https://example.com/lifecycle/public-hanging";
|
|
2310
|
+
const next = "https://example.com/lifecycle/public-hanging-final";
|
|
2311
|
+
const events = [];
|
|
2312
|
+
const originalFetch = globalThis.fetch;
|
|
2313
|
+
let index = 0;
|
|
2314
|
+
globalThis.fetch = ((input) => {
|
|
2315
|
+
const requestUrl = input instanceof Request ? input.url : String(input);
|
|
2316
|
+
index++;
|
|
2317
|
+
events.push(`fetch #${index} ${requestUrl}`);
|
|
2318
|
+
return Promise.resolve(createRecordedResponse(events, index, index === 1 ? {
|
|
2319
|
+
status: 401,
|
|
2320
|
+
body: "Unauthorized",
|
|
2321
|
+
hangCancel: true
|
|
2322
|
+
} : index === 2 ? {
|
|
2323
|
+
status: 302,
|
|
2324
|
+
headers: { Location: next },
|
|
2325
|
+
body: "Found",
|
|
2326
|
+
hangCancel: true
|
|
2327
|
+
} : {
|
|
2328
|
+
status: 200,
|
|
2329
|
+
body: "Done"
|
|
2330
|
+
}).response);
|
|
2331
|
+
});
|
|
2332
|
+
try {
|
|
2333
|
+
const response = await doubleKnock(new Request(url, {
|
|
2334
|
+
method: "POST",
|
|
2335
|
+
body: "activity"
|
|
2336
|
+
}), lifecycleIdentity);
|
|
2337
|
+
assertEquals(events, [
|
|
2338
|
+
`fetch #1 ${url}`,
|
|
2339
|
+
"cancel #1",
|
|
2340
|
+
`fetch #2 ${url}`,
|
|
2341
|
+
"cancel #2",
|
|
2342
|
+
`fetch #3 ${next}`
|
|
2343
|
+
]);
|
|
2344
|
+
assertEquals(await response.text(), "Done");
|
|
2345
|
+
} finally {
|
|
2346
|
+
globalThis.fetch = originalFetch;
|
|
2347
|
+
}
|
|
2348
|
+
});
|
|
1881
2349
|
test("timingSafeEqual()", async (t) => {
|
|
1882
2350
|
await t.step("should return true for equal empty arrays", () => {
|
|
1883
2351
|
assert(timingSafeEqual(new Uint8Array([]), new Uint8Array([])));
|
|
@@ -2737,5 +3205,88 @@ test("verifyRequestDetailed() reports a timed-out key fetch", async (t) => {
|
|
|
2737
3205
|
}
|
|
2738
3206
|
});
|
|
2739
3207
|
});
|
|
3208
|
+
function createRecordedResponse(events, index, init, cancelSuffix = () => "") {
|
|
3209
|
+
const bytes = new TextEncoder().encode(init.body ?? "");
|
|
3210
|
+
const chunkSize = init.chunkSize ?? 256;
|
|
3211
|
+
let offset = 0;
|
|
3212
|
+
let settled = false;
|
|
3213
|
+
const body = new ReadableStream({
|
|
3214
|
+
pull(controller) {
|
|
3215
|
+
if (offset >= bytes.length) {
|
|
3216
|
+
settled = true;
|
|
3217
|
+
events.push(`consumed #${index}`);
|
|
3218
|
+
controller.close();
|
|
3219
|
+
return;
|
|
3220
|
+
}
|
|
3221
|
+
controller.enqueue(bytes.slice(offset, offset + chunkSize));
|
|
3222
|
+
offset += chunkSize;
|
|
3223
|
+
},
|
|
3224
|
+
cancel() {
|
|
3225
|
+
settled = true;
|
|
3226
|
+
events.push(`cancel #${index}${cancelSuffix()}`);
|
|
3227
|
+
if (init.failCancel) throw new Error(`cancel #${index} failed`);
|
|
3228
|
+
if (init.hangCancel) return new Promise(() => {});
|
|
3229
|
+
}
|
|
3230
|
+
}, { highWaterMark: 0 });
|
|
3231
|
+
return {
|
|
3232
|
+
response: new Response(body, {
|
|
3233
|
+
status: init.status ?? 200,
|
|
3234
|
+
headers: init.headers
|
|
3235
|
+
}),
|
|
3236
|
+
settled: () => settled
|
|
3237
|
+
};
|
|
3238
|
+
}
|
|
3239
|
+
function recordHops(respond) {
|
|
3240
|
+
const events = [];
|
|
3241
|
+
const requests = [];
|
|
3242
|
+
const unsettledAtClose = [];
|
|
3243
|
+
let opens = 0;
|
|
3244
|
+
let closes = 0;
|
|
3245
|
+
let fetches = 0;
|
|
3246
|
+
return {
|
|
3247
|
+
events,
|
|
3248
|
+
requests,
|
|
3249
|
+
openHop(url) {
|
|
3250
|
+
opens++;
|
|
3251
|
+
events.push(`open ${url}`);
|
|
3252
|
+
const tracked = [];
|
|
3253
|
+
let closed = false;
|
|
3254
|
+
let closing = false;
|
|
3255
|
+
return Promise.resolve({
|
|
3256
|
+
url: new URL(url),
|
|
3257
|
+
async fetch(input, init) {
|
|
3258
|
+
if (closed) throw new TypeError("The session is closed.");
|
|
3259
|
+
const request = new Request(input instanceof Request ? input.clone() : input, init);
|
|
3260
|
+
const index = ++fetches;
|
|
3261
|
+
requests.push(request);
|
|
3262
|
+
events.push(`fetch #${index} ${request.url}`);
|
|
3263
|
+
const recorded = createRecordedResponse(events, index, await respond(request, index), () => closing ? " by close" : "");
|
|
3264
|
+
tracked.push({
|
|
3265
|
+
...recorded,
|
|
3266
|
+
index
|
|
3267
|
+
});
|
|
3268
|
+
return recorded.response;
|
|
3269
|
+
},
|
|
3270
|
+
close() {
|
|
3271
|
+
if (closed) return Promise.resolve();
|
|
3272
|
+
closed = true;
|
|
3273
|
+
closes++;
|
|
3274
|
+
closing = true;
|
|
3275
|
+
for (const { response, settled, index } of tracked) {
|
|
3276
|
+
if (settled()) continue;
|
|
3277
|
+
if (response.body?.locked) unsettledAtClose.push(index);
|
|
3278
|
+
else response.body?.cancel().catch(() => {});
|
|
3279
|
+
}
|
|
3280
|
+
events.push(`close ${url}`);
|
|
3281
|
+
return Promise.resolve();
|
|
3282
|
+
}
|
|
3283
|
+
});
|
|
3284
|
+
},
|
|
3285
|
+
assertInvariants() {
|
|
3286
|
+
assertEquals(opens, closes);
|
|
3287
|
+
assertEquals(unsettledAtClose, []);
|
|
3288
|
+
}
|
|
3289
|
+
};
|
|
3290
|
+
}
|
|
2740
3291
|
//#endregion
|
|
2741
3292
|
export {};
|
package/dist/sig/key.test.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import "../std__assert-DvMDRPes.mjs";
|
|
|
8
8
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
9
9
|
import { t as assertStrictEquals } from "../assert_strict_equals-CYvBmkpC.mjs";
|
|
10
10
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
11
|
-
import { C as fetchKey, D as validateCryptoKey, E as importJwk, T as generateCryptoKeyPair, w as fetchKeyDetailed, x as exportJwk, y as wrapContextLoaderForJsonLd } from "../ld-
|
|
11
|
+
import { C as fetchKey, D as validateCryptoKey, E as importJwk, T as generateCryptoKeyPair, w as fetchKeyDetailed, x as exportJwk, y as wrapContextLoaderForJsonLd } from "../ld-CdvcOEXQ.mjs";
|
|
12
12
|
import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
13
13
|
import { CryptographicKey, Multikey, Person } from "@fedify/vocab";
|
|
14
14
|
import { FetchError, UrlError, exportDidKey, getDocumentLoader } from "@fedify/vocab-runtime";
|
package/dist/sig/ld.test.mjs
CHANGED
|
@@ -8,7 +8,7 @@ import { t as assertInstanceOf } from "../assert_instance_of-mrXWWNY-.mjs";
|
|
|
8
8
|
import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
9
9
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
10
10
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
11
|
-
import { T as generateCryptoKeyPair, _ as verifyJsonLd, a as compactJsonLd, f as isInvalidUrlTypeError, i as attachSignature, m as signJsonLd, n as UnsafeJsonLdError, o as createSignature, s as detachSignature, u as hasSignatureLike, v as verifySignature } from "../ld-
|
|
11
|
+
import { T as generateCryptoKeyPair, _ as verifyJsonLd, a as compactJsonLd, f as isInvalidUrlTypeError, i as attachSignature, m as signJsonLd, n as UnsafeJsonLdError, o as createSignature, s as detachSignature, u as hasSignatureLike, v as verifySignature } from "../ld-CdvcOEXQ.mjs";
|
|
12
12
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
13
13
|
import { CryptographicKey } from "@fedify/vocab";
|
|
14
14
|
import { createTestMeterProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -5,10 +5,10 @@ import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
6
6
|
import "../std__assert-DvMDRPes.mjs";
|
|
7
7
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
8
|
-
import { d as verifyPortableObjectProof } from "../proof-
|
|
9
|
-
import {
|
|
10
|
-
import { o as createFederation } from "../middleware-
|
|
11
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
8
|
+
import { d as verifyPortableObjectProof } from "../proof-GH7Poos_.mjs";
|
|
9
|
+
import { m as verifyRequestDetailed } from "../http-BoJCMnjY.mjs";
|
|
10
|
+
import { o as createFederation } from "../middleware-CoBLrTKX.mjs";
|
|
11
|
+
import { t as doesActorOwnKey } from "../owner-DTnVpUKA.mjs";
|
|
12
12
|
import { Create, Person } from "@fedify/vocab";
|
|
13
13
|
import { canonicalizePortableUri, decodeMultibase, importDidKey } from "@fedify/vocab-runtime";
|
|
14
14
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
@@ -4,9 +4,9 @@ globalThis.addEventListener = () => {};
|
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
5
5
|
import "../std__assert-DvMDRPes.mjs";
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
|
-
import { d as verifyPortableObjectProof } from "../proof-
|
|
8
|
-
import {
|
|
9
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
7
|
+
import { d as verifyPortableObjectProof } from "../proof-GH7Poos_.mjs";
|
|
8
|
+
import { m as verifyRequestDetailed } from "../http-BoJCMnjY.mjs";
|
|
9
|
+
import { t as doesActorOwnKey } from "../owner-DTnVpUKA.mjs";
|
|
10
10
|
import { Create } from "@fedify/vocab";
|
|
11
11
|
import { canonicalizePortableUri, decodeMultibase, fromCompatibleEf61Id, importDidKey } from "@fedify/vocab-runtime";
|
|
12
12
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
package/dist/sig/mod.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const require_http = require("../http-
|
|
4
|
-
const require_portable_collection = require("../portable-collection-
|
|
3
|
+
const require_http = require("../http-kv1LZw-r.cjs");
|
|
4
|
+
const require_portable_collection = require("../portable-collection-DciwBIia.cjs");
|
|
5
5
|
exports.attachSignature = require_http.attachSignature;
|
|
6
6
|
exports.createProof = require_http.createProof;
|
|
7
7
|
exports.createSignature = require_http.createSignature;
|
package/dist/sig/mod.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { A as AcceptSignatureParameters, B as VerifyPortableObjectProofOptions, C as VerifyRequestDetailedResult, D as verifyRequest, E as signRequest, F as validateAcceptSignature, G as signObject, H as VerifyProofOptions, I as CreateProofOptions, J as verifyProof, K as verifyObject, L as SignObjectOptions, M as formatAcceptSignature, N as fulfillAcceptSignature, O as verifyRequestDetailed, P as parseAcceptSignature, R as VerifyObjectOptions, S as SignRequestOptions, T as VerifyRequestOptions, U as createProof, V as VerifyPortableObjectProofResult, W as hasProofLike, a as KeyCache, b as HttpMessageSignaturesSpecDeterminer, c as fetchKeyDetailed, i as FetchKeyResult, j as FulfillAcceptSignatureResult, k as AcceptSignatureMember, l as generateCryptoKeyPair, n as FetchKeyErrorResult, o as exportJwk, q as verifyPortableObjectProof, r as FetchKeyOptions, s as fetchKey, t as FetchKeyDetailedResult, u as importJwk, w as VerifyRequestFailureReason, x as Rfc9421SignRequestOptions, y as HttpMessageSignaturesSpec, z as VerifyPortableObjectProofFailureReason } from "../key-
|
|
3
|
-
import { a as VerifySignatureOptions, c as detachSignature, d as verifyJsonLd, f as verifySignature, g as getKeyOwner, h as doesActorOwnKey, i as VerifyJsonLdOptions, l as hasSignatureLike, m as GetKeyOwnerOptions, o as attachSignature, p as DoesActorOwnKeyOptions, r as SignJsonLdOptions, s as createSignature, t as CreateSignatureOptions, u as signJsonLd } from "../ld-
|
|
4
|
-
import { i as verifyPortableObject, n as VerifyPortableObjectOptions, r as VerifyPortableObjectResult, t as VerifyPortableObjectFailureReason } from "../mod-
|
|
2
|
+
import { A as AcceptSignatureParameters, B as VerifyPortableObjectProofOptions, C as VerifyRequestDetailedResult, D as verifyRequest, E as signRequest, F as validateAcceptSignature, G as signObject, H as VerifyProofOptions, I as CreateProofOptions, J as verifyProof, K as verifyObject, L as SignObjectOptions, M as formatAcceptSignature, N as fulfillAcceptSignature, O as verifyRequestDetailed, P as parseAcceptSignature, R as VerifyObjectOptions, S as SignRequestOptions, T as VerifyRequestOptions, U as createProof, V as VerifyPortableObjectProofResult, W as hasProofLike, a as KeyCache, b as HttpMessageSignaturesSpecDeterminer, c as fetchKeyDetailed, i as FetchKeyResult, j as FulfillAcceptSignatureResult, k as AcceptSignatureMember, l as generateCryptoKeyPair, n as FetchKeyErrorResult, o as exportJwk, q as verifyPortableObjectProof, r as FetchKeyOptions, s as fetchKey, t as FetchKeyDetailedResult, u as importJwk, w as VerifyRequestFailureReason, x as Rfc9421SignRequestOptions, y as HttpMessageSignaturesSpec, z as VerifyPortableObjectProofFailureReason } from "../key-DlHT4R6k.cjs";
|
|
3
|
+
import { a as VerifySignatureOptions, c as detachSignature, d as verifyJsonLd, f as verifySignature, g as getKeyOwner, h as doesActorOwnKey, i as VerifyJsonLdOptions, l as hasSignatureLike, m as GetKeyOwnerOptions, o as attachSignature, p as DoesActorOwnKeyOptions, r as SignJsonLdOptions, s as createSignature, t as CreateSignatureOptions, u as signJsonLd } from "../ld-CWVpo_NM.cjs";
|
|
4
|
+
import { i as verifyPortableObject, n as VerifyPortableObjectOptions, r as VerifyPortableObjectResult, t as VerifyPortableObjectFailureReason } from "../mod-C1nT74IG.cjs";
|
|
5
5
|
export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyPortableObjectFailureReason, VerifyPortableObjectOptions, VerifyPortableObjectProofFailureReason, VerifyPortableObjectProofOptions, VerifyPortableObjectProofResult, VerifyPortableObjectResult, 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, verifyPortableObject, verifyPortableObjectProof, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
package/dist/sig/mod.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference lib="esnext.temporal" />
|
|
2
|
-
import { A as AcceptSignatureParameters, B as VerifyPortableObjectProofOptions, C as VerifyRequestDetailedResult, D as verifyRequest, E as signRequest, F as validateAcceptSignature, G as signObject, H as VerifyProofOptions, I as CreateProofOptions, J as verifyProof, K as verifyObject, L as SignObjectOptions, M as formatAcceptSignature, N as fulfillAcceptSignature, O as verifyRequestDetailed, P as parseAcceptSignature, R as VerifyObjectOptions, S as SignRequestOptions, T as VerifyRequestOptions, U as createProof, V as VerifyPortableObjectProofResult, W as hasProofLike, a as KeyCache, b as HttpMessageSignaturesSpecDeterminer, c as fetchKeyDetailed, i as FetchKeyResult, j as FulfillAcceptSignatureResult, k as AcceptSignatureMember, l as generateCryptoKeyPair, n as FetchKeyErrorResult, o as exportJwk, q as verifyPortableObjectProof, r as FetchKeyOptions, s as fetchKey, t as FetchKeyDetailedResult, u as importJwk, w as VerifyRequestFailureReason, x as Rfc9421SignRequestOptions, y as HttpMessageSignaturesSpec, z as VerifyPortableObjectProofFailureReason } from "../key-
|
|
3
|
-
import { a as VerifySignatureOptions, c as detachSignature, d as verifyJsonLd, f as verifySignature, g as getKeyOwner, h as doesActorOwnKey, i as VerifyJsonLdOptions, l as hasSignatureLike, m as GetKeyOwnerOptions, o as attachSignature, p as DoesActorOwnKeyOptions, r as SignJsonLdOptions, s as createSignature, t as CreateSignatureOptions, u as signJsonLd } from "../ld-
|
|
4
|
-
import { i as verifyPortableObject, n as VerifyPortableObjectOptions, r as VerifyPortableObjectResult, t as VerifyPortableObjectFailureReason } from "../mod-
|
|
2
|
+
import { A as AcceptSignatureParameters, B as VerifyPortableObjectProofOptions, C as VerifyRequestDetailedResult, D as verifyRequest, E as signRequest, F as validateAcceptSignature, G as signObject, H as VerifyProofOptions, I as CreateProofOptions, J as verifyProof, K as verifyObject, L as SignObjectOptions, M as formatAcceptSignature, N as fulfillAcceptSignature, O as verifyRequestDetailed, P as parseAcceptSignature, R as VerifyObjectOptions, S as SignRequestOptions, T as VerifyRequestOptions, U as createProof, V as VerifyPortableObjectProofResult, W as hasProofLike, a as KeyCache, b as HttpMessageSignaturesSpecDeterminer, c as fetchKeyDetailed, i as FetchKeyResult, j as FulfillAcceptSignatureResult, k as AcceptSignatureMember, l as generateCryptoKeyPair, n as FetchKeyErrorResult, o as exportJwk, q as verifyPortableObjectProof, r as FetchKeyOptions, s as fetchKey, t as FetchKeyDetailedResult, u as importJwk, w as VerifyRequestFailureReason, x as Rfc9421SignRequestOptions, y as HttpMessageSignaturesSpec, z as VerifyPortableObjectProofFailureReason } from "../key-DbLNT-vA.js";
|
|
3
|
+
import { a as VerifySignatureOptions, c as detachSignature, d as verifyJsonLd, f as verifySignature, g as getKeyOwner, h as doesActorOwnKey, i as VerifyJsonLdOptions, l as hasSignatureLike, m as GetKeyOwnerOptions, o as attachSignature, p as DoesActorOwnKeyOptions, r as SignJsonLdOptions, s as createSignature, t as CreateSignatureOptions, u as signJsonLd } from "../ld-Inagww4R.js";
|
|
4
|
+
import { i as verifyPortableObject, n as VerifyPortableObjectOptions, r as VerifyPortableObjectResult, t as VerifyPortableObjectFailureReason } from "../mod-B4kBw1-8.js";
|
|
5
5
|
export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyPortableObjectFailureReason, VerifyPortableObjectOptions, VerifyPortableObjectProofFailureReason, VerifyPortableObjectProofOptions, VerifyPortableObjectProofResult, VerifyPortableObjectResult, 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, verifyPortableObject, verifyPortableObjectProof, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|