@fedify/fedify 2.2.0-dev.869 → 2.2.0-pr.695.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/{builder-D8YzbzDN.mjs → builder-_3USSkAi.mjs} +7 -57
- package/dist/compat/mod.d.cts +1 -1
- package/dist/compat/mod.d.ts +1 -1
- package/dist/compat/transformers.test.mjs +1 -1
- package/dist/{context-BGrYMSTk.d.ts → context-78ecvxf5.d.ts} +1 -143
- package/dist/{context-CMUd4wy0.d.cts → context-DYDPdoCb.d.cts} +1 -143
- package/dist/{context-Dk_tacqz.mjs → context-Juj6bdHC.mjs} +2 -17
- package/dist/{deno-DXdMYkAF.mjs → deno-CALl2W-v.mjs} +1 -1
- package/dist/{docloader-D6GGGkLu.mjs → docloader-Cd_GcKDJ.mjs} +2 -2
- package/dist/federation/builder.test.mjs +1 -25
- package/dist/federation/handler.test.mjs +8 -369
- package/dist/federation/idempotency.test.mjs +2 -2
- package/dist/federation/inbox.test.mjs +3 -3
- package/dist/federation/middleware.test.mjs +8 -510
- 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/send.test.mjs +3 -3
- package/dist/federation/webfinger.test.mjs +2 -2
- package/dist/{http-Bkl65Xah.cjs → http-BmjzD8cM.cjs} +1 -1
- package/dist/{http-kJLVVuQ4.mjs → http-BoYB66uz.mjs} +2 -2
- package/dist/{http-Bwhs9THj.js → http-Co58ywXN.js} +1 -1
- package/dist/inbox-BRn2Zxr4.mjs +179 -0
- package/dist/{key-DY9YAHVK.mjs → key-CrCG-yLH.mjs} +1 -1
- package/dist/{kv-cache-DTEfriBO.js → kv-cache-DWlJLiMn.js} +1 -1
- package/dist/{kv-cache-PqsOT6Ky.cjs → kv-cache-GmvjgIY4.cjs} +1 -1
- package/dist/{ld-Bittq8I7.mjs → ld-Cj_0JVzk.mjs} +3 -26
- package/dist/{middleware-BE03PkEx.mjs → middleware-B-hCoIdY.mjs} +180 -612
- package/dist/{middleware-DVMQdDWr.cjs → middleware-BXCjmWN2.cjs} +1 -1
- package/dist/{middleware-VSA_KWpd.js → middleware-CLVQBjm2.js} +368 -716
- package/dist/{middleware-ChIzhod7.mjs → middleware-Djvz1scF.mjs} +1 -1
- package/dist/{middleware-DMOqJ2rJ.cjs → middleware-SVMhMPsP.cjs} +365 -718
- package/dist/{mod-BcJHeuv1.d.cts → mod-CEohtXhV.d.cts} +1 -1
- package/dist/{mod-CJXfyw7v.d.ts → mod-CokIUYDr.d.ts} +1 -1
- package/dist/{mod-Cr3f-ACa.d.cts → mod-DoJBjjnO.d.cts} +1 -18
- package/dist/{mod-CR8soWa9.d.ts → mod-DvxszxXC.d.ts} +1 -18
- package/dist/mod.cjs +4 -6
- package/dist/mod.d.cts +5 -5
- package/dist/mod.d.ts +5 -5
- package/dist/mod.js +5 -5
- package/dist/nodeinfo/handler.test.mjs +2 -2
- package/dist/{owner-BZgNaUac.mjs → owner-CQ0ITJYn.mjs} +2 -2
- package/dist/{proof-DX47G5Fd.js → proof-B2qPm5I4.js} +2 -54
- package/dist/{proof-B5TlVvOq.cjs → proof-Bvs3L21X.cjs} +3 -61
- package/dist/{proof-41DPsEcO.mjs → proof-OOosrRgx.mjs} +3 -32
- package/dist/{send-m-XUlhVD.mjs → send-CP34W1Zh.mjs} +2 -2
- package/dist/sig/http.test.mjs +2 -2
- package/dist/sig/key.test.mjs +1 -1
- package/dist/sig/ld.test.mjs +2 -44
- package/dist/sig/mod.cjs +2 -4
- package/dist/sig/mod.d.cts +2 -2
- package/dist/sig/mod.d.ts +2 -2
- package/dist/sig/mod.js +3 -3
- package/dist/sig/owner.test.mjs +1 -1
- package/dist/sig/proof.test.mjs +2 -46
- package/dist/testing/mod.d.mts +1 -149
- package/dist/testing/mod.mjs +2 -2
- package/dist/utils/docloader.test.mjs +2 -2
- package/dist/utils/mod.cjs +1 -1
- package/dist/utils/mod.js +1 -1
- package/package.json +5 -5
- package/dist/activity-listener-Ck3JZ_hR.mjs +0 -40
package/dist/sig/ld.test.mjs
CHANGED
|
@@ -5,9 +5,9 @@ import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
|
5
5
|
import { n as assertFalse, t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
|
|
6
6
|
import { t as assertThrows } from "../assert_throws-4NwKEy2q.mjs";
|
|
7
7
|
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
8
|
-
import { i as generateCryptoKeyPair } from "../key-
|
|
8
|
+
import { i as generateCryptoKeyPair } from "../key-CrCG-yLH.mjs";
|
|
9
9
|
import { a as rsaPrivateKey3, c as rsaPublicKey3, i as rsaPrivateKey2, n as ed25519PrivateKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
10
|
-
import { a as signJsonLd,
|
|
10
|
+
import { a as signJsonLd, n as createSignature, o as verifyJsonLd, r as detachSignature, s as verifySignature, t as attachSignature } from "../ld-Cj_0JVzk.mjs";
|
|
11
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
import { CryptographicKey } from "@fedify/vocab";
|
|
13
13
|
import { encodeBase64 } from "byte-encodings/base64";
|
|
@@ -55,48 +55,6 @@ test("signJsonLd()", async () => {
|
|
|
55
55
|
contextLoader: mockDocumentLoader
|
|
56
56
|
}));
|
|
57
57
|
});
|
|
58
|
-
test("hasSignatureLike()", () => {
|
|
59
|
-
assert(hasSignatureLike({ signature: {
|
|
60
|
-
type: "RsaSignature2017",
|
|
61
|
-
creator: "https://example.com/users/alice#main-key",
|
|
62
|
-
signatureValue: "signature"
|
|
63
|
-
} }));
|
|
64
|
-
assert(hasSignatureLike({ signature: {
|
|
65
|
-
type: "Ed25519Signature2020",
|
|
66
|
-
verificationMethod: "https://example.com/users/alice#main-key",
|
|
67
|
-
jws: "signature"
|
|
68
|
-
} }));
|
|
69
|
-
assert(hasSignatureLike({ signature: {
|
|
70
|
-
type: "Ed25519Signature2020",
|
|
71
|
-
verificationMethod: { id: "https://example.com/users/alice#main-key" },
|
|
72
|
-
jws: "signature"
|
|
73
|
-
} }));
|
|
74
|
-
assert(hasSignatureLike({ signature: {
|
|
75
|
-
type: "Ed25519Signature2020",
|
|
76
|
-
verificationMethod: [{ id: "https://example.com/users/alice#main-key" }],
|
|
77
|
-
jws: "signature"
|
|
78
|
-
} }));
|
|
79
|
-
assert(hasSignatureLike({ signature: {
|
|
80
|
-
type: "Ed25519Signature2020",
|
|
81
|
-
verificationMethod: { "@id": "https://example.com/users/alice#main-key" },
|
|
82
|
-
jws: "signature"
|
|
83
|
-
} }));
|
|
84
|
-
assert(hasSignatureLike({ signature: [{
|
|
85
|
-
type: "Ed25519Signature2020",
|
|
86
|
-
verificationMethod: { "@id": "https://example.com/users/alice#main-key" },
|
|
87
|
-
jws: "signature"
|
|
88
|
-
}] }));
|
|
89
|
-
assert(hasSignatureLike({ signature: {
|
|
90
|
-
type: ["Ed25519Signature2020"],
|
|
91
|
-
verificationMethod: "https://example.com/users/alice#main-key",
|
|
92
|
-
jws: "signature"
|
|
93
|
-
} }));
|
|
94
|
-
assertFalse(hasSignatureLike({ signature: {
|
|
95
|
-
type: "Ed25519Signature2020",
|
|
96
|
-
verificationMethod: "https://example.com/users/alice#main-key"
|
|
97
|
-
} }));
|
|
98
|
-
assertFalse(hasSignatureLike(null));
|
|
99
|
-
});
|
|
100
58
|
const document = {
|
|
101
59
|
"@context": ["https://www.w3.org/ns/activitystreams", {
|
|
102
60
|
"ostatus": "http://ostatus.org#",
|
package/dist/sig/mod.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const require_http = require("../http-
|
|
5
|
-
const require_proof = require("../proof-
|
|
4
|
+
const require_http = require("../http-BmjzD8cM.cjs");
|
|
5
|
+
const require_proof = require("../proof-Bvs3L21X.cjs");
|
|
6
6
|
exports.attachSignature = require_proof.attachSignature;
|
|
7
7
|
exports.createProof = require_proof.createProof;
|
|
8
8
|
exports.createSignature = require_proof.createSignature;
|
|
@@ -15,8 +15,6 @@ exports.formatAcceptSignature = require_http.formatAcceptSignature;
|
|
|
15
15
|
exports.fulfillAcceptSignature = require_http.fulfillAcceptSignature;
|
|
16
16
|
exports.generateCryptoKeyPair = require_http.generateCryptoKeyPair;
|
|
17
17
|
exports.getKeyOwner = require_proof.getKeyOwner;
|
|
18
|
-
exports.hasProofLike = require_proof.hasProofLike;
|
|
19
|
-
exports.hasSignatureLike = require_proof.hasSignatureLike;
|
|
20
18
|
exports.importJwk = require_http.importJwk;
|
|
21
19
|
exports.parseAcceptSignature = require_http.parseAcceptSignature;
|
|
22
20
|
exports.signJsonLd = require_proof.signJsonLd;
|
package/dist/sig/mod.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-CrGuipxe.cjs";
|
|
2
2
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-CptqhsOy.cjs";
|
|
3
|
-
import { _ as
|
|
4
|
-
export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner,
|
|
3
|
+
import { _ as verifyJsonLd, a as createProof, c as verifyProof, d as VerifyJsonLdOptions, f as VerifySignatureOptions, g as signJsonLd, h as detachSignature, i as VerifyProofOptions, l as CreateSignatureOptions, m as createSignature, n as SignObjectOptions, o as signObject, p as attachSignature, r as VerifyObjectOptions, s as verifyObject, t as CreateProofOptions, u as SignJsonLdOptions, v as verifySignature } from "../mod-DoJBjjnO.cjs";
|
|
4
|
+
export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
package/dist/sig/mod.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import { Temporal } from "@js-temporal/polyfill";
|
|
|
2
2
|
import { URLPattern } from "urlpattern-polyfill";
|
|
3
3
|
import { C as exportJwk, D as importJwk, E as generateCryptoKeyPair, S as KeyCache, T as fetchKeyDetailed, _ as validateAcceptSignature, a as VerifyRequestDetailedResult, b as FetchKeyOptions, c as signRequest, d as AcceptSignatureMember, f as AcceptSignatureParameters, g as parseAcceptSignature, h as fulfillAcceptSignature, i as SignRequestOptions, l as verifyRequest, m as formatAcceptSignature, n as HttpMessageSignaturesSpecDeterminer, o as VerifyRequestFailureReason, p as FulfillAcceptSignatureResult, r as Rfc9421SignRequestOptions, s as VerifyRequestOptions, t as HttpMessageSignaturesSpec, u as verifyRequestDetailed, v as FetchKeyDetailedResult, w as fetchKey, x as FetchKeyResult, y as FetchKeyErrorResult } from "../http-aQzN9Ayi.js";
|
|
4
4
|
import { i as getKeyOwner, n as GetKeyOwnerOptions, r as doesActorOwnKey, t as DoesActorOwnKeyOptions } from "../owner-74ARJ5TL.js";
|
|
5
|
-
import { _ as
|
|
6
|
-
export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner,
|
|
5
|
+
import { _ as verifyJsonLd, a as createProof, c as verifyProof, d as VerifyJsonLdOptions, f as VerifySignatureOptions, g as signJsonLd, h as detachSignature, i as VerifyProofOptions, l as CreateSignatureOptions, m as createSignature, n as SignObjectOptions, o as signObject, p as attachSignature, r as VerifyObjectOptions, s as verifyObject, t as CreateProofOptions, u as SignJsonLdOptions, v as verifySignature } from "../mod-DvxszxXC.js";
|
|
6
|
+
export { AcceptSignatureMember, AcceptSignatureParameters, CreateProofOptions, CreateSignatureOptions, DoesActorOwnKeyOptions, FetchKeyDetailedResult, FetchKeyErrorResult, FetchKeyOptions, FetchKeyResult, FulfillAcceptSignatureResult, GetKeyOwnerOptions, HttpMessageSignaturesSpec, HttpMessageSignaturesSpecDeterminer, KeyCache, Rfc9421SignRequestOptions, SignJsonLdOptions, SignObjectOptions, SignRequestOptions, VerifyJsonLdOptions, VerifyObjectOptions, VerifyProofOptions, VerifyRequestDetailedResult, VerifyRequestFailureReason, VerifyRequestOptions, VerifySignatureOptions, attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
package/dist/sig/mod.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
|
-
import { a as verifyRequestDetailed, c as fetchKeyDetailed, f as formatAcceptSignature, h as validateAcceptSignature, i as verifyRequest, l as generateCryptoKeyPair, m as parseAcceptSignature, o as exportJwk, p as fulfillAcceptSignature, r as signRequest, s as fetchKey, u as importJwk } from "../http-
|
|
4
|
-
import { a as
|
|
5
|
-
export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner,
|
|
3
|
+
import { a as verifyRequestDetailed, c as fetchKeyDetailed, f as formatAcceptSignature, h as validateAcceptSignature, i as verifyRequest, l as generateCryptoKeyPair, m as parseAcceptSignature, o as exportJwk, p as fulfillAcceptSignature, r as signRequest, s as fetchKey, u as importJwk } from "../http-Co58ywXN.js";
|
|
4
|
+
import { a as doesActorOwnKey, c as createSignature, d as signJsonLd, f as verifyJsonLd, i as verifyProof, l as detachSignature, n as signObject, o as getKeyOwner, p as verifySignature, r as verifyObject, s as attachSignature, t as createProof } from "../proof-B2qPm5I4.js";
|
|
5
|
+
export { attachSignature, createProof, createSignature, detachSignature, doesActorOwnKey, exportJwk, fetchKey, fetchKeyDetailed, formatAcceptSignature, fulfillAcceptSignature, generateCryptoKeyPair, getKeyOwner, importJwk, parseAcceptSignature, signJsonLd, signObject, signRequest, validateAcceptSignature, verifyJsonLd, verifyObject, verifyProof, verifyRequest, verifyRequestDetailed, verifySignature };
|
package/dist/sig/owner.test.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import "../std__assert-Duiq_YC9.mjs";
|
|
|
6
6
|
import { n as assertFalse } from "../assert_rejects-B-qJtC9Z.mjs";
|
|
7
7
|
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
8
8
|
import { o as rsaPublicKey1, s as rsaPublicKey2 } from "../keys-BAK-tUlf.mjs";
|
|
9
|
-
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-
|
|
9
|
+
import { n as getKeyOwner, t as doesActorOwnKey } from "../owner-CQ0ITJYn.mjs";
|
|
10
10
|
import { createTestTracerProvider, mockDocumentLoader, test } from "@fedify/fixture";
|
|
11
11
|
import { Create, CryptographicKey, lookupObject } from "@fedify/vocab";
|
|
12
12
|
//#region src/sig/owner.test.ts
|
package/dist/sig/proof.test.mjs
CHANGED
|
@@ -3,11 +3,10 @@ import "urlpattern-polyfill";
|
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
4
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
5
5
|
import "../std__assert-Duiq_YC9.mjs";
|
|
6
|
-
import {
|
|
6
|
+
import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
|
|
7
7
|
import { t as assertInstanceOf } from "../assert_instance_of-C4Ri6VuN.mjs";
|
|
8
|
-
import { t as assert } from "../assert-ddO5KLpe.mjs";
|
|
9
8
|
import { i as rsaPrivateKey2, n as ed25519PrivateKey, r as ed25519PublicKey, s as rsaPublicKey2, t as ed25519Multikey } from "../keys-BAK-tUlf.mjs";
|
|
10
|
-
import {
|
|
9
|
+
import { i as verifyProof, n as signObject, r as verifyObject, t as createProof } from "../proof-OOosrRgx.mjs";
|
|
11
10
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
11
|
import { Create, DataIntegrityProof, Multikey, Note, Place } from "@fedify/vocab";
|
|
13
12
|
import { decodeMultibase, importMultibaseKey } from "@fedify/vocab-runtime";
|
|
@@ -152,49 +151,6 @@ test("signObject()", async () => {
|
|
|
152
151
|
contextLoader: mockDocumentLoader
|
|
153
152
|
}), TypeError, "Unsupported algorithm");
|
|
154
153
|
});
|
|
155
|
-
test("hasProofLike()", () => {
|
|
156
|
-
assert(hasProofLike({ proof: {
|
|
157
|
-
type: "DataIntegrityProof",
|
|
158
|
-
verificationMethod: "https://example.com/users/alice#main-key",
|
|
159
|
-
proofPurpose: "assertionMethod",
|
|
160
|
-
proofValue: "signature"
|
|
161
|
-
} }));
|
|
162
|
-
assert(hasProofLike({ proof: {
|
|
163
|
-
type: "DataIntegrityProof",
|
|
164
|
-
verificationMethod: { id: "https://example.com/users/alice#main-key" },
|
|
165
|
-
proofPurpose: "assertionMethod",
|
|
166
|
-
proofValue: "signature"
|
|
167
|
-
} }));
|
|
168
|
-
assert(hasProofLike({ proof: [{
|
|
169
|
-
type: "DataIntegrityProof",
|
|
170
|
-
verificationMethod: { id: "https://example.com/users/alice#main-key" },
|
|
171
|
-
proofPurpose: "assertionMethod",
|
|
172
|
-
proofValue: "signature"
|
|
173
|
-
}] }));
|
|
174
|
-
assert(hasProofLike({ proof: {
|
|
175
|
-
type: ["https://w3id.org/security#DataIntegrityProof"],
|
|
176
|
-
verificationMethod: [{ "@id": "https://example.com/users/alice#main-key" }],
|
|
177
|
-
proofPurpose: { "@id": "https://w3id.org/security#assertionMethod" },
|
|
178
|
-
proofValue: "signature"
|
|
179
|
-
} }));
|
|
180
|
-
assert(hasProofLike({ "https://w3id.org/security#proof": {
|
|
181
|
-
type: "DataIntegrityProof",
|
|
182
|
-
verificationMethod: { "@id": "https://example.com/users/alice#main-key" },
|
|
183
|
-
proofPurpose: { "@id": "https://w3id.org/security#assertionMethod" },
|
|
184
|
-
proofValue: "signature"
|
|
185
|
-
} }));
|
|
186
|
-
assert(hasProofLike({ "https://w3id.org/security#proof": [{
|
|
187
|
-
"@type": ["https://w3id.org/security#DataIntegrityProof"],
|
|
188
|
-
"https://w3id.org/security#verificationMethod": [{ "@id": "https://example.com/users/alice#main-key" }],
|
|
189
|
-
"https://w3id.org/security#proofPurpose": [{ "@id": "https://w3id.org/security#assertionMethod" }],
|
|
190
|
-
"https://w3id.org/security#proofValue": [{ "@value": "signature" }]
|
|
191
|
-
}] }));
|
|
192
|
-
assertFalse(hasProofLike({ proof: {
|
|
193
|
-
type: "DataIntegrityProof",
|
|
194
|
-
verificationMethod: { id: "https://example.com/users/alice#main-key" },
|
|
195
|
-
proofPurpose: "assertionMethod"
|
|
196
|
-
} }));
|
|
197
|
-
});
|
|
198
154
|
test("verifyProof()", async () => {
|
|
199
155
|
const cache = {};
|
|
200
156
|
const options = {
|
package/dist/testing/mod.d.mts
CHANGED
|
@@ -393,16 +393,6 @@ type CollectionCursor<TContext extends Context<TContextData>, TContextData, TFil
|
|
|
393
393
|
* @param activity The activity that was received.
|
|
394
394
|
*/
|
|
395
395
|
type InboxListener<TContextData, TActivity extends Activity> = (context: InboxContext<TContextData>, activity: TActivity) => void | Promise<void>;
|
|
396
|
-
/**
|
|
397
|
-
* A callback that listens for activities in an outbox.
|
|
398
|
-
*
|
|
399
|
-
* @template TContextData The context data to pass to the {@link Context}.
|
|
400
|
-
* @template TActivity The type of activity to listen for.
|
|
401
|
-
* @param context The outbox context.
|
|
402
|
-
* @param activity The activity that was received.
|
|
403
|
-
* @since 2.2.0
|
|
404
|
-
*/
|
|
405
|
-
type OutboxListener<TContextData, TActivity extends Activity> = (context: OutboxContext<TContextData>, activity: TActivity) => void | Promise<void>;
|
|
406
396
|
/**
|
|
407
397
|
* The reason why an incoming activity could not be verified.
|
|
408
398
|
*
|
|
@@ -433,15 +423,6 @@ type UnverifiedActivityHandler<TContextData> = (context: RequestContext<TContext
|
|
|
433
423
|
* @param context The inbox context.
|
|
434
424
|
*/
|
|
435
425
|
type InboxErrorHandler<TContextData> = (context: Context<TContextData>, error: Error) => void | Promise<void>;
|
|
436
|
-
/**
|
|
437
|
-
* A callback that handles errors in an outbox listener.
|
|
438
|
-
*
|
|
439
|
-
* @template TContextData The context data to pass to the {@link Context}.
|
|
440
|
-
* @param context The outbox context.
|
|
441
|
-
* @param error The error that occurred.
|
|
442
|
-
* @since 2.2.0
|
|
443
|
-
*/
|
|
444
|
-
type OutboxListenerErrorHandler<TContextData> = (context: OutboxContext<TContextData>, error: Error) => void | Promise<void>;
|
|
445
426
|
/**
|
|
446
427
|
* A callback that dispatches the key pair for the authenticated document loader
|
|
447
428
|
* of the {@link Context} passed to the shared inbox listener.
|
|
@@ -800,32 +781,6 @@ interface Federatable<TContextData> {
|
|
|
800
781
|
* @throws {@link RouterError} Thrown if the path pattern is invalid.
|
|
801
782
|
*/
|
|
802
783
|
setOutboxDispatcher(path: `${string}${Rfc6570Expression<"identifier">}${string}`, dispatcher: CollectionDispatcher<Activity, RequestContext<TContextData>, TContextData, void>): CollectionCallbackSetters<RequestContext<TContextData>, TContextData, void>;
|
|
803
|
-
/**
|
|
804
|
-
* Assigns the URL path for the outbox and starts setting outbox listeners.
|
|
805
|
-
*
|
|
806
|
-
* @example
|
|
807
|
-
* ``` typescript
|
|
808
|
-
* federation
|
|
809
|
-
* .setOutboxListeners("/users/{identifier}/outbox")
|
|
810
|
-
* .on(Activity, async (ctx, activity) => {
|
|
811
|
-
* await ctx.sendActivity({ identifier: ctx.identifier }, "followers", activity);
|
|
812
|
-
* })
|
|
813
|
-
* .authorize(async (ctx, identifier) => {
|
|
814
|
-
* return ctx.request.headers.get("authorization") === `Bearer ${identifier}`;
|
|
815
|
-
* });
|
|
816
|
-
* ```
|
|
817
|
-
*
|
|
818
|
-
* @param outboxPath The URI path pattern for the outbox. The syntax is based
|
|
819
|
-
* on URI Template
|
|
820
|
-
* ([RFC 6570](https://tools.ietf.org/html/rfc6570)). The
|
|
821
|
-
* path must have one variable: `{identifier}`. If an
|
|
822
|
-
* outbox dispatcher is configured, this path must match
|
|
823
|
-
* the outbox dispatcher path.
|
|
824
|
-
* @returns An object to register outbox listeners.
|
|
825
|
-
* @throws {RouterError} Thrown if the path pattern is invalid.
|
|
826
|
-
* @since 2.2.0
|
|
827
|
-
*/
|
|
828
|
-
setOutboxListeners(outboxPath: `${string}${Rfc6570Expression<"identifier">}${string}`): OutboxListenerSetters<TContextData>;
|
|
829
784
|
/**
|
|
830
785
|
* Registers a following collection dispatcher.
|
|
831
786
|
* @param path The URI path pattern for the following collection. The syntax
|
|
@@ -1213,38 +1168,6 @@ type IdempotencyStrategy = "global" | "per-origin" | "per-inbox";
|
|
|
1213
1168
|
* @since 1.9.0
|
|
1214
1169
|
*/
|
|
1215
1170
|
type IdempotencyKeyCallback<TContextData> = (ctx: InboxContext<TContextData>, activity: Activity) => string | null | Promise<string | null>;
|
|
1216
|
-
/**
|
|
1217
|
-
* Registry for outbox listeners for different activity types.
|
|
1218
|
-
* @since 2.2.0
|
|
1219
|
-
*/
|
|
1220
|
-
interface OutboxListenerSetters<TContextData> {
|
|
1221
|
-
/**
|
|
1222
|
-
* Registers a listener for a specific incoming activity type.
|
|
1223
|
-
*
|
|
1224
|
-
* @param type A subclass of {@link Activity} to listen to.
|
|
1225
|
-
* @param listener A callback to handle an incoming activity.
|
|
1226
|
-
* @returns The setters object so that settings can be chained.
|
|
1227
|
-
* @since 2.2.0
|
|
1228
|
-
*/
|
|
1229
|
-
on<TActivity extends Activity>(type: new (...args: any[]) => TActivity, listener: OutboxListener<TContextData, TActivity>): OutboxListenerSetters<TContextData>;
|
|
1230
|
-
/**
|
|
1231
|
-
* Registers an error handler for outbox listeners. Any exceptions thrown
|
|
1232
|
-
* from the listeners are caught and passed to this handler.
|
|
1233
|
-
*
|
|
1234
|
-
* @param handler A callback to handle an error.
|
|
1235
|
-
* @returns The setters object so that settings can be chained.
|
|
1236
|
-
* @since 2.2.0
|
|
1237
|
-
*/
|
|
1238
|
-
onError(handler: OutboxListenerErrorHandler<TContextData>): OutboxListenerSetters<TContextData>;
|
|
1239
|
-
/**
|
|
1240
|
-
* Registers a callback to authorize POST requests to the outbox.
|
|
1241
|
-
*
|
|
1242
|
-
* @param predicate A callback to authorize the request.
|
|
1243
|
-
* @returns The setters object so that settings can be chained.
|
|
1244
|
-
* @since 2.2.0
|
|
1245
|
-
*/
|
|
1246
|
-
authorize(predicate: AuthorizePredicate<TContextData>): OutboxListenerSetters<TContextData>;
|
|
1247
|
-
}
|
|
1248
1171
|
/**
|
|
1249
1172
|
* Registry for inbox listeners for different activity types.
|
|
1250
1173
|
*/
|
|
@@ -2016,71 +1939,6 @@ interface InboxContext<TContextData> extends Context<TContextData> {
|
|
|
2016
1939
|
username: string;
|
|
2017
1940
|
}, recipients: "followers", options?: ForwardActivityOptions): Promise<void>;
|
|
2018
1941
|
}
|
|
2019
|
-
/**
|
|
2020
|
-
* A context for outbox listeners.
|
|
2021
|
-
* @since 2.2.0
|
|
2022
|
-
*/
|
|
2023
|
-
interface OutboxContext<TContextData> extends Context<TContextData> {
|
|
2024
|
-
/**
|
|
2025
|
-
* The identifier of the actor whose outbox received the POST.
|
|
2026
|
-
* @since 2.2.0
|
|
2027
|
-
*/
|
|
2028
|
-
readonly identifier: string;
|
|
2029
|
-
/**
|
|
2030
|
-
* Indicates whether the posted activity has been delivered during the
|
|
2031
|
-
* current outbox listener invocation.
|
|
2032
|
-
* @returns `true` if the posted activity has been delivered; `false`
|
|
2033
|
-
* otherwise.
|
|
2034
|
-
* @since 2.2.0
|
|
2035
|
-
*/
|
|
2036
|
-
hasDeliveredActivity(): boolean;
|
|
2037
|
-
/**
|
|
2038
|
-
* Forwards a posted activity to the recipients' inboxes without
|
|
2039
|
-
* re-serializing the original payload. The forwarded activity will be
|
|
2040
|
-
* signed in HTTP Signatures by the forwarder, but its payload will not be
|
|
2041
|
-
* modified, i.e., Linked Data Signatures and Object Integrity Proofs will
|
|
2042
|
-
* not be added. Therefore, if the posted activity is not signed (i.e., it
|
|
2043
|
-
* has neither Linked Data Signatures nor Object Integrity Proofs), the
|
|
2044
|
-
* recipients probably will not trust the activity.
|
|
2045
|
-
* @param forwarder The forwarder's identifier or the forwarder's username
|
|
2046
|
-
* or the forwarder's key pair(s).
|
|
2047
|
-
* @param recipients The recipients of the activity.
|
|
2048
|
-
* @param options Options for forwarding the activity.
|
|
2049
|
-
* @since 2.2.0
|
|
2050
|
-
*/
|
|
2051
|
-
forwardActivity(forwarder: SenderKeyPair | SenderKeyPair[] | {
|
|
2052
|
-
identifier: string;
|
|
2053
|
-
} | {
|
|
2054
|
-
username: string;
|
|
2055
|
-
}, recipients: Recipient | Recipient[], options?: ForwardActivityOptions): Promise<void>;
|
|
2056
|
-
/**
|
|
2057
|
-
* Forwards a posted activity to the recipients' inboxes without
|
|
2058
|
-
* re-serializing the original payload. The forwarded activity will be
|
|
2059
|
-
* signed in HTTP Signatures by the forwarder, but its payload will not be
|
|
2060
|
-
* modified, i.e., Linked Data Signatures and Object Integrity Proofs will
|
|
2061
|
-
* not be added. Therefore, if the posted activity is not signed (i.e., it
|
|
2062
|
-
* has neither Linked Data Signatures nor Object Integrity Proofs), the
|
|
2063
|
-
* recipients probably will not trust the activity.
|
|
2064
|
-
* @param forwarder The forwarder's identifier or the forwarder's username.
|
|
2065
|
-
* @param recipients In this case, it must be `"followers"`.
|
|
2066
|
-
* @param options Options for forwarding the activity.
|
|
2067
|
-
* @since 2.2.0
|
|
2068
|
-
*/
|
|
2069
|
-
forwardActivity(forwarder: {
|
|
2070
|
-
identifier: string;
|
|
2071
|
-
} | {
|
|
2072
|
-
username: string;
|
|
2073
|
-
}, recipients: "followers", options?: ForwardActivityOptions): Promise<void>;
|
|
2074
|
-
/**
|
|
2075
|
-
* Creates a new context with the same properties as this one,
|
|
2076
|
-
* but with the given data.
|
|
2077
|
-
* @param data The new data to associate with the context.
|
|
2078
|
-
* @returns A new context with the same properties as this one,
|
|
2079
|
-
* but with the given data.
|
|
2080
|
-
* @since 2.2.0
|
|
2081
|
-
*/
|
|
2082
|
-
clone(data: TContextData): OutboxContext<TContextData>;
|
|
2083
|
-
}
|
|
2084
1942
|
/**
|
|
2085
1943
|
* A result of parsing an URI.
|
|
2086
1944
|
*/
|
|
@@ -2346,11 +2204,5 @@ declare function createInboxContext<TContextData>(args: Partial<InboxContext<TCo
|
|
|
2346
2204
|
recipient?: string | null;
|
|
2347
2205
|
federation: Federation<TContextData>;
|
|
2348
2206
|
}): InboxContext<TContextData>;
|
|
2349
|
-
declare function createOutboxContext<TContextData>(args: Partial<OutboxContext<TContextData>> & {
|
|
2350
|
-
url?: URL;
|
|
2351
|
-
data: TContextData;
|
|
2352
|
-
identifier: string;
|
|
2353
|
-
federation: Federation<TContextData>;
|
|
2354
|
-
}): OutboxContext<TContextData>;
|
|
2355
2207
|
//#endregion
|
|
2356
|
-
export { createInboxContext,
|
|
2208
|
+
export { createInboxContext, createRequestContext, testDefinitions };
|
package/dist/testing/mod.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
3
|
globalThis.addEventListener = () => {};
|
|
4
|
-
import { n as
|
|
4
|
+
import { n as createRequestContext, t as createInboxContext } from "../context-Juj6bdHC.mjs";
|
|
5
5
|
import { testDefinitions } from "@fedify/fixture";
|
|
6
|
-
export { createInboxContext,
|
|
6
|
+
export { createInboxContext, createRequestContext, testDefinitions };
|
|
@@ -5,9 +5,9 @@ import { t as esm_default } from "../esm-DVILvP5e.mjs";
|
|
|
5
5
|
import { t as assertEquals } from "../assert_equals-Ew3jOFa3.mjs";
|
|
6
6
|
import "../std__assert-Duiq_YC9.mjs";
|
|
7
7
|
import { t as assertRejects } from "../assert_rejects-B-qJtC9Z.mjs";
|
|
8
|
-
import { l as verifyRequest } from "../http-
|
|
8
|
+
import { l as verifyRequest } from "../http-BoYB66uz.mjs";
|
|
9
9
|
import { i as rsaPrivateKey2 } from "../keys-BAK-tUlf.mjs";
|
|
10
|
-
import { t as getAuthenticatedDocumentLoader } from "../docloader-
|
|
10
|
+
import { t as getAuthenticatedDocumentLoader } from "../docloader-Cd_GcKDJ.mjs";
|
|
11
11
|
import { mockDocumentLoader, test } from "@fedify/fixture";
|
|
12
12
|
import { UrlError } from "@fedify/vocab-runtime";
|
|
13
13
|
//#region src/utils/docloader.test.ts
|
package/dist/utils/mod.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { Temporal } = require("@js-temporal/polyfill");
|
|
2
2
|
const { URLPattern } = require("urlpattern-polyfill");
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
-
const require_kv_cache = require("../kv-cache-
|
|
4
|
+
const require_kv_cache = require("../kv-cache-GmvjgIY4.cjs");
|
|
5
5
|
exports.getAuthenticatedDocumentLoader = require_kv_cache.getAuthenticatedDocumentLoader;
|
|
6
6
|
exports.kvCache = require_kv_cache.kvCache;
|
package/dist/utils/mod.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import "@js-temporal/polyfill";
|
|
2
2
|
import "urlpattern-polyfill";
|
|
3
|
-
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-
|
|
3
|
+
import { n as getAuthenticatedDocumentLoader, t as kvCache } from "../kv-cache-DWlJLiMn.js";
|
|
4
4
|
export { getAuthenticatedDocumentLoader, kvCache };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fedify/fedify",
|
|
3
|
-
"version": "2.2.0-
|
|
3
|
+
"version": "2.2.0-pr.695.23+d0b31ca2",
|
|
4
4
|
"description": "An ActivityPub server framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ActivityPub",
|
|
@@ -144,9 +144,9 @@
|
|
|
144
144
|
"uri-template-router": "^1.0.0",
|
|
145
145
|
"url-template": "^3.1.1",
|
|
146
146
|
"urlpattern-polyfill": "^10.1.0",
|
|
147
|
-
"@fedify/vocab": "2.2.0-
|
|
148
|
-
"@fedify/
|
|
149
|
-
"@fedify/
|
|
147
|
+
"@fedify/vocab": "2.2.0-pr.695.23+d0b31ca2",
|
|
148
|
+
"@fedify/vocab-runtime": "2.2.0-pr.695.23+d0b31ca2",
|
|
149
|
+
"@fedify/webfinger": "2.2.0-pr.695.23+d0b31ca2"
|
|
150
150
|
},
|
|
151
151
|
"devDependencies": {
|
|
152
152
|
"@std/assert": "npm:@jsr/std__assert@^0.226.0",
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
"typescript": "^5.9.2",
|
|
160
160
|
"wrangler": "^4.17.0",
|
|
161
161
|
"@fedify/fixture": "2.0.0",
|
|
162
|
-
"@fedify/vocab-tools": "^2.2.0-
|
|
162
|
+
"@fedify/vocab-tools": "^2.2.0-pr.695.23+d0b31ca2"
|
|
163
163
|
},
|
|
164
164
|
"scripts": {
|
|
165
165
|
"build:self": "tsdown",
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import "@js-temporal/polyfill";
|
|
2
|
-
import "urlpattern-polyfill";
|
|
3
|
-
globalThis.addEventListener = () => {};
|
|
4
|
-
import { Activity } from "@fedify/vocab";
|
|
5
|
-
//#region src/federation/activity-listener.ts
|
|
6
|
-
var ActivityListenerSet = class {
|
|
7
|
-
#listeners;
|
|
8
|
-
constructor() {
|
|
9
|
-
this.#listeners = /* @__PURE__ */ new Map();
|
|
10
|
-
}
|
|
11
|
-
clone() {
|
|
12
|
-
const Clone = this.constructor;
|
|
13
|
-
const clone = new Clone();
|
|
14
|
-
clone.#listeners = new Map(this.#listeners);
|
|
15
|
-
return clone;
|
|
16
|
-
}
|
|
17
|
-
add(type, listener) {
|
|
18
|
-
if (this.#listeners.has(type)) throw new TypeError("Listener already set for this type.");
|
|
19
|
-
this.#listeners.set(type, listener);
|
|
20
|
-
}
|
|
21
|
-
dispatchWithClass(activity) {
|
|
22
|
-
let cls = activity.constructor;
|
|
23
|
-
while (cls != null) {
|
|
24
|
-
if (this.#listeners.has(cls)) break;
|
|
25
|
-
if (cls === Activity) return null;
|
|
26
|
-
cls = globalThis.Object.getPrototypeOf(cls);
|
|
27
|
-
}
|
|
28
|
-
if (cls == null) return null;
|
|
29
|
-
const listener = this.#listeners.get(cls);
|
|
30
|
-
return {
|
|
31
|
-
class: cls,
|
|
32
|
-
listener
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
dispatch(activity) {
|
|
36
|
-
return this.dispatchWithClass(activity)?.listener ?? null;
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
//#endregion
|
|
40
|
-
export { ActivityListenerSet as t };
|