@fedify/fedify 0.7.0-dev.118 → 0.7.0-dev.119
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of @fedify/fedify might be problematic. Click here for more details.
- package/CHANGES.md +2 -0
- package/esm/federation/middleware.js +10 -1
- package/esm/httpsig/mod.js +61 -0
- package/esm/testing/fixtures/example.com/key3 +7 -0
- package/esm/testing/fixtures/example.com/person2 +17 -0
- package/package.json +1 -1
- package/types/federation/context.d.ts +14 -0
- package/types/federation/context.d.ts.map +1 -1
- package/types/federation/middleware.d.ts.map +1 -1
- package/types/httpsig/mod.d.ts +10 -0
- package/types/httpsig/mod.d.ts.map +1 -1
- package/types/testing/context.d.ts.map +1 -1
- package/types/testing/keys.d.ts.map +1 -1
package/CHANGES.md
CHANGED
@@ -17,8 +17,10 @@ To be released.
|
|
17
17
|
- Added `CollectionCallbackSetters.authorize()` method.
|
18
18
|
- Added `AuthorizedPredicate` type.
|
19
19
|
- Added `RequestContext.getSignedKey()` method.
|
20
|
+
- Added `RequestContext.getSignedKeyOwner()` method.
|
20
21
|
- Added `FederationFetchOptions.onUnauthorized` option for handling
|
21
22
|
unauthorized fetches.
|
23
|
+
- Added `getKeyOwner()` function.
|
22
24
|
|
23
25
|
- The default implementation of `FederationFetchOptions.onNotAcceptable`
|
24
26
|
option now responds with `Vary: Accept, Signature` header.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as dntShim from "../_dnt.shims.js";
|
2
2
|
import { Temporal } from "@js-temporal/polyfill";
|
3
3
|
import { exportJwk, importJwk, validateCryptoKey } from "../httpsig/key.js";
|
4
|
-
import { verify } from "../httpsig/mod.js";
|
4
|
+
import { getKeyOwner, verify } from "../httpsig/mod.js";
|
5
5
|
import { handleNodeInfo, handleNodeInfoJrd } from "../nodeinfo/handler.js";
|
6
6
|
import { fetchDocumentLoader, getAuthenticatedDocumentLoader, kvCache, } from "../runtime/docloader.js";
|
7
7
|
import { Activity, CryptographicKey } from "../vocab/mod.js";
|
@@ -220,6 +220,7 @@ export class Federation {
|
|
220
220
|
if (request == null)
|
221
221
|
return context;
|
222
222
|
let signedKey = undefined;
|
223
|
+
let signedKeyOwner = undefined;
|
223
224
|
const reqCtx = {
|
224
225
|
...context,
|
225
226
|
request,
|
@@ -229,6 +230,14 @@ export class Federation {
|
|
229
230
|
return signedKey;
|
230
231
|
return signedKey = await verify(request, context.documentLoader);
|
231
232
|
},
|
233
|
+
async getSignedKeyOwner() {
|
234
|
+
if (signedKeyOwner !== undefined)
|
235
|
+
return signedKeyOwner;
|
236
|
+
const key = await this.getSignedKey();
|
237
|
+
if (key == null)
|
238
|
+
return signedKeyOwner = null;
|
239
|
+
return signedKeyOwner = await getKeyOwner(key, context.documentLoader);
|
240
|
+
},
|
232
241
|
};
|
233
242
|
return reqCtx;
|
234
243
|
}
|
package/esm/httpsig/mod.js
CHANGED
@@ -191,3 +191,64 @@ export async function doesActorOwnKey(activity, key, documentLoader) {
|
|
191
191
|
}
|
192
192
|
return false;
|
193
193
|
}
|
194
|
+
/**
|
195
|
+
* Gets the actor that owns the specified key. Returns `null` if the key has no known owner.
|
196
|
+
*
|
197
|
+
* @param keyId The ID of the key to check, or the key itself.
|
198
|
+
* @param documentLoader The document loader to use for fetching the key and its owner.
|
199
|
+
* @returns The actor that owns the key, or `null` if the key has no known owner.
|
200
|
+
* @sicne 0.7.0
|
201
|
+
*/
|
202
|
+
export async function getKeyOwner(keyId, documentLoader) {
|
203
|
+
let object;
|
204
|
+
if (keyId instanceof CryptographicKey) {
|
205
|
+
object = keyId;
|
206
|
+
if (object.id == null)
|
207
|
+
return null;
|
208
|
+
keyId = object.id;
|
209
|
+
}
|
210
|
+
else {
|
211
|
+
let keyDoc;
|
212
|
+
try {
|
213
|
+
const { document } = await documentLoader(keyId.href);
|
214
|
+
keyDoc = document;
|
215
|
+
}
|
216
|
+
catch (_) {
|
217
|
+
return null;
|
218
|
+
}
|
219
|
+
try {
|
220
|
+
object = await ASObject.fromJsonLd(keyDoc, { documentLoader });
|
221
|
+
}
|
222
|
+
catch (e) {
|
223
|
+
if (!(e instanceof TypeError))
|
224
|
+
throw e;
|
225
|
+
try {
|
226
|
+
object = await CryptographicKey.fromJsonLd(keyDoc, { documentLoader });
|
227
|
+
}
|
228
|
+
catch (e) {
|
229
|
+
if (e instanceof TypeError)
|
230
|
+
return null;
|
231
|
+
throw e;
|
232
|
+
}
|
233
|
+
}
|
234
|
+
}
|
235
|
+
let owner = null;
|
236
|
+
if (object instanceof CryptographicKey) {
|
237
|
+
if (object.ownerId == null)
|
238
|
+
return null;
|
239
|
+
owner = await object.getOwner({ documentLoader });
|
240
|
+
}
|
241
|
+
else if (isActor(object)) {
|
242
|
+
owner = object;
|
243
|
+
}
|
244
|
+
else {
|
245
|
+
return null;
|
246
|
+
}
|
247
|
+
if (owner == null)
|
248
|
+
return null;
|
249
|
+
for (const kid of owner.publicKeyIds) {
|
250
|
+
if (kid.href === keyId.href)
|
251
|
+
return owner;
|
252
|
+
}
|
253
|
+
return null;
|
254
|
+
}
|
@@ -0,0 +1,7 @@
|
|
1
|
+
{
|
2
|
+
"@context": "https://w3id.org/security/v1",
|
3
|
+
"id": "https://example.com/key3",
|
4
|
+
"type": "CryptographicKey",
|
5
|
+
"owner": "https://example.com/person2",
|
6
|
+
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4GUqWgdiYlN3Su5Gr4l6\ni+xRS8gDDVKZ718vpGk6eIpvqs33q430nRbHIzbHRXRaAhc/1++rUBcK0V4/kjZl\nCSzVtRgGU6HMkmjcD+uE56a8XbTczfltbEDj7afoEuB2F3UhQEWrSz+QJ29DPXaL\nMIa1Yv61NR2vxGqNbdtoMjDORMBYtg77CYbcFkiJHw65PDa7+f/yjLxuCRPye5L7\nhncN0UZuuFoRJmHNRLSg5omBad9WTvQXmSyXEhEdk9fHwlI022AqAzlWbT79hldc\nDSKGGLLbQIs1c3JZIG8G5i6Uh5Vy0Z7tSNBcxbhqoI9i9je4f/x/OPIVc19f04BE\n1LgWuHsftZzRgW9Sdqz53W83XxVdxlyHeywXOnstSWT11f8dkLyQUcHKTH+E6urb\nH+aiPLiRpYK8W7D9KTQA9kZ5JXaEuveBd5vJX7wakhbzAn8pWJU7GYIHNY38Ycok\nmivkU5pY8S2cKFMwY0b7ade3MComlir5P3ZYSjF+n6gRVsT96P+9mNfCu9gXt/f8\nXCyjKlH89kGwuJ7HhR8CuVdm0l+jYozVt6GsDy0hHYyn79NCCAEzP7ZbhBMR0T5V\nrkl+TIGXoJH9WFiz4VxO+NnglF6dNQjDS5IzYLoFRXIK1f3cmQiEB4FZmL70l9HL\nrgwR+Xys83xia79OqFDRezMCAwEAAQ==\n-----END PUBLIC KEY-----\n"
|
7
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"@context": [
|
3
|
+
"https://www.w3.org/ns/activitystreams",
|
4
|
+
"https://w3id.org/security/v1"
|
5
|
+
],
|
6
|
+
"id": "https://example.com/person2",
|
7
|
+
"type": "Person",
|
8
|
+
"name": "Jane Doe",
|
9
|
+
"publicKey": [
|
10
|
+
{
|
11
|
+
"id": "https://example.com/key3",
|
12
|
+
"type": "CryptographicKey",
|
13
|
+
"owner": "https://example.com/person2",
|
14
|
+
"publicKeyPem": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA4GUqWgdiYlN3Su5Gr4l6\ni+xRS8gDDVKZ718vpGk6eIpvqs33q430nRbHIzbHRXRaAhc/1++rUBcK0V4/kjZl\nCSzVtRgGU6HMkmjcD+uE56a8XbTczfltbEDj7afoEuB2F3UhQEWrSz+QJ29DPXaL\nMIa1Yv61NR2vxGqNbdtoMjDORMBYtg77CYbcFkiJHw65PDa7+f/yjLxuCRPye5L7\nhncN0UZuuFoRJmHNRLSg5omBad9WTvQXmSyXEhEdk9fHwlI022AqAzlWbT79hldc\nDSKGGLLbQIs1c3JZIG8G5i6Uh5Vy0Z7tSNBcxbhqoI9i9je4f/x/OPIVc19f04BE\n1LgWuHsftZzRgW9Sdqz53W83XxVdxlyHeywXOnstSWT11f8dkLyQUcHKTH+E6urb\nH+aiPLiRpYK8W7D9KTQA9kZ5JXaEuveBd5vJX7wakhbzAn8pWJU7GYIHNY38Ycok\nmivkU5pY8S2cKFMwY0b7ade3MComlir5P3ZYSjF+n6gRVsT96P+9mNfCu9gXt/f8\nXCyjKlH89kGwuJ7HhR8CuVdm0l+jYozVt6GsDy0hHYyn79NCCAEzP7ZbhBMR0T5V\nrkl+TIGXoJH9WFiz4VxO+NnglF6dNQjDS5IzYLoFRXIK1f3cmQiEB4FZmL70l9HL\nrgwR+Xys83xia79OqFDRezMCAwEAAQ==\n-----END PUBLIC KEY-----\n"
|
15
|
+
}
|
16
|
+
]
|
17
|
+
}
|
package/package.json
CHANGED
@@ -144,6 +144,20 @@ export interface RequestContext<TContextData> extends Context<TContextData> {
|
|
144
144
|
* @since 0.7.0
|
145
145
|
*/
|
146
146
|
getSignedKey(): Promise<CryptographicKey | null>;
|
147
|
+
/**
|
148
|
+
* Gets the owner of the signed key, if any exists and it is verified.
|
149
|
+
* Otherwise, `null` is returned.
|
150
|
+
*
|
151
|
+
* This can be used for implementing [authorized fetch] (also known as
|
152
|
+
* secure mode) in ActivityPub.
|
153
|
+
*
|
154
|
+
* [authorized fetch]: https://swicg.github.io/activitypub-http-signature/#authorized-fetch
|
155
|
+
*
|
156
|
+
* @returns The owner of the signed key, or `null` if the key is not verified
|
157
|
+
* or the owner is not found.
|
158
|
+
* @since 0.7.0
|
159
|
+
*/
|
160
|
+
getSignedKeyOwner(): Promise<Actor | null>;
|
147
161
|
}
|
148
162
|
/**
|
149
163
|
* Options for {@link Context.sendActivity} method and
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/federation/context.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC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G;IACH,UAAU,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAE3C;;;;OAIG;IACH,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;IAEhC;;;;;;OAMG;IACH,kCAAkC,CAAC,EAAE,kCAAkC,CAAC;IAExE;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,kBAAkB,CAAC;IAInC,eAAe,CAAC,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;OAGG;IACH,mBAAmB,EAAE,KAAK,CAAC;IAE3B;;;OAGG;IACH,cAAc,EAAE,KAAK,CAAC;CACvB;AAED;;;;;;GAMG;AACH,qBAAa,UAAU,CAAC,YAAY;;IAqBlC;;;OAGG;gBAED,EACE,EAAE,EACF,UAAU,EACV,KAAK,EACL,cAAc,EACd,kCAAkC,EAClC,UAAU,EACV,aAAa,EACb,eAAe,GAChB,EAAE,oBAAoB;IAqEzB;;;;;;OAMG;IACH,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,WAAW,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC;IAE7E;;;;;OAKG;IACH,aAAa,CACX,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,YAAY,GACxB,cAAc,CAAC,YAAY,CAAC;
|
1
|
+
{"version":3,"file":"middleware.d.ts","sourceRoot":"","sources":["../../src/federation/middleware.ts"],"names":[],"mappings":";;AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIjD,OAAO,EACL,KAAK,kCAAkC,EACvC,KAAK,cAAc,EAIpB,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC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AAC,YAAY,CAAC,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB,CAAC,YAAY;IACrD;;;;OAIG;IACH,UAAU,CACR,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAAC,GACvC,yBAAyB,CAAC,YAAY,CAAC,CAAC;IAE3C;;;;OAIG;IACH,cAAc,CACZ,MAAM,EAAE,gBAAgB,CAAC,YAAY,CAAC,GACrC,yBAAyB,CAAC,YAAY,CAAC,CAAC;IAE3C;;;;OAIG;IACH,aAAa,CACX,MAAM,EAAE,gBAAgB,CAAC,YAAY,CAAC,GACrC,yBAAyB,CAAC,YAAY,CAAC,CAAC;IAE3C;;;;;OAKG;IACH,SAAS,CACP,SAAS,EAAE,kBAAkB,CAAC,YAAY,CAAC,GAC1C,yBAAyB,CAAC,YAAY,CAAC,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB,CAAC,YAAY;IAC/C;;;;;;OAMG;IACH,EAAE,CAAC,SAAS,SAAS,QAAQ,EAE3B,IAAI,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,SAAS,EACvC,QAAQ,EAAE,aAAa,CAAC,YAAY,EAAE,SAAS,CAAC,GAC/C,mBAAmB,CAAC,YAAY,CAAC,CAAC;IAErC;;;;;;OAMG;IACH,OAAO,CACL,OAAO,EAAE,iBAAiB,CAAC,YAAY,CAAC,GACvC,mBAAmB,CAAC,YAAY,CAAC,CAAC;CACtC"}
|
package/types/httpsig/mod.d.ts
CHANGED
@@ -9,6 +9,7 @@
|
|
9
9
|
import * as dntShim from "../_dnt.shims.js";
|
10
10
|
import { Temporal } from "@js-temporal/polyfill";
|
11
11
|
import type { DocumentLoader } from "../runtime/docloader.js";
|
12
|
+
import { type Actor } from "../vocab/actor.js";
|
12
13
|
import { type Activity, CryptographicKey } from "../vocab/vocab.js";
|
13
14
|
export { exportJwk, generateCryptoKeyPair, importJwk } from "./key.js";
|
14
15
|
/**
|
@@ -44,4 +45,13 @@ export declare function verify(request: Request, documentLoader: DocumentLoader,
|
|
44
45
|
* @returns Whether the actor is the owner of the key.
|
45
46
|
*/
|
46
47
|
export declare function doesActorOwnKey(activity: Activity, key: CryptographicKey, documentLoader: DocumentLoader): Promise<boolean>;
|
48
|
+
/**
|
49
|
+
* Gets the actor that owns the specified key. Returns `null` if the key has no known owner.
|
50
|
+
*
|
51
|
+
* @param keyId The ID of the key to check, or the key itself.
|
52
|
+
* @param documentLoader The document loader to use for fetching the key and its owner.
|
53
|
+
* @returns The actor that owns the key, or `null` if the key has no known owner.
|
54
|
+
* @sicne 0.7.0
|
55
|
+
*/
|
56
|
+
export declare function getKeyOwner(keyId: URL | CryptographicKey, documentLoader: DocumentLoader): Promise<Actor | null>;
|
47
57
|
//# sourceMappingURL=mod.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/httpsig/mod.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/httpsig/mod.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,KAAK,KAAK,EAAW,MAAM,mBAAmB,CAAC;AACxD,OAAO,EACL,KAAK,QAAQ,EACb,gBAAgB,EAEjB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAEvE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G;IAC5C,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,YAAY,CAAC;CACpB,GACA,cAAc,CAAC,YAAY,CAAC,
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/testing/context.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAIxE,wBAAgB,aAAa,CAAC,YAAY,EACxC,EACE,IAAI,EACJ,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,WAAW,EACX,eAAe,EACf,eAAe,EACf,qBAAqB,EACrB,WAAW,EACX,iBAAiB,EACjB,YAAY,GACb,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACzD,OAAO,CAAC,YAAY,CAAC,CA0BvB;AAED,wBAAgB,oBAAoB,CAAC,YAAY,EAC/C,IAAI,EAAE,OAAO,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,GAAG;IAC5C,GAAG,EAAE,GAAG,CAAC;IACT,IAAI,EAAE,YAAY,CAAC;CACpB,GACA,cAAc,CAAC,YAAY,CAAC,CAQ9B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/testing/keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,UAAU,kBA2BrB,CAAC;AAEH,eAAO,MAAM,WAAW,mBAyCvB,CAAC;AAEF,eAAO,MAAM,UAAU,kBAuBrB,CAAC"}
|
1
|
+
{"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/testing/keys.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,eAAO,MAAM,UAAU,kBA2BrB,CAAC;AAEH,eAAO,MAAM,WAAW,mBAyCvB,CAAC;AAEF,eAAO,MAAM,UAAU,kBAuBrB,CAAC;AAEH,eAAO,MAAM,WAAW,mBA6DvB,CAAC;AAEF,eAAO,MAAM,UAAU,kBA6BrB,CAAC"}
|