aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/activitypub.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-07 15:24:27 +0100
committerChocobozzz <me@florianbigard.com>2020-01-07 15:56:09 +0100
commite92269053e3fd0e9b9c155ded86a1668444f3d70 (patch)
treefc6c48416a028fa4f471fbe91f5b982122e303bf /server/middlewares/activitypub.ts
parent7cde3b9c2e84ea20bb0aae4544598483cde9e22c (diff)
downloadPeerTube-e92269053e3fd0e9b9c155ded86a1668444f3d70.tar.gz
PeerTube-e92269053e3fd0e9b9c155ded86a1668444f3d70.tar.zst
PeerTube-e92269053e3fd0e9b9c155ded86a1668444f3d70.zip
Update http signature
Diffstat (limited to 'server/middlewares/activitypub.ts')
-rw-r--r--server/middlewares/activitypub.ts5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/middlewares/activitypub.ts b/server/middlewares/activitypub.ts
index fedac0e05..bd3bdb076 100644
--- a/server/middlewares/activitypub.ts
+++ b/server/middlewares/activitypub.ts
@@ -51,10 +51,11 @@ export {
51// --------------------------------------------------------------------------- 51// ---------------------------------------------------------------------------
52 52
53async function checkHttpSignature (req: Request, res: Response) { 53async function checkHttpSignature (req: Request, res: Response) {
54 // FIXME: mastodon does not include the Signature scheme 54 // FIXME: compatibility with http-signature < v1.3
55 const sig = req.headers[HTTP_SIGNATURE.HEADER_NAME] as string 55 const sig = req.headers[HTTP_SIGNATURE.HEADER_NAME] as string
56 if (sig && sig.startsWith('Signature ') === false) req.headers[HTTP_SIGNATURE.HEADER_NAME] = 'Signature ' + sig 56 if (sig && sig.startsWith('Signature ') === true) req.headers[HTTP_SIGNATURE.HEADER_NAME] = sig.replace(/^Signature /, '')
57 57
58 logger.info('coucou', { signature: req.headers[HTTP_SIGNATURE.HEADER_NAME] })
58 const parsed = parseHTTPSignature(req, HTTP_SIGNATURE.CLOCK_SKEW_SECONDS) 59 const parsed = parseHTTPSignature(req, HTTP_SIGNATURE.CLOCK_SKEW_SECONDS)
59 60
60 const keyId = parsed.keyId 61 const keyId = parsed.keyId