From 18c024801c58c0d6f5c10568baf08ce061e5daa9 Mon Sep 17 00:00:00 2001 From: Will Murphy Date: Sat, 24 Oct 2020 20:33:45 -0500 Subject: [PATCH] hacky way to sign GETs fix #29 --- index.js | 2 ++ pub/federation.js | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 4822a7e..9016b03 100644 --- a/index.js +++ b/index.js @@ -72,6 +72,8 @@ client.connect({ useNewUrlParser: true }) return pub.actor.createLocalActor('dummy', 'Person') }) .then(dummy => { + // shortcut to be able to sign GETs, will be factored out via activitypub-express + global.guppeSystemUser = dummy return store.setup(DOMAIN, dummy) }) .then(() => { diff --git a/pub/federation.js b/pub/federation.js index 4fe2d34..4e139ec 100644 --- a/pub/federation.js +++ b/pub/federation.js @@ -13,7 +13,12 @@ function requestObject (id) { return request({ url: id, headers: { Accept: 'application/activity+json' }, - json: true + httpSignature: { + key: global.guppeSystemUser._meta.privateKey, + keyId: global.guppeSystemUser.id, + headers: ['(request-target)', 'host', 'date'], + authorizationHeaderName: 'Signature' + } }) }