This commit is contained in:
syuilo 2018-04-15 12:51:05 +09:00
parent 82c93fdcb8
commit eebd5f62b3
2 changed files with 4 additions and 4 deletions

View file

@ -1,7 +1,7 @@
import * as kue from 'kue'; import * as kue from 'kue';
import * as debug from 'debug'; import * as debug from 'debug';
import { verifySignature } from 'http-signature'; const httpSignature = require('http-signature');
import parseAcct from '../../../acct/parse'; import parseAcct from '../../../acct/parse';
import User, { IRemoteUser } from '../../../models/user'; import User, { IRemoteUser } from '../../../models/user';
import perform from '../../../remote/activitypub/perform'; import perform from '../../../remote/activitypub/perform';
@ -50,7 +50,7 @@ export default async (job: kue.Job, done): Promise<void> => {
return; return;
} }
if (!verifySignature(signature, user.publicKey.publicKeyPem)) { if (!httpSignature.verifySignature(signature, user.publicKey.publicKeyPem)) {
console.warn('signature verification failed'); console.warn('signature verification failed');
done(); done();
return; return;

View file

@ -1,6 +1,6 @@
import * as Router from 'koa-router'; import * as Router from 'koa-router';
const koaBody = require('koa-body'); const koaBody = require('koa-body');
const parseRequest = require('http-signature'); const httpSignature = require('http-signature');
import { createHttp } from '../queue'; import { createHttp } from '../queue';
import pack from '../remote/activitypub/renderer'; 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; ctx.req.headers.authorization = 'Signature ' + ctx.req.headers.signature;
try { try {
signature = parseRequest(ctx.req); signature = httpSignature.parseRequest(ctx.req);
} catch (e) { } catch (e) {
ctx.status = 401; ctx.status = 401;
return; return;