mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: sign public key requests
Lack of this signature resulted in ironically failing the verification of signed requests from Mastodon instanced configured to require signed get...
This commit is contained in:
@@ -106,13 +106,9 @@ ActivityPub.getPrivateKey = async (type, id) => {
|
|||||||
|
|
||||||
ActivityPub.fetchPublicKey = async (uri) => {
|
ActivityPub.fetchPublicKey = async (uri) => {
|
||||||
// Used for retrieving the public key from the passed-in keyId uri
|
// Used for retrieving the public key from the passed-in keyId uri
|
||||||
const { response, body } = await request.get(uri, {
|
const body = await ActivityPub.get('uid', 0, uri);
|
||||||
headers: {
|
|
||||||
Accept: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!String(response.statusCode).startsWith('2') || !body.hasOwnProperty('publicKey')) {
|
if (!body.hasOwnProperty('publicKey')) {
|
||||||
throw new Error('[[error:activitypub.pubKey-not-found]]');
|
throw new Error('[[error:activitypub.pubKey-not-found]]');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user