From eebd5f62b37a1ed72fd34f2b66dd8f6723c35ee2 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 15 Apr 2018 12:51:05 +0900 Subject: [PATCH] Fix bug --- src/queue/processors/http/process-inbox.ts | 4 ++-- src/server/activitypub.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/queue/processors/http/process-inbox.ts b/src/queue/processors/http/process-inbox.ts index a2c6bf4f9..2c49a67b6 100644 --- a/src/queue/processors/http/process-inbox.ts +++ b/src/queue/processors/http/process-inbox.ts @@ -1,7 +1,7 @@ import * as kue from 'kue'; import * as debug from 'debug'; -import { verifySignature } from 'http-signature'; +const httpSignature = require('http-signature'); import parseAcct from '../../../acct/parse'; import User, { IRemoteUser } from '../../../models/user'; import perform from '../../../remote/activitypub/perform'; @@ -50,7 +50,7 @@ export default async (job: kue.Job, done): Promise => { return; } - if (!verifySignature(signature, user.publicKey.publicKeyPem)) { + if (!httpSignature.verifySignature(signature, user.publicKey.publicKeyPem)) { console.warn('signature verification failed'); done(); return; diff --git a/src/server/activitypub.ts b/src/server/activitypub.ts index 954cc7480..1682fc27d 100644 --- a/src/server/activitypub.ts +++ b/src/server/activitypub.ts @@ -1,6 +1,6 @@ import * as Router from 'koa-router'; const koaBody = require('koa-body'); -const parseRequest = require('http-signature'); +const httpSignature = require('http-signature'); import { createHttp } from '../queue'; import pack from '../remote/activitypub/renderer'; @@ -25,7 +25,7 @@ router.post('/users/:user/inbox', koaBody(), ctx => { ctx.req.headers.authorization = 'Signature ' + ctx.req.headers.signature; try { - signature = parseRequest(ctx.req); + signature = httpSignature.parseRequest(ctx.req); } catch (e) { ctx.status = 401; return;