@fedify/fedify 2.5.0-dev.2364 → 2.5.0-dev.2378
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-ClDm_1c7.mjs → builder-J1K0IJj6.mjs} +2 -2
- 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-D03g5HXz.mjs → compound-proof-DtmVrMV7.mjs} +47 -19
- package/dist/{context-tsYPJ2Ew.d.cts → context-BjD_CTxh.d.cts} +1 -1
- package/dist/{context-7NyiqIcg.d.ts → context-C2-UDo2c.d.ts} +1 -1
- package/dist/{deno-Bp8q024B.mjs → deno-Ci6tSK9-.mjs} +1 -1
- package/dist/{docloader-DarxdYmj.mjs → docloader-DZ9h6KJS.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -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 +4 -5
- package/dist/federation/hashlink-media.test.mjs +2 -2
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox-report.test.mjs +5 -5
- package/dist/federation/metrics.test.mjs +1 -1
- package/dist/federation/middleware.test.mjs +7 -7
- 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/outgoing-proof.test.mjs +4 -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-delivery.test.mjs +2 -2
- package/dist/federation/portable-gateway-keys.test.mjs +4 -4
- 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 +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-BW53Wxj7.cjs → federation-lzy7M3hT.cjs} +48 -20
- package/dist/{http-D6JDnBO1.mjs → http-CFyizTHa.mjs} +4 -4
- package/dist/{http-Cg5Yj_yk.js → http-Cmz7x6Iw.js} +151 -19
- package/dist/{http-Btzv2JZU.cjs → http-D1RPHoq3.cjs} +161 -17
- package/dist/{key-DYxuyd-s.d.cts → key-DhsBxxZN.d.ts} +6 -2
- package/dist/{key-C1nv7_jD.d.ts → key-nYGY4QB9.d.cts} +6 -2
- package/dist/{kv-cache-CamfvHLY.js → kv-cache-C0-HuvwP.js} +1 -1
- package/dist/{kv-cache-0qHe-sN1.cjs → kv-cache-Jym5nP3J.cjs} +1 -1
- package/dist/{kv-cache-BoekCvYF.mjs → kv-cache-rOQX3I3c.mjs} +1 -1
- package/dist/{key-R5cUSA6S.mjs → ld-DJ--ZUpr.mjs} +760 -16
- package/dist/{metrics-DUdlIyrB.mjs → metrics-Dwgav7s_.mjs} +1 -1
- package/dist/{middleware-Hl0lTClT.mjs → middleware-BbBsa5iR.mjs} +13 -14
- package/dist/{middleware-DLB1TqQ1.mjs → middleware-CJWxuUy5.mjs} +1 -1
- package/dist/{middleware-BYOXwJvI.js → middleware-CqgRIsWM.js} +48 -20
- package/dist/{mod-Dw-nPxQh.d.cts → mod-B5-wdzmJ.d.cts} +1 -1
- package/dist/{mod-BojP2Bw3.d.cts → mod-BBPd4M_0.d.cts} +1 -1
- package/dist/{mod-CtpF2BU5.d.ts → mod-BRpER-B0.d.ts} +1 -1
- package/dist/{mod-Xj5P4s4d.d.ts → mod-CUYBGKof.d.ts} +1 -1
- package/dist/{mod-DEZXwV6J.d.ts → mod-DkhfZC1u.d.ts} +1 -1
- package/dist/{mod-CavhAgLw.d.cts → mod-xAfaLS4T.d.cts} +1 -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-CKHKMnp-.mjs → owner-Btd7SwMj.mjs} +3 -3
- package/dist/{portable-collection-CyTnj1m9.cjs → portable-collection-BvWxS1sL.cjs} +1 -1
- package/dist/{portable-collection-Dhg0By3t.js → portable-collection-DwQT28O2.js} +1 -1
- package/dist/{portable-collection-DxVKitQN.mjs → portable-collection-gb9V8XEO.mjs} +2 -2
- package/dist/{portable-key-BOBhrrKN.mjs → portable-key-Cwti99nP.mjs} +1 -1
- package/dist/{proof-BGyUYuOb.mjs → proof-Bwzv6mXZ.mjs} +44 -11
- package/dist/{send-DmlYxKmb.mjs → send-BrQYUSb4.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 +168 -2
- package/dist/sig/compound-proof.test.mjs +2 -2
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +208 -3
- package/dist/sig/ld.test.mjs +1 -2
- 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 +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-interop.test.mjs +3 -3
- package/dist/sig/portable-key.test.mjs +5 -6
- package/dist/sig/proof.test.mjs +3 -3
- 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-Bvota1RR.mjs → temporal-BRaCTxVe.mjs} +1 -1
- package/dist/testing/kv.test.mjs +1 -1
- package/dist/testing/mod.d.mts +5 -1
- package/dist/utils/docloader.test.mjs +2 -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/ld-B6RQHcnq.mjs +0 -658
|
@@ -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 {
|
|
7
|
+
import { s as verifyMapLocalProof, u as verifyPortableObjectProofPolicy } from "../proof-Bwzv6mXZ.mjs";
|
|
8
8
|
import { n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
9
|
-
import { a as inspectCompoundPortableObjectApplicability, o as verifyCompoundPortableObjectProofs, s as verifyCompoundProofDocuments, t as containsCompoundPortableObject } from "../compound-proof-
|
|
9
|
+
import { a as inspectCompoundPortableObjectApplicability, o as verifyCompoundPortableObjectProofs, s as verifyCompoundProofDocuments, t as containsCompoundPortableObject } from "../compound-proof-DtmVrMV7.mjs";
|
|
10
10
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
11
11
|
import { t as map_local_context_conflict_default } from "../map-local-context-conflict-DOYEEJ3u.mjs";
|
|
12
12
|
import { CryptographicKey, Multikey, Person } from "@fedify/vocab";
|
|
@@ -829,5 +829,171 @@ test("compound proof observation does not throw for malformed subject IDs", asyn
|
|
|
829
829
|
assertEquals(evidence.attempts[0].subject.id, null);
|
|
830
830
|
assertEquals(evidence.attempts[0].subject.pointer, "");
|
|
831
831
|
});
|
|
832
|
+
test("compound portable policy rejects actor gateways before key work", async () => {
|
|
833
|
+
const { verificationObservation } = await import("../verification-C3954hQh.mjs");
|
|
834
|
+
for (const gateways of [
|
|
835
|
+
void 0,
|
|
836
|
+
[],
|
|
837
|
+
["https://gw.example/path"],
|
|
838
|
+
["https://gw.example"]
|
|
839
|
+
]) {
|
|
840
|
+
const inner = await secureRawDocument({
|
|
841
|
+
"@context": ["https://www.w3.org/ns/activitystreams", "https://w3id.org/security/data-integrity/v1"],
|
|
842
|
+
id: map_local_create_note_default.documents.innerUnsecuredDocument.id,
|
|
843
|
+
type: "Person",
|
|
844
|
+
inbox: "https://inner.example/inbox",
|
|
845
|
+
outbox: "https://inner.example/outbox",
|
|
846
|
+
...gateways === void 0 ? {} : { gateways }
|
|
847
|
+
}, map_local_create_note_default.keys.inner.testPrivateKeyJwk, map_local_create_note_default.keys.inner.verificationMethod);
|
|
848
|
+
const outer = await secureRawDocument({
|
|
849
|
+
...map_local_create_note_default.documents.outerUnsecuredDocument,
|
|
850
|
+
object: inner
|
|
851
|
+
}, map_local_create_note_default.keys.outer.testPrivateKeyJwk, map_local_create_note_default.keys.outer.verificationMethod);
|
|
852
|
+
const reads = [];
|
|
853
|
+
const evidence = { attempts: [] };
|
|
854
|
+
const result = await verifyCompoundPortableObjectProofs(outer, limits, {
|
|
855
|
+
...options,
|
|
856
|
+
keyCache: {
|
|
857
|
+
get(id) {
|
|
858
|
+
reads.push(id.href);
|
|
859
|
+
return Promise.resolve(void 0);
|
|
860
|
+
},
|
|
861
|
+
async set() {}
|
|
862
|
+
},
|
|
863
|
+
[verificationObservation]: evidence
|
|
864
|
+
});
|
|
865
|
+
assert(result.status === "ok");
|
|
866
|
+
const valid = gateways?.[0] === "https://gw.example";
|
|
867
|
+
assertEquals(result.verified, valid);
|
|
868
|
+
assertEquals(reads.sort(), (valid ? [map_local_create_note_default.keys.inner.verificationMethod, map_local_create_note_default.keys.outer.verificationMethod] : [map_local_create_note_default.keys.outer.verificationMethod]).sort());
|
|
869
|
+
assertEquals(result.proofs.map((p) => [p.path, p.verified]), [["/object", valid], ["", true]]);
|
|
870
|
+
assertEquals(result.snapshot, outer);
|
|
871
|
+
assert(Object.isFrozen(result.snapshot));
|
|
872
|
+
assert(Object.isFrozen(result.proofs));
|
|
873
|
+
assert(Object.isFrozen(result.portableObjects));
|
|
874
|
+
const child = result.portableObjects[0];
|
|
875
|
+
if (!valid) {
|
|
876
|
+
assert(!child.verified);
|
|
877
|
+
assertEquals(child.reason.type, "invalidGateways");
|
|
878
|
+
assertEquals(result.proofs[0], {
|
|
879
|
+
path: "/object",
|
|
880
|
+
id: map_local_create_note_default.documents.innerUnsecuredDocument.id,
|
|
881
|
+
depth: 1,
|
|
882
|
+
verified: false,
|
|
883
|
+
reason: { type: "invalidProof" }
|
|
884
|
+
});
|
|
885
|
+
const attempt = evidence.attempts.find((a) => a.subject.pointer === "/object");
|
|
886
|
+
assert(attempt?.status === "rejected");
|
|
887
|
+
assertEquals(attempt.reason, {
|
|
888
|
+
type: "proofPolicy",
|
|
889
|
+
reason: { type: "invalidGateways" }
|
|
890
|
+
});
|
|
891
|
+
assertEquals(attempt.checks, []);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
test("compound portable policy skips doomed proofs without pruning parents", async () => {
|
|
896
|
+
const context = createInlineProofContext();
|
|
897
|
+
const scoped = createInlineProofContext();
|
|
898
|
+
scoped.proof = {
|
|
899
|
+
"@id": "https://w3id.org/security#proof",
|
|
900
|
+
"@context": { assertionMethod: "https://w3id.org/security#authentication" }
|
|
901
|
+
};
|
|
902
|
+
const cases = [
|
|
903
|
+
{
|
|
904
|
+
id: map_local_create_note_default.documents.outerUnsecuredDocument.id,
|
|
905
|
+
type: "Note",
|
|
906
|
+
method: map_local_create_note_default.keys.inner.verificationMethod,
|
|
907
|
+
context,
|
|
908
|
+
reason: "verificationMethodMismatch"
|
|
909
|
+
},
|
|
910
|
+
{
|
|
911
|
+
id: map_local_create_note_default.documents.innerUnsecuredDocument.id,
|
|
912
|
+
type: "Note",
|
|
913
|
+
method: "https://attacker.example/key",
|
|
914
|
+
context,
|
|
915
|
+
reason: "unsupportedVerificationMethod"
|
|
916
|
+
},
|
|
917
|
+
{
|
|
918
|
+
id: "ap://did%ZZkey/objects/1",
|
|
919
|
+
type: "Note",
|
|
920
|
+
method: map_local_create_note_default.keys.inner.verificationMethod,
|
|
921
|
+
context,
|
|
922
|
+
reason: "invalidPortableObject"
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
id: map_local_create_note_default.documents.innerUnsecuredDocument.id,
|
|
926
|
+
type: "Link",
|
|
927
|
+
method: map_local_create_note_default.keys.inner.verificationMethod,
|
|
928
|
+
context: {
|
|
929
|
+
...context,
|
|
930
|
+
Link: "https://www.w3.org/ns/activitystreams#Link",
|
|
931
|
+
href: {
|
|
932
|
+
"@id": "https://www.w3.org/ns/activitystreams#href",
|
|
933
|
+
"@type": "@id"
|
|
934
|
+
}
|
|
935
|
+
},
|
|
936
|
+
extra: { href: "https://example.com/resource" },
|
|
937
|
+
reason: "unsupportedObjectType"
|
|
938
|
+
},
|
|
939
|
+
{
|
|
940
|
+
id: map_local_create_note_default.documents.innerUnsecuredDocument.id,
|
|
941
|
+
type: "Note",
|
|
942
|
+
method: map_local_create_note_default.keys.inner.verificationMethod,
|
|
943
|
+
context: scoped,
|
|
944
|
+
reason: "invalidProof"
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
id: map_local_create_note_default.documents.innerUnsecuredDocument.id,
|
|
948
|
+
type: "Note",
|
|
949
|
+
method: map_local_create_note_default.keys.inner.verificationMethod,
|
|
950
|
+
context,
|
|
951
|
+
extra: { "@id": "https://example.com/ordinary" },
|
|
952
|
+
reason: "notPortableObject"
|
|
953
|
+
}
|
|
954
|
+
];
|
|
955
|
+
for (const candidate of cases) {
|
|
956
|
+
const child = await secureRawDocument({
|
|
957
|
+
"@context": candidate.context,
|
|
958
|
+
id: candidate.id,
|
|
959
|
+
type: candidate.type,
|
|
960
|
+
...candidate.extra,
|
|
961
|
+
content: "Rejected attachment"
|
|
962
|
+
}, map_local_create_note_default.keys.inner.testPrivateKeyJwk, candidate.method);
|
|
963
|
+
if (candidate.context === scoped) delete asRecord(child.proof)["@context"];
|
|
964
|
+
const parent = {
|
|
965
|
+
...map_local_create_note_default.documents.outerUnsecuredDocument,
|
|
966
|
+
id: "https://social.example/activities/1",
|
|
967
|
+
attachment: [child]
|
|
968
|
+
};
|
|
969
|
+
delete parent.object;
|
|
970
|
+
const outer = await secureRawDocument(parent, map_local_create_note_default.keys.outer.testPrivateKeyJwk, map_local_create_note_default.keys.outer.verificationMethod);
|
|
971
|
+
const reads = [];
|
|
972
|
+
let loads = 0;
|
|
973
|
+
const result = await verifyCompoundPortableObjectProofs(outer, limits, {
|
|
974
|
+
...options,
|
|
975
|
+
documentLoader() {
|
|
976
|
+
loads++;
|
|
977
|
+
throw new TypeError("unexpected key fetch");
|
|
978
|
+
},
|
|
979
|
+
keyCache: {
|
|
980
|
+
get(id) {
|
|
981
|
+
reads.push(id.href);
|
|
982
|
+
return Promise.resolve(void 0);
|
|
983
|
+
},
|
|
984
|
+
async set() {}
|
|
985
|
+
}
|
|
986
|
+
});
|
|
987
|
+
assert(result.status === "ok");
|
|
988
|
+
assertEquals(result.verified, false);
|
|
989
|
+
assertEquals(reads, [map_local_create_note_default.keys.outer.verificationMethod]);
|
|
990
|
+
assertEquals(loads, 0);
|
|
991
|
+
assertEquals(result.proofs.map((p) => [p.path, p.verified]), [["/attachment/0", false], ["", true]]);
|
|
992
|
+
const [rejected] = result.portableObjects;
|
|
993
|
+
assert(!rejected.verified);
|
|
994
|
+
assertEquals(rejected.reason.type, candidate.reason);
|
|
995
|
+
assertEquals(rejected.path, "/attachment/0");
|
|
996
|
+
}
|
|
997
|
+
});
|
|
832
998
|
//#endregion
|
|
833
999
|
export {};
|
|
@@ -6,9 +6,9 @@ import "../std__assert-DvMDRPes.mjs";
|
|
|
6
6
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
7
7
|
import { n as preloadedOnlyDocumentLoader } from "../public-audience--klBIOk1.mjs";
|
|
8
8
|
import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-4IJqPYos.mjs";
|
|
9
|
-
import {
|
|
9
|
+
import { o as signObject, p as verifyProof } from "../proof-Bwzv6mXZ.mjs";
|
|
10
10
|
import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
|
|
11
|
-
import { s as verifyCompoundProofDocuments } from "../compound-proof-
|
|
11
|
+
import { s as verifyCompoundProofDocuments } from "../compound-proof-DtmVrMV7.mjs";
|
|
12
12
|
import { t as map_local_create_note_default } from "../map-local-create-note-B0SeXJms.mjs";
|
|
13
13
|
import { t as map_local_context_conflict_default } from "../map-local-context-conflict-DOYEEJ3u.mjs";
|
|
14
14
|
import { Create, DataIntegrityProof, Note, Question } from "@fedify/vocab";
|
package/dist/sig/http.test.mjs
CHANGED
|
@@ -12,8 +12,8 @@ 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 {
|
|
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-
|
|
15
|
+
import { y as exportJwk } from "../ld-DJ--ZUpr.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-CFyizTHa.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-D-MNltOk.mjs";
|
|
19
19
|
import { FetchError, UrlError, exportSpki, getDocumentLoader } from "@fedify/vocab-runtime";
|
package/dist/sig/key.test.mjs
CHANGED
|
@@ -5,11 +5,12 @@ import { t as assertEquals } from "../assert_equals-Z6IcEbWU.mjs";
|
|
|
5
5
|
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
|
+
import { t as assertStrictEquals } from "../assert_strict_equals-CYvBmkpC.mjs";
|
|
8
9
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
9
|
-
import {
|
|
10
|
+
import { C as generateCryptoKeyPair, S as fetchKeyDetailed, T as validateCryptoKey, _ as wrapContextLoaderForJsonLd, w as importJwk, x as fetchKey, y as exportJwk } from "../ld-DJ--ZUpr.mjs";
|
|
10
11
|
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
|
-
import { CryptographicKey, Multikey } from "@fedify/vocab";
|
|
12
|
-
import { FetchError, exportDidKey } from "@fedify/vocab-runtime";
|
|
12
|
+
import { CryptographicKey, Multikey, Person } from "@fedify/vocab";
|
|
13
|
+
import { FetchError, UrlError, exportDidKey, getDocumentLoader } from "@fedify/vocab-runtime";
|
|
13
14
|
import { createTestMeterProvider, createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
14
15
|
//#region src/sig/key.test.ts
|
|
15
16
|
test("validateCryptoKey()", async () => {
|
|
@@ -680,6 +681,210 @@ test("fetchKey() returns null for a malformed actor publicKey", async () => {
|
|
|
680
681
|
cached: true
|
|
681
682
|
});
|
|
682
683
|
});
|
|
684
|
+
for (const cls of [CryptographicKey, Multikey]) for (const location of [
|
|
685
|
+
"actor",
|
|
686
|
+
"key",
|
|
687
|
+
"owner"
|
|
688
|
+
]) test(`fetchKey() handles JSON-LD context failures in ${cls.name} ${location} documents`, async (t) => {
|
|
689
|
+
const actorId = new URL("https://example.com/context-actor");
|
|
690
|
+
const keyId = new URL(`${actorId.href}#key`);
|
|
691
|
+
const key = cls === CryptographicKey ? rsaPublicKey1.clone({
|
|
692
|
+
id: keyId,
|
|
693
|
+
owner: actorId
|
|
694
|
+
}) : ed25519Multikey.clone({
|
|
695
|
+
id: keyId,
|
|
696
|
+
controller: actorId
|
|
697
|
+
});
|
|
698
|
+
const actorDocument = await new Person({
|
|
699
|
+
id: actorId,
|
|
700
|
+
...key instanceof CryptographicKey ? { publicKeys: [key] } : { assertionMethods: [key] }
|
|
701
|
+
}).toJsonLd({ contextLoader: mockDocumentLoader });
|
|
702
|
+
const keyDocument = await key.toJsonLd({ contextLoader: mockDocumentLoader });
|
|
703
|
+
const contextUrl = `https://example.com/context/${cls.name}/${location}`;
|
|
704
|
+
const transportErrors = [
|
|
705
|
+
/* @__PURE__ */ new TypeError("fetch failed"),
|
|
706
|
+
/* @__PURE__ */ new TypeError("error reading a body from connection"),
|
|
707
|
+
globalThis.Object.assign(/* @__PURE__ */ new TypeError("The socket connection was closed unexpectedly."), { code: "ECONNRESET" }),
|
|
708
|
+
globalThis.Object.assign(/* @__PURE__ */ new TypeError("Network request failed"), { code: "ECONNRESET" }),
|
|
709
|
+
new TypeError("Network request failed", { cause: globalThis.Object.assign(/* @__PURE__ */ new Error("connection refused"), { code: "ECONNREFUSED" }) }),
|
|
710
|
+
new FetchError(contextUrl, "HTTP 503"),
|
|
711
|
+
new FetchError(contextUrl, "HTTP 503", new Response("unavailable", { status: 503 })),
|
|
712
|
+
new UrlError("DNS lookup failed", { reason: "dns" }),
|
|
713
|
+
globalThis.Object.assign(/* @__PURE__ */ new Error("request aborted"), { name: "AbortError" })
|
|
714
|
+
];
|
|
715
|
+
const programmingErrors = [
|
|
716
|
+
/* @__PURE__ */ new Error("loader bug"),
|
|
717
|
+
/* @__PURE__ */ new ReferenceError("loader bug"),
|
|
718
|
+
/* @__PURE__ */ new TypeError("loader bug"),
|
|
719
|
+
"loader bug",
|
|
720
|
+
null,
|
|
721
|
+
void 0
|
|
722
|
+
];
|
|
723
|
+
const cases = [
|
|
724
|
+
{ kind: "inline" },
|
|
725
|
+
{
|
|
726
|
+
kind: "url",
|
|
727
|
+
wrapped: false
|
|
728
|
+
},
|
|
729
|
+
{
|
|
730
|
+
kind: "url",
|
|
731
|
+
wrapped: true
|
|
732
|
+
},
|
|
733
|
+
{
|
|
734
|
+
kind: "wrapped",
|
|
735
|
+
error: /* @__PURE__ */ new TypeError("Invalid URL string.")
|
|
736
|
+
},
|
|
737
|
+
{
|
|
738
|
+
kind: "remote",
|
|
739
|
+
document: 123
|
|
740
|
+
},
|
|
741
|
+
{
|
|
742
|
+
kind: "remote",
|
|
743
|
+
document: "not JSON"
|
|
744
|
+
},
|
|
745
|
+
{
|
|
746
|
+
kind: "remote",
|
|
747
|
+
document: { "@context": contextUrl }
|
|
748
|
+
},
|
|
749
|
+
...transportErrors.map((error) => ({
|
|
750
|
+
kind: "transport",
|
|
751
|
+
error
|
|
752
|
+
})),
|
|
753
|
+
...programmingErrors.map((error) => ({
|
|
754
|
+
kind: "programming",
|
|
755
|
+
error
|
|
756
|
+
})),
|
|
757
|
+
...location === "key" ? [{
|
|
758
|
+
kind: "transport",
|
|
759
|
+
error: /* @__PURE__ */ new TypeError("fetch failed"),
|
|
760
|
+
fallback: true
|
|
761
|
+
}, {
|
|
762
|
+
kind: "programming",
|
|
763
|
+
error: /* @__PURE__ */ new ReferenceError("fallback bug"),
|
|
764
|
+
fallback: true
|
|
765
|
+
}] : []
|
|
766
|
+
];
|
|
767
|
+
for (const scenario of cases) {
|
|
768
|
+
const description = "error" in scenario ? scenario.error instanceof Error ? `${scenario.error.name}: ${scenario.error.message}` : String(scenario.error) : "document" in scenario ? JSON.stringify(scenario.document) : "invalid type mapping";
|
|
769
|
+
await t.step(`${scenario.kind}: ${description}${"fallback" in scenario ? " (fallback)" : ""}`, async () => {
|
|
770
|
+
const cache = {};
|
|
771
|
+
let fetchError = { error: /* @__PURE__ */ new Error("stale fetch error") };
|
|
772
|
+
const [meterProvider, recorder] = createTestMeterProvider();
|
|
773
|
+
let recovered = false;
|
|
774
|
+
let contextLoads = 0;
|
|
775
|
+
const options = {
|
|
776
|
+
meterProvider,
|
|
777
|
+
documentLoader(resource) {
|
|
778
|
+
const document = structuredClone(resource === keyId.href && location !== "actor" ? keyDocument : actorDocument);
|
|
779
|
+
if (location === "actor" || location === "key" && resource === keyId.href || location === "owner" && resource === actorId.href) {
|
|
780
|
+
const context = scenario.kind === "inline" ? { broken: {
|
|
781
|
+
"@id": "https://example.com/ns#broken",
|
|
782
|
+
"@type": "not-an-absolute-iri"
|
|
783
|
+
} } : scenario.kind === "url" ? "http://[" : contextUrl;
|
|
784
|
+
document["@context"] = [document["@context"], context].flat();
|
|
785
|
+
}
|
|
786
|
+
return Promise.resolve({
|
|
787
|
+
contextUrl: null,
|
|
788
|
+
documentUrl: resource,
|
|
789
|
+
document
|
|
790
|
+
});
|
|
791
|
+
},
|
|
792
|
+
async contextLoader(resource) {
|
|
793
|
+
if (scenario.kind === "url" && resource === "http://[") {
|
|
794
|
+
const loader = getDocumentLoader();
|
|
795
|
+
return await (scenario.wrapped ? wrapContextLoaderForJsonLd(loader) : loader)(resource);
|
|
796
|
+
}
|
|
797
|
+
if (scenario.kind === "wrapped" && resource === contextUrl) return await wrapContextLoaderForJsonLd(() => Promise.reject(scenario.error))(resource);
|
|
798
|
+
if (resource !== contextUrl) return await mockDocumentLoader(resource);
|
|
799
|
+
contextLoads++;
|
|
800
|
+
if (!recovered && "error" in scenario && (!("fallback" in scenario) || contextLoads > 1)) throw scenario.error;
|
|
801
|
+
return {
|
|
802
|
+
contextUrl: null,
|
|
803
|
+
documentUrl: resource,
|
|
804
|
+
document: !recovered && "document" in scenario ? scenario.document : { "@context": {} }
|
|
805
|
+
};
|
|
806
|
+
},
|
|
807
|
+
keyCache: {
|
|
808
|
+
get: (id) => Promise.resolve(cache[id.href]),
|
|
809
|
+
set(id, value) {
|
|
810
|
+
cache[id.href] = value;
|
|
811
|
+
return Promise.resolve();
|
|
812
|
+
},
|
|
813
|
+
getFetchError: () => Promise.resolve(fetchError),
|
|
814
|
+
setFetchError(_id, error) {
|
|
815
|
+
fetchError = error ?? void 0;
|
|
816
|
+
return Promise.resolve();
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
};
|
|
820
|
+
const lookup = () => fetchKey(keyId, cls, options);
|
|
821
|
+
if (scenario.kind === "programming" && "error" in scenario) {
|
|
822
|
+
assertStrictEquals(await assertRejects(lookup), scenario.error);
|
|
823
|
+
assertEquals(cache, {});
|
|
824
|
+
assertStrictEquals(await assertRejects(() => fetchKeyDetailed(keyId, cls, options)), scenario.error);
|
|
825
|
+
assertEquals(cache, {});
|
|
826
|
+
return;
|
|
827
|
+
}
|
|
828
|
+
assertEquals(await lookup(), {
|
|
829
|
+
key: null,
|
|
830
|
+
cached: false
|
|
831
|
+
});
|
|
832
|
+
if (scenario.kind === "transport") {
|
|
833
|
+
const counter = recorder.getMeasurement("activitypub.key.lookup");
|
|
834
|
+
const duration = recorder.getMeasurement("activitypub.key.lookup.duration");
|
|
835
|
+
const status = scenario.error instanceof FetchError ? scenario.error.response?.status : void 0;
|
|
836
|
+
const expected = status != null ? "error" : scenario.error instanceof TypeError || scenario.error instanceof FetchError || scenario.error instanceof Error && scenario.error.name === "AbortError" ? "network_error" : "error";
|
|
837
|
+
assertEquals(counter?.attributes["activitypub.lookup.result"], expected);
|
|
838
|
+
assertEquals(duration?.attributes["activitypub.lookup.result"], expected);
|
|
839
|
+
assertEquals(counter?.attributes["http.response.status_code"], status);
|
|
840
|
+
}
|
|
841
|
+
assertEquals(cache, { [keyId.href]: null });
|
|
842
|
+
const detailed = await fetchKeyDetailed(keyId, cls, options);
|
|
843
|
+
assertEquals(detailed.cached, true);
|
|
844
|
+
if (scenario.kind === "transport" || scenario.kind === "wrapped") {
|
|
845
|
+
assert(detailed.fetchError != null);
|
|
846
|
+
if (scenario.error instanceof FetchError && scenario.error.response != null) {
|
|
847
|
+
assert("status" in detailed.fetchError);
|
|
848
|
+
assertEquals(detailed.fetchError.status, 503);
|
|
849
|
+
assertEquals(await detailed.fetchError.response.text(), "unavailable");
|
|
850
|
+
} else {
|
|
851
|
+
assert("error" in detailed.fetchError);
|
|
852
|
+
assertStrictEquals(detailed.fetchError.error, scenario.error);
|
|
853
|
+
}
|
|
854
|
+
} else assertEquals(detailed.fetchError, void 0);
|
|
855
|
+
const previousLoads = contextLoads;
|
|
856
|
+
assertEquals(await lookup(), {
|
|
857
|
+
key: null,
|
|
858
|
+
cached: true
|
|
859
|
+
});
|
|
860
|
+
assertEquals(contextLoads, previousLoads);
|
|
861
|
+
delete cache[keyId.href];
|
|
862
|
+
fetchError = void 0;
|
|
863
|
+
const fresh = await fetchKeyDetailed(keyId, cls, options);
|
|
864
|
+
assertEquals(fresh.cached, false);
|
|
865
|
+
assertEquals(fresh.key, null);
|
|
866
|
+
if (scenario.kind === "transport" || scenario.kind === "wrapped") {
|
|
867
|
+
assert(fresh.fetchError != null);
|
|
868
|
+
if (scenario.error instanceof FetchError && scenario.error.response != null) {
|
|
869
|
+
assert("status" in fresh.fetchError);
|
|
870
|
+
assertEquals(fresh.fetchError.status, 503);
|
|
871
|
+
assertEquals(await fresh.fetchError.response.text(), "unavailable");
|
|
872
|
+
} else {
|
|
873
|
+
assert("error" in fresh.fetchError);
|
|
874
|
+
assertStrictEquals(fresh.fetchError.error, scenario.error);
|
|
875
|
+
}
|
|
876
|
+
} else assertEquals(fresh.fetchError, void 0);
|
|
877
|
+
if (scenario.kind === "transport") {
|
|
878
|
+
delete cache[keyId.href];
|
|
879
|
+
recovered = true;
|
|
880
|
+
const result = await lookup();
|
|
881
|
+
assertEquals(result.cached, false);
|
|
882
|
+
assertEquals(result.key?.id, keyId);
|
|
883
|
+
assert(result.key?.publicKey != null);
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
});
|
|
683
888
|
test("fetchKey() rejects a key whose owner does not link back", async () => {
|
|
684
889
|
const keyId = "https://attacker.example/key";
|
|
685
890
|
const keyDocument = await rsaPublicKey1.toJsonLd({ contextLoader: mockDocumentLoader });
|
package/dist/sig/ld.test.mjs
CHANGED
|
@@ -8,8 +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 {
|
|
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-B6RQHcnq.mjs";
|
|
11
|
+
import { C as generateCryptoKeyPair, 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-DJ--ZUpr.mjs";
|
|
13
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";
|
|
14
13
|
import { CryptographicKey } from "@fedify/vocab";
|
|
15
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 {
|
|
9
|
-
import { p as verifyRequestDetailed } from "../http-
|
|
10
|
-
import { o as createFederation } from "../middleware-
|
|
11
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
8
|
+
import { l as verifyPortableObjectProof } from "../proof-Bwzv6mXZ.mjs";
|
|
9
|
+
import { p as verifyRequestDetailed } from "../http-CFyizTHa.mjs";
|
|
10
|
+
import { o as createFederation } from "../middleware-BbBsa5iR.mjs";
|
|
11
|
+
import { t as doesActorOwnKey } from "../owner-Btd7SwMj.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 {
|
|
8
|
-
import { p as verifyRequestDetailed } from "../http-
|
|
9
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
7
|
+
import { l as verifyPortableObjectProof } from "../proof-Bwzv6mXZ.mjs";
|
|
8
|
+
import { p as verifyRequestDetailed } from "../http-CFyizTHa.mjs";
|
|
9
|
+
import { t as doesActorOwnKey } from "../owner-Btd7SwMj.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-D1RPHoq3.cjs");
|
|
4
|
+
const require_portable_collection = require("../portable-collection-BvWxS1sL.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-
|
|
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-nYGY4QB9.cjs";
|
|
3
3
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-BF0L9cMt.cjs";
|
|
4
|
-
import { a as CreateSignatureOptions, c as VerifySignatureOptions, d as detachSignature, f as hasSignatureLike, h as verifySignature, i as verifyPortableObject, l as attachSignature, m as verifyJsonLd, n as VerifyPortableObjectOptions, o as SignJsonLdOptions, p as signJsonLd, r as VerifyPortableObjectResult, s as VerifyJsonLdOptions, t as VerifyPortableObjectFailureReason, u as createSignature } from "../mod-
|
|
4
|
+
import { a as CreateSignatureOptions, c as VerifySignatureOptions, d as detachSignature, f as hasSignatureLike, h as verifySignature, i as verifyPortableObject, l as attachSignature, m as verifyJsonLd, n as VerifyPortableObjectOptions, o as SignJsonLdOptions, p as signJsonLd, r as VerifyPortableObjectResult, s as VerifyJsonLdOptions, t as VerifyPortableObjectFailureReason, u as createSignature } from "../mod-xAfaLS4T.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-
|
|
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-DhsBxxZN.js";
|
|
3
3
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-BSzr5-I8.js";
|
|
4
|
-
import { a as CreateSignatureOptions, c as VerifySignatureOptions, d as detachSignature, f as hasSignatureLike, h as verifySignature, i as verifyPortableObject, l as attachSignature, m as verifyJsonLd, n as VerifyPortableObjectOptions, o as SignJsonLdOptions, p as signJsonLd, r as VerifyPortableObjectResult, s as VerifyJsonLdOptions, t as VerifyPortableObjectFailureReason, u as createSignature } from "../mod-
|
|
4
|
+
import { a as CreateSignatureOptions, c as VerifySignatureOptions, d as detachSignature, f as hasSignatureLike, h as verifySignature, i as verifyPortableObject, l as attachSignature, m as verifyJsonLd, n as VerifyPortableObjectOptions, o as SignJsonLdOptions, p as signJsonLd, r as VerifyPortableObjectResult, s as VerifyJsonLdOptions, t as VerifyPortableObjectFailureReason, u as createSignature } from "../mod-BRpER-B0.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 { A as detachSignature, C as verifyProof, D as attachSignature, G as generateCryptoKeyPair, I as signJsonLd, K as importJwk, N as hasSignatureLike, R as verifyJsonLd, U as fetchKey, V as exportJwk, W as fetchKeyDetailed, _t as fulfillAcceptSignature, a as signRequest, c as verifyRequestDetailed, g as signObject, gt as formatAcceptSignature, k as createSignature, m as hasProofLike, p as createProof, s as verifyRequest, v as verifyObject, vt as parseAcceptSignature, y as verifyPortableObjectProof, yt as validateAcceptSignature, z as verifySignature } from "../http-Cmz7x6Iw.js";
|
|
4
|
+
import { n as doesActorOwnKey, r as getKeyOwner, t as verifyPortableObject } from "../portable-collection-DwQT28O2.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 };
|
package/dist/sig/owner.test.mjs
CHANGED
|
@@ -6,7 +6,7 @@ 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
8
|
import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
9
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-
|
|
9
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-Btd7SwMj.mjs";
|
|
10
10
|
import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
|
|
11
11
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
//#region src/sig/owner.test.ts
|
|
@@ -2,7 +2,7 @@ import "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { n as ed25519PrivateKey, r as ed25519PublicKey } from "../keys-DIJNHW-Y.mjs";
|
|
5
|
-
import { t as verifyPortableObject } from "../portable-collection-
|
|
5
|
+
import { t as verifyPortableObject } from "../portable-collection-gb9V8XEO.mjs";
|
|
6
6
|
import { Collection, CollectionPage, Note, OrderedCollection, Person, traverseCollection } from "@fedify/vocab";
|
|
7
7
|
import { FetchError, encodeMultibase, exportDidKey, preloadedContexts } from "@fedify/vocab-runtime";
|
|
8
8
|
import { 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 {
|
|
8
|
-
import { n as getKeyOwner } from "../owner-
|
|
9
|
-
import { t as verifyPortableObject } from "../portable-collection-
|
|
7
|
+
import { l as verifyPortableObjectProof, p as verifyProof } from "../proof-Bwzv6mXZ.mjs";
|
|
8
|
+
import { n as getKeyOwner } from "../owner-Btd7SwMj.mjs";
|
|
9
|
+
import { t as verifyPortableObject } from "../portable-collection-gb9V8XEO.mjs";
|
|
10
10
|
import { Application, DataIntegrityProof, lookupObject } from "@fedify/vocab";
|
|
11
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
//#region test-vectors/fep-ef61/tootik-v0.25.4/actor.json
|
|
@@ -2,13 +2,12 @@ import { Temporal } from "temporal-polyfill";
|
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as MemoryKvStore } from "../kv-DCHkaJ9-.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { f as verifyRequest, l as signRequest, p as verifyRequestDetailed } from "../http-D6JDnBO1.mjs";
|
|
5
|
+
import { S as fetchKeyDetailed, h as verifyJsonLd, p as signJsonLd, x as fetchKey } from "../ld-DJ--ZUpr.mjs";
|
|
6
|
+
import { p as verifyProof, r as createProof } from "../proof-Bwzv6mXZ.mjs";
|
|
7
|
+
import { n as resolvePortableActorKey } from "../portable-key-Cwti99nP.mjs";
|
|
8
|
+
import { f as verifyRequest, l as signRequest, p as verifyRequestDetailed } from "../http-CFyizTHa.mjs";
|
|
10
9
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2 } from "../keys-DIJNHW-Y.mjs";
|
|
11
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-
|
|
10
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-Btd7SwMj.mjs";
|
|
12
11
|
import { t as KvKeyCache } from "../keycache-D-MNltOk.mjs";
|
|
13
12
|
import { Create, CryptographicKey, Multikey, Note, Person } from "@fedify/vocab";
|
|
14
13
|
import { FetchError, encodeMultibase, exportDidKey, exportSpki, parseIri, preloadedContexts } from "@fedify/vocab-runtime";
|
package/dist/sig/proof.test.mjs
CHANGED
|
@@ -11,10 +11,10 @@ import { t as assertRejects } from "../assert_rejects-CTptdYck.mjs";
|
|
|
11
11
|
import { t as assert } from "../assert-D1Eafmd_.mjs";
|
|
12
12
|
import { a as verificationObservation } from "../verification-Dpfcw8ml.mjs";
|
|
13
13
|
import { r as normalizeOutgoingActivityJsonLd } from "../outgoing-jsonld-4IJqPYos.mjs";
|
|
14
|
-
import {
|
|
15
|
-
import { f as verifyRequest } from "../http-
|
|
14
|
+
import { c as verifyObject, i as hasProofLike, l as verifyPortableObjectProof, o as signObject, p as verifyProof, r as createProof, s as verifyMapLocalProof } from "../proof-Bwzv6mXZ.mjs";
|
|
15
|
+
import { f as verifyRequest } from "../http-CFyizTHa.mjs";
|
|
16
16
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-DIJNHW-Y.mjs";
|
|
17
|
-
import { t as getAuthenticatedDocumentLoader } from "../docloader-
|
|
17
|
+
import { t as getAuthenticatedDocumentLoader } from "../docloader-DZ9h6KJS.mjs";
|
|
18
18
|
import { Create, DataIntegrityProof, Document, Multikey, Note, PUBLIC_COLLECTION, Place, Translation } from "@fedify/vocab";
|
|
19
19
|
import { decodeMultibase, encodeMultibase, exportDidKey, exportMultibaseKey, formatIri, importMultibaseKey, parseIri } from "@fedify/vocab-runtime";
|
|
20
20
|
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 {
|
|
9
|
-
import { p as verifyRequestDetailed } from "../http-
|
|
10
|
-
import { o as createFederation } from "../middleware-
|
|
11
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
8
|
+
import { l as verifyPortableObjectProof } from "../proof-Bwzv6mXZ.mjs";
|
|
9
|
+
import { p as verifyRequestDetailed } from "../http-CFyizTHa.mjs";
|
|
10
|
+
import { o as createFederation } from "../middleware-BbBsa5iR.mjs";
|
|
11
|
+
import { t as doesActorOwnKey } from "../owner-Btd7SwMj.mjs";
|
|
12
12
|
import { Follow, Person } from "@fedify/vocab";
|
|
13
13
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
14
14
|
import { encodeHex } from "byte-encodings/hex";
|
|
@@ -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 {
|
|
8
|
-
import { p as verifyRequestDetailed } from "../http-
|
|
9
|
-
import { t as doesActorOwnKey } from "../owner-
|
|
7
|
+
import { l as verifyPortableObjectProof } from "../proof-Bwzv6mXZ.mjs";
|
|
8
|
+
import { p as verifyRequestDetailed } from "../http-CFyizTHa.mjs";
|
|
9
|
+
import { t as doesActorOwnKey } from "../owner-Btd7SwMj.mjs";
|
|
10
10
|
import { Create } from "@fedify/vocab";
|
|
11
11
|
import { decodeMultibase, importDidKey } from "@fedify/vocab-runtime";
|
|
12
12
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|