@fedify/fedify 2.4.0-dev.2164 → 2.4.0-dev.2190
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-BqRmnx7p.mjs → builder-CFF0YNTp.mjs} +3 -3
- package/dist/{circuit-breaker-C5NqoLBJ.mjs → circuit-breaker-XJ53md4S.mjs} +16 -11
- 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-CxDBdtNz.mjs → compound-proof-F2jjkrt0.mjs} +3 -3
- package/dist/{context-BykNUf04.d.ts → context-9T--NSo4.d.ts} +55 -1
- package/dist/{context-L0Fnib9j.d.cts → context-CDcAgm4l.d.cts} +55 -1
- package/dist/{deno-CizGaYeG.mjs → deno-EopndaNb.mjs} +1 -1
- package/dist/{docloader-BBFAItNB.mjs → docloader-u6zzOExF.mjs} +25 -17
- package/dist/federation/builder.test.mjs +1 -1
- package/dist/federation/circuit-breaker.test.mjs +50 -1
- package/dist/federation/compound-fanout.test.mjs +3 -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/keycache.test.mjs +1 -1
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +137 -13
- 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/outgoing-proof.test.mjs +5 -5
- 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-gateway-keys.test.mjs +6 -6
- package/dist/federation/portable-inbox.test.mjs +35 -5
- package/dist/federation/portable-parse-uri.test.mjs +1 -1
- package/dist/federation/portable-route-activity.test.d.mts +2 -0
- package/dist/federation/portable-route-activity.test.mjs +259 -0
- package/dist/federation/portable.test.mjs +3 -3
- package/dist/federation/send.test.mjs +3 -3
- 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-DFCnp94y.cjs → federation-BSS2dUO7.cjs} +38 -21
- package/dist/{http-Baovr6xq.js → http-BqN5kyUf.js} +426 -141
- package/dist/{http-DC1cqAQ2.d.cts → http-BrwKINQn.d.cts} +28 -0
- package/dist/{http-R4g1McwE.cjs → http-CCr2_ipG.cjs} +443 -140
- package/dist/{http-Cok5-vIC.d.ts → http-DGx0KOws.d.ts} +28 -0
- package/dist/{http-DRH0n8TD.mjs → http-Y1ObT1A8.mjs} +180 -92
- package/dist/{key-D5awqp7u.mjs → key-DyXf88bq.mjs} +4 -4
- package/dist/{key-owner-evidence-Bo3yaeL5.mjs → key-owner-evidence-APB6NpSk.mjs} +1 -1
- package/dist/{keycache-PiOM9pM0.mjs → keycache-Da8A8mZa.mjs} +1 -1
- package/dist/{kv-cache-CZiBDLPi.js → kv-cache-C02XitwK.js} +24 -16
- package/dist/{kv-cache-C7RWL7hz.mjs → kv-cache-C8YjNAi_.mjs} +1 -1
- package/dist/{kv-cache-Ct-KWRta.cjs → kv-cache-DUXluAc0.cjs} +23 -15
- package/dist/{ld-CyliEU48.mjs → ld-oQj6j_hP.mjs} +3 -3
- package/dist/{metrics-CFBEehTc.mjs → metrics-zMe834ID.mjs} +1 -1
- package/dist/{middleware-B99JjvFn.mjs → middleware-Bdu2-OPD.mjs} +37 -25
- package/dist/{middleware-CdpTFsa2.js → middleware-CaR2MRWY.js} +39 -22
- package/dist/{middleware-BmqEWsWP.mjs → middleware-Ck9yghxs.mjs} +1 -1
- package/dist/{mod-DK0y9fd-.d.ts → mod-B3OBLj5g.d.ts} +1 -1
- package/dist/{mod-B5z_q9TH.d.ts → mod-C5Mwx5ty.d.ts} +5 -1
- package/dist/{mod--jv6vyrP.d.ts → mod-Ck9_lSJB.d.ts} +1 -1
- package/dist/{mod-BLOXGs6m.d.cts → mod-D58KCqUg.d.cts} +1 -1
- package/dist/{mod-CPPqkyV_.d.cts → mod-DHTuu3l8.d.cts} +1 -1
- package/dist/{mod-BA_F2x53.d.cts → mod-Dp3Ij7sw.d.cts} +5 -1
- package/dist/mod.cjs +4 -4
- package/dist/mod.d.cts +5 -5
- package/dist/mod.d.ts +5 -5
- package/dist/mod.js +4 -4
- package/dist/nodeinfo/handler.test.mjs +1 -1
- package/dist/{owner-DKdtsrEq.mjs → owner-Dem4fbwc.mjs} +5 -5
- package/dist/{portable-collection-uv4CuQXm.js → portable-collection-BEqLrMW3.js} +1 -1
- package/dist/{portable-collection-Cb5cdPIU.mjs → portable-collection-BL6aZlQ0.mjs} +2 -2
- package/dist/{portable-collection-UajqDrSL.cjs → portable-collection-DJe_bk50.cjs} +1 -1
- package/dist/{portable-key-Bv1RdQ0n.mjs → portable-key-Duue9Y2Y.mjs} +209 -56
- package/dist/{portable-key-id-Bg259c4Z.mjs → portable-key-id-Ca30-hOa.mjs} +45 -1
- package/dist/{proof-CRTPWbVh.mjs → proof-C9115DX_.mjs} +5 -5
- package/dist/{send-2dULlZc8.mjs → send-D0hxFFRB.mjs} +3 -3
- 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 +495 -23
- package/dist/sig/key-owner-evidence.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- 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/portable-collection.test.mjs +1 -1
- package/dist/sig/portable-key-id.test.d.mts +2 -0
- package/dist/sig/portable-key-id.test.mjs +67 -0
- package/dist/sig/portable-key.test.mjs +253 -7
- package/dist/sig/proof.test.mjs +3 -3
- package/dist/{temporal-Dhsk6aUT.mjs → temporal-DKchpKyp.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/testing/mod.d.mts +52 -0
- package/dist/utils/docloader.test.mjs +93 -2
- package/dist/utils/kv-cache.test.mjs +1 -1
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.d.cts +1 -1
- package/dist/utils/mod.d.ts +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +6 -6
package/dist/sig/http.test.mjs
CHANGED
|
@@ -2,6 +2,7 @@ import { Temporal } from "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as esm_default } from "../esm-BHXXx4Wx.mjs";
|
|
5
|
+
import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
5
6
|
import { t as AssertionError } from "../assertion_error-B-cx0fFA.mjs";
|
|
6
7
|
import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
7
8
|
import { t as assertExists } from "../assert_exists-cffSpJ7X.mjs";
|
|
@@ -11,11 +12,12 @@ import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
|
11
12
|
import "../std__assert-DvMDRPes.mjs";
|
|
12
13
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
13
14
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
14
|
-
import { n as exportJwk } from "../key-
|
|
15
|
-
import { a as listRequestSignatures, c as selectRequestSignature,
|
|
16
|
-
import { i as rsaPrivateKey2, l as rsaPublicKey5, o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
15
|
+
import { n as exportJwk } from "../key-DyXf88bq.mjs";
|
|
16
|
+
import { a as listRequestSignatures, c as selectRequestSignature, f as verifyRequest, i as formatRfc9421SignatureParameters, l as signRequest, n as doubleKnock, o as parseRfc9421Signature, p as verifyRequestDetailed, r as formatRfc9421Signature, s as parseRfc9421SignatureInput, t as createRfc9421SignatureBase, u as timingSafeEqual } from "../http-Y1ObT1A8.mjs";
|
|
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
|
+
import { t as KvKeyCache } from "../keycache-Da8A8mZa.mjs";
|
|
17
19
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
18
|
-
import { FetchError, exportSpki } from "@fedify/vocab-runtime";
|
|
20
|
+
import { FetchError, exportSpki, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
19
21
|
import { encodeBase64 } from "byte-encodings/base64";
|
|
20
22
|
//#region ../../node_modules/.pnpm/@jsr+std__assert@0.226.0/node_modules/@jsr/std__assert/assert_string_includes.js
|
|
21
23
|
/**
|
|
@@ -258,7 +260,7 @@ test("verifyRequestDetailed() records failure details on span", async () => {
|
|
|
258
260
|
assertEquals(span.attributes["http_signatures.key_fetch_status"], 410);
|
|
259
261
|
});
|
|
260
262
|
test("verifyRequestDetailed() records verification duration metric", async (t) => {
|
|
261
|
-
const buildSignedRequest = () => signRequest(new Request("https://example.com/inbox", {
|
|
263
|
+
const buildSignedRequest = (spec) => signRequest(new Request("https://example.com/inbox", {
|
|
262
264
|
method: "POST",
|
|
263
265
|
headers: {
|
|
264
266
|
"Content-Type": "application/activity+json",
|
|
@@ -269,7 +271,7 @@ test("verifyRequestDetailed() records verification duration metric", async (t) =
|
|
|
269
271
|
type: "Create",
|
|
270
272
|
actor: "https://example.com/key2"
|
|
271
273
|
})
|
|
272
|
-
}), rsaPrivateKey2, new URL("https://example.com/key2"));
|
|
274
|
+
}), rsaPrivateKey2, new URL("https://example.com/key2"), { spec });
|
|
273
275
|
await t.step("verified path emits one measurement", async () => {
|
|
274
276
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
275
277
|
assert((await verifyRequestDetailed(await buildSignedRequest(), {
|
|
@@ -372,23 +374,26 @@ test("verifyRequestDetailed() records verification duration metric", async (t) =
|
|
|
372
374
|
assertEquals(recorder.getMeasurements("activitypub.signature.verification.duration").length, 1);
|
|
373
375
|
});
|
|
374
376
|
await t.step("cached-key retry emits one measurement, not two", async () => {
|
|
375
|
-
const [
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
377
|
+
for (const spec of ["draft-cavage-http-signatures-12", "rfc9421"]) {
|
|
378
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
379
|
+
const cache = { "https://example.com/key2": rsaPublicKey1 };
|
|
380
|
+
assertExists(await verifyRequest(await buildSignedRequest(spec), {
|
|
381
|
+
contextLoader: mockDocumentLoader,
|
|
382
|
+
documentLoader: mockDocumentLoader,
|
|
383
|
+
meterProvider,
|
|
384
|
+
keyCache: {
|
|
385
|
+
get(keyId) {
|
|
386
|
+
return Promise.resolve(cache[keyId.href]);
|
|
387
|
+
},
|
|
388
|
+
set(keyId, k) {
|
|
389
|
+
cache[keyId.href] = k;
|
|
390
|
+
return Promise.resolve();
|
|
391
|
+
}
|
|
388
392
|
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
|
|
393
|
+
}), spec);
|
|
394
|
+
assertEquals(recorder.getMeasurements("activitypub.signature.verification.duration").length, 1, spec);
|
|
395
|
+
assertEquals(recorder.getMeasurements("activitypub.signature.key_fetch.duration").length, 2, spec);
|
|
396
|
+
}
|
|
392
397
|
});
|
|
393
398
|
await t.step("key fetch records result=fetched on a cold cache", async () => {
|
|
394
399
|
const [meterProvider, recorder] = createTestMeterProvider();
|
|
@@ -691,10 +696,394 @@ for (const failure of [
|
|
|
691
696
|
return mockDocumentLoader(url, options);
|
|
692
697
|
}
|
|
693
698
|
}), failure === "digest mismatch" ? null : rsaPublicKey2);
|
|
694
|
-
assertEquals(loaded, failure === "digest mismatch" ? [] : failure === "missing key" ? ["https://example.com/missing-key", "https://example.com/key2"] : ["https://example.com/key2"
|
|
699
|
+
assertEquals(loaded, failure === "digest mismatch" ? [] : failure === "missing key" ? ["https://example.com/missing-key", "https://example.com/key2"] : ["https://example.com/key2"]);
|
|
695
700
|
assertFalse(request.bodyUsed);
|
|
696
701
|
assertEquals(await request.text(), failure === "digest mismatch" ? "Tampered body" : body);
|
|
697
702
|
});
|
|
703
|
+
async function signRfc9421Many(signatures, currentTime) {
|
|
704
|
+
let request = new Request("https://example.com/inbox", {
|
|
705
|
+
method: "POST",
|
|
706
|
+
body: "Hello, world!"
|
|
707
|
+
});
|
|
708
|
+
let i = 0;
|
|
709
|
+
for (const signature of signatures) {
|
|
710
|
+
const { label, keyId, privateKey } = typeof signature === "string" ? { keyId: signature } : signature;
|
|
711
|
+
i++;
|
|
712
|
+
request = await signRequest(request, privateKey ?? rsaPrivateKey2, new URL(keyId), {
|
|
713
|
+
spec: "rfc9421",
|
|
714
|
+
currentTime,
|
|
715
|
+
rfc9421: { label: label ?? `sig${i}` }
|
|
716
|
+
});
|
|
717
|
+
}
|
|
718
|
+
return request;
|
|
719
|
+
}
|
|
720
|
+
function splitRfc9421Header(header) {
|
|
721
|
+
return Object.fromEntries(header.split(/,\s*/).map((member) => [member.slice(0, member.indexOf("=")), member]));
|
|
722
|
+
}
|
|
723
|
+
function createCountingKeyLoader() {
|
|
724
|
+
const loaded = [];
|
|
725
|
+
const loader = (url, options) => {
|
|
726
|
+
loaded.push(url);
|
|
727
|
+
if (url === "https://example.com/key2") return mockDocumentLoader(url, options);
|
|
728
|
+
return Promise.reject(new FetchError(url, `Not found: ${url}`));
|
|
729
|
+
};
|
|
730
|
+
return Object.assign(loader, { loaded });
|
|
731
|
+
}
|
|
732
|
+
test("verifyRequestDetailed() [rfc9421] caps the number of signatures", async (t) => {
|
|
733
|
+
const currentTime = Temporal.Instant.from("2024-03-05T08:09:44Z");
|
|
734
|
+
const missing = (n) => `https://example.com/missing-${n}`;
|
|
735
|
+
const valid = "https://example.com/key2";
|
|
736
|
+
await t.step("fetches only the keys of the first signatures", async () => {
|
|
737
|
+
const request = await signRfc9421Many([
|
|
738
|
+
1,
|
|
739
|
+
2,
|
|
740
|
+
3,
|
|
741
|
+
4,
|
|
742
|
+
5
|
|
743
|
+
].map(missing), currentTime);
|
|
744
|
+
for (const [maxSignatures, count] of [
|
|
745
|
+
[void 0, 3],
|
|
746
|
+
[1, 1],
|
|
747
|
+
[5, 5],
|
|
748
|
+
[Infinity, 5]
|
|
749
|
+
]) {
|
|
750
|
+
const documentLoader = createCountingKeyLoader();
|
|
751
|
+
const result = await verifyRequestDetailed(request, {
|
|
752
|
+
documentLoader,
|
|
753
|
+
contextLoader: mockDocumentLoader,
|
|
754
|
+
currentTime,
|
|
755
|
+
maxSignatures
|
|
756
|
+
});
|
|
757
|
+
assertFalse(result.verified);
|
|
758
|
+
assertEquals(result.reason.type, "keyFetchError");
|
|
759
|
+
assertEquals("keyId" in result.reason ? result.reason.keyId?.href : void 0, missing(count));
|
|
760
|
+
assertEquals(documentLoader.loaded, [
|
|
761
|
+
1,
|
|
762
|
+
2,
|
|
763
|
+
3,
|
|
764
|
+
4,
|
|
765
|
+
5
|
|
766
|
+
].slice(0, count).map(missing));
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
await t.step("accepts a valid signature within the cap", async () => {
|
|
770
|
+
const documentLoader = createCountingKeyLoader();
|
|
771
|
+
const result = await verifyRequestDetailed(await signRfc9421Many([
|
|
772
|
+
missing(1),
|
|
773
|
+
missing(2),
|
|
774
|
+
valid,
|
|
775
|
+
missing(4)
|
|
776
|
+
], currentTime), {
|
|
777
|
+
documentLoader,
|
|
778
|
+
contextLoader: mockDocumentLoader,
|
|
779
|
+
currentTime
|
|
780
|
+
});
|
|
781
|
+
assert(result.verified);
|
|
782
|
+
assertEquals(result.key, rsaPublicKey2);
|
|
783
|
+
assertEquals(result.signatureLabel, "sig3");
|
|
784
|
+
assertEquals(documentLoader.loaded, [
|
|
785
|
+
missing(1),
|
|
786
|
+
missing(2),
|
|
787
|
+
valid
|
|
788
|
+
]);
|
|
789
|
+
});
|
|
790
|
+
await t.step("ignores a valid signature beyond the cap", async () => {
|
|
791
|
+
const request = await signRfc9421Many([
|
|
792
|
+
missing(1),
|
|
793
|
+
missing(2),
|
|
794
|
+
missing(3),
|
|
795
|
+
valid
|
|
796
|
+
], currentTime);
|
|
797
|
+
const documentLoader = createCountingKeyLoader();
|
|
798
|
+
const result = await verifyRequestDetailed(request, {
|
|
799
|
+
documentLoader,
|
|
800
|
+
contextLoader: mockDocumentLoader,
|
|
801
|
+
currentTime
|
|
802
|
+
});
|
|
803
|
+
assertFalse(result.verified);
|
|
804
|
+
assertEquals(result.reason.type, "keyFetchError");
|
|
805
|
+
assertEquals("keyId" in result.reason ? result.reason.keyId?.href : void 0, missing(3));
|
|
806
|
+
assertEquals(documentLoader.loaded, [
|
|
807
|
+
1,
|
|
808
|
+
2,
|
|
809
|
+
3
|
|
810
|
+
].map(missing));
|
|
811
|
+
assertEquals(await verifyRequest(request, {
|
|
812
|
+
documentLoader: createCountingKeyLoader(),
|
|
813
|
+
contextLoader: mockDocumentLoader,
|
|
814
|
+
currentTime,
|
|
815
|
+
maxSignatures: 4
|
|
816
|
+
}), rsaPublicKey2);
|
|
817
|
+
});
|
|
818
|
+
await t.step("tries signatures in the header order", async () => {
|
|
819
|
+
const request = await signRfc9421Many([
|
|
820
|
+
{
|
|
821
|
+
label: "z",
|
|
822
|
+
keyId: missing(1)
|
|
823
|
+
},
|
|
824
|
+
{
|
|
825
|
+
label: "a",
|
|
826
|
+
keyId: valid
|
|
827
|
+
},
|
|
828
|
+
{
|
|
829
|
+
label: "m",
|
|
830
|
+
keyId: missing(3)
|
|
831
|
+
}
|
|
832
|
+
], currentTime);
|
|
833
|
+
const documentLoader = createCountingKeyLoader();
|
|
834
|
+
assertEquals(await verifyRequest(request, {
|
|
835
|
+
documentLoader,
|
|
836
|
+
contextLoader: mockDocumentLoader,
|
|
837
|
+
currentTime,
|
|
838
|
+
maxSignatures: 1
|
|
839
|
+
}), null);
|
|
840
|
+
assertEquals(documentLoader.loaded, [missing(1)]);
|
|
841
|
+
});
|
|
842
|
+
await t.step("counts signatures that fail before their keys are fetched", async () => {
|
|
843
|
+
const outdated = await signRfc9421Many([{
|
|
844
|
+
label: "old",
|
|
845
|
+
keyId: missing(1)
|
|
846
|
+
}], currentTime.subtract({ hours: 2 }));
|
|
847
|
+
const signed = await signRfc9421Many([
|
|
848
|
+
{
|
|
849
|
+
label: "nobytes1",
|
|
850
|
+
keyId: missing(2)
|
|
851
|
+
},
|
|
852
|
+
{
|
|
853
|
+
label: "nobytes2",
|
|
854
|
+
keyId: missing(3)
|
|
855
|
+
},
|
|
856
|
+
{
|
|
857
|
+
label: "valid",
|
|
858
|
+
keyId: valid
|
|
859
|
+
}
|
|
860
|
+
], currentTime);
|
|
861
|
+
const inputs = {
|
|
862
|
+
...splitRfc9421Header(outdated.headers.get("Signature-Input")),
|
|
863
|
+
...splitRfc9421Header(signed.headers.get("Signature-Input"))
|
|
864
|
+
};
|
|
865
|
+
const signatures = {
|
|
866
|
+
...splitRfc9421Header(outdated.headers.get("Signature")),
|
|
867
|
+
...splitRfc9421Header(signed.headers.get("Signature"))
|
|
868
|
+
};
|
|
869
|
+
const build = (labels) => {
|
|
870
|
+
const headers = new Headers(signed.headers);
|
|
871
|
+
headers.set("Signature-Input", [`dropped=("@method");keyid="${missing(0)}"`, ...labels.map((label) => inputs[label])].join(", "));
|
|
872
|
+
headers.set("Signature", labels.filter((label) => !label.startsWith("nobytes")).map((label) => signatures[label]).join(", "));
|
|
873
|
+
return new Request(signed.url, {
|
|
874
|
+
method: "POST",
|
|
875
|
+
headers,
|
|
876
|
+
body: "Hello, world!"
|
|
877
|
+
});
|
|
878
|
+
};
|
|
879
|
+
let documentLoader = createCountingKeyLoader();
|
|
880
|
+
let result = await verifyRequestDetailed(build([
|
|
881
|
+
"old",
|
|
882
|
+
"nobytes1",
|
|
883
|
+
"valid"
|
|
884
|
+
]), {
|
|
885
|
+
documentLoader,
|
|
886
|
+
contextLoader: mockDocumentLoader,
|
|
887
|
+
currentTime
|
|
888
|
+
});
|
|
889
|
+
assert(result.verified);
|
|
890
|
+
assertEquals(result.signatureLabel, "valid");
|
|
891
|
+
assertEquals(documentLoader.loaded, [valid]);
|
|
892
|
+
documentLoader = createCountingKeyLoader();
|
|
893
|
+
result = await verifyRequestDetailed(build([
|
|
894
|
+
"old",
|
|
895
|
+
"nobytes1",
|
|
896
|
+
"nobytes2",
|
|
897
|
+
"valid"
|
|
898
|
+
]), {
|
|
899
|
+
documentLoader,
|
|
900
|
+
contextLoader: mockDocumentLoader,
|
|
901
|
+
currentTime
|
|
902
|
+
});
|
|
903
|
+
assertFalse(result.verified);
|
|
904
|
+
assertEquals(documentLoader.loaded, []);
|
|
905
|
+
});
|
|
906
|
+
await t.step("rejects an invalid maxSignatures", async () => {
|
|
907
|
+
const unsigned = new Request("https://example.com/inbox");
|
|
908
|
+
for (const maxSignatures of [
|
|
909
|
+
0,
|
|
910
|
+
-1,
|
|
911
|
+
1.5,
|
|
912
|
+
NaN,
|
|
913
|
+
2 ** 53,
|
|
914
|
+
-Infinity
|
|
915
|
+
]) {
|
|
916
|
+
await assertRejects(() => verifyRequestDetailed(unsigned, { maxSignatures }), RangeError);
|
|
917
|
+
await assertRejects(() => verifyRequest(unsigned, { maxSignatures }), RangeError);
|
|
918
|
+
}
|
|
919
|
+
await assertRejects(() => verifyRequestDetailed(unsigned, { maxSignatures: null }), RangeError);
|
|
920
|
+
});
|
|
921
|
+
});
|
|
922
|
+
test("verifyRequestDetailed() [rfc9421] looks up each key once per request", async (t) => {
|
|
923
|
+
const currentTime = Temporal.Instant.from("2024-03-05T08:09:44Z");
|
|
924
|
+
const missing = (n) => `https://example.com/missing-${n}`;
|
|
925
|
+
const valid = "https://example.com/key2";
|
|
926
|
+
const forged = {
|
|
927
|
+
keyId: valid,
|
|
928
|
+
privateKey: rsaPrivateKey3
|
|
929
|
+
};
|
|
930
|
+
await t.step("signatures naming the same key", async () => {
|
|
931
|
+
const request = await signRfc9421Many([
|
|
932
|
+
forged,
|
|
933
|
+
forged,
|
|
934
|
+
valid
|
|
935
|
+
], currentTime);
|
|
936
|
+
for (const keyCache of [void 0, new KvKeyCache(new MemoryKvStore(), ["pk"])]) {
|
|
937
|
+
const documentLoader = createCountingKeyLoader();
|
|
938
|
+
const result = await verifyRequestDetailed(request, {
|
|
939
|
+
documentLoader,
|
|
940
|
+
contextLoader: mockDocumentLoader,
|
|
941
|
+
currentTime,
|
|
942
|
+
keyCache
|
|
943
|
+
});
|
|
944
|
+
assert(result.verified);
|
|
945
|
+
assertEquals(result.signatureLabel, "sig3");
|
|
946
|
+
assertEquals(documentLoader.loaded, [valid]);
|
|
947
|
+
}
|
|
948
|
+
});
|
|
949
|
+
await t.step("signatures naming the same missing key", async () => {
|
|
950
|
+
const documentLoader = createCountingKeyLoader();
|
|
951
|
+
const result = await verifyRequestDetailed(await signRfc9421Many([
|
|
952
|
+
missing(1),
|
|
953
|
+
missing(1),
|
|
954
|
+
missing(1)
|
|
955
|
+
], currentTime), {
|
|
956
|
+
documentLoader,
|
|
957
|
+
contextLoader: mockDocumentLoader,
|
|
958
|
+
currentTime
|
|
959
|
+
});
|
|
960
|
+
assertFalse(result.verified);
|
|
961
|
+
assertEquals(result.reason.type, "keyFetchError");
|
|
962
|
+
assertEquals(documentLoader.loaded, [missing(1)]);
|
|
963
|
+
});
|
|
964
|
+
await t.step("separate requests", async () => {
|
|
965
|
+
const request = await signRfc9421Many([valid], currentTime);
|
|
966
|
+
const documentLoader = createCountingKeyLoader();
|
|
967
|
+
const options = {
|
|
968
|
+
documentLoader,
|
|
969
|
+
contextLoader: mockDocumentLoader,
|
|
970
|
+
currentTime
|
|
971
|
+
};
|
|
972
|
+
assertEquals(await verifyRequest(request, options), rsaPublicKey2);
|
|
973
|
+
assertEquals(await verifyRequest(request, options), rsaPublicKey2);
|
|
974
|
+
assertEquals(documentLoader.loaded, [valid, valid]);
|
|
975
|
+
});
|
|
976
|
+
const createStaleKeyCache = () => {
|
|
977
|
+
const gets = [];
|
|
978
|
+
return {
|
|
979
|
+
keyCache: {
|
|
980
|
+
get(keyId) {
|
|
981
|
+
gets.push(keyId.href);
|
|
982
|
+
return Promise.resolve(keyId.href === valid ? rsaPublicKey1 : keyId.href === missing(1) ? null : void 0);
|
|
983
|
+
},
|
|
984
|
+
set: () => Promise.resolve(),
|
|
985
|
+
getFetchError: (keyId) => Promise.resolve(keyId.href === missing(1) ? { error: new FetchError(keyId, "Cached failure") } : void 0),
|
|
986
|
+
setFetchError: () => Promise.resolve()
|
|
987
|
+
},
|
|
988
|
+
gets
|
|
989
|
+
};
|
|
990
|
+
};
|
|
991
|
+
await t.step("refreshes a stale cached key once, only for its signature", async () => {
|
|
992
|
+
const { keyCache, gets } = createStaleKeyCache();
|
|
993
|
+
const documentLoader = createCountingKeyLoader();
|
|
994
|
+
const result = await verifyRequestDetailed(await signRfc9421Many([
|
|
995
|
+
missing(1),
|
|
996
|
+
missing(2),
|
|
997
|
+
forged,
|
|
998
|
+
valid
|
|
999
|
+
], currentTime), {
|
|
1000
|
+
documentLoader,
|
|
1001
|
+
contextLoader: mockDocumentLoader,
|
|
1002
|
+
currentTime,
|
|
1003
|
+
keyCache,
|
|
1004
|
+
maxSignatures: 4
|
|
1005
|
+
});
|
|
1006
|
+
assert(result.verified);
|
|
1007
|
+
assertEquals(result.key, rsaPublicKey2);
|
|
1008
|
+
assertEquals(result.signatureLabel, "sig4");
|
|
1009
|
+
assertEquals(documentLoader.loaded, [missing(2), valid]);
|
|
1010
|
+
assertEquals(gets, [
|
|
1011
|
+
missing(1),
|
|
1012
|
+
missing(2),
|
|
1013
|
+
valid
|
|
1014
|
+
]);
|
|
1015
|
+
});
|
|
1016
|
+
await t.step("refreshes each stale cached key at most once", async () => {
|
|
1017
|
+
const stale = (n) => `https://example.com/stale-${n}`;
|
|
1018
|
+
const gets = [];
|
|
1019
|
+
const keyCache = {
|
|
1020
|
+
get(keyId) {
|
|
1021
|
+
gets.push(keyId.href);
|
|
1022
|
+
return Promise.resolve(rsaPublicKey1);
|
|
1023
|
+
},
|
|
1024
|
+
set: () => Promise.resolve()
|
|
1025
|
+
};
|
|
1026
|
+
const documentLoader = createCountingKeyLoader();
|
|
1027
|
+
const result = await verifyRequestDetailed(await signRfc9421Many([
|
|
1028
|
+
stale(1),
|
|
1029
|
+
stale(2),
|
|
1030
|
+
stale(1),
|
|
1031
|
+
stale(4)
|
|
1032
|
+
], currentTime), {
|
|
1033
|
+
documentLoader,
|
|
1034
|
+
contextLoader: mockDocumentLoader,
|
|
1035
|
+
currentTime,
|
|
1036
|
+
keyCache
|
|
1037
|
+
});
|
|
1038
|
+
assertFalse(result.verified);
|
|
1039
|
+
assertEquals(result.reason.type, "keyFetchError");
|
|
1040
|
+
assertEquals("keyId" in result.reason ? result.reason.keyId?.href : void 0, stale(1));
|
|
1041
|
+
assertEquals(documentLoader.loaded, [stale(1), stale(2)]);
|
|
1042
|
+
assertEquals(gets, [stale(1), stale(2)]);
|
|
1043
|
+
});
|
|
1044
|
+
await t.step("does not refresh a cached key for other failures", async () => {
|
|
1045
|
+
const [input] = Object.values(splitRfc9421Header((await signRfc9421Many([valid], currentTime)).headers.get("Signature-Input")));
|
|
1046
|
+
const withAlg = (alg) => /;alg="[^"]*"/.test(input) ? input.replace(/;alg="[^"]*"/, `;alg="${alg}"`) : `${input};alg="${alg}"`;
|
|
1047
|
+
for (const signatureInput of [withAlg("unknown"), input.replace(/^sig1=\([^)]*\)/, "sig1=(\"@unsupported\")")]) {
|
|
1048
|
+
const request = await signRfc9421Many([valid], currentTime);
|
|
1049
|
+
request.headers.set("Signature-Input", signatureInput);
|
|
1050
|
+
const { keyCache } = createStaleKeyCache();
|
|
1051
|
+
const documentLoader = createCountingKeyLoader();
|
|
1052
|
+
assertEquals(await verifyRequest(request, {
|
|
1053
|
+
documentLoader,
|
|
1054
|
+
contextLoader: mockDocumentLoader,
|
|
1055
|
+
currentTime,
|
|
1056
|
+
keyCache
|
|
1057
|
+
}), null, signatureInput);
|
|
1058
|
+
assertEquals(documentLoader.loaded, [], signatureInput);
|
|
1059
|
+
}
|
|
1060
|
+
});
|
|
1061
|
+
await t.step("refreshes a cached key of another algorithm family", async () => {
|
|
1062
|
+
const keyId = ed25519PublicKey.id.href;
|
|
1063
|
+
const request = await signRfc9421Many([keyId], currentTime);
|
|
1064
|
+
const input = request.headers.get("Signature-Input");
|
|
1065
|
+
request.headers.set("Signature-Input", /;alg="[^"]*"/.test(input) ? input.replace(/;alg="[^"]*"/, ";alg=\"ed25519\"") : `${input};alg="ed25519"`);
|
|
1066
|
+
const { sig1 } = parseRfc9421SignatureInput(request.headers.get("Signature-Input"));
|
|
1067
|
+
const signature = await crypto.subtle.sign("Ed25519", ed25519PrivateKey, new TextEncoder().encode(createRfc9421SignatureBase(request, sig1.components, sig1.parameters)));
|
|
1068
|
+
request.headers.set("Signature", `sig1=:${encodeBase64(new Uint8Array(signature))}:`);
|
|
1069
|
+
const loaded = [];
|
|
1070
|
+
const result = await verifyRequestDetailed(request, {
|
|
1071
|
+
documentLoader: (url, options) => {
|
|
1072
|
+
loaded.push(url);
|
|
1073
|
+
return mockDocumentLoader(url, options);
|
|
1074
|
+
},
|
|
1075
|
+
contextLoader: mockDocumentLoader,
|
|
1076
|
+
currentTime,
|
|
1077
|
+
keyCache: {
|
|
1078
|
+
get: (id) => Promise.resolve(id.href === keyId ? rsaPublicKey1 : void 0),
|
|
1079
|
+
set: () => Promise.resolve()
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1082
|
+
assert(result.verified);
|
|
1083
|
+
assertEquals(result.key.id?.href, keyId);
|
|
1084
|
+
assertEquals(loaded.length, 1);
|
|
1085
|
+
});
|
|
1086
|
+
});
|
|
698
1087
|
test("verifyRequest() [rfc9421] manual POST verification", async () => {
|
|
699
1088
|
const currentTimestamp = 1709626184;
|
|
700
1089
|
const currentTime = Temporal.Instant.from("2024-03-05T08:09:44Z");
|
|
@@ -2166,6 +2555,29 @@ test("listRequestSignatures()", async (t) => {
|
|
|
2166
2555
|
"content-digest"
|
|
2167
2556
|
]);
|
|
2168
2557
|
});
|
|
2558
|
+
await t.step("RFC 9421 beyond the limit", async () => {
|
|
2559
|
+
const currentTime = Temporal.Instant.from("2024-03-05T08:09:44Z");
|
|
2560
|
+
const signed = await signRfc9421Many([
|
|
2561
|
+
1,
|
|
2562
|
+
2,
|
|
2563
|
+
3,
|
|
2564
|
+
4
|
|
2565
|
+
].map((n) => `https://example.com/key-${n}`), currentTime);
|
|
2566
|
+
const headers = new Headers(signed.headers);
|
|
2567
|
+
headers.set("Signature-Input", headers.get("Signature-Input").replace("https://example.com/key-1", "not a URL"));
|
|
2568
|
+
const request = new Request(signed.url, {
|
|
2569
|
+
method: "POST",
|
|
2570
|
+
headers
|
|
2571
|
+
});
|
|
2572
|
+
const keyIds = (maxSignatures) => listRequestSignatures(request, maxSignatures).map((s) => s.keyId.href);
|
|
2573
|
+
assertEquals(keyIds(), ["https://example.com/key-2", "https://example.com/key-3"]);
|
|
2574
|
+
assertEquals(keyIds(1), []);
|
|
2575
|
+
assertEquals(keyIds(Infinity), [
|
|
2576
|
+
"https://example.com/key-2",
|
|
2577
|
+
"https://example.com/key-3",
|
|
2578
|
+
"https://example.com/key-4"
|
|
2579
|
+
]);
|
|
2580
|
+
});
|
|
2169
2581
|
await t.step("unsigned or malformed", () => {
|
|
2170
2582
|
assertEquals(listRequestSignatures(request()), []);
|
|
2171
2583
|
const malformed = request();
|
|
@@ -2208,5 +2620,65 @@ test("selectRequestSignature()", async () => {
|
|
|
2208
2620
|
assertEquals(await selected.text(), body);
|
|
2209
2621
|
assertEquals(await request.text(), body);
|
|
2210
2622
|
});
|
|
2623
|
+
test("verifyRequestDetailed() reports a timed-out key fetch", async (t) => {
|
|
2624
|
+
for (const stall of ["headers", "body"]) await t.step(`stalled ${stall}`, async () => {
|
|
2625
|
+
esm_default.mockGlobal();
|
|
2626
|
+
const keyId = new URL(`https://slow.example/actors/alice#${stall}`);
|
|
2627
|
+
let requests = 0;
|
|
2628
|
+
esm_default.get(`begin:https://slow.example/actors/alice`, () => {
|
|
2629
|
+
requests++;
|
|
2630
|
+
if (stall === "headers") return new Promise(() => {});
|
|
2631
|
+
return new Response(new ReadableStream({ pull: () => new Promise(() => {}) }), { status: 404 });
|
|
2632
|
+
});
|
|
2633
|
+
const loader = getDocumentLoader({
|
|
2634
|
+
allowPrivateAddress: true,
|
|
2635
|
+
timeout: 100
|
|
2636
|
+
});
|
|
2637
|
+
const documentLoader = (url, options) => url.startsWith("https://slow.example/") ? loader(url, options) : mockDocumentLoader(url);
|
|
2638
|
+
const kv = new MemoryKvStore();
|
|
2639
|
+
try {
|
|
2640
|
+
const sign = () => signRequest(new Request("https://example.com/inbox", {
|
|
2641
|
+
method: "POST",
|
|
2642
|
+
headers: {
|
|
2643
|
+
"Content-Type": "application/activity+json",
|
|
2644
|
+
accept: "application/ld+json"
|
|
2645
|
+
},
|
|
2646
|
+
body: JSON.stringify({
|
|
2647
|
+
"@context": "https://www.w3.org/ns/activitystreams",
|
|
2648
|
+
type: "Create",
|
|
2649
|
+
actor: "https://slow.example/actors/alice"
|
|
2650
|
+
})
|
|
2651
|
+
}), rsaPrivateKey2, keyId);
|
|
2652
|
+
const result = await verifyRequestDetailed(await sign(), {
|
|
2653
|
+
contextLoader: mockDocumentLoader,
|
|
2654
|
+
documentLoader,
|
|
2655
|
+
keyCache: new KvKeyCache(kv, ["pk"])
|
|
2656
|
+
});
|
|
2657
|
+
assertFalse(result.verified);
|
|
2658
|
+
assert(result.reason.type === "keyFetchError");
|
|
2659
|
+
assertEquals(result.reason.keyId, keyId);
|
|
2660
|
+
assert("error" in result.reason.result);
|
|
2661
|
+
const error = result.reason.result.error;
|
|
2662
|
+
assert(error instanceof FetchError);
|
|
2663
|
+
assertEquals(error.response, void 0);
|
|
2664
|
+
assert(error.cause instanceof DOMException);
|
|
2665
|
+
assertEquals(error.cause.name, "TimeoutError");
|
|
2666
|
+
assertEquals(requests, 1);
|
|
2667
|
+
const cached = await verifyRequestDetailed(await sign(), {
|
|
2668
|
+
contextLoader: mockDocumentLoader,
|
|
2669
|
+
documentLoader,
|
|
2670
|
+
keyCache: new KvKeyCache(kv, ["pk"])
|
|
2671
|
+
});
|
|
2672
|
+
assertFalse(cached.verified);
|
|
2673
|
+
assert(cached.reason.type === "keyFetchError");
|
|
2674
|
+
assert("error" in cached.reason.result);
|
|
2675
|
+
assertEquals(cached.reason.result.error.name, "FetchError");
|
|
2676
|
+
assertStringIncludes(cached.reason.result.error.message, "Timed out after 100 ms");
|
|
2677
|
+
assertEquals(requests, 1);
|
|
2678
|
+
} finally {
|
|
2679
|
+
esm_default.hardReset();
|
|
2680
|
+
}
|
|
2681
|
+
});
|
|
2682
|
+
});
|
|
2211
2683
|
//#endregion
|
|
2212
2684
|
export {};
|
|
@@ -5,8 +5,8 @@ import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
|
5
5
|
import { t as assertFalse } from "../assert_false-CPdRnc3E.mjs";
|
|
6
6
|
import "../std__assert-DvMDRPes.mjs";
|
|
7
7
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
8
|
-
import {
|
|
9
|
-
import { a as promoteKeyOwnerEvidence, i as parseKeyOwnerEvidence, n as attachKeyOwnerEvidence, r as getVerifiedKeyOwnerEvidence } from "../key-owner-evidence-
|
|
8
|
+
import { n as getCanonicalPortableId } from "../portable-key-id-Ca30-hOa.mjs";
|
|
9
|
+
import { a as promoteKeyOwnerEvidence, i as parseKeyOwnerEvidence, n as attachKeyOwnerEvidence, r as getVerifiedKeyOwnerEvidence } from "../key-owner-evidence-APB6NpSk.mjs";
|
|
10
10
|
import { r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
11
11
|
import { CryptographicKey, Person } from "@fedify/vocab";
|
|
12
12
|
import { test } from "@fedify/fixture";
|
package/dist/sig/key.test.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { t as assertThrows } from "../assert_throws-BYITOvPO.mjs";
|
|
|
6
6
|
import "../std__assert-DvMDRPes.mjs";
|
|
7
7
|
import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
8
8
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
9
|
-
import { a as fetchKeyDetailed, c as validateCryptoKey, i as fetchKey, n as exportJwk, o as generateCryptoKeyPair, s as importJwk } from "../key-
|
|
9
|
+
import { a as fetchKeyDetailed, c as validateCryptoKey, i as fetchKey, n as exportJwk, o as generateCryptoKeyPair, s as importJwk } from "../key-DyXf88bq.mjs";
|
|
10
10
|
import { c as rsaPublicKey3, i as rsaPrivateKey2, o as rsaPublicKey1, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
11
11
|
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
12
12
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
package/dist/sig/ld.test.mjs
CHANGED
|
@@ -8,8 +8,8 @@ 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 { o as generateCryptoKeyPair } from "../key-
|
|
12
|
-
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-
|
|
11
|
+
import { o as generateCryptoKeyPair } from "../key-DyXf88bq.mjs";
|
|
12
|
+
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-oQj6j_hP.mjs";
|
|
13
13
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
14
14
|
import { CryptographicKey } from "@fedify/vocab";
|
|
15
15
|
import { createTestMeterProvider, 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-CCr2_ipG.cjs");
|
|
4
|
+
const require_portable_collection = require("../portable-collection-DJe_bk50.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 { 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-BrwKINQn.cjs";
|
|
3
3
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-BF0L9cMt.cjs";
|
|
4
|
-
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "../mod-
|
|
4
|
+
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "../mod-DHTuu3l8.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 { 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-DGx0KOws.js";
|
|
3
3
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-BSzr5-I8.js";
|
|
4
|
-
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "../mod
|
|
4
|
+
import { C as createSignature, D as verifyJsonLd, E as signJsonLd, O as verifySignature, S as attachSignature, T as hasSignatureLike, _ as verifyProof, a as CreateProofOptions, b as VerifyJsonLdOptions, c as VerifyPortableObjectProofFailureReason, d as VerifyProofOptions, f as createProof, g as verifyPortableObjectProof, h as verifyObject, i as verifyPortableObject, l as VerifyPortableObjectProofOptions, m as signObject, n as VerifyPortableObjectOptions, o as SignObjectOptions, p as hasProofLike, r as VerifyPortableObjectResult, s as VerifyObjectOptions, t as VerifyPortableObjectFailureReason, u as VerifyPortableObjectProofResult, v as CreateSignatureOptions, w as detachSignature, x as VerifySignatureOptions, y as SignJsonLdOptions } from "../mod-Ck9_lSJB.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 };
|
package/dist/sig/mod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Temporal } from "temporal-polyfill";
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
|
-
import {
|
|
4
|
-
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "../portable-collection-
|
|
3
|
+
import { D as createSignature, H as fetchKeyDetailed, I as verifyJsonLd, L as verifySignature, O as detachSignature, P as signJsonLd, T as attachSignature, U as generateCryptoKeyPair, V as fetchKey, W as importJwk, _ as verifyObject, _t as validateAcceptSignature, a as signRequest, c as verifyRequestDetailed, gt as parseAcceptSignature, h as signObject, ht as fulfillAcceptSignature, j as hasSignatureLike, m as hasProofLike, mt as formatAcceptSignature, p as createProof, s as verifyRequest, v as verifyPortableObjectProof, x as verifyProof, z as exportJwk } from "../http-BqN5kyUf.js";
|
|
4
|
+
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "../portable-collection-BEqLrMW3.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, verifyPortableObject, verifyPortableObjectProof, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|